# Top up the simulated balance

`POST /v1/sandbox/balances/top-up` · [Sandbox only]

> Base URL: Sandbox `https://sandbox.zulu.com.co/v1`
>
> A test helper: it only exists in the sandbox.

Credits simulated COP or USD balance to test withdrawals and conversions. COP in whole pesos, USD up to 2 decimals; each currency's balance has a cap (10,000,000,000 COP and 10,000,000 USD). Exists only in the sandbox.

## Authentication

`Authorization: Bearer <access_token>` (401 when missing or expired) and `X-API-Key` (403 when missing or not matching).

## Request

### Headers

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | string | optional | Idempotency key (up to 255 characters), valid for 24 hours per workspace. Repeating the call with the same key and body returns the original response with `Idempotent-Replayed: true`; a different body answers 422 and, while the first call is still running, 409. Production ignores it today: every call creates a new resource. max. 255 characters. [Sandbox · coming soon] |

### Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `currency` | string | required | Currency to top up. Values: `COP` (Colombian peso (whole pesos).), `USD` (US dollar (up to 2 decimals).). |
| `amount` | number | required | Amount to credit: COP in whole pesos, USD up to 2 decimals. > 0. |

## Responses

### 200

The updated balance.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `currency` | string | required | Currency. Values: `COP` (Colombian peso (whole pesos).), `USD` (US dollar (up to 2 decimals).). |
| `balance` | number | required | Available balance. |
| `updatedAt` | string (date-time) | required | Last movement (UTC). |

### 400

Invalid request: the body is not JSON, a field has another type or fails its validation.

### 401

The access token is missing, invalid or expired.

### 403

The `X-API-Key` is missing, invalid or does not match the token.

### 409

Conflict with the current state.

### 422

The operation can not be processed; nothing is recorded.

### 429

Too many requests: wait the seconds in `Retry-After`.

### 500

Internal error.

## Errors

| HTTP | error | cause | Description |
| --- | --- | --- | --- |
| 400 | `BadRequestApiError` | `error in struct validation` | One or more fields fail their validation. `values` carries one message per field, keyed by its JSON path, naming the Go validator that failed. |
| 400 | `BadRequestApiError` | `invalid json body: %s` | The body is not valid JSON, or a field has the wrong type (a string where a number goes, for example). Answered before the fields are validated. |
| 401 | — | `Unauthorized` | The `Authorization: Bearer <access_token>` header is missing, or the token is invalid or expired. |
| 403 | — | `Forbidden` | The `X-API-Key` is missing, unknown, revoked or does not belong to the credentials of the token. |
| 409 | `ResourceConflictApiError` | `idempotency key "%s" is still being processed` | Another call with the same `Idempotency-Key` is still running. Retry in a few seconds to receive its response. |
| 422 | `UnprocessableEntityApiError` | `idempotency key "%s" was used with a different request` | The `Idempotency-Key` was already used in the last 24 hours with a different body or operation. Use a new key for every distinct operation. |
| 422 | `UnprocessableEntityApiError` | `the top-up would leave the %s balance above the sandbox cap of %.2f` | The simulated balance has a cap per currency (10,000,000,000 COP and 10,000,000 USD). |
| 422 | `UnprocessableEntityApiError` | `amount %v has too many decimals for %s (max %d)` | The amount has more decimals than its currency allows: COP in whole pesos, USD up to 2 decimals. |
| 429 | — | `Too Many Requests` | You exceeded the request limit of your credentials. Wait the seconds in `Retry-After`. |
| 500 | `InternalServerApiError` | `[code:1] unexpected error` | Internal error. On operations that move money, check the state before retrying so the operation is not duplicated. |

## Examples

### Top up 50,000,000 COP

```bash
curl https://sandbox.zulu.com.co/v1/sandbox/balances/top-up \
  -H "Authorization: Bearer $ZULU_ACCESS_TOKEN" \
  -H "X-API-Key: $ZULU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "currency": "COP",
  "amount": 50000000
}'
```

**Response 200**

```json
{
  "currency": "COP",
  "balance": 75000000,
  "updatedAt": "2026-11-24T15:04:05.123Z"
}
```

### COP with cents

```bash
curl https://sandbox.zulu.com.co/v1/sandbox/balances/top-up \
  -H "Authorization: Bearer $ZULU_ACCESS_TOKEN" \
  -H "X-API-Key: $ZULU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "currency": "COP",
  "amount": 1500.5
}'
```

**Response 422**

```json
{
  "error": "UnprocessableEntityApiError",
  "cause": "amount 1500.5 has too many decimals for COP (max 0)"
}
```
