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

ParameterTypeRequiredDescription
api_keystringYesYour API key (starts with oct_)
actionstringNoAction 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

CodeHTTP StatusDescription
INVALID_KEY401API key not found
INVALID_KEY_FORMAT401API key format is invalid
LICENSE_INACTIVE403License is suspended or revoked
LICENSE_EXPIRED403Trial license has expired
ACCOUNT_INACTIVE403User account is suspended
DAILY_LIMIT_EXCEEDED429Daily usage limit reached
MONTHLY_LIMIT_EXCEEDED429Monthly usage limit reached
APP_INACTIVE403Application 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
    pass

Best 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.