> This page is for version Preview (default).
> For other versions, use one of these documentation indexes:
> - Preview (default): https://docs.preview.paid.ai/preview/llms.txt
> - Current: https://docs.preview.paid.ai/current/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.preview.paid.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.preview.paid.ai/_mcp/server.

# Credit balances and ledger

> Show customers how many credits they have left, find customers about to run out, and trace every change to a balance back to the usage or grant that caused it.

A customer's **credit balance** says how many credits they have left in a credit currency. The **credit ledger** is the history behind it: every grant, spend, expiry, void, refill and overage, each with the balance after it. Use the balance to show your customer what's left, and the ledger to explain how it got there. The ledger is append-only, so its entries always add up to the balance.

Use balances and the ledger to:

* **Show what's left** in your product, with a customer's [credit balance](#credit-balances).
* **Find customers about to run out**, across your whole account, with the `available[lte]` and `percentAvailable[lte]` filters.
* **Explain a balance** to your customer, entry by entry, with [credit transactions](#credit-transactions).
* **Reconcile** credits against the grants, events and orders behind them.

## How balances and the ledger fit together

1. **Every change is a ledger entry.** A grant adds credits, a spend or an expiry takes them away, and each entry records the balance after it.
2. **The balance is computed from the entries,** per customer and credit currency: `available` is `granted` minus `used` minus `held`.
3. **Holds and overage sit beside the ledger.** A [credit hold](/credits/credit-holds) reserves credits without writing an entry, and overage is billed in money rather than taken from the balance.

Credit amounts are in the credit currency, as exact decimal strings with up to 15 decimal places. A balance doesn't stay a whole number once a fractional spend arrives, so don't assume balances are integers.

## Credit balances

Brightrail's app shows each user how many Adatum credits their company has left:

#### API

[List credit balances](../api-reference/credits/credit-balances/list) for a customer and credit currency. A balance has no ID of its own, so the list is how you read one. These endpoints are in the `credits=v1` beta; send `Paid-Beta: credits=v1`.

**`GET /v1/credit-balances`**

```text title="GET /v1/credit-balances"
?customer=cus_3Vb9Rk
&creditCurrency=adatum_credits
```

**`Response`**

```json title="Response"
{
  "object": "list",
  "data": [
    {
      "object": "creditBalance",
      "customer": "cus_3Vb9Rk",
      "seat": null,
      "customerUnit": null,
      "creditCurrency": "adatum_credits",
      "granted": "1200",
      "used": "200.25",
      "held": "0",
      "available": "999.75",
      "percentAvailable": "83.3125",
      "pending": "0",
      "overage": "0",
      "nextExpiry": { "amount": "799.75", "expiresAt": "2027-01-01T00:00:00Z" },
      "asOf": "2026-12-02T18:00:00Z"
    }
  ],
  "hasMore": false,
  "nextCursor": null
}
```

#### Dashboard

> **Draft**
>
> These steps describe the planned v1 dashboard and will change before release.

1. Go to **Operate > Customers** and open **Brightrail**.
2. Open the **Credits** tab to see the balance in each credit currency.
3. Click a balance to see its grants and ledger entries.

| Field              | Meaning                                                                                                     |
| ------------------ | ----------------------------------------------------------------------------------------------------------- |
| `granted`          | Credits granted on grants in effect.                                                                        |
| `used`             | Credits spent from those grants.                                                                            |
| `held`             | Credits reserved by active [credit holds](/credits/credit-holds): not spent, but not spendable either.      |
| `available`        | Credits left to spend or hold: `granted` - `used` - `held`. Never negative.                                 |
| `percentAvailable` | `available` ÷ `granted` × 100. `"0"` when nothing has been granted, and `null` for unlimited grants.        |
| `pending`          | Usage held for a first grant, when the credit currency's `unfundedUsage` is `pending`.                      |
| `overage`          | Credits spent past the balance and not yet invoiced, billed in money at the credit currency's `conversion`. |
| `nextExpiry`       | The next credits to be forfeited, and when. Rollover counts; refills don't.                                 |
| `asOf`             | When the balance was calculated.                                                                            |

In the response, `available` is 1,200 - 200.25 - 0 = 999.75, and `percentAvailable` is 999.75 ÷ 1,200 × 100 = 83.3125.

### Find customers running low

Leave out `customer` to list balances across your account. `available[lte]` and `percentAvailable[lte]` keep only the balances at or below a value, sorted by `percentAvailable`, lowest first:

**`GET /v1/credit-balances`**

```text title="GET /v1/credit-balances"
?creditCurrency=adatum_credits
&percentAvailable[lte]=10
```

Customers with unlimited grants are left out, because their `percentAvailable` is `null`. To top up low balances automatically, use [auto top-ups](/credits/auto-top-ups).

### Child customers' balances

With `customer`, set `includeChildren=true` to also list the balances of that customer's [child customers](/customers/customers#parent-customers), one row each. Trey Research reads Northwind Traders' balances together with those of its subsidiaries, such as Northwind UK Ltd:

**`GET /v1/credit-balances`**

```text title="GET /v1/credit-balances"
?customer=cus_8HqL2xT
&includeChildren=true
```

Rows aren't summed: each child keeps its own balance, and a child never spends its parent's credits. `includeChildren` needs `customer`.

### Seat balances

With `holder=seat`, the list returns each [seat's](/orders-and-billing/seats) own balance instead of the shared ones, with `seat` and `customerUnit` set. A seat's usage spends its own balance first, then the shared balance.

## Credit transactions

Each change to a balance is a **credit transaction**: one entry in the ledger. [List credit transactions](../api-reference/credits/credit-transactions/list) to read them, newest first:

**`GET /v1/credit-transactions`**

```text title="GET /v1/credit-transactions"
?customer=cus_3Vb9Rk
&creditCurrency=adatum_credits
&occurredAt[gte]=2026-12-02T00:00:00Z
&occurredAt[lt]=2026-12-03T00:00:00Z
```

| `type`    | Written when                                                                                                                                                       |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `grant`   | Credits are granted.                                                                                                                                               |
| `spend`   | Usage spends credits. A spend that draws on several grants writes one entry per grant, all with the same `event`.                                                  |
| `expiry`  | Unspent credits expire, including when rollover runs out.                                                                                                          |
| `void`    | A grant is voided, or a seat is freed, and its credits are forfeited.                                                                                              |
| `refill`  | A refilling grant resets, restoring what was spent in the window that ended.                                                                                       |
| `overage` | Usage spends past the balance.                                                                                                                                     |
| `pending` | Usage arrives before the first grant, and is held for it. The `spend` and `overage` entries that settle it when the first grant arrives name it in `pendingEntry`. |

Each entry has a signed `amount`, the `balanceAfter` it, `occurredAt` (when the usage or grant happened) and `createdAt` (when it was recorded). It links to what caused it: the `grant`, `event`, `meter`, `product`, `order` or `seat`. Filter by `type`, `grant`, `event`, `order`, `product`, `meter` or an `occurredAt` range to trace a balance back to the usage behind it. `reason` carries a manual grant's reason.

## How it reconciles

Brightrail starts a trial with a 1,000-credit grant that expires on 1 January 2027, and gets 200 goodwill credits that never expire. Adatum charges 4 credits a minute. Here's its first day of the ledger, oldest first:

| Time  | `type`  | `amount` | `balanceAfter` | Why                 |
| ----- | ------- | -------- | -------------- | ------------------- |
| 09:00 | `grant` | `1000`   | `1000`         | Trial grant         |
| 11:15 | `spend` | `-120`   | `880`          | 30 minutes × 4      |
| 14:20 | `spend` | `-0.5`   | `879.5`        | 0.125 minutes × 4   |
| 16:10 | `grant` | `200`    | `1079.5`       | Goodwill            |
| 17:45 | `spend` | `-79.75` | `999.75`       | 19.9375 minutes × 4 |

The `grant`, `spend`, `expiry`, `void` and `refill` entries always sum to the balance before holds, `available` + `held`: 1,000 - 120 - 0.5 + 200 - 79.75 = 999.75. All three spends came from the trial grant, because it's forfeited first, so `nextExpiry` is 1,000 - 200.25 = 799.75 credits on 1 January.

The next day, one event costs 1,019.75 credits, 254.9375 minutes × 4. The balance covers 999.75 of it:

| `type`    | Credits                | `balanceAfter` | From                             |
| --------- | ---------------------- | -------------- | -------------------------------- |
| `spend`   | 799.75                 | `200`          | the trial grant, forfeited first |
| `spend`   | 200                    | `0`            | the goodwill grant               |
| `overage` | 1,019.75 - 999.75 = 20 | `0`            | past the balance                 |

The balance now shows `available` of `0` and `overage` of `20`. At the credit currency's 75¢ conversion, the overage is billed as 20 × 75¢ = 1,500¢, or **\$15.00**. Overage entries are left out of the balance sum: those not yet invoiced add up to the balance's `overage`.

## Correct a balance

Ledger entries can't be changed or deleted. To add credits, [create a grant](/credits/credit-grants#grant-credits-by-hand). To take them away, [void the grant](../api-reference/credits/credit-grants/void) that holds them, which writes a `void` entry, and grant the right amount again if needed.

## Related

* [How credits work](/credits/how-credits-work)
* [Credit grants](/credits/credit-grants)
* [Credit holds](/credits/credit-holds)
* [Usage summaries](/usage/usage-summaries)
* [Credit transactions API reference](../api-reference/credits/credit-transactions/list)