comecerodocs
Entitlements

Check API

The usage meter route your server calls to check access. Read GET /v1/entitlements with a usage key, and every field, answer and status code it has.

Your app checks a customer's access on the usage meter, the same service at https://usage.comecero.com that takes usage events. Call it from your server: it does not answer browsers. It does not take Comecero API tokens, only usage keys. The 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.

Check a customer's entitlements

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

Headers

HeaderValue
AuthorizationBearer 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

ParameterTypeRequiredDescription
customer_idstringYes1 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, or their Comecero customer_id when none is set.
featurestringNo1 to 64 of a-z 0-9 _ . -. One feature's key. Leave it out for every feature.
curl "https://usage.comecero.com/v1/entitlements?customer_id=user_8412" \
  -H "Authorization: Bearer $COMECERO_USAGE_KEY"

Answer

{
  "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".

FieldTypeDescription
customer_idstringThe id you sent.
checked_atstringWhen the answer was made, ISO 8601 in UTC.
rules_revisionobjectThe catalog and customer versions and the feature set revisions used for this answer. Versions can be null when no record has synced.
entitlements[].featurestringThe feature's key.
entitlements[].typestringboolean, number or metered.
entitlements[].has_accessbooleanWhether the customer may use the feature now.
entitlements[].reasonstring or nullWhy 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[].valueboolean, string or nullboolean: true or false. number: the value as a decimal string, null for unlimited. metered: null.
entitlements[].limitstring or nullmetered: the limit in the window, null for unlimited. See no pooling.
entitlements[].usedstring or nullmetered: the usage in the window.
entitlements[].remainingstring or nullmetered: what is left, never below 0. Null when unlimited.
entitlements[].reset_atstring or nullmetered: when the window ends and usage starts again from zero. Null for a window that never resets.
entitlements[].hard_limitbooleanWhether reaching the limit stops access.
entitlements[].limit_reachedbooleanWhether usage reached the limit. With a soft limit, has_access stays true.
entitlements[].valid_untilstring or nullThe earliest moment the answer may change by itself: an override expiring, access ending, a window resetting. Null when none is known.
entitlements[].itemsarraymetered: 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_unavailablebooleanPresent 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

StatusMeaning
200The rows.
400{ "error": "<code>" } with invalid_customer_id or invalid_feature: the value is missing or not in the allowed format.
401No Authorization header ({ "message": "Unauthorized" }).
403The usage key is unknown, revoked, not active yet, or in the wrong format ({ "message": "Forbidden" }).
404feature_not_found: your catalog has no feature with that key.
429too_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.
503try_again: a temporary problem. Try again.

Rules

  • Cache the answer. Keep it until valid_until or for 60 seconds, whichever comes first, and drop it when entitlement:changed 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.
  • Your server only. The key must stay on your server. Pages ask your backend, which asks the meter. See HTTP integration.

On this page