Update a License Key

PATCH

/v1/license-keys/:id

Updates the license key with the given ID and provided attributes.


Attributes

activation_limit

A number or null. The activation limit of this license key. Assign null to set the activation limit to “unlimited”.

expires_at

An ISO 8601 formatted date-time string indicating when the license key expires. Can be null if the license key is perpetual.

disabled

If true, the license key will have “disabled” status.


curl "https://api.lemonsqueezy.com/v1/license-keys/1" \
  -H 'Accept: application/vnd.api+json' \
  -H 'Content-Type: application/vnd.api+json' \
  -H 'Authorization: Bearer {api_key}' \
  -d $'{
    "data": {
      "type": "license-keys",
      "id": "1",
      "attributes": {
        "activation_limit": 5,
        "expires_at": "2024-04-20T10:30:00Z",
        "disabled": false
      }
    }
  }'

Returns

Returns updated License Key object.

{
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "self": "https://api.lemonsqueezy.com/v1/subscription-item/1"
  },
  "data": {
    "type": "subscription-items",
    "id": "1",
    "attributes": {
      "subscription_id": 1,
      "price_id": 1,
      "quantity": 10,
      "is_usage_based": false,
      "created_at": "2023-07-18T12:16:24.000000Z",
      "updated_at": "2023-07-18T12:23:18.000000Z"
    },
    "relationships": {
      "subscription": {
        "links": {
          "related": "https://api.lemonsqueezy.com/v1/subscription-items/1/subscription",
          "self": "https://api.lemonsqueezy.com/v1/subscription-items/1/relationships/subscription"
        }
      },
      "price": {
        "links": {
          "related": "https://api.lemonsqueezy.com/v1/subscription-items/1/price",
          "self": "https://api.lemonsqueezy.com/v1/subscription-items/1/relationships/price"
        }
      },
      "usage-records": {
        "links": {
          "related": "https://api.lemonsqueezy.com/v1/subscription-items/1/usage-records",
          "self": "https://api.lemonsqueezy.com/v1/subscription-items/1/relationships/usage-records"
        }
      }
    },
    "links": {
      "self": "https://api.lemonsqueezy.com/v1/subscription-items/1"
    }
  }
}

Was this page helpful?