LicenseKeys

April 28, 2026 ยท View on GitHub

(license_keys)

Overview

Available Operations

list

Get license keys connected to the given organization & filters.

Scopes: license_keys:read license_keys:write

Example Usage

from polar_sdk import Polar


with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    res = polar.license_keys.list(organization_id="1dbfc517-0bbf-4301-9ba8-555ca42b9737", page=1, limit=10)

    while res is not None:
        # Handle items

        res = res.next()

Parameters

ParameterTypeRequiredDescription
organization_idOptionalNullable[models.LicenseKeysListQueryParamOrganizationIDFilter]:heavy_minus_sign:Filter by organization ID.
benefit_idOptionalNullable[models.QueryParamBenefitIDFilter]:heavy_minus_sign:Filter by benefit ID.
statusOptionalNullable[models.LicenseKeyStatusFilter]:heavy_minus_sign:Filter by license key status.
pageOptional[int]:heavy_minus_sign:Page number, defaults to 1.
limitOptional[int]:heavy_minus_sign:Size of a page, defaults to 10. Maximum is 100.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.LicenseKeysListResponse

Errors

Error TypeStatus CodeContent Type
models.Unauthorized401application/json
models.ResourceNotFound404application/json
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

get

Get a license key.

Scopes: license_keys:read license_keys:write

Example Usage

from polar_sdk import Polar


with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    res = polar.license_keys.get(id="<value>")

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
idstr:heavy_check_mark:N/A
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.LicenseKeyWithActivations

Errors

Error TypeStatus CodeContent Type
models.Unauthorized401application/json
models.ResourceNotFound404application/json
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

update

Update a license key.

Scopes: license_keys:write

Example Usage

from polar_sdk import Polar


with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    res = polar.license_keys.update(id="<value>", license_key_update={})

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
idstr:heavy_check_mark:N/A
license_key_updatemodels.LicenseKeyUpdate:heavy_check_mark:N/A
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.LicenseKeyRead

Errors

Error TypeStatus CodeContent Type
models.Unauthorized401application/json
models.ResourceNotFound404application/json
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

get_activation

Get a license key activation.

Scopes: license_keys:read license_keys:write

Example Usage

from polar_sdk import Polar


with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    res = polar.license_keys.get_activation(id="<value>", activation_id="<value>")

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
idstr:heavy_check_mark:N/A
activation_idstr:heavy_check_mark:N/A
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.LicenseKeyActivationRead

Errors

Error TypeStatus CodeContent Type
models.Unauthorized401application/json
models.ResourceNotFound404application/json
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

validate

Validate a license key.

Scopes: license_keys:write

Example Usage

from polar_sdk import Polar


with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

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

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
requestmodels.LicenseKeyValidate:heavy_check_mark:The request object to use for the request.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.ValidatedLicenseKey

Errors

Error TypeStatus CodeContent Type
models.ResourceNotFound404application/json
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

activate

Activate a license key instance.

Scopes: license_keys:write

Example Usage

from polar_sdk import Polar


with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

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

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
requestmodels.LicenseKeyActivate:heavy_check_mark:The request object to use for the request.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.LicenseKeyActivationRead

Errors

Error TypeStatus CodeContent Type
models.NotPermitted403application/json
models.ResourceNotFound404application/json
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

deactivate

Deactivate a license key instance.

Scopes: license_keys:write

Example Usage

from polar_sdk import Polar


with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    polar.license_keys.deactivate(request={
        "key": "<key>",
        "organization_id": "<value>",
        "activation_id": "<value>",
    })

    # Use the SDK ...

Parameters

ParameterTypeRequiredDescription
requestmodels.LicenseKeyDeactivate:heavy_check_mark:The request object to use for the request.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Errors

Error TypeStatus CodeContent Type
models.ResourceNotFound404application/json
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*