> ## Documentation Index
> Fetch the complete documentation index at: https://docs.topokki.exchange/llms.txt
> Use this file to discover all available pages before exploring further.

# Get a swap quote

> Request a current V2/V3 smart-order-routed swap quote.

`GET /v1/quote`

Use this endpoint immediately before a swap. It returns an exact-input or exact-output quote, route information, protection limits, and—when executable—transaction parameters for the Universal Router.

## Request

```bash theme={null}
curl --get 'https://api.testnet.topokki.exchange/v1/quote' \
  --data-urlencode 'tokenIn=0x01a24d6f238c29d4bebc2ac40f56723f4f8e83d2' \
  --data-urlencode 'tokenOut=0x4200000000000000000000000000000000000006' \
  --data-urlencode 'amount=100000000000000000' \
  --data-urlencode 'tradeType=exactIn' \
  --data-urlencode 'tokenInChainId=91342' \
  --data-urlencode 'tokenOutChainId=91342' \
  --data-urlencode 'recipient=0xYourRecipientAddress' \
  --data-urlencode 'slippageBps=50'
```

## Parameters

| Parameter                             | Required      | Description                                                           |
| ------------------------------------- | ------------- | --------------------------------------------------------------------- |
| `tokenIn`                             | Yes           | Token being spent. `tokenInAddress` is also accepted.                 |
| `tokenOut`                            | Yes           | Token being received. `tokenOutAddress` is also accepted.             |
| `amount`                              | Yes           | Raw input amount for `exactIn`, or raw desired output for `exactOut`. |
| `tradeType`                           | No            | `exactIn` (default) or `exactOut`. `type` is also accepted.           |
| `recipient`                           | No            | Address that receives the swap output.                                |
| `tokenInChainId`, `tokenOutChainId`   | Optional pair | Both must be supplied together and equal `91342`.                     |
| `slippageBps`                         | No            | Price protection in basis points; default is `50` (0.5%).             |
| `tokenInIsNative`, `tokenOutIsNative` | No            | Set `true` when using native ETH rather than WETH.                    |
| `protocols`                           | No            | Limit the search to `v2`, `v3`, or both.                              |

## Response

```json theme={null}
{
  "quoteId": "6c31bd86-7e2b-4450-b3a5-d182b8b2498a",
  "amount": "100000000000000000",
  "amountDecimals": "0.1",
  "quote": "47483898806496",
  "quoteDecimals": "0.000047483898806496",
  "amountOutMinimum": "47246479312463",
  "amountInMaximum": "100000000000000000",
  "gasUseEstimate": "260612",
  "routeString": "[V2] 50.00% TTEST -> WETH, [V3] 50.00% TTEST -> WETH",
  "methodParameters": {
    "to": "0xc4a0afb2436792e11d7892c107482f8e8e65c4cd",
    "calldata": "0x...",
    "value": "0"
  }
}
```

`amountOutMinimum` protects an exact-input swap. `amountInMaximum` protects an exact-output swap. The route, quote, and transaction parameters are only valid for the state at the time of the request.

<Warning>
  Check that `methodParameters` exists before submitting a transaction. When it is returned, submit `to`, `calldata`, and `value` exactly as provided. If the amount, recipient, or slippage changes, request a new quote.
</Warning>

## Error response

```json theme={null}
{
  "error": "amount must be a positive raw integer"
}
```
