> 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.md).

# Swaps

> **Base URL**: `https://api.omypayments.com`\
> **Version**: `v2` (all endpoints below start with `/2.0/...`)\
> **Auth**: add your API key in the header: `apiKey: <yourApiKey>`\
> **Permission**: the API key must have the **swap** permission enabled, otherwise requests are rejected with `403 Forbidden`.

**Prerequisites**

* Both the source and target assets must be enabled in **Assets** (dashboard).
* `amount` is expressed in the token’s base units (integer string, no decimal point). For USDT with 6 decimals, `100` USDT = `"100000000"` — see `crypto.decimals` on the “Get Merchant Asset Data” endpoint to convert.
* An estimate is held for **30 minutes** and is single-use: creating a swap consumes it.
* Native coins (e.g. ETH, BNB) cannot be used as the **target** asset.
* Rate limit: **50 requests/second**.

**Typical flow**

1. `swap/estimate` → 2. `swap/create` (reserves funds, starts processing) → 3. `swap/get` and/or callbacks to track status.

**Swap statuses**

| Status        | Meaning                                                            |
| ------------- | ------------------------------------------------------------------ |
| `new`         | Swap created, funds reserved, awaiting processing.                 |
| `in_progress` | Swap is being executed on-chain / via the routing provider.        |
| `finished`    | Swap completed; `amountTo`, `hashFrom`, `hashTo` are populated.    |
| `rejected`    | Swap failed; reserved funds are returned to the available balance. |

***
