Skip to main content
POST
/
api
/
v1
/
credits
/
consumption
/
async
JavaScript
import Stigg from '@stigg/typescript';

const client = new Stigg({
  apiKey: process.env['STIGG_API_KEY'], // This is the default and can be omitted
});

const response = await client.v1.credits.consumption.consumeAsync({
  consumptions: [
    {
      amount: 1,
      currencyId: 'currencyId',
      customerId: 'customerId',
      idempotencyKey: 'x',
    },
  ],
});

console.log(response.data);
{
  "data": {}
}

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 wallets asynchronously

consumptions
ConsumeCreditRequest · object[]
required

The credit consumptions to report (up to 1000)

Required array length: 1 - 1000 elements

Response

Confirmation that the credit consumptions were accepted for processing.

Response object

data
ConsumeCreditsAsyncResponse · object
required

Confirmation that the credit consumptions were accepted for processing