# Balance (/docs/balance)

> Pre-release: the public API is not live yet and has no base URL. Routes and fields are in the OpenAPI contract, at /openapi.yaml.

What your sales left in the environment: what can be paid out, what is still pending, what a dispute holds and what is on its way out.

The balance is what the paid charges left in the environment, after fees, refunds, disputes and payouts. It is never stored: it is the sum of the ledger at the moment you read it.

## Operations [#operations]

| Operation in the contract | What it does |
|---|---|
| `getBalance` | Returns the four balances of the environment. Requires the `balance:read` scope |

The route and the fields are in the [OpenAPI contract](/openapi.yaml), under this name. It is the same balance the dashboard shows in **Saldo**.

## The four balances [#the-four-balances]

Every amount is an integer number of cents.

| Field | What it is |
|---|---|
| `available_cents` | What can leave in a payout now: what was paid, minus the fees, the refunds, the payouts, what a dispute holds and what is still pending |
| `pending_cents` | The part of the balance that cannot leave in a payout yet: what the charges paid less than the release period ago left |
| `blocked_cents` | What the bank holds because a payer disputed the payment, until it decides: the amount of the charges in dispute |
| `outgoing_cents` | What already left the balance and the bank has not confirmed yet: the refunds on their way to the payers and the payouts on their way to you |

The four are read at the same instant: one is never from before an entry of the ledger and another from after it.

## The release period [#the-release-period]

What a paid charge leaves is yours at once, and it can be paid out only after the release period of your account.

- **Every account starts with a release period of 2 days**, counted from the moment each charge was paid. The period is a setting of your account.
- **A paid charge enters `pending_cents` first.** When its period ends, its amount moves to `available_cents` by itself, charge by charge. No event tells you: read the balance again.
- **`available_cents` plus `pending_cents` is what you have.** A refund and a dispute take from the two together, so a charge can be refunded before its period ends.
- **Only a charge that is still `paid` counts.** A `refunded` or `disputed` charge is not pending, and neither is one with a refund on its way: its amount already left the balance.
- **`pending_cents` is never more than what the balance has.** When a refund or a dispute of an older charge takes part of it, it shrinks, and `available_cents` stays at zero until what is left is released.

## What changes it [#what-changes-it]

| What happens | `available_cents` plus `pending_cents` | `blocked_cents` | `outgoing_cents` |
|---|---|---|---|
| A charge becomes `paid` | Grows by the amount, minus the fee, in `pending_cents` | | |
| The release period of a charge ends | Stays the same: the amount moves from `pending_cents` to `available_cents` | | |
| A refund is asked for | Shrinks by what the refund takes | | Grows by the amount of the refund |
| The refund reaches the payer | | | Shrinks by the amount of the refund |
| The bank does not make the refund | Grows back | | Shrinks by the amount of the refund |
| The payer disputes a charge | Shrinks by what the dispute takes | Grows by the amount of the charge | |
| The bank refuses the dispute | Grows back | Shrinks by the amount of the charge | |
| The bank accepts the dispute | | Shrinks by the amount of the charge | |

- What a refund or a dispute takes from the balance depends on the fee rule of your account. See [The amount](/docs/refunds#the-amount) and [Disputes](/docs/disputes).
- A payout, asked for in the dashboard, moves its amount from `available_cents` to `outgoing_cents` until the bank confirms it. A payout never takes from `pending_cents`.
- **`available_cents` can be negative.** A dispute takes its amount even when you already withdrew it, and the next sales cover it.
- **Read the balance again instead of keeping it.** A `refund.created` or a `charge.paid` webhook tells you it changed. See [Webhooks](/docs/webhooks).

## What a key needs [#what-a-key-needs]

- **`balance:read`.** No other scope includes it: a key that creates and reads charges does not read the balance. See [What a key can do](/docs/authentication#what-a-key-can-do).
- **A key created before the balance was in the API does not have it.** A scope is never added to a key that exists: create another key in the dashboard.
- Without the scope the answer is `403` with the `insufficient_scope` code.

## What is not in the API [#what-is-not-in-the-api]

The statement, with each entry that changed the balance, and the payouts are in the dashboard, under **Saldo**. A payout asks for your passkey, and an API key cannot ask for one.

## The balance of another environment [#the-balance-of-another-environment]

The balance is always the one of the environment of your key. There is no parameter to read another: a test key reads the test balance, and a live key the live one.