Create or update an entitlement
A metered entitlement bills a metric on a pinned rate plan version. A credit entitlement holds prepaid credit for the agreement. Send an existing entitlement_id to update it: its kind, agreement, metric and customer_id can not change. It answers 201 for a create and for an update. Create a credit entitlement before a metered one that draws on it. Secret and trusted tokens may call it; a limited token may not (403).
AuthorizationBearer <token>A secret, trusted or limited token. See Authentication.
An entitlement.
application/json- body
entitlement_id?stringSend an existing id to update it. Defaults to a new id. A new id can't start with ent_ent_ (400): those are kept for the entitlements priced feature sets make.
kind?stringDefaults to metered.
"metered""credit"billing_agreement_id*stringRequired.
metric_id?stringMetered: required. Credit: leave out.
rate_plan_id?stringMetered: required. Credit: leave out.
rate_plan_version?integerMetered: required.
funding_source_entitlement_id?stringMetered only. A credit entitlement of the same agreement.
overage_policy?stringallow (the default) charges usage above what credit pays. block is a hard limit: nothing is charged past the allowance and credit, and the line's capped_amount shows what was left off.
"allow""block"drawdown_priority?integerDefault 0. Only sets the order entitlements are listed in.
capacity?numberUnits included when the rate plan has none.
effective_from?stringDefaults to the agreement's start (metered) or now (credit).
date-timeeffective_to?stringSet it to end the entitlement.
date-timestatus?stringactive (the default) or ended.
"active""ended"billing_region?stringBilling region. Defaults to us.
"us""uk""eu"balance_alerts?Credit entitlements only. Turns on the usage:balance_low and usage:balance_depleted webhooks for this credit. The balance is low at or below low_balance, or at or below low_percent of the last credit added; with both, whichever is higher. With neither, only usage:balance_depleted is sent. Left out (the default): no balance alerts.
at_zero?stringCredit only: what the usage it pays for does once it is used up. charge, or left out: billed in cash as before. stop: usage past the credit is not charged (kept off the bill, as a hard limit does). Set from the shop's usage_customer_settings when a customer first buys credit. Saving the entitlement without it clears it. On any other kind it is a 400 (UbV141).
"charge""stop"customer_id?stringOptional. Your id for the customer, 1 to 128 of A-Z a-z 0-9 _ . : -. Billing always uses the agreement's customer_id.
Success.
application/json- response
A metered entitlement bills a metric on a pinned rate plan version. A credit entitlement holds prepaid credit. See https://docs.comecero.com/docs/usage-billing/entitlements
object?stringAlways entitlement_grant.
entitlement_id?stringYour id, or ent_ plus 32 characters.
kind?stringDefaults to metered. Never changes.
"metered""credit"billing_agreement_id?stringThe agreement it belongs to.
metric_id?stringMetered only: the metric billed.
rate_plan_id?stringMetered only: the pinned rate plan.
rate_plan_version?integerMetered only: the pinned version.
funding_source_entitlement_id?stringMetered only: a credit entitlement of the same agreement that pays first.
overage_policy?stringallow charges usage past the allowance and credit. block charges nothing past them (a hard limit); the run completes and the line's capped_amount shows what was left off.
"allow""block"drawdown_priority?integerDoes not affect billing order. Entitlements draw on a shared credit in the order they are billed (by the hour each starts in the period, then by entitlement_id). Default 0.
capacity?|Units included each period when the rate plan has no included_allowance.
status?stringactive, or any other value once ended.
effective_from?stringWhen it starts.
date-timeeffective_to?|When it stops.
date-timecustomer_id?stringThe agreement's customer id.
balance_alerts?Credit entitlements only. Turns on the usage:balance_low and usage:balance_depleted webhooks for this credit. The balance is low at or below low_balance, or at or below low_percent of the last credit added; with both, whichever is higher. With neither, only usage:balance_depleted is sent. Left out (the default): no balance alerts.
at_zero?stringCredit only: what the usage it pays for does once it is used up. charge, or left out: billed in cash as before. stop: usage past the credit is not charged (kept off the bill, as a hard limit does). Set from the shop's usage_customer_settings when a customer first buys credit. Saving the entitlement without it clears it. On any other kind it is a 400 (UbV141).
"charge""stop"billing_region?stringBilling region. Defaults to us.
"us""uk""eu"test?booleanTest or live.
unit_snapshot?credit_unit_rate_id?stringcurl -X POST 'https://api.comecero.com/api/v1/usage/entitlements' \ -H 'Content-Type: application/json' \ -d '{ "entitlement_id": "ent_cust_8412_ai_tokens", "billing_agreement_id": "agr_cust_8412", "metric_id": "met_ai_tokens", "rate_plan_id": "ai_tokens_standard", "rate_plan_version": 1, "funding_source_entitlement_id": "credit_cust_8412", "overage_policy": "allow"}'{ "object": "entitlement_grant", "entitlement_id": "ent_cust_8412_ai_tokens", "kind": "metered", "billing_agreement_id": "agr_cust_8412", "metric_id": "met_ai_tokens", "rate_plan_id": "ai_tokens_standard", "rate_plan_version": 1, "funding_source_entitlement_id": "credit_cust_8412", "overage_policy": "allow", "drawdown_priority": 0, "capacity": null, "status": "active", "effective_from": "2026-11-01T00:00:00Z", "effective_to": null, "customer_id": "cust_8412", "billing_region": "us", "test": false}