> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stigg.io/llms.txt
> Use this file to discover all available pages before exploring further.

# consumeCredits

> Consume credits directly from a wallet (synchronous, low-volume)



**mutation** `consumeCredits(input: ConsumeCreditInput!): CreditConsumptionResponse!`

## Arguments

**`input`**: `ConsumeCreditInput!` (required)

## Returns

`CreditConsumptionResponse!`

**`amount`**: `Float!`

The amount of credits consumed

---

**`credit`**: `OptimisticCreditBalance`

The optimistic credit balance after consumption (when sync credit consumption is enabled)

---

**`currencyId`**: `String!`

The credit currency (custom currency refId) to consume from

---

**`customerId`**: `String!`

The customer to consume credits from (refId)

---

**`resourceId`**: `String`

Optional resource (refId) the consumption is attributed to

---

**`timestamp`**: `DateTime!`

The timestamp the consumption was attributed to

## Examples

```graphql Mutation
mutation ConsumeCredits($input: ConsumeCreditInput!) {
  consumeCredits(input: $input) {
    amount
    credit {
      currencyId
      currentUsage
      timestamp
      usageLimit
      usagePeriodEnd
    }
    currencyId
    customerId
    resourceId
    timestamp
  }
}
```

```json Variables
{
  "input": {
    "amount": 1.5,
    "currencyId": "string",
    "customerId": "string",
    "idempotencyKey": "string"
  }
}
```

```json Response
{
  "data": {
    "consumeCredits": {
      "amount": 1.5,
      "credit": {
        "currencyId": "string",
        "currentUsage": 1.5,
        "timestamp": "value",
        "usageLimit": 1.5,
        "usagePeriodEnd": "value"
      },
      "currencyId": "string",
      "customerId": "string",
      "resourceId": "string",
      "timestamp": "value"
    }
  }
}
```


## Related topics

- [Usage, billing & credits](https://docs.stigg.io/api-and-sdks/integration/backend/usage-and-billing.md)
- [Customer credits](https://docs.stigg.io/documentation/modeling-your-pricing-in-stigg/credits/customer-credits.md)
- [Deduct credits directly](https://docs.stigg.io/guides/i-want-to/deduct-credits-directly.md)
- [.NET SDK](https://docs.stigg.io/api-and-sdks/changelog/backend-graphql/dotnet.md)
- [Go SDK](https://docs.stigg.io/api-and-sdks/changelog/backend-graphql/go.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.