curl -X POST "https://api.chariow.com/v1/licenses/ABC-123-XYZ-789/activate" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"device_identifier": "00:1B:44:11:3A:B7"
}'
const response = await fetch(
'https://api.chariow.com/v1/licenses/ABC-123-XYZ-789/activate',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
device_identifier: '00:1B:44:11:3A:B7'
})
}
);
const data = await response.json();
$ch = curl_init('https://api.chariow.com/v1/licenses/ABC-123-XYZ-789/activate');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'device_identifier' => '00:1B:44:11:3A:B7'
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
{
"message": "License activated successfully",
"data": {
"id": "lic_abc123",
"sale_id": 156,
"customer_id": 89,
"license_key": "ABC-123-XYZ-789",
"status": "active",
"activated_at": "2025-01-15T10:30:00.000000Z",
"expires_at": "2026-01-15T10:30:00.000000Z",
"expired_at": null,
"revoked_at": null,
"activation_count": 1,
"max_activations": 10,
"activations_remaining": 9,
"is_active": true,
"is_expired": false,
"can_activate": true,
"metadata": null,
"created_at": "2025-01-15T09:00:00.000000Z",
"updated_at": "2025-01-15T10:30:00.000000Z",
"product": {
"id": 42,
"name": "Premium Software License"
}
},
"errors": []
}
{
"message": "License has been revoked",
"data": [],
"errors": []
}
{
"message": "Activation limit reached",
"data": [],
"errors": []
}
{
"message": "License has expired",
"data": [],
"errors": []
}
{
"message": "No query results for model [App\\Models\\IssuedLicense].",
"data": [],
"errors": []
}
Licenses
Activate License
Activate a license on a device
curl -X POST "https://api.chariow.com/v1/licenses/ABC-123-XYZ-789/activate" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"device_identifier": "00:1B:44:11:3A:B7"
}'
const response = await fetch(
'https://api.chariow.com/v1/licenses/ABC-123-XYZ-789/activate',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
device_identifier: '00:1B:44:11:3A:B7'
})
}
);
const data = await response.json();
$ch = curl_init('https://api.chariow.com/v1/licenses/ABC-123-XYZ-789/activate');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'device_identifier' => '00:1B:44:11:3A:B7'
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
{
"message": "License activated successfully",
"data": {
"id": "lic_abc123",
"sale_id": 156,
"customer_id": 89,
"license_key": "ABC-123-XYZ-789",
"status": "active",
"activated_at": "2025-01-15T10:30:00.000000Z",
"expires_at": "2026-01-15T10:30:00.000000Z",
"expired_at": null,
"revoked_at": null,
"activation_count": 1,
"max_activations": 10,
"activations_remaining": 9,
"is_active": true,
"is_expired": false,
"can_activate": true,
"metadata": null,
"created_at": "2025-01-15T09:00:00.000000Z",
"updated_at": "2025-01-15T10:30:00.000000Z",
"product": {
"id": 42,
"name": "Premium Software License"
}
},
"errors": []
}
{
"message": "License has been revoked",
"data": [],
"errors": []
}
{
"message": "Activation limit reached",
"data": [],
"errors": []
}
{
"message": "License has expired",
"data": [],
"errors": []
}
{
"message": "No query results for model [App\\Models\\IssuedLicense].",
"data": [],
"errors": []
}
Activates a license for a device by recording activation details and incrementing the activation count. The system automatically captures the requesting IP address and user agent. On the first activation, the license status changes from
pending_activation to active, and the expiration date is calculated based on the product’s validity period settings.
Each activation is tracked individually, allowing you to view the complete activation history. The license cannot be activated if it has been revoked, has expired, or if the maximum activation limit has been reached.
Path Parameters
string
required
The license key to activate (e.g.,
ABC-123-XYZ-789)Request Body
string
Optional unique identifier for the device (e.g., MAC address, hardware UUID, machine ID). Max 255 characters.
The IP address and user agent are automatically captured from the request and do not need to be provided.
Response
object
Show properties
Show properties
string
Unique license identifier
string
The license key string
string
License status (will be
active after successful activation)string
ISO 8601 timestamp when first activated
string
ISO 8601 expiration timestamp (calculated on first activation)
integer
Current number of activations (incremented)
integer
Maximum number of activations allowed
integer
Number of activations remaining
boolean
Whether the license is currently active
boolean
Whether the license can be activated again
object
Product information
Error Responses
object
Returned when:
- License has been revoked
- License has expired
- Activation limit has been reached
object
Returned when the license key doesn’t exist or doesn’t belong to your store
curl -X POST "https://api.chariow.com/v1/licenses/ABC-123-XYZ-789/activate" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"device_identifier": "00:1B:44:11:3A:B7"
}'
const response = await fetch(
'https://api.chariow.com/v1/licenses/ABC-123-XYZ-789/activate',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
device_identifier: '00:1B:44:11:3A:B7'
})
}
);
const data = await response.json();
$ch = curl_init('https://api.chariow.com/v1/licenses/ABC-123-XYZ-789/activate');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'device_identifier' => '00:1B:44:11:3A:B7'
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
{
"message": "License activated successfully",
"data": {
"id": "lic_abc123",
"sale_id": 156,
"customer_id": 89,
"license_key": "ABC-123-XYZ-789",
"status": "active",
"activated_at": "2025-01-15T10:30:00.000000Z",
"expires_at": "2026-01-15T10:30:00.000000Z",
"expired_at": null,
"revoked_at": null,
"activation_count": 1,
"max_activations": 10,
"activations_remaining": 9,
"is_active": true,
"is_expired": false,
"can_activate": true,
"metadata": null,
"created_at": "2025-01-15T09:00:00.000000Z",
"updated_at": "2025-01-15T10:30:00.000000Z",
"product": {
"id": 42,
"name": "Premium Software License"
}
},
"errors": []
}
{
"message": "License has been revoked",
"data": [],
"errors": []
}
{
"message": "Activation limit reached",
"data": [],
"errors": []
}
{
"message": "License has expired",
"data": [],
"errors": []
}
{
"message": "No query results for model [App\\Models\\IssuedLicense].",
"data": [],
"errors": []
}
Implementation Notes
First Activation
When a license is activated for the first time:- Status changes from
pending_activationtoactive activated_atis set to the current timestampexpires_atis calculated based on the product’s validity period (if configured)
Subsequent Activations
activation_countis incremented- A new activation record is created in the activation history
- The license status remains
active
Device Tracking
Each activation is tracked with:device_identifier(optional, provided by you)activated_by_ip(automatically captured)user_agent(automatically captured)created_at(timestamp of activation)
Example: Desktop Application
class LicenseActivator {
constructor(apiKey) {
this.apiKey = apiKey;
this.baseUrl = 'https://api.chariow.com/v1';
}
async activate(licenseKey) {
// Get unique device identifier
const deviceId = this.getDeviceIdentifier();
try {
const response = await fetch(
`${this.baseUrl}/licenses/${licenseKey}/activate`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${this.apiKey}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
device_identifier: deviceId
})
}
);
if (!response.ok) {
const error = await response.json();
throw new Error(error.message);
}
const result = await response.json();
console.log('License activated successfully');
console.log(`Activations remaining: ${result.data.activations_remaining}`);
return result.data;
} catch (error) {
console.error('Activation failed:', error.message);
throw error;
}
}
getDeviceIdentifier() {
// Implementation depends on your platform
// Examples: MAC address, hardware UUID, machine ID
return 'unique-device-id-here';
}
}
// Usage
const activator = new LicenseActivator('sk_live_your_api_key');
await activator.activate('ABC-123-XYZ-789');
Was this page helpful?