LicenseKey
The LicenseKey is a unique identifier that grants access to a digital product. Each license key is typically provided to a user, allowing them to activate and use the product. License keys are commonly used to manage permissions, track individual activations, and control how a product can be accessed.
The LicenseKey object
The LicenseKey object represents the data structure for each license key within Mercantive. It includes information such as activation status, associated license, and usage details. The license key object allows you to monitor activations, enforce limits, and manage access to your products on a per-key basis, providing fine-grained control and visibility over product distribution.
- Name
id
- Type
- uuid
- Description
Unique identifier for the license.
- Name
name
- Type
- string
- Description
The identifier for the License, Example:
Macbook Pro
.
- 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.
List Keys
This enpoint allows you to get all the keys for a license.
Request
curl -X GET https://api.mercantive.com/v1/licenses/{id}/keys \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json"
Response
{
"data": [
{
"id": "9d1cf8ef-3337-4059-b88b-505db1bdc52b",
"name": "Macbook Pro",
"created_at": "2024-09-27T22:53:30.000000Z",
"updated_at": "2024-09-27T22:53:30.000000Z"
},
{
"id": "9d1e90c3-db31-4a36-8d29-945a4061d9c9",
"name": "iMac",
"created_at": "2024-09-28T17:53:53.000000Z",
"updated_at": "2024-09-28T17:53:53.000000Z"
},
]
}
Active a Key
This endpoint allows you to activate a license key. Activation is the process of associating a license key with a specific License, enabling the user to access the product or service associated with the key. Activation typically involves validating the key, checking usage limits, and updating the key status to ACTIVE
.
Required attributes
- Name
name
- Type
- string
- Description
The identifier for the License, Example:
Macbook Pro
.
Request
curl -X POST https://api.mercantive.com/v1/licenses/{id}/activate \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d name="Macbook Pro"
Response
{
"license": {
"id": "9d1cf32d-1dc3-4f9e-91a2-ba840f0821dc",
"activation_limit": 5,
"expires_at": "2025-09-27T22:37:24.000000Z",
"suspended_at": null,
"status": "ACTIVE",
"activation_usage": 3,
"activation_usage_formatted": "3/5",
"created_at": "2024-09-27T22:37:24.000000Z",
"updated_at": "2024-09-27T22:37:24.000000Z"
},
"key": {
"id": "9d1eb6d6-163d-49c2-baf9-6c837bdce229",
"name": "Macbook",
"created_at": "2024-09-28T19:40:20.000000Z",
"updated_at": "2024-09-28T19:40:20.000000Z"
}
}
Validate a Key
This endpoint enables you to verify if a license key is valid, active, and authorized to access a specific product or service.
Required attributes
- Name
key
- Type
- uuid
- Description
The unique identifier for the license key.
Request
curl -X POST https://api.mercantive.com/v1/licenses/{id}/validate \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d key="9d1eb6d6-163d-49c2-baf9-6c837bdce229"
Response
{
"license": {
"id": "9d1cf32d-1dc3-4f9e-91a2-ba840f0821dc",
"activation_limit": 5,
"expires_at": "2025-09-27T22:37:24.000000Z",
"suspended_at": null,
"status": "ACTIVE",
"activation_usage": 3,
"activation_usage_formatted": "3/5",
"created_at": "2024-09-27T22:37:24.000000Z",
"updated_at": "2024-09-27T22:37:24.000000Z"
},
"key": {
"id": "9d1cf8ef-3337-4059-b88b-505db1bdc52b",
"name": "Macbook Pro",
"created_at": "2024-09-27T22:53:30.000000Z",
"updated_at": "2024-09-27T22:53:30.000000Z"
}
}
Show Key
This endpoint allows you to retrieve a specific license key by its unique identifier.
Request
curl -X GET https://api.mercantive.com/v1/licenses/{id}/keys/{key} \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json"
Response
{
"data": {
"id": "9d1e90c3-db31-4a36-8d29-945a4061d9c9",
"name": "iMac",
"created_at": "2024-09-28T17:53:53.000000Z",
"updated_at": "2024-09-28T17:53:53.000000Z"
}
}
Deactivate a Key
This endpoint allows you to deactivate a license key.
Required attributes
- Name
key
- Type
- uuid
- Description
The unique identifier for the license key.
Request
curl -X DELETE https://api.mercantive.com/v1/licenses/{id}/deactivate \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d key="9d1eb6d6-163d-49c2-baf9-6c837bdce229"
Response
{
"message": "License key deactivated successfully."
}