Activate a License Key

POST

/v1/licenses/activate

Activates a license key.


Parameters

license_key Required

The license key to activate.

instance_name Required

A label for the new instance to identify it in Lemon Squeezy.


curl -X POST https://api.lemonsqueezy.com/v1/licenses/activate \
  -H "Accept: application/json" \
  -d "license_key=38b1460a-5104-4067-a91d-77b872934d51" \
  -d "instance_name=Test"

Returns

activated

A boolean indicating whether the license key was successfully activated.

error

An error message if the license key could not be activated. This will be null if the license key was activated successfully.

license_key

The information about the license key that was activated.

instance

The information about the license key instance that was created.

meta

Additional information about the license key, including the order, product, variant, and customer information.


All license_key objects include an id attribute which can be used to fetch the full license key information from the Lemon Squeezy API. Responses also include a meta object containing information related to the license key.

ID fields in the meta object can be used to fetch data related to the license key, such as relevant order/product information, from the Lemon Squeezy API. The meta object also contains convenience information from the license key, including product and variant names, and the customer’s name and email address.

{
  "activated": true,
  "error": null,
  "license_key": {
    "id": 1,
    "status": "active",
    "key": "38b1460a-5104-4067-a91d-77b872934d51",
    "activation_limit": 1,
    "activation_usage": 5,
    "created_at": "2021-01-24T14:15:07.000000Z",
    "expires_at": null
  },
  "instance": {
    "id": "47596ad9-a811-4ebf-ac8a-03fc7b6d2a17",
    "name": "Test",
    "created_at": "2021-04-06T14:15:07.000000Z"
  },
  "meta": {
    "store_id": 1,
    "order_id": 2,
    "order_item_id": 3,
    "product_id": 4,
    "product_name": "Example Product",
    "variant_id": 5,
    "variant_name": "Default",
    "customer_id": 6,
    "customer_name": "John Doe",
    "customer_email": "[email protected]"
  }
}

Error response example:

{
  "activated": false,
  "error": "This license key has reached the activation limit.",
  "license_key": {
    "id": 1,
    "status": "active",
    "key": "38b1460a-5104-4067-a91d-77b872934d51",
    "activation_limit": 5,
    "activation_usage": 5,
    "created_at": "2021-01-24T14:15:07.000000Z",
    "expires_at": null
  },
  "meta": {
    "store_id": 1,
    "order_id": 2,
    "order_item_id": 3,
    "product_id": 4,
    "product_name": "Lemonade",
    "variant_id": 5,
    "variant_name": "Default",
    "customer_id": 6,
    "customer_name": "John Doe",
    "customer_email": "[email protected]"
  }
}

Was this page helpful?