# Simulate a built transaction before signing

`POST https://api.getchord.xyz/v1/swap/simulate`

Source: https://getchord.xyz/docs/api-reference/operations/simulateswap/

`eth_call`s the built calldata from the user's address and estimates gas, so a revert is caught before the wallet opens. Known selectors are decoded (`NotRouter`, a paused Kuru market, allowance and balance errors). An allowance revert is advisory: approve first, then swap.

## Request body (JSON)

| Field | Required | Type | Description |
| --- | --- | --- | --- |
| `chain` | no | `5042` · `4663` · `143` · `43114` · `8453` · `56` · `42161` · `1` |  |
| `from` | yes | string | EVM address, hex, case-insensitive. |
| `to` | yes | string | EVM address, hex, case-insensitive. |
| `data` | yes | string | Calldata from `/swap`. |
| `value` | yes | string | Amount in the token's smallest unit, as a decimal string. Never a float. |

```json
{
  "chain": 5042,
  "from": "0xb145400da27a2497d9fc2cd5621f2bfd37617af4",
  "to": "0x1b1fee89a381e595fe6536b99ba91f3e16e9601a",
  "data": "0xdc72a437…",
  "value": "0"
}
```

## Response 200

`ok: true` with the simulated output and gas, or `ok: false` with the decoded revert.

Example (captured from the live API):

```json
{
  "ok": true,
  "amountOut": "465",
  "gas": 318189
}
```

- **400**: Invalid parameters — `error` names the check that failed (`INVALID_PARAMS`, `BAD_ADDRESS`, `BAD_LIMIT`, `BAD_HOURS`, …).
- **503**: The lane behind this endpoint is not ready or not enabled here (`NOT_READY`, `CHAIN_NOT_ENABLED`, `NOT_ENABLED`, `*_UNAVAILABLE`). Retry later; do not treat it as an empty answer.
