Refresh the signed state of an activated installation.
What you will learn
- Send this exact operation with its required credentials and fields.
- Interpret success, refusal, side effects and retry risks.
Prerequisites
- Complete the Sandbox quickstart.
- Read API conventions and authentication.
- Keep customer credentials private and management keys on your trusted backend.
Method and path
POST /api/v1/licenses/validate
When to use it
Refresh the signed state of an activated installation. Send its activation token and the exact persisted installation ID, then verify the returned envelope and semantic policy before enabling features.
Authentication and environment
Use Authorization: Bearer YOUR_ACTIVATION_TOKEN. The token fixes the installation/product/environment; X-Environment cannot override it.
Request headers
| Header | Required | Description | Example |
|---|---|---|---|
| Accept | recommended | JSON responses | application/json |
| Content-Type | for JSON body | Use the documented JSON object | application/json |
| Authorization | yes | Installation token | Bearer YOUR_ACTIVATION_TOKEN |
| X-Installation-ID | no | Always send the persisted ID. Omission signs a null installation hash that official clients reject. | YOUR_PERSISTED_INSTALLATION_ID |
Path and query parameters
No path parameters are accepted.
No pagination, filtering, sorting or list query parameters are implemented. Use JSON rather than relying on alternate form/query parsing.
Request body
No body fields are consumed. Omit the body or send an empty object.
Full request JSON
{}
The schemas describe supported recommended input types. Current PHP parsing trims/casts strings and may ignore unknown fields; it is not strict JSON-schema validation. Invalid optional descriptive fields can become empty/null. Conventions describes malformed JSON and alternate parsing.
Success response
HTTP 200. The following is a real isolated Sandbox capture; secret values are replaced with explicit placeholders.
{
"success": true,
"valid": true,
"license": {
"payload": {
"license_id": "lic_578581bd80c2a672da30fc29",
"product_id": "app_a642cd24641ec976626b",
"product": "Docs fixture product",
"plan": "fixture-plan",
"status": "active",
"environment": "sandbox",
"expires_at": "2026-11-16T10:39:35+00:00",
"license_key_mask": "TESTDOCS-••••-••••-HAHH",
"starts_at": "2026-10-17T10:39:35+00:00",
"created_at": "2026-10-17T12:39:35+00:00",
"max_devices": 2,
"max_activations": 4,
"activation_count": 1,
"min_version": null,
"max_version": null,
"active_devices": 1,
"customer": {
"id": "cus_d7db5516f8377f89a869e293",
"name": "Synthetic contract customer",
"email": "contract-6b9f0843f1d3609f@example.invalid",
"company": null,
"country": null
},
"product_details": {
"id": "app_a642cd24641ec976626b",
"name": "Docs fixture product",
"platform": "desktop"
},
"plan_details": {
"id": "plan_3bf54c099326639ee183661f",
"name": "Fixture plan",
"slug": "fixture-plan",
"billing_type": "monthly",
"price": 19.5,
"currency": "EUR",
"duration_days": 30,
"trial_days": null
},
"features": {
"pdf_export": true
},
"device": {
"id": "dev_299a6753c013047b3ed013de",
"installation_hash": "e119b615ebfb5e5a2da5ea9c2a64b2117621399ff61d16718d460e0bb919a988",
"name": "Synthetic local installation",
"platform": "test",
"app_version": "1.0.0"
},
"server_time": "2026-10-17T10:39:35+00:00",
"next_validation_at": "2026-10-18T10:39:35+00:00",
"offline_grace_until": "2026-10-24T10:39:35+00:00"
},
"signature": "wYwFAPoyaaIVtq8zvUHlQeyqV91sI7115WJHUzY7unDEjOts7MrN_OL3PZAd-Ahd-OdfI-EjIwAVwhfLbYQlDQ",
"algorithm": "Ed25519",
"key_id": "ed25519_2b9bc7e214b1209f"
},
"request_id": "req_b8b3d83f5a1820e7c2f16167"
}
Response fields
| Field | Type | Required | Constraints | Description | Example |
|---|---|---|---|---|---|
| success | boolean | yes | const=true | The operation succeeded. | true |
| valid | boolean | yes | const=true | Server accepted this validation; still verify the signed snapshot. | true |
| license | object | yes | See description | Only payload is signed. This is PHP-specific canonical JSON, not RFC8785. | Nested object/array shown in full JSON |
| license.payload | object | yes | See description | Exact signed snapshot. Signature authenticity alone does not grant access. | Nested object/array shown in full JSON |
| license.payload.license_id | string | yes | See description | License public identifier. | "lic_578581bd80c2a672da30fc29" |
| license.payload.product_id | string | yes | See description | Public App ID; compare to configured product. | "app_a642cd24641ec976626b" |
| license.payload.product | string | yes | See description | Product display name. | "Docs fixture product" |
| license.payload.plan | string | yes | See description | Product-plan slug. | "fixture-plan" |
| license.payload.status | string | yes | enum=["active", "suspended", "revoked", "expired", "pending", "cancelled"] | Stored license status in lowercase. | "active" |
| license.payload.environment | string | yes | enum="sandbox", "[live"] | Bound license environment. | "sandbox" |
| license.payload.expires_at | string or null | yes | format="date-time" | Independent license expiry; null has no configured expiry. | "2026-11-16T10:39:35+00:00" |
| license.payload.license_key_mask | string | yes | See description | Display-only masked key. | "TESTDOCS-••••-••••-HAHH" |
| license.payload.starts_at | string or null | yes | format="date-time" | Configured license start, currently not enforced by server eligibility. | "2026-10-17T10:39:35+00:00" |
| license.payload.created_at | string or null | yes | format="date-time" | Creation timestamp; database-timezone discrepancy is disclosed. | "2026-10-17T12:39:35+00:00" |
| license.payload.max_devices | integer | yes | See description | Concurrent device limit. | 2 |
| license.payload.max_activations | integer or null | yes | See description | Cumulative activation cap; null means no configured cap. | 4 |
| license.payload.activation_count | integer | yes | See description | Cumulative consumed activations. | 1 |
| license.payload.min_version | string or null | yes | See description | Optional lower version restriction. | null |
| license.payload.max_version | string or null | yes | See description | Optional upper version restriction. | null |
| license.payload.active_devices | integer | yes | See description | Active count at snapshot time. | 1 |
| license.payload.customer | object | yes | See description | Customer information; personal data, not an authentication credential. | Nested object/array shown in full JSON |
| license.payload.customer.id | string | yes | See description | Customer public identifier. | "cus_d7db5516f8377f89a869e293" |
| license.payload.customer.name | string or null | yes | See description | Optional customer name. | "Synthetic contract customer" |
| license.payload.customer.email | string | yes | See description | Customer email associated with this license. | "contract-6b9f0843f1d3609f@example.invalid" |
| license.payload.customer.company | string or null | yes | See description | Optional company. | null |
| license.payload.customer.country | string or null | yes | See description | Optional country. | null |
| license.payload.product_details | object | yes | See description | Product display metadata. | Nested object/array shown in full JSON |
| license.payload.product_details.id | string | yes | See description | Public App ID. | "app_a642cd24641ec976626b" |
| license.payload.product_details.name | string | yes | See description | Product display name. | "Docs fixture product" |
| license.payload.product_details.platform | string | yes | See description | Lowercase configured product platform. | "desktop" |
| license.payload.plan_details | object | yes | See description | Product plan, not the developer platform subscription. | Nested object/array shown in full JSON |
| license.payload.plan_details.id | string | yes | See description | Internal product-plan identifier. | "plan_3bf54c099326639ee183661f" |
| license.payload.plan_details.name | string | yes | See description | Plan display name. | "Fixture plan" |
| license.payload.plan_details.slug | string | yes | See description | Plan slug. | "fixture-plan" |
| license.payload.plan_details.billing_type | string | yes | See description | Lowercase product-plan billing type. | "monthly" |
| license.payload.plan_details.price | number | yes | See description | PHP float; preserve numeric tokens such as19.0 for signatures. | 19.5 |
| license.payload.plan_details.currency | string | yes | See description | Configured product-plan currency. | "EUR" |
| license.payload.plan_details.duration_days | integer or null | yes | See description | Configured duration in days. | 30 |
| license.payload.plan_details.trial_days | integer or null | yes | See description | Configured trial duration in days. | null |
| license.payload.features | object or array | yes | See description | Dynamic plan feature JSON values; empty PHP feature array may be[]. Validate types before use. | Nested object/array shown in full JSON |
| license.payload.device | object | yes | See description | Installation binding and descriptions. | Nested object/array shown in full JSON |
| license.payload.device.id | string | yes | See description | Device public identifier. | "dev_299a6753c013047b3ed013de" |
| license.payload.device.installation_hash | string or null | yes | See description | SHA256 of supplied installation ID; null if validation header was omitted. | "e119b615ebfb5e5a2da5ea9c2a64b2117621399ff61d16718d460e0bb919a988" |
| license.payload.device.name | string or null | yes | See description | Optional device label; activation can return an empty string. | "Synthetic local installation" |
| license.payload.device.platform | string or null | yes | See description | Optional platform description. | "test" |
| license.payload.device.app_version | string or null | yes | See description | Optional application version. | "1.0.0" |
| license.payload.server_time | string | yes | format="date-time" | Signed snapshot time in UTC. | "2026-10-17T10:39:35+00:00" |
| license.payload.next_validation_at | string | yes | format="date-time" | server_time plus product interval hours. | "2026-10-18T10:39:35+00:00" |
| license.payload.offline_grace_until | string | yes | format="date-time" | server_time plus grace hours, not added after the validation interval. | "2026-10-24T10:39:35+00:00" |
| license.signature | string | yes | pattern="^[A-Za-z0-9_-]{86}$" | Unpadded base64url Ed25519 signature over canonical payload bytes. | "wYwFAPoyaaIVtq8zvUHlQeyqV91sI7115WJHUzY7unDEjOts7MrN_OL3PZAd-Ahd-OdfI-EjIwAVwhfLbYQlDQ" |
| license.algorithm | string | yes | const="Ed25519" | Fixed algorithm, not negotiated. | "Ed25519" |
| license.key_id | string | yes | See description | Must equal independently trusted key ID. | "ed25519_2b9bc7e214b1209f" |
| request_id | string | yes | pattern="^req_[a-f0-9]{24}$" | Request correlation ID. Replay bodies can retain an earlier ID. | "req_b8b3d83f5a1820e7c2f16167" |
Response headers
X-Request-ID identifies the current request. Successful limited calls include X-RateLimit-Remaining and X-RateLimit-Reset, the latter in Unix seconds.
Errors omit those rate headers and Retry-After. See the complete rate-limit reference.
Error responses
| Code | HTTP | Cause | Fix | Retryable? |
|---|---|---|---|---|
| RATE_LIMITED | 429 | Bucket exhausted; wait for window reset; no licensing Retry-After header | After window; apply jitter | After the 60-second window, with jitter |
| INVALID_TOKEN | 401 | Missing/non-act_/unknown/revoked/deactivated activation token | Reactivate eligible installation | No blind retry; apply the correction |
| INVALID_REQUEST | 422 | Input constraints or entitlement/resource/renewal domain rejection | Correct input/plan; not blind retry | No blind retry; apply the correction |
| DEVICE_NOT_AUTHORIZED | 403 | Token is active but associated device is not ACTIVE | Reactivation if eligible | No blind retry; apply the correction |
| DEVICE_MISMATCH | 403 | Provided installation ID does not match token-bound HMAC hash | Use original installation; do not copy token | No blind retry; apply the correction |
| LICENSE_EXPIRED | 403 | Elapsed expires_at before state check; or EXPIRED state; SDK local expiry has no HTTP | Renew eligible license | No blind retry; apply the correction |
| LICENSE_REVOKED | 403 | License REVOKED and no elapsed deadline taking precedence | Do not retry; contact developer | No blind retry; apply the correction |
| LICENSE_SUSPENDED | 403 | License SUSPENDED and no elapsed deadline taking precedence | Restore then reactivate | No blind retry; apply the correction |
| LICENSE_CANCELLED | 403 | License CANCELLED and no elapsed deadline taking precedence | Do not retry; new eligible license | No blind retry; apply the correction |
| LICENSE_PENDING | 403 | License PENDING and no elapsed deadline taking precedence | Wait for authorized activation | No blind retry; apply the correction |
| INTERNAL_ERROR | 500 | Uncaught exception at global boundary | Safe retry only for idempotent operation; preserve request_id | Only safe reads after backoff; reconcile mutations |
An unregistered path or wrong method is handled by the global router as NOT_FOUND (HTTP 404), not405. Every licensing error has success=false, error.code, error.message and request_id. Errors keeps SDK-local and operational namespaces separate.
Side effects
Updates activation.last_validated_at and device.last_seen_at. It does not create a new token, consume another lifetime activation, emit a dedicated validation audit/webhook or send email. Existing tokens are checked against device/license state. Current validation does not consistently recheck product status/deletion; see the known limitations. An elapsed expiry is rejected, but the attempted EXPIRED update rolls back with the rejection; cron may later persist that state.
Authenticated requests can consume the organization monthly API usage counter once tenant context is established, including some failures. This usage counter is currently warning-only, not a monthly API rejection gate. Developer-key authentication can update last_used_at before a later failure. No request body or Authorization value is saved by the API metadata logger.
Idempotency and concurrency
Idempotency-Key is ignored. Bounded validation retries are possible after a transport failure, but do not loop after an explicit rejection. Respect signed next_validation_at and the client's verified-cache policy. Omission of X-Installation-ID is transport-accepted and returns a null signed installation_hash; official clients expect a bound hash, so always send the header.
Rate limits
120 requests per60 seconds for SHA256(IP + activation token). Malformed/missing token or installation headers can reject before the bucket is reached.
Fixed windows begin with the first hit after expiry. Attempted calls consume every bucket they reach, even if later business validation fails.
Runnable examples
These are complete native HTTP transport programs, not full SDK clients or entitlement verifiers. JSON request bodies and credentials come from KDP_* environment variables. They print raw responses to a private terminal; do not send their stdout to application/CI logs. Use the P5 verification guides before granting access.
JavaScript (Node)
Save every file shown below. Install the exact runtime/dependencies from the complete example archive README. Set the endpoint request JSON in KDP_BODY_JSON and the documented KDP_* credential variables in your private process environment.
Run node request.mjs validate. Expected: full JSON, exit 0 for success, exit 1 for an API rejection; exit 2 for setup/transport failure. The cURL sample checks HTTP status; parse JSON before use. Never authorize a feature from transport output alone.
// Purpose: inspect one Sandbox API operation; not an entitlement verifier.
// Requirements: Node18.20+ native fetch, trusted server/Electron main process.
// Run: node request.mjs public-key. Expected: JSON; exit0 success/1 rejection/2 transport or setup.
// Credentials/body use KDP_* environment variables. Output can contain new secrets.
// Use a private terminal, never application/CI logs. Verify signed state separately.
const operations = Object.freeze({
"public-key": {
"method": "GET",
"path": "/public-key",
"auth": "public"
},
"create-license": {
"method": "POST",
"path": "/licenses",
"auth": "developer"
},
"activate": {
"method": "POST",
"path": "/licenses/activate",
"auth": "publicApp"
},
"validate": {
"method": "POST",
"path": "/licenses/validate",
"auth": "activation"
},
"deactivate": {
"method": "POST",
"path": "/licenses/deactivate",
"auth": "activation"
},
"get-license": {
"method": "GET",
"path": "/licenses/{license}",
"auth": "developer"
},
"revoke": {
"method": "POST",
"path": "/licenses/{license}/revoke",
"auth": "developer"
},
"suspend": {
"method": "POST",
"path": "/licenses/{license}/suspend",
"auth": "developer"
},
"restore": {
"method": "POST",
"path": "/licenses/{license}/restore",
"auth": "developer"
},
"renew": {
"method": "POST",
"path": "/licenses/{license}/renew",
"auth": "developer"
},
"reset-devices": {
"method": "POST",
"path": "/licenses/{license}/reset-devices",
"auth": "developer"
}
});
function required(name) {
const value = process.env[name];
if (!value || /[\r\n]/.test(value)) throw new Error(`Set a valid ${name}.`);
return value;
}
async function main() {
const name = process.argv[2];
if (process.argv.length !== 3 || !Object.hasOwn(operations, name)) throw new Error('Choose a documented operation.');
const operation = operations[name];
const base = (process.env.KDP_BASE_URL || 'https://licensing.kdpika.com/api/v1').replace(/\/+$/, '');
const url = new URL(base);
const loopback = url.protocol === 'http:' && ['127.0.0.1', 'localhost'].includes(url.hostname) && process.env.KDP_ALLOW_LOOPBACK === '1';
if ((url.protocol !== 'https:' && !loopback) || url.username || url.password || url.search || url.hash || url.pathname !== '/api/v1') throw new Error('Use an HTTPS API URL ending in /api/v1; loopback HTTP requires explicit test opt-in.');
let path = operation.path;
if (path.includes('{license}')) {
const id = required('KDP_LICENSE_ID');
if (!/^[A-Za-z0-9_-]+$/.test(id)) throw new Error('Use the simple license ID issued by this platform with this sample.');
path = path.replace('{license}', id);
}
const headers = {'Accept': 'application/json', 'User-Agent': 'KDPikaDocsExample/1.0 Node'};
if (operation.auth === 'developer') {
const key = required('KDP_API_KEY');
if (!key.startsWith('lmp_sandbox_')) throw new Error('Use a Sandbox developer key.');
headers.Authorization = `Bearer ${key}`;
} else if (operation.auth === 'activation') headers.Authorization = `Bearer ${required('KDP_ACTIVATION_TOKEN')}`;
else if (operation.auth === 'publicApp') {
headers['X-App-ID'] = required('KDP_APP_ID'); headers['X-Environment'] = 'SANDBOX';
}
if (name === 'create-license') headers['Idempotency-Key'] = required('KDP_IDEMPOTENCY_KEY');
if (name === 'validate') headers['X-Installation-ID'] = required('KDP_INSTALLATION_ID');
let body;
if (operation.method === 'POST') {
body = process.env.KDP_BODY_JSON || '{}';
const value = JSON.parse(body);
if (!value || typeof value !== 'object' || Array.isArray(value)) throw new Error('KDP_BODY_JSON must be a JSON object.');
headers['Content-Type'] = 'application/json';
}
const response = await fetch(base + path, {method: operation.method, headers, body, redirect: 'error', signal: AbortSignal.timeout(15000)});
const raw = await response.text();
const result = JSON.parse(raw);
process.stdout.write(raw + '\n');
if (!response.ok || result.success !== true) {
process.stderr.write('The API rejected this request. Inspect error.code and request_id; reconcile mutations before retrying.\n');
return 1;
}
return 0;
}
main().then(code => {process.exitCode = code;}).catch(() => {
process.stderr.write('Request unavailable or configuration invalid. Check KDP_* settings/connectivity; do not blindly retry mutations.\n');
process.exitCode = 2;
});
Expected result
A correctly authenticated eligible request returns the documented HTTP status and schema. Check the actual success/error result and request IDs; a successful transport or unsigned management response does not grant a feature.
Common mistakes
- Mixing Public App IDs, internal product IDs and product-plan IDs.
- Assuming a mutation timeout means no work committed, or assuming Idempotency-Key protects every action.
- Logging raw responses that contain a newly issued license key or activation token.
Security notes
Keep lmp_ credentials out of shipped desktop/browser code. Verify signed payload bytes and product/environment/installation/status/time/feature policy. The examples do not fix the documented idempotency, cache canonicalization or current-key-only rotation limitations.
Troubleshooting
| Symptom | Cause | Action |
|---|---|---|
| RATE_LIMITED (HTTP 429) | Bucket exhausted; wait for window reset; no licensing Retry-After header | After window; apply jitter |
| INVALID_TOKEN (HTTP 401) | Missing/non-act_/unknown/revoked/deactivated activation token | Reactivate eligible installation |
| INVALID_REQUEST (HTTP 422) | Input constraints or entitlement/resource/renewal domain rejection | Correct input/plan; not blind retry |
| DEVICE_NOT_AUTHORIZED (HTTP 403) | Token is active but associated device is not ACTIVE | Reactivation if eligible |
| DEVICE_MISMATCH (HTTP 403) | Provided installation ID does not match token-bound HMAC hash | Use original installation; do not copy token |
| LICENSE_EXPIRED (HTTP 403) | Elapsed expires_at before state check; or EXPIRED state; SDK local expiry has no HTTP | Renew eligible license |
| LICENSE_REVOKED (HTTP 403) | License REVOKED and no elapsed deadline taking precedence | Do not retry; contact developer |
| LICENSE_SUSPENDED (HTTP 403) | License SUSPENDED and no elapsed deadline taking precedence | Restore then reactivate |
| LICENSE_CANCELLED (HTTP 403) | License CANCELLED and no elapsed deadline taking precedence | Do not retry; new eligible license |
| LICENSE_PENDING (HTTP 403) | License PENDING and no elapsed deadline taking precedence | Wait for authorized activation |
| INTERNAL_ERROR (HTTP 500) | Uncaught exception at global boundary | Safe retry only for idempotent operation; preserve request_id |
Next steps
Read idempotency and signed responses before integrating a purchase-to-license workflow.