# Convert with a quote

`POST /v1/transactions` · [Sandbox · coming soon]

> Base URL: Sandbox `https://sandbox.zulu.com.co/v1`
>
> Not in production yet: it arrives with this same signature. Try it in the sandbox.

Executes a current quote: debits the origin currency from your balance and credits the destination one on the settlement date. Send `originAmount` **or** `destinationAmount`; the other side is computed with the factor. If you send both, they must match exactly.

Rounding (f₂ = factor × 100): COP→USD, cents = round(pesos × 10⁴ / f₂); USD→COP, pesos = round(cents × f₂ / 10⁴). With `destinationAmount` the origin is rounded up so you never receive less than asked. Both sides must stay within the limits of `GET /v1/limits`.

The conversion stays `IN_PROGRESS` until settlement and then becomes `COMPLETED`; it never goes through `SENT`.

## 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 |
| --- | --- | --- | --- |
| `quote` | string | required | Quote id (`GET /v1/quotes`), 30 characters long. min. 30 characters, max. 30 characters. |
| `originAmount` | number | optional | Amount to debit in the origin currency. Required when `destinationAmount` is not sent. > 0. |
| `destinationAmount` | number | optional | Amount to receive in the destination currency. Required when `originAmount` is not sent. > 0. |

## Responses

### 201

Conversion created.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `transactionId` | string | required | Conversion id (see `GET /v1/transactions/{transactionId}`). |
| `type` | string | required | Always `FX`. Always `"FX"`. |
| `status` | string | required | Status: `IN_PROGRESS` until settlement. Values: `CREATED` (Created. For a Bre-B withdrawal, the transfer is in flight.), `IN_PROGRESS` (In progress: the withdrawal is being paid (ACH or manual) or the conversion awaits settlement.), `SENT` (The money was sent to the beneficiary's bank. Withdrawals only (never FX).), `COMPLETED` (Completed.), `REJECTED` (Rejected. The sandbox reverses the debit automatically; in production operations reverses it.). |
| `originCurrency` | string | required | Currency debited. Values: `COP` (Colombian peso (whole pesos).), `USD` (US dollar (up to 2 decimals).). |
| `originAmount` | number | required | Amount debited. |
| `destinationCurrency` | string | required | Currency credited. Values: `COP` (Colombian peso (whole pesos).), `USD` (US dollar (up to 2 decimals).). |
| `destinationAmount` | number | required | Amount credited at settlement. |
| `factor` | number | required | Factor applied (COP per USD). |
| `factorFormula` | string | required | Always `COP/USD`. Always `"COP/USD"`. |
| `settlementTerm` | string | required | Settlement term. Values: `SAME_DAY` (Settles the same business day (before the 13:00 cutoff).), `NEXT_DAY` (Settles the next business day.), `SECOND_DAY` (Settles on the second business day.). |
| `settlementDate` | string (date) | required | Settlement business day (Bogotá). |

### 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.

### 404

The resource does not exist.

### 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. |
| 404 | `NotFoundApiError` | `quote "%s" not found` | No quote with that id exists in your workspace. |
| 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` | `quote "%s" is expired` | The quote expired (it lives 30 seconds). Request a new one. |
| 422 | `UnprocessableEntityApiError` | `quote "%s" has already been used` | Each quote serves a single conversion. |
| 422 | `UnprocessableEntityApiError` | `origin or destination amount wasn't calculated with factor "%v"` | You sent `originAmount` and `destinationAmount` and they do not match the quote's factor. Send only one of them. |
| 422 | `UnprocessableEntityApiError` | `insufficient %s balance to convert %.2f` | The balance of the origin currency is not enough. |
| 422 | `UnprocessableEntityApiError` | `%s amount %.2f is below the minimum of %.2f` | One side of the conversion is below the minimum (`GET /v1/limits`). |
| 422 | `UnprocessableEntityApiError` | `%s amount %.2f is above the maximum of %.2f` | One side of the conversion exceeds the maximum (`GET /v1/limits`). |
| 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

### Convert 4,000,000 COP to USD

```bash
curl https://sandbox.zulu.com.co/v1/transactions \
  -H "Authorization: Bearer $ZULU_ACCESS_TOKEN" \
  -H "X-API-Key: $ZULU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "quote": "EQ-COPXUSDX-261124150405-SBX7Q",
  "originAmount": 4000000
}'
```

**Response 201**

```json
{
  "transactionId": "SBX-OR-NPTRFI261124W8D3QF-2K",
  "type": "FX",
  "status": "IN_PROGRESS",
  "originCurrency": "COP",
  "originAmount": 4000000,
  "destinationCurrency": "USD",
  "destinationAmount": 1006.62,
  "factor": 3973.7,
  "factorFormula": "COP/USD",
  "settlementTerm": "SAME_DAY",
  "settlementDate": "2026-11-24"
}
```

### Receive exactly 1,000 USD

```bash
curl https://sandbox.zulu.com.co/v1/transactions \
  -H "Authorization: Bearer $ZULU_ACCESS_TOKEN" \
  -H "X-API-Key: $ZULU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "quote": "EQ-COPXUSDX-261124150405-SBX7Q",
  "destinationAmount": 1000
}'
```

**Response 201**

```json
{
  "transactionId": "SBX-OR-NPTRFI261124W8D3QF-2K",
  "type": "FX",
  "status": "IN_PROGRESS",
  "originCurrency": "COP",
  "originAmount": 3973700,
  "destinationCurrency": "USD",
  "destinationAmount": 1000,
  "factor": 3973.7,
  "factorFormula": "COP/USD",
  "settlementTerm": "SAME_DAY",
  "settlementDate": "2026-11-24"
}
```

### No amount at all

```bash
curl https://sandbox.zulu.com.co/v1/transactions \
  -H "Authorization: Bearer $ZULU_ACCESS_TOKEN" \
  -H "X-API-Key: $ZULU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "quote": "EQ-COPXUSDX-261124150405-SBX7Q"
}'
```

**Response 400**

```json
{
  "error": "BadRequestApiError",
  "cause": "error in struct validation",
  "values": {
    "destinationAmount": "failed validation on the \"required_without\" tag with value required \"OriginAmount\"",
    "originAmount": "failed validation on the \"required_without\" tag with value required \"DestinationAmount\""
  }
}
```

### Expired quote

```bash
curl https://sandbox.zulu.com.co/v1/transactions \
  -H "Authorization: Bearer $ZULU_ACCESS_TOKEN" \
  -H "X-API-Key: $ZULU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "quote": "EQ-COPXUSDX-261124150405-SBX7Q",
  "originAmount": 4000000
}'
```

**Response 422**

```json
{
  "error": "UnprocessableEntityApiError",
  "cause": "quote \"EQ-COPXUSDX-261124150405-SBX7Q\" is expired"
}
```

### Two amounts that do not match

```bash
curl https://sandbox.zulu.com.co/v1/transactions \
  -H "Authorization: Bearer $ZULU_ACCESS_TOKEN" \
  -H "X-API-Key: $ZULU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "quote": "EQ-COPXUSDX-261124150405-SBX7Q",
  "originAmount": 4000000,
  "destinationAmount": 1010
}'
```

**Response 422**

```json
{
  "error": "UnprocessableEntityApiError",
  "cause": "origin or destination amount wasn't calculated with factor \"3973.7\""
}
```
