Skip to main content
POST
/
defi
/
swaps
/
quote
curl --request POST \
  --url http://localhost:4000/v1/defi/swaps/quote \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "tokenIn": "0x0000000000000000000000000000000000000000",
  "tokenOut": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
  "amountIn": "1000000000000000000",
  "chainId": 1,
  "allowMultihop": true
}
'
{
  "amountOut": "1500000000",
  "priceImpact": "0.5",
  "route": {},
  "estimatedGas": "150000"
}

Authorizations

Authorization
string
header
required

Use this format: ApiKey <your_api_key>

Body

application/json
tokenIn
string
required

Input token address (use 0x0000000000000000000000000000000000000000 for native token)

Example:

"0x0000000000000000000000000000000000000000"

tokenOut
string
required

Output token address

Example:

"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"

amountIn
string
required

Amount to swap (in token decimals)

Example:

"1000000000000000000"

chainId
number
required

Chain ID

Example:

1

allowMultihop
boolean

Allow multi-hop swaps (default: true)

Example:

true

Response

Quote retrieved successfully

amountOut
string
required

Expected output amount

Example:

"1500000000"

priceImpact
string
required

Price impact percentage

Example:

"0.5"

route
object
required

Swap route information

estimatedGas
string
required

Estimated gas cost

Example:

"150000"