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

# List Licenses

> Retrieve all licenses from your store

Retrieves a cursor-paginated list of all licenses in your store. Licenses are automatically generated when customers purchase license-based products. This endpoint supports filtering by status, customer, and product.

## Query Parameters

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

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

<ParamField query="status" type="string">
  Filter by license status. Valid values: `pending_activation`, `active`, `expired`, `revoked`
</ParamField>

<ParamField query="customer_id" type="string">
  Filter by customer public ID (e.g., `cus_abc123`)
</ParamField>

<ParamField query="product_id" type="string">
  Filter by product public ID (e.g., `prd_def456`)
</ParamField>

## Response

<ResponseField name="data" type="object">
  <Expandable title="properties">
    <ResponseField name="data" type="array">
      Array of license objects

      <Expandable title="license object">
        <ResponseField name="id" type="string">
          Unique license identifier (e.g., `lic_abc123`)
        </ResponseField>

        <ResponseField name="sale_id" type="integer">
          Associated sale ID
        </ResponseField>

        <ResponseField name="customer_id" type="integer">
          Associated customer ID
        </ResponseField>

        <ResponseField name="license_key" type="string">
          The license key string
        </ResponseField>

        <ResponseField name="status" type="string">
          License status: `pending_activation`, `active`, `expired`, or `revoked`
        </ResponseField>

        <ResponseField name="activated_at" type="string">
          ISO 8601 timestamp when first activated (null if not yet activated)
        </ResponseField>

        <ResponseField name="expires_at" type="string">
          ISO 8601 expiration timestamp (null if no expiration)
        </ResponseField>

        <ResponseField name="expired_at" type="string">
          ISO 8601 timestamp when expired (null if not expired)
        </ResponseField>

        <ResponseField name="revoked_at" type="string">
          ISO 8601 timestamp when revoked (null if not revoked)
        </ResponseField>

        <ResponseField name="activation_count" type="integer">
          Current number of activations
        </ResponseField>

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

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

        <ResponseField name="is_active" type="boolean">
          Whether the license is currently active
        </ResponseField>

        <ResponseField name="is_expired" type="boolean">
          Whether the license has expired
        </ResponseField>

        <ResponseField name="can_activate" type="boolean">
          Whether the license can be activated (has remaining activations)
        </ResponseField>

        <ResponseField name="metadata" type="object">
          Custom metadata attached to the license
        </ResponseField>

        <ResponseField name="created_at" type="string">
          ISO 8601 creation timestamp
        </ResponseField>

        <ResponseField name="updated_at" type="string">
          ISO 8601 last update timestamp
        </ResponseField>

        <ResponseField name="product" type="object">
          Product information

          <Expandable title="product object">
            <ResponseField name="id" type="integer">
              Product ID
            </ResponseField>

            <ResponseField name="name" type="string">
              Product name
            </ResponseField>
          </Expandable>
        </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>
  </Expandable>
</ResponseField>

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

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.chariow.com/v1/licenses?status=active&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?status=active&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": {
      "data": [
        {
          "id": "lic_ghi789",
          "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": 3,
          "max_activations": 10,
          "activations_remaining": 7,
          "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"
          }
        }
      ],
      "pagination": {
        "next_cursor": "eyJpZCI6NTB9",
        "prev_cursor": null,
        "has_more": true,
        "per_page": 20
      }
    },
    "errors": []
  }
  ```
</ResponseExample>
