> For the complete documentation index, see [llms.txt](https://docs.omypayments.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.omypayments.com/api/api-endpoints/swaps/create-a-swap.md).

# Create a swap

**Endpoint**\
`POST /2.0/swap/create`

**Request body**

```json
{
  "estimateId": "{estimateId}"
}
```

| Field        | Type   | Required | Description                                                         |
| ------------ | ------ | -------- | ------------------------------------------------------------------- |
| `estimateId` | string | yes      | UUID returned by Estimate a swap. Valid for 30 minutes, single-use. |

**cURL**

```bash
curl -X POST "/2.0/swap/create" \
  -H "Content-Type: application/json" \
  -H "apiKey: <yourApiKey>" \
  -d '{"estimateId":"{estimateId}"}'
```

**Response (200 OK)**

```json
{
  "id": "{swap-uuid}",                                   // Swap ID
  "amountFrom": "100000000",                             // Source amount in base units
  "amountFromInUsd": "100.00",                           // Source amount in USD (or null)
  "amountTo": null,                                      // Received amount in base units (null until finished)
  "amountToInUsd": null,                                 // Received amount in USD (or null)
  "assetIdFrom": "{assetIdFrom}",                        // Source merchant asset ID
  "assetIdTo": "{assetIdTo}",                            // Target merchant asset ID
  "cryptoIdFrom": "{cryptoIdFrom}",                      // Source cryptocurrency ID
  "cryptoIdTo": "{cryptoIdTo}",                          // Target cryptocurrency ID
  "hashFrom": null,                                      // Source transaction hash (null until available)
  "hashTo": null,                                        // Target transaction hash (null until available)
  "status": "new",                                       // new | in_progress | finished | rejected
  "createdAt": "2025-03-11T14:30:16+00:00"               // RFC3339, UTC+0
}
```

See Swaps → Swap statuses for the full status lifecycle.

**Validation errors**

`400 Bad Request` returns the standard validation envelope (see Error format). Common messages:

* `Estimate not found` — the estimate is unknown, expired (older than 30 minutes), already used, or does not belong to your merchant.
* `Balance not enough` — your available balance for the source asset is lower than the swap amount.
