# Request quotes

> POST /v0/quotes


`POST /v0/quotes`



## Authentication

A secret key (`ik_`) as a Bearer token. The prefix sets the mode: `_test_` or `_live_`. Publishable keys (`pk_`) cannot call it.

## Body parameters

| Field | Type | Required | Notes |
|---|---|---|---|
| `tradeType` | `EXACT_INPUT` \| `EXACT_OUTPUT` | no |  |
| `from` | object | yes |  |
| `from.asset` | string | yes |  |
| `from.amount` | string | no |  |
| `to` | object | yes |  |
| `to.asset` | string | yes |  |
| `to.amount` | string | no |  |
| `sender` | string | yes |  |
| `recipient` | string | yes |  |
| `refundTo` | string | no |  |
| `slippageBps` | object | no |  |
| `providers` | array | no |  |
| `excludeProviders` | array | no |  |
| `rank` | `output` \| `speed` \| `balanced` | no |  |
| `executionModes` | array | no |  |
| `timeoutMs` | integer | no |  |

## Responses

| Status | Means |
|---|---|
| `200` | Ranked quotes from every provider that answered in time |


## Request



```bash title="curl"
curl https://api.intents.fi/v0/quotes \
  -X POST \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY' \
  -H 'content-type: application/json' \
  -d '{
       "from": {
         "asset": "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
         "amount": "100000000"
       },
       "to": {
         "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
       },
       "sender": "0x15AAB9098125C5A728CA818B31620a902C25f764",
       "recipient": "0x9b3c1f4A6D2E5b70CA18F4D3e9B2A7C641FD8E05",
       "refundTo": "0x15AAB9098125C5A728CA818B31620a902C25f764"
     }'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/quotes", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
    "content-type": "application/json",
  },
  body: JSON.stringify({
    "from": {
      "asset": "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
      "amount": "100000000"
    },
    "to": {
      "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
    },
    "sender": "0x15AAB9098125C5A728CA818B31620a902C25f764",
    "recipient": "0x9b3c1f4A6D2E5b70CA18F4D3e9B2A7C641FD8E05",
    "refundTo": "0x15AAB9098125C5A728CA818B31620a902C25f764"
  }),
});

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

```python title="Python"
import os
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/quotes",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
    json={
        "from": {
            "asset": "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
            "amount": "100000000"
        },
        "to": {
            "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
        },
        "sender": "0x15AAB9098125C5A728CA818B31620a902C25f764",
        "recipient": "0x9b3c1f4A6D2E5b70CA18F4D3e9B2A7C641FD8E05",
        "refundTo": "0x15AAB9098125C5A728CA818B31620a902C25f764"
    },
)
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-quotes · The whole corpus: https://intents.fi/docs/llms-full.txt
