Skip to main content
POST
Reserve credits

Authorizations

Authorization
string
header
required

API key authentication. Pass your API key as a Bearer token.

Headers

Alguna-Version
enum<string>
required
Available options:
2026-04-01
Idempotency-Key
string

A unique string used to ensure the request is processed exactly once. If you retry a request with the same idempotency key within 24 hours, the original response is returned without re-executing the operation.

Maximum string length: 255
Example:

"ik_a1b2c3d4e5f6"

Body

application/json
account
string
required

Customer account ID or alias the credits belong to

Example:

"cust_abc123"

event_name
string

The usage event the work will produce. This is what resolves which billable metrics the check is against — you name what you are about to do, not which metric counts it. An event that feeds no credit-consuming metric is rejected with 422 — that usage belongs on POST /beta/events; an event feeding several credit-consuming metrics is checked (and held) against all of them at once. Optional when events carries the sample; required for reserve.max_quantity.

Example:

"api_call"

events
object[]

A sample of the work about to happen. The response's charges carry what that work would cost per metric, priced exactly as /track would price it. Nothing is recorded and no credit moves — this is how you learn a price without performing the work. With reserve: {}, the hold is sized to exactly these events.

properties
object

Event properties used to resolve customer-specific filter groups for this check. Not a billing input: this call records nothing.

reserve
object | null

Open a durable hold alongside the check. An object, never a number: send {} to hold enough for exactly the events in this request, or {"max_quantity": "…"} with event_name for an open-ended ceiling in metric units. The old numeric credit-amount form is rejected — the request no longer carries credit amounts anywhere. Omit for a cost-free preflight or quote (no hold is opened). Requires an Idempotency-Key.

ttl_seconds
integer<int64> | null

How long the hold stays open, in seconds. Defaults to 900 (15 minutes) and cannot exceed 14400 (4 hours), the maximum lifetime any hold may reach. Use it for a run that cannot report progress as it goes; a run that can should send partial settlements to /track instead, since each one slides this same TTL forward. Requires reserve. Not part of idempotency identity: a retry under the same Idempotency-Key replays the original hold with its original expires_at, whatever ttl_seconds it now carries.

Required range: 1 <= x <= 14400
Example:

3600

Response

Success

allowed
boolean
required

Whether the named work is covered by available credit (and, with reserve, whether a hold was opened).

at_zero_action
string
required

The at-zero policy the caller should apply on a deny: stop (hard deny) or overflow (fall through to metered billing). When the work feeds several metrics with differing policies, the strictest (stop) is reported.

Example:

"overflow"

balances
object[]
required

Per-metric, per-ledger availability — one entry per ledger, so a single-ledger account returns one. Always an array, but not always a populated one: it is empty when no availability was resolved to report, which is every response the gate could not read balances for (a back-pressure fail-open, a failed post-hold refresh, a failed report behind a deny) and every response served while the organization's gate is disabled. Check the length before indexing.

charges
object[]
required

One entry per metric the named work feeds: what the sampled events (or the max_quantity ceiling) price to per metric, and what a hold covers of it. Where no hold was opened — a quote, a denied reserve, a degraded fail-open — covered is zero and overflow carries the whole priced amount as the cash exposure of the described work. A check that named work but sampled none prices to zero throughout. Always an array, length 1 in the single-metric case.

reservation_id
string
required

Reservation token to settle later via /track. Empty unless a hold was opened (reserve).

Example:

"crt_abc123"

totals
object
required

The charges summed. Derived from charges — the breakdown is authoritative.

expires_at
string<date-time> | null

When the opened hold expires. Present only when a reservation was opened.

Example:

"2026-04-01T10:05:00Z"