# Quote a swap

> POST /v0/swap/quote. Exact-input quote for Intents Swap: every route is asked, the best one for the mode is returned with the all-in cost. Public, no API key, rate-limited per IP. Addresses are optional here; the order asks for them.


`POST /v0/swap/quote`

Exact-input quote for Intents Swap: every route is asked, the best one for the mode is returned with the all-in cost. Public, no API key, rate-limited per IP. Addresses are optional here; the order asks for them.

## Authentication

None. Intents Swap is public: it runs in the browser with no key, and is rate-limited per IP.

## Body parameters

| Field | Type | Required | Notes |
|---|---|---|---|
| `from` | string | yes | CAIP-19 of the asset you send |
| `to` | string | yes | CAIP-19 of the asset you receive |
| `amount` | string | yes | Exact input, in the `from` asset's base units |
| `mode` | `manual` \| `wallet` | no | `manual` = send to a deposit address (the default); `wallet` = connect and sign |
| `sender` | string | no | Wallet mode: the source wallet |
| `recipient` | string | no |  |
| `refundTo` | string | no |  |
| `slippageBps` | integer | no | Override; omitted = automatic (50 bps, 100 on long-tail tokens) |
| `context` | object | no | Where the swap started, for analytics (SPEC-swap §8). Never an address. |
| `context.landingUrl` | string | no |  |
| `context.ref` | string | no |  |
| `context.pageType` | string | no |  |

## Responses

| Status | Means |
|---|---|
| `200` | The best quote for the mode |
| `400` | Invalid request (`INVALID_REQUEST`, `UNSUPPORTED_ASSET`) |
| `403` | `SWAP_REFUSED`: we can't route this swap (no reason is given) |
| `404` | `NOT_FOUND`, `NO_ROUTE` |
| `422` | `TRANSFER_MODE_UNAVAILABLE`: no deposit address for this pair |
| `429` | `RATE_LIMITED` |
| `503` | `SWAP_UNAVAILABLE`: swap is not configured on this deployment |


## Request



```bash title="curl"
curl https://api.intents.fi/v0/swap/quote \
  -X POST \
  -H 'content-type: application/json' \
  -d '{
       "from": "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
       "to": "bip122:000000000019d6689c085ae165831e93/slip44:0",
       "amount": "100000000",
       "mode": "manual"
     }'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/swap/quote", {
  method: "POST",
  headers: {
    "content-type": "application/json",
  },
  body: JSON.stringify({
    "from": "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
    "to": "bip122:000000000019d6689c085ae165831e93/slip44:0",
    "amount": "100000000",
    "mode": "manual"
  }),
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/swap/quote",
    json={
        "from": "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
        "to": "bip122:000000000019d6689c085ae165831e93/slip44:0",
        "amount": "100000000",
        "mode": "manual"
    },
)
response.raise_for_status()
data = response.json()
```



## Errors

```json
{ "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } }
```

Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api).

---

Source: https://intents.fi/docs/api/post-swap-quote · The whole corpus: https://intents.fi/docs/llms-full.txt
