Skip to main content
POST
consume an amount if it fits

Authorizations

Authorization
string
header
required

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

Body

application/json

The charge 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 consume now, checked against every hard limit

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

"0.05"

idempotencyKey
string
required

Up to 256 characters. A retry with the same key and the same request replays the first answer; the same key with a different request returns 409.

Required string length: 1 - 256
Example:

"run_8f2c:step_3"

Response

The charge

allowed
enum<boolean>
required
Available options:
true
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