# Quote

## API Path

```
POST https://api.rabbitswap.xyz/quote 
```

## Request Interface

```
interface QuoteRequest {
	tokenInChainId: number,
	tokenIn: string, // token address or "ETH" for native
	tokenOutChainId: number,
	tokenOut: string, // token address or "ETH" for native
	amount: string, // in wei (bigint in string form)
	type: "EXACT_INPUT" | "EXACT_OUTPUT",
	swapper: string | undefined, // wallet address to use the swap
	slippageTolerance: string, // in percentage
	deadline: number, // seconds
	withPoolFee: boolean | undefined, // to calculate pool fee from server (slower response)
}
```

```
example
{
  "tokenInChainId": 88,
  "tokenIn": "ETH", // VIC
  "tokenOutChainId": 88,
  "tokenOut": "0x0fd0288aaae91eaf935e2ec14b23486f86516c8c", // C98
  "type": "EXACT_INPUT",
  "amount": "1000000000000000000", // 1 VIC as input, to swap to C98
  "slippageTolerance": "0.5", // 0.5%
  "deadline": 600, // 10 mins
  "withPoolFee": true
}
```

## Response Interface

```
export interface MethodParameters {
	data: Hex
	value: string
	to: Address
}

export interface SwapPool {
	address: Address // pool address
	tokenIn: {
		address: Address // token address
	}
	tokenOut: {
		address: Address // token address
	}
	fee: string // pool fee
	amountIn?: string
	amountOut?: string
}

export interface QuoteResponse {
	methodParameters: MethodParameters
	chainId: number
	route: SwapPool[][]
	input: {
		amount: string
	}
	output: {
		amount: string
	}
	poolFeeAmounts: {
		token: Address
		value: string
	}[]
}

export interface QuoteAPIResponse {
	quote: QuoteResponse
}

```

```
example
{
    "quote": {
        "methodParameters": { // zero value if swapper is not defined
            "to": "0x",
            "data": "0x",
            "value": ""
        },
        "chainId": 88,
        "input": {
            "amount": "1000000000000000000" // 1 VIC
        },
        "output": {
            "amount": "3689609194842071250" // 3.689 C98
        },
        "route": [
            [
                {
                    "address": "0xC8E762af329FFa942f89f4528092f37323514Cea",
                    "tokenIn": {
                        "address": "0xc054751bdbd24ae713ba3dc9bd9434abe2abc1ce"
                    },
                    "tokenOut": {
                        "address": "0x0fd0288aaae91eaf935e2ec14b23486f86516c8c"
                    },
                    "fee": "3000", // 0.30% fee
                    "amountIn": "1000000000000000000", // 1 VIC
                    "amountOut": "3689609194842071250" // 3.689 C98
                }
            ]
        ],
        "poolFeeAmounts": [
            {
                "token": "0xC054751BdBD24Ae713BA3Dc9Bd9434aBe2abc1ce",
                "value": "3000000000000000"
            }
        ]
    }
}
```

## Another Response Example For Swaooer Defined

```
curl 'https://dev-api.rabbitswap.xyz/quote' \
  -H 'accept: application/json, text/plain, */*' \
  -H 'accept-language: en-US,en;q=0.9' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'dnt: 1' \
  -H 'origin: http://localhost:5173' \
  -H 'pragma: no-cache' \
  -H 'priority: u=1, i' \
  -H 'referer: http://localhost:5173/' \
  -H 'sec-ch-ua: "Chromium";v="135", "Not-A.Brand";v="8"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: cross-site' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36' \
  -H 'x-request-id: 2f19c6ff-0dac-4c5c-abce-aad4fef9ca95' \
  -H 'x-validator: bfe66d093b08e9eb74771218e867d108ab05e3c4b31b4a69c497cfd179220659' \
  -H 'x-validator-timestamp: 1744184028' \
  --data-raw '{"tokenInChainId":88,"tokenIn":"ETH","tokenOutChainId":88,"tokenOut":"0x0fd0288aaae91eaf935e2ec14b23486f86516c8c","type":"EXACT_INPUT","amount":"1000000000000000000","slippageTolerance":"0.5","deadline":600,"swapper":"0x4E0BD60324971Ad1Cbc177C0C5c1ABA890d8FDA9","withPoolFee":true}'
```

```
{
    "quote": {
        "methodParameters": { // use this for swap function
            "to": "0x71eBF8972459B01A50cca14Ed351CF34213Ed742", // swap router address
            "data": "0xc04b8d59000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000004e0bd60324971ad1cbc177c0c5c1aba890d8fda90000000000000000000000000000000000000000000000000000000067f625350000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000032f15a5f9379cc8b000000000000000000000000000000000000000000000000000000000000002bc054751bdbd24ae713ba3dc9bd9434abe2abc1ce000bb80fd0288aaae91eaf935e2ec14b23486f86516c8c000000000000000000000000000000000000000000",
            "value": "1000000000000000000"
        },
        "chainId": 88,
        "input": {
            "amount": "1000000000000000000"
        },
        "output": {
            "amount": "3689260842036473193"
        },
        "route": [
            [
                {
                    "address": "0xC8E762af329FFa942f89f4528092f37323514Cea",
                    "tokenIn": {
                        "address": "0xc054751bdbd24ae713ba3dc9bd9434abe2abc1ce"
                    },
                    "tokenOut": {
                        "address": "0x0fd0288aaae91eaf935e2ec14b23486f86516c8c"
                    },
                    "fee": "3000",
                    "amountIn": "1000000000000000000",
                    "amountOut": "3689260842036473193"
                }
            ]
        ],
        "poolFeeAmounts": [
            {
                "token": "0xC054751BdBD24Ae713BA3Dc9Bd9434aBe2abc1ce",
                "value": "3000000000000000"
            }
        ]
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.rabbitswap.xyz/rabbitswap/for-developer/rabbitswap-api/quote.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
