price

API reference to fetch an indicative price for a swap.

Get indicative price for a swap

get
Query parameters
sellTokenstringRequired

Address of the sell token

Example: 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
buyTokenstringRequired

Address of the buy token

Example: 0x2260fac5e5542a773aa44fbcfedf7c193bc2c599
sellAmountstringRequired

Sell amount in token base units (e.g. Wei for ETH)

Example: 1000000000000
Header parameters
x-api-keystringOptional

31Third API key (Request via [email protected])

chain-idstringOptional

Chain ID as hex string. (e.g.: 0x1 for Ethereum mainnet)

Responses
chevron-right
200Success
application/json
idstringRequired

Unique ID of the calculated swap price.

Example: 0096124c-19df-4459-8cbb-7615fdc7c157
sellAmountinteger · int64Required

Amount to sell. (In sell token units)

Example: 100000000
buyAmountinteger · int64Required

Estimated buy amount. (In buy token units)

Example: 99500000
pricenumberRequired

Price of the buy token in sell token. E.g. 1 BTC = 100.000 USD; you sell WBTC and buy USDC; the price is 0.000001

Example: 0.999955
priceImpactBpsnumber · min: -10000 · max: 10000Required

Estimated price impact in basis points. [-10_000;10_000]. > 0 = value loss. < 0 = value gain

Example: 31
get
/1.3/swap/price
200Success

Last updated