Panora
  • 👋Welcome to Panora
  • 🌐Official Links
  • PRODUCT SUITE
    • 💱Panora Swap
    • 📊Panora Trade
  • Developer
    • 💻Swap Widget
      • Install Widget
      • Widget Configuration
      • Theme Customization
      • Widget Controls
      • Guide
    • 🤖Swap API & SDK
      • 💻Swap API
        • Examples
      • 🖥️Swap SDK
      • 💦Supported Sources
    • 🎞️Swap iframe
    • 🪙Token List
      • 📔How to Add Your Token to the Panora Token List
    • 💲Token Prices
  • PARTNERSHIPS
    • 🤝Become Our Partner
    • 🏢Media & Brand Kit
  • FAQs
    • ❓Panora Help
  • LEGAL
    • 🗒️Legal Disclaimer
    • 🔓Brand & Logos
    • 📏Terms of Use
Powered by GitBook
On this page
  • 1. Get transaction details for the swap
  • Headers
  • Query Parameters
  • Request Example
  • Response Parameters
  • 2. Get quote for the swap
  • Headers
  • Query Parameters
  • Request Example
  • Response Parameters
  1. Developer
  2. Swap API & SDK

Swap 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 public applications, please submit a ticket on Discord to request a dedicated API key for enhanced performance and reliability.

Name
Value
Description

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 USDC, then the toTokenAmount response is the maximum USDC 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 USDC, toTokenAmount is 100 and fromToken is APT, then the fromTokenAmount response is the minimum APT a user would pay for swapping to 100 USDC.

Parameter
Required
Type
Description

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 one decimal place 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. If a numeric value is entered, anything after one decimal place 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: ["ThalaSwapV2", "Hyperion"]

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: ["SushiSwap"]

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

*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();
import requests

end_point = 'https://api.panora.exchange/swap'
query = {
    'fromTokenAddress': '0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b',
    'toTokenAddress':'0xa',
    'fromTokenAmount': '100',
    'toWalletAddress':'0x1c3206329806286fd2223647c9f9b130e66baeb6d7224a18c1f642ffe48f3b4c'
}

headers = {
    'x-api-key': 'Your API key',
}

url = f"{end_point}?{'&'.join([f'{key}={value}' for key, value in query.items()])}"

response = requests.post(url, headers=headers)

print(response.json())

import (
    "fmt"
    "net/http"
    "io/ioutil"
    "net/url"
)

func main() {
    endPoint := "https://api.panora.exchange/swap"
    query := url.Values{
        "fromTokenAddress": {"0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b"},
        "toTokenAddress":{"0xa"},
        "fromTokenAmount": {"100"},
        "toWalletAddress":{"0x1c3206329806286fd2223647c9f9b130e66baeb6d7224a18c1f642ffe48f3b4c"}
    }

    headers := map[string]string{
        "x-api-key": "Your API key",
    }

    url := endPoint + "?" + query.Encode()

    req, err := http.NewRequest("POST", url, nil)
    if err != nil {
        fmt.Println("Error creating request:", err)
        return
    }

    for key, value := range headers {
        req.Header.Set(key, value)
    }

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        fmt.Println("Error sending request:", err)
        return
    }
    defer resp.Body.Close()

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        fmt.Println("Error reading response:", err)
        return
    }

    fmt.Println(string(body))
}
// Copy and paste the below command in your terminal

curl -X POST \
  'https://api.panora.exchange/swap?fromTokenAddress=0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b&toTokenAddress=0xa&fromTokenAmount=100&toWalletAddress=0x1c3206329806286fd2223647c9f9b130e66baeb6d7224a18c1f642ffe48f3b4c' \
  -H 'x-api-key: Your API key'

Response Parameters

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

Name
Type
Description

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

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

feeAmount: Platform fee for the transaction

feeToken : An object containing the details of the feeToken, which includestokenType , name , symbol , decimals

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

Name
Type
Description

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

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

feeAmount: Platform fee for the transaction

feeToken : An object containing the details of the feeToken, which includestokenType , name , symbol , decimals 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

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.

Name
Value
Description

x-api-key

Your API Key

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

Query Parameters

Parameter
Required
Type
Description

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 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

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 one decimal place 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. If a numeric value is entered, anything after one decimal place 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: ["ThalaSwapV2", "Hyperion"]

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: ["SushiSwap"]

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

*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:"0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b"
    toTokenAddress:"0xa"
    fromTokenAmount:"100"
};

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();
import requests

end_point = 'https://api.panora.exchange/swap/quote'
query = {
    'fromTokenAddress': '0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b',
    'toTokenAddress':'0xa',
    'fromTokenAmount': '100',
}

headers = {
    'x-api-key': 'Your API key',
}

url = f"{end_point}?{'&'.join([f'{key}={value}' for key, value in query.items()])}"

response = requests.get(url, headers=headers)

print(response.json())

import (
    "fmt"
    "net/http"
    "io/ioutil"
    "net/url"
)

func main() {
    endPoint := "https://api.panora.exchange/swap/quote"
    query := url.Values{
        "fromTokenAddress": {"0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b"},
        "toTokenAddress":{"0xa"},
        "fromTokenAmount": {"100"},
    }

    headers := map[string]string{
        "x-api-key": "Your API key",
    }

    url := endPoint + "?" + query.Encode()

    req, err := http.NewRequest("GET", url, nil)
    if err != nil {
        fmt.Println("Error creating request:", err)
        return
    }

    for key, value := range headers {
        req.Header.Set(key, value)
    }

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        fmt.Println("Error sending request:", err)
        return
    }
    defer resp.Body.Close()

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        fmt.Println("Error reading response:", err)
        return
    }

    fmt.Println(string(body))
}
// Copy and paste the below command in your terminal

curl -X GET \
  'https://api.panora.exchange/swap/quote?fromTokenAddress=0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b&toTokenAddress=0xa&fromTokenAmount=100' \
  -H 'x-api-key: Your API key'

Response Parameters

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

Name
Type
Description

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

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

feeAmount: Platform fee for the transaction

feeToken : An object containing the details of the feeToken, which includes tokenType , name , symbol , decimals

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

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 fromTokenAmount

Name
Type
Description

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

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

feeAmount: Platform fee for the transaction

feeToken : An object containing the details of the feeToken, which includes tokenType , name , symbol , decimals priceImpact: percentage difference between USD price of fromTokenAmount and toTokenAmount. Will be null if either fromTokenAmountUSD or toTokenAmountUSD is null 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

PreviousSwap API & SDKNextExamples

Last updated 15 days ago

🤖
💻