Skip to main content
POST
JavaScript

Authorizations

X-API-KEY
string
header
required

Server API Key

Headers

X-ACCOUNT-ID
string

Account ID — optional when authenticating with a user JWT (Bearer token); falls back to the user's first membership. Ignored for API-key auth.

X-ENVIRONMENT-ID
string

Environment ID — required when authenticating with a user JWT (Bearer token) on environment-scoped endpoints. Ignored for API-key auth (env is intrinsic to the key).

Body

application/json

Request body for consuming credits directly from a wallet

customerId
string
required

The customer to consume credits from (required)

Required string length: 1 - 255
Pattern: ^[a-zA-Z0-9][a-zA-Z0-9_|.@-]*$
currencyId
string
required

The credit currency to consume from (required)

Required string length: 1 - 255
Pattern: ^[a-zA-Z0-9][a-zA-Z0-9_|.-]*$
amount
number
required

The amount of credits to consume

Required range: x > 0
idempotencyKey
string
required

A unique key used to deduplicate the consumption (required)

Required string length: 1 - 255
resourceId
string

Optional resource the consumption is attributed to

Required string length: 1 - 255
Pattern: ^[a-zA-Z0-9][a-zA-Z0-9_|.-]*$
dimensions
object

Optional dimensions describing the consumption

createdAt
string<date-time>

Optional timestamp the consumption is attributed to

Response

The result of the credit consumption, including the optimistic balance.

Response object

data
ConsumeCreditResponse · object
required

Result of a synchronous direct credit consumption