Skip to main content
POST
Error

Autorizações

Authorization
string
header
obrigatório

An organization API key, uk_sk_live_… or uk_sk_test_…. The environment is resolved from the stored key row on every request, never from a request parameter.

Every route behind this credential is rate limited per key — 1000 requests a minute — with a second ceiling of 3000 a minute across all the keys of one environment, so splitting your traffic across keys isolates it and minting more keys does not buy more of it. A test key can never spend a live key's allowance. Every response carries the current state in headers; see the rate-limits guide.

Cabeçalhos

Idempotency-Key
string

A key you choose — a UUID, or your own identifier for the operation — that makes this write safe to retry. Send the same key again and you get the same response back: the same status, the same body, and Idempotent-Replay: true. The handler does not run a second time.

The key is scoped to your API key and the route, so keys never collide between environments or tenants. It is remembered for 24 hours. Reusing it for a different request is refused (422), and a second request arriving while the first is still running is refused too (409) — retry that one in a moment.

A request that failed with a 5xx or was rate limited leaves the key spendable: retry it with the same key.

Maximum string length: 255

Corpo

application/json
feature
string
obrigatório

The key of the credit feature being spent. A boolean or metered feature answers 422 — neither holds a balance.

amount
integer<int64>
obrigatório

How many units this usage spends. Positive; the ledger line is written negative.

Intervalo obrigatório: x >= 1
customer_id
string<uuid>

Whose balance this spends. Exactly one of customer_id or customer_key is required.

customer_key
string

A customer-issued key (uk_ck_…) naming the customer instead — the string a caller presented to your surface. Resolved within your key's environment (404 otherwise, revoked included), and its id is stamped on the ledger line for per-key attribution. Exactly one of customer_id or customer_key is required.

request_key
string

This spend's own idempotency handle — an id from your system, such as the job or request that incurred the usage. Optional, but without it a replayed batch double-charges.

Resposta

The usage was recorded.

customer_id
string<uuid>
feature
string
amount
integer<int64>
balance
integer<int64>

What remains after this spend. Negative while inside the overdraft.

overage
integer<int64>

How much of amount was billed rather than taken from the balance. 0 on every ordinary spend, and always present — so a client can tell "this came out of what they had" from "this will be on their invoice" without knowing how the environment is configured. Non-zero only where credit_overage is bill on the environment, the plan's cell names a meter, and the gateway can count it.