Credit consumption

Consume credits

Consumes a specified amount of credits directly from a customer wallet, with no feature mapping. Returns the optimistic balance.

post/api/v1/credits/consumption

Headers

X-ACCOUNT-IDstring

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-IDstring

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).

Request body

customerIdstring required

The customer to consume credits from (required)

currencyIdstring required

The credit currency to consume from (required)

amountnumber required

The amount of credits to consume

resourceIdstring

Optional resource the consumption is attributed to

idempotencyKeystring required

A unique key used to deduplicate the consumption (required)

dimensionsobject

Optional dimensions describing the consumption

createdAtstring date-time

Optional timestamp the consumption is attributed to

Response

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

Changes

Changed in 4 of the 115 revisions of this API.71

    • added the new ContractNotFound enum value to the code response property for the response status 404

      response-property-enum-value-added

    • added the new CreditOveragePriceCurrencyNotFound enum value to the code response property for the response status 400

      response-property-enum-value-added

    • added the new InvalidCreditOverageBillingModel enum value to the code response property for the response status 400

      response-property-enum-value-added

    • added the new InvoicePreviewNotAvailableForDraftContract enum value to the code response property for the response status 400

      response-property-enum-value-added

    • added the new OveragePriceNotSupportedOnAddon enum value to the code response property for the response status 400

      response-property-enum-value-added

    • added the new OveragePriceRequiresUsageLimit enum value to the code response property for the response status 400

      response-property-enum-value-added

    • added the new GovernanceNotEnabled enum value to the code response property for the response status 403

      response-property-enum-value-added

    • endpoint added

      endpoint-added