Skip to main content
POST
/
v1
/
customer-portal
/
license-keys
/
activate
Python (SDK)
from polar_sdk import Polar


with Polar() as polar:

    res = polar.customer_portal.license_keys.activate(request={
        "key": "<key>",
        "organization_id": "<value>",
        "label": "<value>",
    })

    # Handle response
    print(res)
{
  "id": "<string>",
  "license_key_id": "<string>",
  "label": "<string>",
  "meta": {},
  "created_at": "2023-11-07T05:31:56Z",
  "modified_at": "2023-11-07T05:31:56Z",
  "license_key": {
    "id": "<string>",
    "created_at": "2023-11-07T05:31:56Z",
    "modified_at": "2023-11-07T05:31:56Z",
    "organization_id": "<string>",
    "customer_id": "<string>",
    "customer": {
      "id": "<string>",
      "created_at": "2023-11-07T05:31:56Z",
      "modified_at": "2023-11-07T05:31:56Z",
      "metadata": {},
      "external_id": "usr_1337",
      "email": "<string>",
      "email_verified": true,
      "name": "John Doe",
      "billing_address": {
        "country": "AD",
        "line1": "<string>",
        "line2": "<string>",
        "postal_code": "<string>",
        "city": "<string>",
        "state": "<string>"
      },
      "tax_id": [
        "911144442",
        "us_ein"
      ],
      "organization_id": "<string>",
      "deleted_at": "2023-11-07T05:31:56Z",
      "avatar_url": "<string>"
    },
    "benefit_id": "<string>",
    "key": "<string>",
    "display_key": "<string>",
    "status": "granted",
    "limit_activations": 123,
    "usage": 123,
    "limit_usage": 123,
    "validations": 123,
    "last_validated_at": "2023-11-07T05:31:56Z",
    "expires_at": "2023-11-07T05:31:56Z"
  }
}
You only need to use this endpoint if you have device activations enabled on the license key benefit. You then use this endpoint to reserve an allocation for a specific device. Storing the unique activation ID from the response on the device and using it as extra validation in the /validate endpoint.Not using activations? Just use the /validate endpoint directly instead.

Body

application/json
key
string
required
organization_id
string<uuid4>
required
label
string
required
conditions
Conditions · object

Key-value object allowing you to set conditions that must match when validating the license key.

The key must be a string with a maximum length of 40 characters. The value must be either:

  • A string with a maximum length of 500 characters
  • An integer
  • A floating-point number
  • A boolean

You can store up to 50 key-value pairs.

meta
Meta · object

Key-value object allowing you to store additional information about the activation

The key must be a string with a maximum length of 40 characters. The value must be either:

  • A string with a maximum length of 500 characters
  • An integer
  • A floating-point number
  • A boolean

You can store up to 50 key-value pairs.

Response

Successful Response

id
string<uuid4>
required
license_key_id
string<uuid4>
required
label
string
required
meta
Meta · object
required
created_at
string<date-time>
required
modified_at
string<date-time> | null
required
license_key
LicenseKeyRead · object
required