Overview
License keys are automatically generated and granted to customers who purchase products with license key benefits. They support activation limits and expiration.
The License Key Object
Status: granted, revoked, or disabled
Customer who owns the key
Benefit that granted this key
Maximum number of activations allowed
Current number of activations
List License Keys
curl -X GET "https://api.polar.sh/v1/license-keys" \
-H "Authorization: Bearer polar_pat_..."
Query Parameters
Get License Key
curl -X GET "https://api.polar.sh/v1/license-keys/{id}" \
-H "Authorization: Bearer polar_pat_..."
Path Parameters
Response
Includes activations array.
Update License Key
curl -X PATCH "https://api.polar.sh/v1/license-keys/{id}" \
-H "Authorization: Bearer polar_pat_..." \
-H "Content-Type: application/json" \
-d '{
"status": "disabled"
}'
Request Body
Update status: granted, revoked, or disabled
Validate License Key
curl -X POST "https://api.polar.sh/v1/license-keys/validate" \
-H "Authorization: Bearer polar_pat_..." \
-H "Content-Type: application/json" \
-d '{
"key": "PRO-XXXX-XXXX-XXXX",
"organization_id": "org_123"
}'
Validate a license key and get its details.
Request Body
Specific benefit to validate against
Response
Returns the license key object if valid.
Activate License Key
curl -X POST "https://api.polar.sh/v1/license-keys/activate" \
-H "Authorization: Bearer polar_pat_..." \
-H "Content-Type: application/json" \
-d '{
"key": "PRO-XXXX-XXXX-XXXX",
"organization_id": "org_123",
"label": "MacBook Pro"
}'
Activate a license key on a new device/instance.
Request Body
Response
Returns activation object.
Errors
Activation limit reached or key is revoked
Deactivate License Key
curl -X POST "https://api.polar.sh/v1/license-keys/deactivate" \
-H "Authorization: Bearer polar_pat_..." \
-H "Content-Type: application/json" \
-d '{
"key": "PRO-XXXX-XXXX-XXXX",
"organization_id": "org_123",
"activation_id": "activation_123"
}'
Request Body
Activation ID to deactivate
Get Activation
curl -X GET "https://api.polar.sh/v1/license-keys/{id}/activations/{activation_id}" \
-H "Authorization: Bearer polar_pat_..."
Path Parameters
Examples
Validate and Activate
# First, validate the key
curl -X POST "https://api.polar.sh/v1/license-keys/validate" \
-H "Authorization: Bearer polar_pat_..." \
-H "Content-Type: application/json" \
-d '{
"key": "PRO-1234-5678-9ABC",
"organization_id": "org_xyz"
}'
# Then activate it
curl -X POST "https://api.polar.sh/v1/license-keys/activate" \
-H "Authorization: Bearer polar_pat_..." \
-H "Content-Type: application/json" \
-d '{
"key": "PRO-1234-5678-9ABC",
"organization_id": "org_xyz",
"label": "Production Server",
"metadata": {
"hostname": "prod-01.example.com",
"ip": "192.168.1.100"
}
}'
Disable a License Key
curl -X PATCH "https://api.polar.sh/v1/license-keys/lk_123" \
-H "Authorization: Bearer polar_pat_..." \
-H "Content-Type: application/json" \
-d '{"status": "disabled"}'