RESTful API Documentation v1.0
All API requests should include an API key in the header (optional but recommended):
Authorization: Bearer YOUR_API_KEY
Or use the custom header:
X-API-Key: YOUR_API_KEY
Activate a license key on a device.
{
"license_key": "ABCD-1234-EFGH-5678-IJKL",
"hardware_id": "a1b2c3d4e5f6g7h8"
}
{
"success": true,
"activation_token": "abc123def456...",
"license_info": {
"product_name": "My Software",
"license_type": "subscription",
"expiry_date": "2025-12-31 23:59:59"
}
}
{
"success": false,
"error": "Maximum activations reached"
}
Validate an active license.
{
"license_key": "ABCD-1234-EFGH-5678-IJKL",
"hardware_id": "a1b2c3d4e5f6g7h8",
"activation_token": "abc123def456..."
}
{
"valid": true,
"license": {
"license_key": "ABCD-1234-EFGH-5678-IJKL",
"product_name": "My Software",
"license_type": "subscription",
"status": "active",
"expiry_date": "2025-12-31 23:59:59",
"remaining_days": 365,
"max_activations": 3,
"current_activations": 1
}
}
Deactivate a license on a device.
{
"license_key": "ABCD-1234-EFGH-5678-IJKL",
"hardware_id": "a1b2c3d4e5f6g7h8",
"activation_token": "abc123def456..."
}
{
"success": true,
"message": "License deactivated successfully"
}
Get information about a license.
{
"success": true,
"license": {
"license_key": "ABCD-1234-EFGH-5678-IJKL",
"product_name": "My Software",
"license_type": "subscription",
"status": "active",
"issued_date": "2025-01-01 00:00:00",
"expiry_date": "2025-12-31 23:59:59",
"max_activations": 3,
"current_activations": 1
}
}
| Code | Description |
|---|---|
| 200 | Success - Request completed successfully |
| 400 | Bad Request - Invalid parameters or missing required fields |
| 401 | Unauthorized - Invalid or missing API key |
| 404 | Not Found - License key not found |
| 405 | Method Not Allowed - Wrong HTTP method used |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Server Error - Internal server error |
$ch = curl_init('https://yourdomain.com/api/v1/activate.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'license_key' => 'ABCD-1234-EFGH-5678-IJKL',
'hardware_id' => 'unique-hardware-id'
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json'
]);
$response = curl_exec($ch);
$result = json_decode($response, true);
if ($result['success']) {
echo "License activated!";
} else {
echo "Error: " . $result['error'];
}
fetch('https://yourdomain.com/api/v1/activate.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
license_key: 'ABCD-1234-EFGH-5678-IJKL',
hardware_id: 'unique-hardware-id'
})
})
.then(response => response.json())
.then(data => {
if (data.success) {
console.log('License activated!');
} else {
console.error('Error:', data.error);
}
});