Skip to content

License Validation (Edge)

Public endpoint for validating license keys. Runs at the edge on Cloudflare Workers with KV caching.

Validate License

POST /v1/licenses/validate

Request:

json
{
  "license_key": "MYPLUGIN-XXXX-XXXX-XXXX-XXXX",
  "product_slug": "my-plugin",
  "domain": "https://example.com"
}
FieldRequiredDescription
license_keyYesThe license key to validate
product_slugNoVerify the license belongs to this product
domainNoRequesting domain (for logging)

Response (valid):

json
{
  "valid": true,
  "license": {
    "key": "MYPLUGIN-XXXX-XXXX-XXXX-XXXX",
    "status": "active",
    "seats": 5,
    "activatedCount": 2,
    "expiresAt": "2026-12-31T23:59:59.000Z"
  },
  "product": {
    "id": "prd_xxx",
    "name": "My Plugin",
    "slug": "my-plugin"
  }
}

Response (invalid):

json
{
  "valid": false,
  "error": "License expired"
}

Activate License

POST /v1/licenses/activate
json
{
  "license_key": "MYPLUGIN-XXXX-XXXX-XXXX-XXXX",
  "domain": "https://example.com"
}

Response:

json
{
  "success": true,
  "activation_id": "act_xxx"
}

Returns the existing activation if the domain is already activated (idempotent).

Deactivate License

POST /v1/licenses/deactivate
json
{
  "license_key": "MYPLUGIN-XXXX-XXXX-XXXX-XXXX",
  "domain": "https://example.com"
}

You can provide either domain or activation_id to identify which activation to deactivate.

Caching

  • Validation responses are cached in Cloudflare KV for 60 seconds
  • Cache is invalidated on activation/deactivation
  • Cache key: license:{licenseKey}