💻Aggregator 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.

1. Get transaction details for the swap

POST https://api.panora.exchange/swap


Headers

  • Public API Key:

    a4^KV_EaTf4MW#ZdvgGKX#HUD^3IFEAOV_kzpIE^3BQGA8pDnrkT7JcIy#HNlLGi

    Note: For large-scale apps, please raise a ticket on Discord for a dedicated key.

NameValueDescription

x-api-key

Your API Key

Use the public API key or enter the API key provided by Panora

Query Parameters

Note: Panora's APIs supports the following.

  1. ExactIn Swap: When fromTokenAmount is entered, the endpoint returns the maximum toTokenAmount that will be received. Example: If the fromToken is APT, fromTokenAmount is 10.5 and toToken is lzUSDC, then the toTokenAmount response is the maximum lzUSDC a user would receive for swapping from 10.5 APT.

  2. ExactOut Swap: When toTokenAmount is entered, the endpoint returns the minimum fromTokenAmount that has to be paid. Example: If the toToken is lzUSDC, toTokenAmount is 100 and fromToken is APT, then the fromTokenAmount response is the minimum APT a user would pay for swapping to 100 lzUSDC.

ParameterRequiredTypeDescription

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 lzUSDC, then fromTokenAddress is 0x1::aptos_coin::AptosCoin

toTokenAddress

yes

string

Address of the token being swapped to Example: If you want to swap 10.5 APT to lzUSDC, then toTokenAddress is 0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDC

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 lzUSDC, 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 lzUSDC, 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 four decimals 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. If nothing is entered, integrator fee will be set to 0 by default. Anything after four decimals will be truncated.

integratorFeeAddress

no

string

Wallet Address where integrators want to receive their fee share.

Note: Ensure it starts with 0x followed by 64 characters

includeSources

no

string

List of liquidity sources to be included for route calculation.

Example: ["Thala", "Liquidswap"]

Note: If nothing is entered, all available sources are included by default.

excludeSources

no

string

List of liquidity sources to be excluded from the route.

Example: ["Aux"]

Note: If nothing is entered, none of the sources will be excluded by default.

onlyDirectRoutes

no

boolean

Set to true to restrict to direct routes without intermediate hops or splits.

Example: For direct swaps without hops or splits, set to true. 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:
    toTokenAddress:
    fromTokenAmount:
    toWalletAddress:
};

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 Parameters

Scenario 1: For ExactIn Swap where fromTokenAmount is entered (instead of toTokenAmount), the endpoint returns the maximum toTokenAmount

NameTypeDescription

fromToken

object

An object containing the details of the fromToken, which includes address and current_price

toToken

object

An object containing the details of the toToken, which includes address 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 array of objects containing the swap details, in the decreasing order of toTokenAmount. Each object consists of:

toTokenAmount: Amount of the tokens (without Token decimals) being swapped to.

minToTokenAmount: Minimum amount of tokens (without Token decimals) user would receive after reducing slippage.

route: Route details of the swap

priceImpact: percentage difference between USD price of fromTokenAmount and toTokenAmount. Will be null if either fromTokenAmountUSD or toTokenAmountUSD is null

feeAmount: Platform fee for the transaction

slippagePercentage: Percentage of slippage tolerance

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 (when the Panora server is down)

Scenario 2: For ExactOut Swap where toTokenAmount is entered (instead of fromTokenAmount), the endpoint returns the minimum toTokenAmount

NameTypeDescription

fromToken

object

An object containing the details of the fromToken, which includes address and current_price

toToken

object

An object containing the details of the toToken, which includes address 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 array of objects containing the swap details, in the increasing order of fromTokenAmount 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.

route: Route details of the swap

priceImpact: percentage difference between USD price of fromTokenAmount and toTokenAmount. Will be null if either fromTokenAmountUSD or toTokenAmountUSD is null

feeAmount: Platform fee for the transaction

slippagePercentage: Percentage of slippage tolerance

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 (when the Panora server is down)

2. Get quote for the swap

GET https://api.panora.exchange/swap/quote

Headers

  • Public API Key:

    a4^KV_EaTf4MW#ZdvgGKX#HUD^3IFEAOV_kzpIE^3BQGA8pDnrkT7JcIy#HNlLGi

    Note: For large-scale apps, please raise a ticket on Discord for a dedicated key.

NameValueDescription

x-api-key

Your API Key

Use the public API key or enter the API key provided by Panora

Query Parameters

ParameterRequiredTypeDescription

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 lzUSDC, then fromTokenAddress is 0x1::aptos_coin::AptosCoin

toTokenAddress

yes

string

Address of the token being swapped to Example: If you want to swap 10.5 APT to lzUSDC, then toTokenAddress is 0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDC

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 lzUSDC, then fromTokenAmount is 10.5

toTokenAmount

yes*

number

Amount of the token being swapped to. Please set the amount without Token decimals

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 four decimals 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. If nothing is entered, integrator fee will be set to 0 by default. Anything after four decimals will be truncated.

integratorFeeAddress

no

string

Wallet Address where integrators want to receive their fee share.

Note: Ensure it starts with 0x followed by 64 characters

includeSources

no

string

List of liquidity sources to be included for route calculation.

Example: ["Thala", "Liquidswap"]

Note: If nothing is entered, all available sources are included by default.

excludeSources

no

string

List of liquidity sources to be excluded from the route.

Example: ["Aux"]

Note: If nothing is entered, none of the sources will be excluded by default.

onlyDirectRoutes

no

boolean

Set to true to restrict to direct routes without intermediate hops or splits.

Example: For direct swaps without hops or splits, set to true. 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/quote'
const query = {
    fromTokenAddress:
    toTokenAddress:
    fromTokenAmount:
};

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: 'GET',
        headers: headers
    })
).json();

Response Parameters

Scenario 1: For ExactIn Swap where fromTokenAmount is entered (instead of toTokenAmount), the endpoint returns the maximum toTokenAmount

NameTypeDescription

fromToken

object

An object containing the details of the fromToken, which includes addressand current_price

toToken

object

An object containing the details of the toToken, which includes address 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 array of objects containing the swap details, in the decreasing order of toTokenAmount. Each object consists of:

toTokenAmount: Amount of the tokens (without Token decimals) being swapped to.

minToTokenAmount: Minimum amount of tokens (without Token decimals) user would receive after reducing slippage.

route : Route details of the swap

priceImpact: percentage difference between USD price of fromTokenAmount and toTokenAmount. Will be null if either fromTokenAmountUSD or toTokenAmountUSD is null

feeAmount: charges for the transaction

slippagePercentage: Percentage of slippage tolerance 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 (when the Panora server is down)

Scenario 2: For ExactOut Swap where toTokenAmount is entered (instead of fromTokenAmount), the endpoint returns the minimum fromTokenAmount

NameTypeDescription

fromToken

object

An object containing the details of the fromToken, which includes address and current_price

toToken

object

An object containing the details of the toToken, which includes address 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 array of objects containing the swap details, in the increasing order of fromTokenAmount 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.

route: Route details of the swap

priceImpact: percentage difference between USD price of fromTokenAmount and toTokenAmount. Will be null if either fromTokenAmountUSD or toTokenAmountUSD is null

feeAmount: Platform fee for the transaction

slippagePercentage: Percentage of slippage tolerance 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 (when the Panora server is down)

Last updated