License Validation API
Validate API keys and enforce usage limits in your Chrome extensions and applications
Quick Start
POST /api/v1/validate
Content-Type: application/json
{
"api_key": "oct_your_api_key_here",
"action": "download"
}Authentication
All API requests require an API key. You can get your API key from your dashboard.
Important: Keep your API key secure. Never expose it in client-side code that users can access.
Endpoint Reference
POST /api/v1/validate
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| api_key | string | Yes | Your API key (starts with oct_) |
| action | string | No | Action type: download, api_call, feature_use |
✅ Success Response
{
"success": true,
"valid": true,
"license": {
"plan": "Pro",
"user": {
"id": "user_123",
"email": "user@example.com",
"name": "John Doe"
},
"usage": {
"daily": {
"current": 3,
"limit": 500,
"remaining": 497
},
"monthly": {
"current": 87,
"limit": 15000,
"remaining": 14913
},
"total": 1234
},
"expiresAt": null,
"resetAt": "2024-12-28T10:00:00Z"
}
}Error Responses
INVALID_KEY (401)
{
"success": false,
"error": "Invalid API key",
"code": "INVALID_KEY"
}DAILY_LIMIT_EXCEEDED (429)
{
"success": false,
"error": "Daily limit reached",
"code": "DAILY_LIMIT_EXCEEDED",
"resetAt": "2024-12-28T10:00:00Z",
"usage": {
"current": 500,
"limit": 500
}
}LICENSE_EXPIRED (403)
{
"success": false,
"error": "License has expired",
"code": "LICENSE_EXPIRED"
}Error Codes Reference
| Code | HTTP Status | Description |
|---|---|---|
| INVALID_KEY | 401 | API key not found |
| INVALID_KEY_FORMAT | 401 | API key format is invalid |
| LICENSE_INACTIVE | 403 | License is suspended or revoked |
| LICENSE_EXPIRED | 403 | Trial license has expired |
| ACCOUNT_INACTIVE | 403 | User account is suspended |
| DAILY_LIMIT_EXCEEDED | 429 | Daily usage limit reached |
| MONTHLY_LIMIT_EXCEEDED | 429 | Monthly usage limit reached |
| APP_INACTIVE | 403 | Application is under maintenance |
Code Examples
JavaScript (Chrome Extension)
// Octozia License Validator
const OCTOZIA_API = 'https://octozia.com/api/v1/validate';
const API_KEY = 'oct_your_api_key_here';
async function validateLicense(action = 'api_call') {
try {
const response = await fetch(OCTOZIA_API, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ api_key: API_KEY, action })
});
const data = await response.json();
if (!data.success) {
if (data.code === 'DAILY_LIMIT_EXCEEDED') {
const resetTime = new Date(data.resetAt);
const hoursRemaining = Math.ceil((resetTime - new Date()) / 3600000);
console.log(`Limit reached. Resets in ${hoursRemaining}h`);
}
return { valid: false, error: data.error };
}
console.log(`Usage: ${data.license.usage.daily.current}/${data.license.usage.daily.limit}`);
return { valid: true, license: data.license };
} catch (error) {
return { valid: false, error: 'Network error' };
}
}
// Usage before any action
async function downloadFile() {
const result = await validateLicense('download');
if (!result.valid) return;
// Continue with download...
}cURL
curl -X POST https://octozia.com/api/v1/validate \
-H "Content-Type: application/json" \
-d '{"api_key": "oct_your_api_key", "action": "download"}'Python
import requests
API_KEY = "oct_your_api_key_here"
API_URL = "https://octozia.com/api/v1/validate"
def validate_license(action="api_call"):
response = requests.post(API_URL, json={
"api_key": API_KEY,
"action": action
})
data = response.json()
if not data.get("success"):
print(f"Error: {data.get('error')}")
return None
usage = data["license"]["usage"]["daily"]
print(f"Usage: {usage['current']}/{usage['limit']}")
return data["license"]
# Usage
license = validate_license("download")
if license:
# Continue with your operation
passBest Practices
- Always validate before resource-intensive operations
- Handle rate limit errors gracefully with user-friendly messages
- Cache the validation result for a short time to reduce API calls
- Store your API key securely (environment variables, secure storage)
- Implement exponential backoff for retries on network errors
- Display remaining usage to users to prevent surprise limits
Need Help?
If you have questions or need assistance, our support team is here to help.
