> For the complete documentation index, see [llms.txt](https://docs-swap.crypto-chief.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-swap.crypto-chief.com/getting-started/billing.md).

# Billing

## Billing

Swap API calls are charged to your **platform API credits** — the same balance your RPC Gateway calls spend. There is no separate balance to top up, and nothing is ever taken out of your blockchain wallets.

**10,000,000 credits = $1.**

### Prices

| Operation                                                                                                                                                                                                          | Credits per call | USD per call |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------- | ------------ |
| [`POST /v1/quote`](/api-reference/quote.md)                                                                                                                                                                        | 1,000            | $0.0001      |
| [`POST /v1/build`](/api-reference/build.md)                                                                                                                                                                        | 10,000           | $0.001       |
| Approvals — each of [`/v1/approve/spender`](/api-reference/approve-spender.md), [`/v1/approve/allowance`](/api-reference/approve-allowance.md), [`/v1/approve/transaction`](/api-reference/approve-transaction.md) | 260              | $0.000026    |
| Reference data — each of [`/v1/networks`](/api-reference/networks.md), [`/v1/tokens`](/api-reference/tokens.md), [`/v1/liquidity-sources`](/api-reference/liquidity-sources.md)                                    | 260              | $0.000026    |

### When you are charged

**Before the call runs, and once.** A project whose balance will not cover the call is refused with `402 INSUFFICIENT_CREDITS` and nothing runs. A call that runs is charged exactly once, whatever happens after.

### Never charged

A call refused before it ran costs nothing:

| Status | Code                                                                                       | Why                                                             |
| ------ | ------------------------------------------------------------------------------------------ | --------------------------------------------------------------- |
| `401`  | `UNAUTHORIZED`                                                                             | Unknown or frozen key                                           |
| `402`  | `INSUFFICIENT_CREDITS`                                                                     | The balance will not cover the call                             |
| `403`  | `DOMAIN_NOT_ALLOWED`, `IP_NOT_ALLOWED`                                                     | The project whitelist refused the call                          |
| `404`  | `NOT_FOUND`                                                                                | No such path                                                    |
| `405`  | `METHOD_NOT_ALLOWED`                                                                       | The path exists with another method                             |
| `413`  | `PAYLOAD_TOO_LARGE`                                                                        | The body is over 64 KiB                                         |
| `429`  | `RATE_LIMITED`                                                                             | Your project is over its per-second or per-minute request limit |
| `503`  | `SWAP_UNAVAILABLE`, `BALANCE_NOT_READY`, `BILLING_UNAVAILABLE`, `SWAP_PRICING_UNAVAILABLE` | Temporarily unavailable — retry later                           |

### Refunded

These are charged and then returned in full. The call got no answer, or it failed on availability that your request cannot cause:

| What happened                                                                                                                       | What you see                                                        |
| ----------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| The API could not be reached, or did not answer in time                                                                             | `502 SWAP_UNAVAILABLE`, `504 TIMEOUT`                               |
| The API was too busy to start your call: more than 64 calls of your project in progress, or 16 non-atomic deals open for the wallet | `429 RATE_LIMITED`                                                  |
| The network could not be read, its state lags, or it did not start                                                                  | `503 STATE_STALE`, `503 RPC_UNAVAILABLE`, `503 NETWORK_UNAVAILABLE` |

### Charged

Everything else is a real answer to a real call and stays charged:

* **`200`**: the call succeeded.
* **Every other `4xx`**: the request was invalid (`400`), or valid but impossible: `422 NO_ROUTE`, `INSUFFICIENT_LIQUIDITY`, `BALANCE_INSUFFICIENT`, `SIMULATION_FAILED`.
* **`500 INTERNAL`**.
* **`503` your request can cause**: `EXECUTOR_UNAVAILABLE` (for example an `executors` filter naming one that is off), `STATE_INCOMPLETE` (the pools of your route are still loading), and `STATE_STALE` / `RPC_UNAVAILABLE` when your call caused them, for example continuing a non-atomic deal whose previous swap is not visible yet.
* **A call your client aborted**: the work happened.

{% hint style="info" %}
Whether a call is retried and whether it is charged are separate questions: a charged `503 STATE_INCOMPLETE` is still safe to retry. [Errors](/getting-started/errors.md) lists which codes a retry fixes.
{% endhint %}

### Rate limits

Swap API calls count against the **same per-second and per-minute request limits of your project** as RPC Gateway calls: one call is one slot, and the slot is never returned, also not when the call is refunded. Over the limit, calls are refused with `429 RATE_LIMITED` before running, not charged.

In addition, at most **64 calls of one project run at the same time**. Number 65 is answered `429 RATE_LIMITED` and refunded. The same refunded `429` comes back when the API is too busy to start the call, or the wallet already has 16 non-atomic deals open. Retry after about one second.

### Timeouts

A call that runs too long fails with `504 TIMEOUT`: after 15 seconds, at most 20. A call that cannot reach the API fails with `502 SWAP_UNAVAILABLE`. Both are refunded.
