Skip to main content
POST
https://api.chariow.com/v1
/
licenses
/
{licenseKey}
/
activate
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"
  }'
{
  "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": []
}
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

licenseKey
string
required
The license key to activate (e.g., ABC-123-XYZ-789)

Request Body

device_identifier
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

data
object

Error Responses

400 Bad Request
object
Returned when:
  • License has been revoked
  • License has expired
  • Activation limit has been reached
404 Not Found
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"
  }'
{
  "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": []
}

Implementation Notes

First Activation

When a license is activated for the first time:
  • Status changes from pending_activation to active
  • activated_at is set to the current timestamp
  • expires_at is calculated based on the product’s validity period (if configured)

Subsequent Activations

  • activation_count is 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)
You can retrieve the full activation history using the Get License Activations endpoint.

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');