> 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/estimate-a-swap.md).

# Estimate a swap

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

**Body parameters**

| Parameter     | Type   | Required | Description                                                                                             |
| ------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------- |
| `assetIdFrom` | string | yes      | UUID of the source merchant asset (the asset you swap from).                                            |
| `assetIdTo`   | string | yes      | UUID of the target merchant asset (the asset you receive).                                              |
| `amount`      | string | yes      | Source amount in the asset’s base units (integer string, no decimal point). `100` USDT = `"100000000"`. |

**cURL**

```bash
curl -X POST "/2.0/swap/estimate" \
  -H "Content-Type: application/json" \
  -H "apiKey: <yourApiKey>" \
  -d '{"assetIdFrom":"{assetIdFrom}","assetIdTo":"{assetIdTo}","amount":"{amount}"}'
```

**Response (200 OK)**

```json
{
  "id": "estimage-uuid", // Estimate ID — pass this to "Create a swap"
  "serviceId": "1inch",                          // Internal routing service identifier
  "routeType": "dex",                            // Route type: "dex" or "cex"
  "estimatedAmount": "99500000"                  // Estimated amount you will receive (target base units)
}
```

> The estimate is approximate. The final received amount (`amountTo`) is fixed when the swap is executed and is reported via the swap object and callbacks.

**Validation errors**

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

* `Asset from not found` / `Asset to not found` — the asset UUID does not belong to your merchant.
* `Unsupported source currency` / `Unsupported target currency` — the currency is not enabled for swaps.
* `Native currency not supported as target` — native coins (ETH, BNB, …) cannot be the target asset.
* `Unsupported source network` / `Unsupported target network` — the network is not enabled for swaps.
* `Min swap amount is <amount> <symbol>` — the amount is below the minimum swap threshold.
* `No route found` — no DEX/CEX route is currently available for this pair and amount.
