---
title: "Consume credits"
method: POST
path: "/api/v1/credits/consumption"
tags: ["Credit consumption"]
---

# Consume credits

`POST /api/v1/credits/consumption`

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

## Headers

- `X-ACCOUNT-ID` string
- `X-ENVIRONMENT-ID` string

## Request body

- ConsumeCreditRequestDto — Request body for consuming credits directly from a wallet
  - `customerId` string, required — The customer to consume credits from (required)
  - `currencyId` string, required — The credit currency to consume from (required)
  - `amount` number, required — The amount of credits to consume
  - `resourceId` string — Optional resource the consumption is attributed to
  - `idempotencyKey` string, required — A unique key used to deduplicate the consumption (required)
  - `dimensions` object — Optional dimensions describing the consumption
  - `createdAt` string, date-time — Optional timestamp the consumption is attributed to

## Response `200`

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

- ConsumeCreditResponseResponseDto — Response object
  - `data` object, required — Result of a synchronous direct credit consumption
    - `customerId` string, required — The customer the credits were consumed from
    - `currencyId` string, required — The credit currency the credits were consumed from
    - `resourceId` string, nullable — The resource the consumption was attributed to
    - `amount` number, required — The amount of credits consumed
    - `timestamp` string, date-time, required — The timestamp the consumption was attributed to
    - `credit` object, nullable — The optimistic credit balance after consumption (when sync credit consumption is enabled)
      - `currencyId` string, required — The credit currency identifier
      - `currentUsage` number, required — The wallet's total consumed credits for this currency (optimistic — includes not-yet-reconciled usage), shared across every feature that draws on the currency. This is the running balance, not this call's deduction — see `consumed` for that.
      - `usageLimit` number, required — The total credits granted
      - `timestamp` string, date-time, required — The grant-version timestamp of this balance, used by the SDK for last-write-wins reconciliation
      - `usagePeriodEnd` string, date-time, nullable — End of the current credit grant period (when recurring credits reset), if applicable

## Other responses

- `400` — bad request.
- `401` — User is not authenticated.
- `403` — User is not allowed to access this resource.
- `404` — CreditConsumption not found.
- `429` — Too many requests.

---

[API](https://skmtc.net/stiggio/apis/stigg-api.md) · [All operations](https://skmtc.net/stiggio/apis/stigg-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/stiggio/stigg-api/revisions/ffc977f1c07e/schema)
