Track credit consumption
Records usage and charges credit for it. The request carries no credit amount: send what happened, and the response’s charges carry what it priced to per metric, with totals as the sum.
Two shapes. A direct draw (account + events) charges against the account’s current credit. A settlement (reservation_id + events + close) closes a hold opened by /credits/check, pricing each metric at the rate frozen when the hold opened. One payload can feed several credit-consuming metrics, and the draw is all-or-nothing: a refusal for one metric leaves every metric uncharged.
Events sent here are both metered and charged, so do not also send them to POST /events. An event feeding no credit-consuming metric is rejected with 422 and belongs there instead. Insufficient credit returns 200 with allowed: false.
The events’ own unique_ids identify the work, so a resent batch draws once. The SDKs send no automatic Idempotency-Key on this call and retry it without one. Send your own key only to replay a specific response; it then replaces the unique_ids as the identity, so reuse it when you resend the same work. The SDKs do not retry a 500. 409 means the identity is bound to different work. Back off on 429.
Authorizations
Headers
A unique string that makes a retried write safe. If you send the same request with the same key within 24 hours, the API returns the stored response and does not run the request again. A 5xx or 429 response is not stored, so a retry with that key runs the request again.
255"ik_a1b2c3d4e5f6"
Body
The usage being recorded, up to 100 events. The amount charged is computed from these against whichever billable metrics count them; there is no credit amount in the request. On a settlement, an empty array with close: true releases the whole reservation, charging nothing, which is the recovery when work is abandoned.
100Whether this is the final call for the reservation. Required whenever reservation_id is set: there is no safe default, since true would end runs that meant to continue and false would leak reservations until they expire. The reservation also closes on its own if the events consume everything held. Not valid on a direct draw.
true
What to do when a settle cannot be fully covered by credit on a metric that stops at zero — either because it prices past the reservation's authorized hold, or because credit ran out before a late settle arrived. "reject" (the default) refuses the settle, burning and recording nothing. "record" burns what is available and reports the remainder in the charges' overflow, deliberately weakening a hard stop you configured. Reservation-settlement mode only. The refusal body's reason says which condition fired: adding credit resolves coverage_shortfall, but not envelope_exceeded, whose limit is the hold's size.
reject, record "record"
Response
Success
Per-metric, per-ledger availability after this call — one entry per ledger, so a single-ledger payload returns one. Always an array, but empty when no availability was resolved to report, including every response served while the organization's gate is disabled. Check the length before indexing.