Skip to main content
Your application checks a customer’s key against Polar’s API at startup, per session or before a paid action. This page shows the three calls involved: activate a device, validate the key, deactivate a device. To set up the benefit itself, see License Keys.
API only. Not available from the CLI or MCP server.
The examples use API version 2026-10 and the sandbox.

Server or public client

The same three calls exist twice. Pick by where your code runs: Never ship an access token inside an application you distribute. Anyone could extract it. The customer portal endpoints need no token and only accept the license key itself, so they’re safe in public clients. Both take the same request body and return the same response. Every request needs the key and your organization_id. Copy the ID from Settings under Identifiers, or run polar organizations list. It stops a valid key from another Polar organization from unlocking your software.

Activate a device

Skip this step if the benefit has no activation limit. Activating a key without Limit Activations returns 403. With activations on, activate once per device or installation and store the returned id locally. Use conditions for values that must match on later validations, like a major version or a machine fingerprint, and meta for anything you only want to record.
The TypeScript and Python examples use the server endpoints through the polar client. From a public client, send the request without Authorization, as the cURL example does. With the SDK, create the client with an empty access token and call polar.customerPortal.licenseKeys.activate (polar.customer_portal.license_keys.activate in Python). The same applies to validate and deactivate.

Validate a key

Validate on each session or before a paid action. Pass activation_id and the same conditions when the key uses activations. Pass increment_usage to consume the key’s usage quota.
A successful response means the key is valid right now: its status is granted, it hasn’t expired, and everything you passed matched. It includes the key’s benefit_id, customer_id, expires_at, usage, limit_usage, validations and the matched activation.

Scope the check

organization_id only proves the key is yours. If you sell more than one product with license keys, pass benefit_id so a key for one product can’t unlock another. On your server, you can also pass customer_id to require that the key belongs to the signed-in customer.

Deactivate a device

Deactivate when the customer signs out or moves to another device, to free the activation slot. Customers can also do this in the Customer Portal if you enabled it on the benefit.
A successful deactivation returns 204 with no body.

Handle failures

The response’s detail says which check failed. Treat any 404 from validate as “no access”. Don’t retry it.

Learn more