# Check API (/docs/entitlements/check-api)

Your app checks a customer's access on the usage meter, the same service at `https://usage.comecero.com` that takes [usage events](/docs/usage-billing/usage-meter-api). Call it from your server: it does not answer browsers. It does not take Comecero API tokens, only [usage keys](/docs/usage-billing/set-up#5-create-a-usage-key). The [SDK](/docs/entitlements/sdk) is coming soon and is not on npm yet. Use plain HTTP today.

Every query field, response schema and status code is in [Check feature access](/api/customer-entitlements/check-entitlements).

## Check a customer's entitlements [#check-a-customers-entitlements]

**GET** `https://usage.comecero.com/v1/entitlements`

### Headers [#headers]

| Header | Value |
| --- | --- |
| `Authorization` | `Bearer apk_live_...` or `Bearer apk_test_...` |

The key decides the account and the mode (live or test). Nothing in the query can change them.

### Query [#query]

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `customer_id` | string | Yes | 1 to 128 of `A-Z a-z 0-9 _ . : -`. Your id for the customer, the one usage events send as `external_customer_id`. It is the customer's [`external_id`](/docs/entitlements#your-id-for-the-customer), or their Comecero `customer_id` when none is set. |
| `feature` | string | No | 1 to 64 of `a-z 0-9 _ . -`. One feature's key. Leave it out for every feature. |

````bash
curl "https://usage.comecero.com/v1/entitlements?customer_id=user_8412" \
  -H "Authorization: Bearer $COMECERO_USAGE_KEY"
````

### Answer [#answer]

````json
{
  "customer_id": "user_8412",
  "checked_at": "2026-11-15T10:30:00.000Z",
  "rules_revision": {
    "catalog_version": 3,
    "customer_version": 1,
    "revisions": { "fs_pro|2026-11-01T00:00:00.000Z": 1 }
  },
  "entitlements": [
    {
      "feature": "api_calls",
      "type": "metered",
      "has_access": true,
      "reason": null,
      "value": null,
      "limit": "50000",
      "used": "12840",
      "remaining": "37160",
      "reset_at": "2026-12-01T00:00:00.000Z",
      "hard_limit": true,
      "limit_reached": false,
      "valid_until": "2026-12-01T00:00:00.000Z",
      "items": [
        {
          "source": "SB0123456789:1",
          "has_access": true,
          "limit": "50000",
          "used": "12840",
          "remaining": "37160",
          "reset_at": "2026-12-01T00:00:00.000Z",
          "hard_limit": true,
          "limit_reached": false,
          "valid_until": "2026-12-01T00:00:00.000Z"
        }
      ]
    },
    {
      "feature": "sso",
      "type": "boolean",
      "has_access": true,
      "reason": null,
      "value": true,
      "limit": null,
      "used": null,
      "remaining": null,
      "reset_at": null,
      "hard_limit": false,
      "limit_reached": false,
      "valid_until": null
    }
  ]
}
````

One row per feature in your catalog, or only the one asked for. A customer the meter doesn't know gets every feature with `has_access: false` and `reason: "not_entitled"`.

| Field | Type | Description |
| --- | --- | --- |
| `customer_id` | string | The id you sent. |
| `checked_at` | string | When the answer was made, ISO 8601 in UTC. |
| `rules_revision` | object | The catalog and customer versions and the feature set revisions used for this answer. Versions can be null when no record has synced. |
| `entitlements[].feature` | string | The feature's key. |
| `entitlements[].type` | string | `boolean`, `number` or `metered`. |
| `entitlements[].has_access` | boolean | Whether the customer may use the feature now. |
| `entitlements[].reason` | string or null | Why not: `not_entitled` (never granted), `ended` (the access ended), `denied` (an override took it away), `limit_reached` (a hard limit) or `usage_not_read` (a hard limit whose usage this check of every feature did not read, so ask for the feature alone; or a finite hard limit whose usage can't be read). Null when `has_access` is true. |
| `entitlements[].value` | boolean, string or null | boolean: true or false. number: the value as a decimal string, null for unlimited. metered: null. |
| `entitlements[].limit` | string or null | metered: the limit in the window, null for unlimited. See [no pooling](/docs/entitlements#no-pooling). |
| `entitlements[].used` | string or null | metered: the usage in the window. |
| `entitlements[].remaining` | string or null | metered: what is left, never below 0. Null when unlimited. |
| `entitlements[].reset_at` | string or null | metered: when the window ends and usage starts again from zero. Null for a window that never resets. |
| `entitlements[].hard_limit` | boolean | Whether reaching the limit stops access. |
| `entitlements[].limit_reached` | boolean | Whether usage reached the limit. With a soft limit, `has_access` stays true. |
| `entitlements[].valid_until` | string or null | The earliest moment the answer may change by itself: an override expiring, access ending, a window resetting. Null when none is known. |
| `entitlements[].items` | array | metered: one item per purchase (or the override alone), with `source`, `has_access`, `limit`, `used`, `remaining`, `reset_at`, `hard_limit`, `limit_reached` and `valid_until`. |
| `entitlements[].usage_unavailable` | boolean | Present and true when the usage could not be read. `used` and `remaining` are then null. A soft limit then does not deny access; a finite hard limit whose usage was not read, for any reason, is denied with `usage_not_read`. |

Quantities are decimal strings, such as `"12840"` or `"0.5"`.

### Status codes [#status-codes]

| Status | Meaning |
| --- | --- |
| `200` | The rows. |
| `400` | `{ "error": "<code>" }` with `invalid_customer_id` or `invalid_feature`: the value is missing or not in the allowed format. |
| `401` | No `Authorization` header (`{ "message": "Unauthorized" }`). |
| `403` | The usage key is unknown, revoked, not active yet, or in the wrong format (`{ "message": "Forbidden" }`). |
| `404` | `feature_not_found`: your catalog has no feature with that key. |
| `429` | `too_many_requests`: the account sent over its checks-per-second limit (500 by default) (live and test together), or the route is over its limit. Try again after the `Retry-After` seconds. |
| `503` | `try_again`: a temporary problem. Try again. |

### Rules [#rules]

- **Cache the answer.** Keep it until `valid_until` or for 60 seconds, whichever comes first, and drop it when [`entitlement:changed`](/docs/entitlements#when-access-changes) arrives for the customer.
- **Seconds behind.** Usage is read from the meter's totals, which are seconds behind the events you send. A burst can pass a hard limit by a little.
- **Usage is read hard limits first.** When usage can't be read, the row has `usage_unavailable: true` and a soft limit or an unlimited one does not take access away. A check of every feature reads at most 32 separate usages (one metric in one window), hard limits first. A hard limit past that is denied with `reason: "usage_not_read"` rather than granted unchecked: ask for that `feature` alone, which reads all of its usage. A soft limit past it keeps access with `usage_unavailable`. A finite hard limit is also denied with `usage_not_read` while its usage can't be read, because it may already be over the limit.
- **No pooling.** Purchases of the same feature are never added up. See [no pooling](/docs/entitlements#no-pooling).
- **Your server only.** The key must stay on your server. Pages ask your backend, which asks the meter. See [HTTP integration](/docs/entitlements/sdk#pages).
