License Validation (Edge)
Public endpoint for validating license keys. Runs at the edge on Cloudflare Workers with KV caching.
Validate License
POST /v1/licenses/validateRequest:
json
{
"license_key": "MYPLUGIN-XXXX-XXXX-XXXX-XXXX",
"product_slug": "my-plugin",
"domain": "https://example.com"
}| Field | Required | Description |
|---|---|---|
license_key | Yes | The license key to validate |
product_slug | No | Verify the license belongs to this product |
domain | No | Requesting 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/activatejson
{
"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/deactivatejson
{
"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}
