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

# Quote and build

> Get the best route, and optionally a ready-to-sign transaction, in one request.

```
GET https://partners.route.fun/quote
```

Without `recipient`, this returns a quote. With `recipient`, it also returns `tx` and `swap`: the quote and the transaction come from one request. The transaction is only returned after the route has been run through the executor at the quote block and delivered exactly the quoted output less the fee.

## Headers

<ParamField header="Authorization" type="string" required>
  `Bearer rk_...`. Your partner key. [Get one](/access).
</ParamField>

<ParamField header="x-request-id" type="string">
  Optional trace ID, echoed back in the response header and in `requestId`.
</ParamField>

## Query parameters

<ParamField query="in" type="address" required>
  Input token. Use `0x0000000000000000000000000000000000000000` for native ETH.
</ParamField>

<ParamField query="out" type="address" required>
  Output token. Use the zero address for native ETH.
</ParamField>

<ParamField query="amount" type="string" required>
  Exact input amount in raw token units, as a decimal integer with no leading zeros.
</ParamField>

### Transaction parameters

These need a key with swap permission.

<ParamField query="recipient" type="address">
  Address that receives the output. Setting it returns `tx` and `swap`. Cannot be the zero address.
</ParamField>

<ParamField query="slippageBps" type="integer" default="50">
  Allowed slippage from `swap.netOut`, `0` to `500`.
</ParamField>

<ParamField query="minOut" type="string">
  Your own minimum output after fees, in raw units. Overrides `slippageBps`. Must not exceed `swap.netOut`.
</ParamField>

<ParamField query="deadline" type="integer" default="now + 600">
  Unix time in seconds. Must be between now and one hour from now.
</ParamField>

Any other parameter returns `400`.

## Response

<ResponseField name="requestId" type="string">Trace ID for this request.</ResponseField>
<ResponseField name="ok" type="boolean">`true` when a route was found (and built, if requested).</ResponseField>
<ResponseField name="error" type="string">Present when `ok` is `false`. See [errors](/guides/errors-and-limits).</ResponseField>

<ResponseField name="block" type="object">
  The block the quote is exact at: `number` and `hash`.
</ResponseField>

<ResponseField name="tokenIn" type="address" />

<ResponseField name="tokenOut" type="address" />

<ResponseField name="amountIn" type="string">Input amount, raw units.</ResponseField>
<ResponseField name="amountOut" type="string">Output before the Route fee, raw units.</ResponseField>
<ResponseField name="gas" type="string">Estimated gas for the swaps.</ResponseField>
<ResponseField name="gasCostOut" type="string">Estimated gas cost, converted to output-token units.</ResponseField>
<ResponseField name="netOut" type="string">`amountOut − gasCostOut`. A ranking figure; it does not include the Route fee.</ResponseField>

<ResponseField name="tx" type="object">
  Only with `recipient`. The unsigned transaction.

  <Expandable title="properties">
    <ResponseField name="to" type="address">The Route executor.</ResponseField>
    <ResponseField name="data" type="hex">Calldata. Send as returned.</ResponseField>
    <ResponseField name="value" type="string">Wei to send. Equals `amountIn` for ETH input, otherwise `"0"`.</ResponseField>
    <ResponseField name="chainId" type="integer">`4663`</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="swap" type="object">
  Only with `recipient`. The terms the transaction enforces.

  <Expandable title="properties">
    <ResponseField name="amountOut" type="string">Output before the Route fee.</ResponseField>
    <ResponseField name="fee" type="string">Route fee in output-token units.</ResponseField>
    <ResponseField name="feeBps" type="integer">Route fee rate.</ResponseField>
    <ResponseField name="netOut" type="string">Expected output for the recipient, after the fee.</ResponseField>
    <ResponseField name="minOut" type="string">Minimum the recipient receives. Below this the transaction reverts.</ResponseField>
    <ResponseField name="deadline" type="integer">Unix seconds. The transaction reverts after this.</ResponseField>

    <ResponseField name="recipient" type="address" />

    <ResponseField name="executorGas" type="string">Gas used when the transaction was run through the executor at the quote block.</ResponseField>
    <ResponseField name="spender" type="address">Address to approve for ERC-20 input. Same as `tx.to`.</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="swaps" type="object[]">
  The route, one entry per pool swap in execution order: `pool`, `source`, `kind`, `tokenIn`, `tokenOut`, `amountIn`, `amountOut`. Native ETH legs show WETH.
</ResponseField>

## Examples

<CodeGroup>
  ```bash Quote only theme={null}
  curl -G "https://partners.route.fun/quote" \
    -H "Authorization: Bearer $ROUTE_API_KEY" \
    --data-urlencode "in=0x0000000000000000000000000000000000000000" \
    --data-urlencode "out=0x5fc5360d0400a0fd4f2af552add042d716f1d168" \
    --data-urlencode "amount=10000000000000000"
  ```

  ```bash Quote and transaction theme={null}
  curl -G "https://partners.route.fun/quote" \
    -H "Authorization: Bearer $ROUTE_API_KEY" \
    --data-urlencode "in=0x0000000000000000000000000000000000000000" \
    --data-urlencode "out=0x5fc5360d0400a0fd4f2af552add042d716f1d168" \
    --data-urlencode "amount=10000000000000000" \
    --data-urlencode "recipient=0xYourUserAddress" \
    --data-urlencode "slippageBps=50"
  ```
</CodeGroup>

```json Response: 0.01 ETH to USDG, with transaction theme={null}
{
  "requestId": "docs-1",
  "ok": true,
  "block": { "number": "77691525", "hash": "0xf8e9...1fa2" },
  "tokenIn": "0x0000000000000000000000000000000000000000",
  "tokenOut": "0x5fc5360d0400a0fd4f2af552add042d716f1d168",
  "amountIn": "10000000000000000",
  "amountOut": "26933299",
  "gas": "189951",
  "gasCostOut": "10533",
  "netOut": "26922766",
  "tx": {
    "to": "0x27F38C4fd323D635d0E15054a6cfbdFc9D076F25",
    "data": "0x0bc1c562...",
    "value": "10000000000000000",
    "chainId": 4663
  },
  "swap": {
    "amountOut": "26933299",
    "fee": "26933",
    "feeBps": 10,
    "netOut": "26906366",
    "minOut": "26771834",
    "deadline": 1790890155,
    "recipient": "0x...",
    "executorGas": "267646",
    "spender": "0x27F38C4fd323D635d0E15054a6cfbdFc9D076F25"
  },
  "swaps": [
    {
      "pool": "0x18ab375abb1891f998fb6e342613b339e8752486",
      "source": "v3:0x0ec554f0bff0be6c99d1e95c8015bb0950f6a2c7",
      "kind": "v3",
      "tokenIn": "0x0bd7d308f8e1639fab988df18a8011f41eacad73",
      "tokenOut": "0x5fc5360d0400a0fd4f2af552add042d716f1d168",
      "amountIn": "10000000000000000",
      "amountOut": "26933299"
    }
  ]
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.