Skip to main content
GET
https://api.chariow.com/v1
/
licenses
/
{licenseKey}
curl -X GET "https://api.chariow.com/v1/licenses/ABC-123-XYZ-789" \
  -H "Authorization: Bearer YOUR_API_KEY"
{
  "message": "success",
  "data": {
    "id": "lic_ghi789",
    "license_key": "ABC-123-XYZ-789",
    "status": "active",
    "is_active": true,
    "is_expired": false,
    "can_activate": true,
    "activation_count": 3,
    "max_activations": 10,
    "activations_remaining": 7,
    "expires_at": null,
    "revoked_at": null,
    "product": {
      "id": 42,
      "name": "Premium Software License"
    }
  },
  "errors": []
}
Validates a license key by retrieving its details and checking the status. Use this endpoint to verify if a license is active and can be used before granting access to your software or service.
This endpoint is the same as Get License. To validate a license, retrieve it and check the is_active, is_expired, and can_activate fields.

Path Parameters

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

Validation Logic

A license is considered valid if:
  • The license exists and belongs to your store
  • is_active is true (status is active and not expired)
  • is_expired is false
  • revoked_at is null
A license can be activated if:
  • It’s valid (meets the above criteria)
  • can_activate is true (activation_count < max_activations)

Response

data
object
curl -X GET "https://api.chariow.com/v1/licenses/ABC-123-XYZ-789" \
  -H "Authorization: Bearer YOUR_API_KEY"
{
  "message": "success",
  "data": {
    "id": "lic_ghi789",
    "license_key": "ABC-123-XYZ-789",
    "status": "active",
    "is_active": true,
    "is_expired": false,
    "can_activate": true,
    "activation_count": 3,
    "max_activations": 10,
    "activations_remaining": 7,
    "expires_at": null,
    "revoked_at": null,
    "product": {
      "id": 42,
      "name": "Premium Software License"
    }
  },
  "errors": []
}

Validation Example

Here’s a complete validation function:
async function validateLicense(licenseKey) {
  try {
    const response = await fetch(
      `https://api.chariow.com/v1/licenses/${licenseKey}`,
      { headers: { 'Authorization': 'Bearer YOUR_API_KEY' }}
    );

    if (!response.ok) {
      return { valid: false, reason: 'License not found' };
    }

    const result = await response.json();

    // Check if revoked
    if (result.data.revoked_at) {
      return { valid: false, reason: 'License has been revoked' };
    }

    // Check if expired
    if (result.data.is_expired) {
      return { valid: false, reason: 'License has expired' };
    }

    // Check if active
    if (!result.data.is_active) {
      return { valid: false, reason: 'License is not active' };
    }

    return {
      valid: true,
      license: result.data,
      canActivate: result.data.can_activate
    };
  } catch (error) {
    return { valid: false, reason: error.message };
  }
}