Licenses

Licenses play a vital role in Mercantive, enabling you to manage and control access to your digital products. In this section, we’ll explore the various license endpoints available to programmatically manage licenses. You’ll learn how to query, create, update, and delete licenses to efficiently handle access to your products.

The License object

The license object stores all essential information about your licenses, including the associated store, user, product, and product variant. It also provides details on activation limits, expiration dates, suspension status, and usage statistics.

  • Name
    id
    Type
    uuid
    Description

    Unique identifier for the license.

  • Name
    activation_limit
    Type
    integer
    Description

    The maximum number of times this license can be activated. Null if there's no limit.

  • Name
    expires_at
    Type
    timestamp
    Description

    Timestamp of when the license expires. Null if the license doesn’t expire.

  • Name
    suspended_at
    Type
    timestamp
    Description

    Timestamp of when the license was suspended. Null if the license is not suspended.

  • Name
    status
    Type
    string
    Description

    The current status of the license (e.g., ACTIVE, INACTIVE, EXPIRED, SUSPENDED).

  • Name
    activation_usage
    Type
    integer
    Description

    The number of times this license has been activated.

  • Name
    activation_usage_formatted
    Type
    string
    Description

    A formatted string showing the current activation usage against the activation limit (e.g., "2/5").

  • Name
    created_at
    Type
    timestamp
    Description

    Timestamp of when the license was created.

  • Name
    updated_at
    Type
    timestamp
    Description

    Timestamp of when the license was last updated.


GET/licenses

List all licenses

This enpoint allows you to get all licenses from the store.

Optional attributes

  • Name
    page
    Type
    integer
    Description

    The page number to retrieve.

Request

GET
/licenses
curl -X GET https://api.mercantive.com/v1/licenses \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json"

Response

{
  "data": [
    {
      "id": "9d1cf32d-1dc3-4f9e-91a2-ba840f0821dc",
      "activation_limit": 5,
      "expires_at": "2025-09-27T22:37:24.000000Z",
      "suspended_at": null,
      "status": "ACTIVE",
      "activation_usage": 2,
      "activation_usage_formatted": "2/5",
      "created_at": "2024-09-27T22:37:24.000000Z",
      "updated_at": "2024-09-27T22:37:24.000000Z"
    }
  ],
  "links": {
    "first": "https://api.mercantive.com/v1/licenses?page=1",
    "last": "https://api.mercantive.com/v1/licenses?page=1",
    "prev": null,
    "next": null
  },
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 1,
    "links": [
      {
        "url": null,
        "label": "Previous",
        "active": false
      },
      {
        "url": "https://api.mercantive.com/v1/licenses?page=1",
        "label": "1",
        "active": true
      },
      {
        "url": null,
        "label": "Next",
        "active": false
      }
    ],
    "path": "https://api.mercantive.com/v1/licenses",
    "per_page": 25,
    "to": 1,
    "total": 1
  }
}

Was this page helpful?