# Quote and build in one call

`GET https://api.getchord.xyz/v1/swap/calldata`

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

For contracts and bots that call the router directly: routes and encodes in a single request. The output goes to `msg.sender`; the caller approves the router for `tokenIn` and sends the calldata.

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `chain` | query | no | `5042` · `4663` · `143` · `43114` · `8453` · `56` · `42161` · `1` (default `143`) | Chain id: `5042` Arc · `4663` Robinhood Chain · `143` Monad · `43114` Avalanche C-Chain · `8453` Base · `56` BNB Chain · `42161` Arbitrum One · `1` Ethereum. Omitted = 143. |
| `tokenIn` | query | yes | string | Token the caller approves and sends. |
| `tokenOut` | query | yes | string | Token returned to msg.sender. |
| `amountIn` | query | yes | string |  |
| `slippageBps` | query | no | integer (default `100`) | Sets `minOut` on the returned calldata. |

## Response 200

Router call.

Example (captured from the live API):

```json
{
  "to": "0x1b1fee89a381e595fe6536b99ba91f3e16e9601a",
  "data": "0x…",
  "value": "0",
  "minOut": "0.0942",
  "expectedOut": "0.0951",
  "gasLimit": "1000000"
}
```

- **400**: Invalid parameters — `error` names the check that failed (`INVALID_PARAMS`, `BAD_ADDRESS`, `BAD_LIMIT`, `BAD_HOURS`, …).
- **404**: Nothing at this identity (`NOT_FOUND`, `UNKNOWN_TOKEN`, `NO_ROUTE`).
- **429**: Over the per-minute limit (`RATE_LIMIT_EXCEEDED`). Read `X-RateLimit-Reset` and back off.
- **502**: The routing engine or an upstream did not answer (`ENGINE_ERROR`, `ROUTE_ERROR`).
