> ## Documentation Index
> Fetch the complete documentation index at: https://chariow.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Get License Activations

> Retrieve activation history for a license

Fetches a cursor-paginated list of all activation records for a specific license, ordered by most recent first. Each activation record contains detailed information about when and where the license was activated, including IP address, user agent, device identifier, and timestamp.

This endpoint is useful for auditing license usage, tracking device activations, and debugging activation-related issues. The response includes pagination metadata and a summary of total, maximum, and remaining activations.

## Path Parameters

<ParamField path="licenseKey" type="string" required>
  The license key to retrieve activations for (e.g., `ABC-123-XYZ-789`)
</ParamField>

## Query Parameters

<ParamField query="per_page" type="integer" default="50">
  Number of activation records to return per page (max 100)
</ParamField>

<ParamField query="cursor" type="string">
  Cursor for pagination. Use the `next_cursor` from the previous response.
</ParamField>

## Response

<ResponseField name="data" type="object">
  <Expandable title="properties">
    <ResponseField name="activations" type="array">
      Array of activation records

      <Expandable title="activation object">
        <ResponseField name="id" type="integer">
          Unique activation record ID
        </ResponseField>

        <ResponseField name="issued_license_id" type="integer">
          The license ID this activation belongs to
        </ResponseField>

        <ResponseField name="activated_by_ip" type="string">
          IP address from which the activation was made
        </ResponseField>

        <ResponseField name="user_agent" type="string">
          User agent string from the activation request
        </ResponseField>

        <ResponseField name="device_identifier" type="string">
          Device identifier provided during activation (if any)
        </ResponseField>

        <ResponseField name="metadata" type="object">
          Additional metadata attached to the activation
        </ResponseField>

        <ResponseField name="created_at" type="string">
          ISO 8601 timestamp when the activation was created
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="pagination" type="object">
      Cursor pagination metadata

      <Expandable title="pagination object">
        <ResponseField name="next_cursor" type="string">
          Cursor for the next page (null if no more pages)
        </ResponseField>

        <ResponseField name="prev_cursor" type="string">
          Cursor for the previous page (null if on first page)
        </ResponseField>

        <ResponseField name="has_more" type="boolean">
          Whether there are more results
        </ResponseField>

        <ResponseField name="per_page" type="integer">
          Number of items per page
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="summary" type="object">
      Activation summary statistics

      <Expandable title="summary object">
        <ResponseField name="total_activations" type="integer">
          Total number of activations for this license
        </ResponseField>

        <ResponseField name="max_activations" type="integer">
          Maximum number of activations allowed
        </ResponseField>

        <ResponseField name="activations_remaining" type="integer">
          Number of activations remaining
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.chariow.com/v1/licenses/ABC-123-XYZ-789/activations?per_page=20" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://api.chariow.com/v1/licenses/ABC-123-XYZ-789/activations?per_page=20',
    {
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    }
  );
  const data = await response.json();
  ```

  ```php PHP theme={null}
  $ch = curl_init('https://api.chariow.com/v1/licenses/ABC-123-XYZ-789/activations?per_page=20');
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      'Authorization: Bearer YOUR_API_KEY'
  ]);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  $response = curl_exec($ch);
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "message": "success",
    "data": {
      "activations": [
        {
          "id": 3,
          "issued_license_id": 1,
          "activated_by_ip": "203.0.113.45",
          "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
          "device_identifier": "00:1B:44:11:3A:B7",
          "metadata": null,
          "created_at": "2025-01-18T15:42:00.000000Z"
        },
        {
          "id": 2,
          "issued_license_id": 1,
          "activated_by_ip": "198.51.100.12",
          "user_agent": "MyApp/1.2.0 (macOS 14.2)",
          "device_identifier": "A4:5E:60:D8:2F:11",
          "metadata": null,
          "created_at": "2025-01-16T09:15:00.000000Z"
        },
        {
          "id": 1,
          "issued_license_id": 1,
          "activated_by_ip": "192.0.2.100",
          "user_agent": "MyApp/1.0.0 (Windows 11)",
          "device_identifier": "desktop-workstation-001",
          "metadata": null,
          "created_at": "2025-01-15T10:30:00.000000Z"
        }
      ],
      "pagination": {
        "next_cursor": null,
        "prev_cursor": null,
        "has_more": false,
        "per_page": 20
      },
      "summary": {
        "total_activations": 3,
        "max_activations": 10,
        "activations_remaining": 7
      }
    },
    "errors": []
  }
  ```

  ```json License Not Found (404) theme={null}
  {
    "message": "No query results for model [App\\Models\\IssuedLicense].",
    "data": [],
    "errors": []
  }
  ```
</ResponseExample>

## Use Cases

### Audit Trail

Track all devices that have activated a license:

```javascript theme={null}
async function getActivationHistory(licenseKey) {
  const response = await fetch(
    `https://api.chariow.com/v1/licenses/${licenseKey}/activations`,
    {
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    }
  );

  const { data } = await response.json();

  console.log(`License activated ${data.summary.total_activations} times`);
  console.log(`${data.summary.activations_remaining} activations remaining`);

  data.activations.forEach(activation => {
    console.log(`Device: ${activation.device_identifier}`);
    console.log(`IP: ${activation.activated_by_ip}`);
    console.log(`Date: ${activation.created_at}`);
  });

  return data;
}
```

### Device Management

Display activation history to customers:

```javascript theme={null}
async function showCustomerActivations(licenseKey) {
  const response = await fetch(
    `https://api.chariow.com/v1/licenses/${licenseKey}/activations`,
    {
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    }
  );

  const { data } = await response.json();

  return {
    devices: data.activations.map(a => ({
      name: a.device_identifier || 'Unknown Device',
      ip: a.activated_by_ip,
      activatedAt: new Date(a.created_at).toLocaleDateString()
    })),
    summary: data.summary
  };
}
```

### Fraud Detection

Identify suspicious activation patterns:

```javascript theme={null}
async function detectSuspiciousActivity(licenseKey) {
  const response = await fetch(
    `https://api.chariow.com/v1/licenses/${licenseKey}/activations`,
    {
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    }
  );

  const { data } = await response.json();

  // Check for multiple activations from different locations
  const uniqueIPs = new Set(data.activations.map(a => a.activated_by_ip));

  if (uniqueIPs.size > 5) {
    console.warn('Suspicious: License activated from multiple IP addresses');
  }

  // Check for rapid activations
  const activations = data.activations.map(a => new Date(a.created_at));
  // ... implement your logic

  return {
    suspicious: uniqueIPs.size > 5,
    uniqueLocations: uniqueIPs.size,
    activations: data.activations
  };
}
```

## Pagination

This endpoint uses cursor-based pagination for efficient traversal of large activation lists:

```javascript theme={null}
async function getAllActivations(licenseKey) {
  let allActivations = [];
  let cursor = null;

  do {
    const url = cursor
      ? `https://api.chariow.com/v1/licenses/${licenseKey}/activations?cursor=${cursor}`
      : `https://api.chariow.com/v1/licenses/${licenseKey}/activations`;

    const response = await fetch(url, {
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    });

    const { data } = await response.json();
    allActivations = [...allActivations, ...data.activations];
    cursor = data.pagination.next_cursor;

  } while (cursor);

  return allActivations;
}
```

## Notes

* Activations are ordered by most recent first (`created_at DESC`)
* Each activation is immutable and cannot be modified
* Activation records persist even after a license is revoked
* The `device_identifier` field is optional and may be `null` if not provided during activation
* IP addresses and user agents are automatically captured during activation
