π»API
Explore authentication, endpoints, and trading operations to start trading efficiently. Whether you're a developer or a trader, this guide has everything you need to get started with Panora's APIs.
Usage
Use the below endpoint to get quotes for the swap (also contains transaction data that can be sent to wallet adapter directly or used to build, sign and submit)
POST
https://api.panora.exchange/swap
Headers
Public API Key:
a4^KV_EaTf4MW#ZdvgGKX#HUD^3IFEAOV_kzpIE^3BQGA8pDnrkT7JcIy#HNlLGi
Note: This API key's limits should be sufficient for most use cases. Protocols within the Aptos ecosystem with specific requirements or customization may submit a ticket on Discord.
x-api-key
Your API Key
Use the public API key or enter the API key provided by Panora
Query Parameters
chainId
no
number
ID for the chain for which the endpoint is being invoked.
Note: Default chainID is 1 for Aptos Mainnet
fromTokenAddress
yes
string
Address of the token being swapped from
Example: If you want to swap 10.5 APT to USDC, then fromTokenAddress is 0xa
toTokenAddress
yes
string
Address of the token being swapped to
Example: If you want to swap 10.5 APT to USDC, then toTokenAddress is 0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b
fromTokenAmount
*
number
Amount of the token being swapped from. Please set the amount without Token decimals Example: If you want to swap 10.5 APT to USDC, then fromTokenAmount is 10.5
toTokenAmount
yes*
number
Amount of the token being swapped to. Please set the amount without Token decimals
Example: If you want to swap from APT to 100 USDC, then toTokenAmount is 100
toWalletAddress
yes
string
Address of the wallet to which the swapped tokens will be sent
slippagePercentage
no
number
Slippage tolerance as 'auto' (which lets Panora choose the optimal slippage for the transaction, up to a maximum of 5%) or a percentage value. Example: For 3% slippage tolerance, set the value as 3. This can be set as 0.1, 0.5, 1.0 or any custom slippage percentage between 0 and 100.
Note: If nothing is entered, slippage tolerance will be set to auto by default. If a numeric value is entered, anything after two decimal places will be truncated.
integratorFeePercentage
no
number
Integrator fee as a percentage value Example: For 2% integrator fee, set the value as 2. This can be set as 0.1, 0.5, 1.0 or any custom integrator fee between 0 and 2.
Note: Fee sharing applicable. Fee amount is auto-swapped to APT, whenever possible. If nothing is entered, integrator fee will be set to 0 by default. If a numeric value is entered, anything after two decimal places will be truncated.
integratorFeeAddress
no
string
Wallet Address where integrators want to receive their fee share. The fee share is settled immediately with the swap transaction to the provided wallet address.
Note: Ensure it starts with 0x followed by 64 characters
includeSources
no
string
List of liquidity sources to be included for route calculation.
Example: Hyperion, ThalaSwapV2
Note: If nothing is entered, all available sources are included by default. Check entire list here.
excludeSources
no
string
List of liquidity sources to be excluded from the route.
Example: SushiSwap
Note: If nothing is entered, none of the sources will be excluded by default. Check entire list here.
includePools
no
string
List of pool addresses to be included for route calculation.
Example: 0xd3894aca06d5f42b27c89e6f448114b3ed6a1ba07f992a58b2126c71dd83c127, 0xc3c4cbb3efcd3ec1b6679dc0ed45851486920dba0e86e612e80a79041a6cf1a3
Note: If nothing is entered, all available pools are included by default. Max 10 pool addresses are supported. Coin standard DEX pools with comma ( , ) within the pool address would get skipped
onlyDirectRoutes
no
boolean
Set to true to restrict to direct routes without intermediate hops or splits. Default is false.
*Please send either fromTokenAmount or toTokenAmount at a time.
Request Example
//CALL THE BELOW FUNCTION WITH THE ASYNC
const end_point = 'https://api.panora.exchange/swap'
const query = {
fromTokenAddress:"0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b"
toTokenAddress:"0xa"
fromTokenAmount:100
toWalletAddress:"0x1c3206329806286fd2223647c9f9b130e66baeb6d7224a18c1f642ffe48f3b4c"
};
const headers = {
"x-api-key": "Your API key"
};
const queryString = new URLSearchParams(query).toString();
const url = `${end_point}?${queryString}`;
const response = await (
await fetch(url, {
method: 'POST',
headers: headers
})
).json();
Response
Scenario 1: For ExactIn Swap where fromTokenAmount is entered (instead of toTokenAmount), the endpoint returns the maximum toTokenAmount
fromToken
object
An object containing the details of the fromToken, which includes address
, decimals
and current_price
toToken
object
An object containing the details of the toToken, which includes address
, decimals
and current_price
feeToken
object
An object containing the details of the feeToken, which includes address
, name
, symbol
, decimals and current_price
fromTokenAmount
string
Amount of token being swapped from Note: Amount is without Token decimals
fromTokenAmountUSD
string
USD equivalent of fromTokenAmount Note: Will be null for those tokens whose usd price is not available from external price feeds
quotes
array
An object (within an array) containing the swap details.The object consists of:
toTokenAmount
: Amount of the token (without Token decimals) being swapped to.
priceImpact
: percentage difference between USD price of fromTokenAmount and toTokenAmount. Will be null if either fromTokenAmountUSD or toTokenAmountUSD is null
slippagePercentage
: Percentage of slippage tolerance
feeTokenAmount
: Platform fee for the transaction
minToTokenAmount
: Minimum amount of token (without Token decimals) user would receive after reducing slippage.
txData
: Details of the transaction for the swap
toTokenAmountUSD:
USD equivalent of toTokenAmount. Will be null for those tokens whose USD price is not available from external price feeds
Note: Values are of type string
status Code
200
: Successful response
400
: Bad Request
401
: Unauthorized (in case no/wrong API key is passed)
404
: Not Found
429
: Too many requests (in case of rate limit breach)
500
: Internal Server Error
Scenario 2: For ExactOut Swap where toTokenAmount is entered (instead of fromTokenAmount), the endpoint returns the minimum toTokenAmount
fromToken
object
An object containing the details of the fromToken, which includes address
, decimals
and current_price
toToken
object
An object containing the details of the toToken, which includes address
, decimals
and current_price
feeToken
object
An object containing the details of the feeToken, which includes address
, name
, symbol
, decimals and current_price
toTokenAmount
string
Amount of token user desires to get after the swap Note: Amount is without Token decimals
toTokenAmountUSD
string
USD equivalent of toTokenAmount. Note: Will be null for those tokens whose usd price is not available from external price feeds
quotes
array
An object (within an array) containing the swap details.The object consists of:
fromTokenAmount
: Amount of tokens (without Token decimals) user needs to pay for the swap
maxFromTokenAmount:
Maximum amount of tokens (without Token decimals) user would need to pay after adding slippage.
slippagePercentage
: Percentage of slippage tolerance
feeTokenAmount
: Platform fee for the transaction
priceImpact
: percentage difference between USD price of fromTokenAmount and toTokenAmount. Will be null if either fromTokenAmountUSD or toTokenAmountUSD is null
txData
: Details of the transaction for the swap
fromTokenAmountUSD:
USD equivalent of fromTokenAmount. Will be null for those tokens whose usd price is not available from external price feeds
Note: Values are of type string
status code
200
: Successful response
400
: Bad Request
401
: Unauthorized (in case no/wrong API key is passed)
404
: Not Found
429
: Too many requests (in case of rate limit breach)
500
: Internal Server Error
Last updated