Skip to main content
POST
record usage that already happened

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

The record request

key
string
required

The budget's key, chosen by you and unique within the project. Up to 128 letters, digits, and : / _ . @ -, starting with a letter or digit.

Pattern: ^[A-Za-z0-9][A-Za-z0-9:/_.@-]{0,127}$
Example:

"customer:acme"

amount
string
required

The amount to record. It always counts, even past a hard limit; recording after work does not authorize that work retroactively.

Pattern: ^\d{1,19}(\.\d{1,8})?$
Example:

"0.05"

idempotencyKey
string
required

Up to 256 characters, usually the event id. For 8 days, the same key with the same amount replays instead of counting again, and with another amount returns 409.

Required string length: 1 - 256
Example:

"evt_01J9Z3"

occurredAt
integer
required

When the usage happened, in epoch milliseconds: the event's own time, not the time of the call. Must be within the last 7 days and at most 5 minutes ahead. It bounds acceptance only; usage counts in the window it arrives in.

Required range: x >= 0
Example:

1792000000000

Response

The record

amount
string
required

The amount consumed

crossed
string[]
required

Limit ids whose consumed amount first exceeded the limit's amount. A hard limit crosses only after recorded usage took its room. Reservations do not trigger crossings. Replays preserve the original result.

replayed
boolean
required

True when this answer replays an earlier request instead of applying it again

balance
object
required