PancakeSwap V3

Supported Chains

Available on Arbitrum, Base, Binance Smart Chain.

Available Endpoints:

Click on the endpoint to jump to the section with full details

  • /getprice GET - Returns the swap quotation for a given token pair on PancakeSwap V3.

  • /getuserliquidity GET - Returns the balance of a particular token pair of accounts.

  • /getpoolliquidity GET - Returns the total liquidity for a specified pool.

  • /gettokenliquidity GET - Returns the individual token liquidity within the specified liquidity pool.

  • /getindividualposition GET - Returns the liquidity position for a specified user address across all the pools for a given DEX.

  • /swap POST - Initiate a swap transaction on a specified DEX.

  • /addliquidity POST - Add liquidity to a specified pool in a specified DEX.

  • /removeliquidity POST - Remove liquidity from a specified pool in a specified DEX.

DEX IDs

Many endpoints have a parameter where you can provide a DEX ID.

Below is a list of DEX IDs related to PancakeSwap V3. Please see the DEX ID page for a complete DEX ID list and more information.

DEX NameChainDEX ID

PancakeSwap V3

Binance Smart Chain

2800

PancakeSwap V3

Arbitrum

2808

PancakeSwap V3

Base

2809

Endpoint Details

/getprice

Returns the swap quotation for a given token pair on PancakeSwap V3

GET https://api.expand.network/dex/getprice

Query Parameters

NameTypeDescription

rpc

String

Remote procedural call URL.

dexId*

String

See the DEX ID page for a list of all DEX IDs.

path*

String

Comma separated values of token addresses whose price is to be fetched.

amountIn*

String

Amount of token.

poolFees

String

Different pool based on the fees. By default, it is selected as 3000.

https://api.expand.network/dex/getprice?path=0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c&amountIn=100000000&dexId=2800&poolFees=10000

back to top

/getuserliquidity

Returns the balance of a particular token pair of an account.

GET https://api.expand.network/dex/getuserliquidity

Query Parameters

NameTypeDescription

rpc

String

Remote procedural call URL.

tokenId*

String

The token ID for PancakeSwap V3 liquidity position.

dexId*

String

Refer to DexId page for details.

https://api.expand.network/dex/getuserliquidity?dexId=2800&tokenId=1312988

back to top

/getpoolliquidity

Returns the total liquidity for a specified pool.

GET https://api.expand.network/dex/getpoolliquidity

Query Parameters

NameTypeDescription

rpc

String

Remote procedural call URL.

poolAddress*

String

Pool address whose liquidity is to be fetched.

dexId*

String

Refer to DEX ID page for details.

https://api.expand.network/dex/getpoolliquidity?dexId=2800&poolAddress=0xd710DaC10B7255fCc0eC929a0e742A18F25b6395

back to top

/gettokenliquidity

Returns the individual token liquidity within the specified liquidity pool.

GET https://api.expand.network/dex/gettokenliquidity

Query Parameters

NameTypeDescription

rpc

String

Remote procedural call URL.

poolAddress*

String

The pool address.

dexId*

String

Refer to DEX ID page for details.

https://api.expand.network/dex/gettokenliquidity?dexId=2800&poolAddress=0xd710DaC10B7255fCc0eC929a0e742A18F25b6395

back to top

/getindividualposition

Returns the liquidity position for a specified user address across all the pools for a given DEX.

GET https://api.expand.network/dex/getindividualposition

Query Parameters

NameTypeDescription

rpc

String

Remote procedural call URL.

address*

String

The public address of the liquidity holder.

dexId*

String

Refer to DEX ID page for details.

poolAddresses

String

The pool Addresses whose liquidity is to be fetched. (Comma-separated vaules)

https://api.expand.network/dex/getindividualposition?dexId=2800&address=0x1782ceA0D026430ad4b410697c2df05a104EFA9b

back to top

/swap

Initiate a swap transaction on a specified DEX.

POST https://api.expand.network/dex/swap

Request Body

NameTypeDescription

rpc

String

Remote procedural call URL.

dexId*

String

Refer to the DEX ID page for details.

path*

Array

Comma-separated values of token addresses, inside an array, to swap.

amountIn*

String

Amount of token to be swapped.

amountOutMin*

String

Minimum amount accepted as a result of swap.

to*

String

Address of the recipient of the token.

from*

String

Address of the sender of the token.

gas*

String

Maximum gas limit provided by the sender, for the transaction.

involveBaseToken

String

If a base token is involved in the swap; 0 for erc20 -> erc20, 1 for base -> erc20 ("from" address should be of equivalent wrapped token), 2 for erc20 -> base ("to" address should be of equivalent wrapped token). By default, 0.

poolFees

String

Different pool based on the fees. By default, it is selected as 3000.

gasPriority

String

low, medium, or high.

slippage

String

Percentage of total swap value. By default, 1.

0 <= slippage value <= 100

{
    "dexId": "2800",
    "path": ["0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", "0x55d398326f99059fF775485246999027B3197955"],
    "amountIn":"1000000000000",
    "gas": "100000",
    "to": "0xf67d5d28614f26f56a73E635197534871D4ACf14",
    "amountOutMin": "100",
    "from": "0xf67d5d28614f26f56a73E635197534871D4ACf14",
    "poolFees": "10000",
    "involveBaseToken": "1",
    "deadline": "19999999999999"
}

With gasPriority (medium):

{
    "dexId": "2800",
    "path": ["0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", "0x55d398326f99059fF775485246999027B3197955"],
    "amountIn":"1000000000000",
    "gas": "100000",
    "to": "0xf67d5d28614f26f56a73E635197534871D4ACf14",
    "amountOutMin": "100",
    "from": "0xf67d5d28614f26f56a73E635197534871D4ACf14",
    "poolFees": "10000",
    "involveBaseToken": "1",
    "deadline": "19999999999999",
    "gasPriority": "medium"
}

back to top

/addliquidity

Add liquidity to a specified pool in a specified DEX.

POST https://api.expand.network/dex/addliquidity

Request Body

NameTypeDescription

dexId*

String

Refer to the DEX ID page for details.

tokenA*

String

Address of the first token being added.

tokenB*

String

Address of the second token being added.

poolFees*

String

Different pool based on the fees.

amountADesired*

String

Desired amount of token A.

amountBDesired*

String

Desired amount of token B.

amountAMin*

String

Minimum amount of token A.

amountBMin*

String

Minimum amount of token B.

deadline*

String

Deadline for the transaction to be executed (UNIX Timestamp).

to*

String

Address of the recipient of the token.

from*

String

Address of the sender of the token.

gas*

String

Maximum gas limit provided by the sender, for the transaction.

rpc

String

Remote procedural call URL.

tokenId

String

The token ID for PancakeSwap V3 liquidity position.

gasPriority

String

low, medium, or high.

slippage

String

Percentage of total value. By default, 1.

0 <= slippage value <= 100

{
    "dexId": "2800",
    "tokenA": "0x55d398326f99059fF775485246999027B3197955",
    "tokenB": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
    "amountADesired":"1000",
    "amountBDesired": "10",
    "amountAMin": "0",
    "amountBMin": "0",
    "deadline": "19999999999",
    "gas": "10000",
    "to": "0xf67d5d28614f26f56a73E635197534871D4ACf14",
    "amountOutMin": "100",
    "from": "0xf67d5d28614f26f56a73E635197534871D4ACf14",
    "poolFees": "10000"
}

With gasPriority (medium):

{
    "dexId": "2800",
    "tokenA": "0x55d398326f99059fF775485246999027B3197955",
    "tokenB": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
    "amountADesired": "1000",
    "amountBDesired": "10",
    "amountAMin": "0",
    "amountBMin": "0",
    "deadline": "19999999999",
    "gas": "10000",
    "to": "0xf67d5d28614f26f56a73E635197534871D4ACf14",
    "amountOutMin": "100",
    "from": "0xf67d5d28614f26f56a73E635197534871D4ACf14",
    "poolFees": "10000",
    "gasPriority": "medium"
}

back to top

/removeliquidity

Remove liquidity from a specified pool for a specified DEX.

POST https://api.expand.network/dex/removeliquidity

Request Body

NameTypeDescription

dexId*

String

Refer to the DEX ID page for details.

tokenId*

String

The token ID for PancakeSwap V3 liquidity position.

amountAMin

String

Minimum amount of Token A.

amountAMax

String

Maximum amount of Token A.

amountBMax

String

Maximum amount of Token B.

recipient

String

Recipient for sweep tokens.

deadline*

String

Deadline for the transaction to be executed (UNIX Timestamp).

from*

String

Address of the sender of the token.

gas*

String

Maximum gas limit provided by the sender, for the transaction.

rpc

String

Remote procedural call URL.

tokenA*

String

Address of the first token being removed.

tokenB

String

Address of the second token being removed.

liquidity*

string

The liquidity to be removed.

amountBMin

String

Minimum amount of Token B.

gasPriority

String

low, medium, or high.

slippage

String

Percentage of total value. By default, 1.

0 <= slippage value <= 100

{
    "dexId": "2800",
    "tokenA": "0x55d398326f99059fF775485246999027B3197955",
    "tokenB": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
    "amountAMax": "1000",
    "amountBMax": "10",
    "amountAMin": "0",
    "amountBMin": "0",
    "deadline": "19999999999",
    "liquidity": "10000",
    "gas": "10000",
    "amountOutMin": "100",
    "from": "0x176a7FCF400d3af85909e5A16ea9D04b4717C529",
    "tokenId": "1312988"
}

With gasPriority:

{
    "dexId": "2800",
    "tokenA": "0x55d398326f99059fF775485246999027B3197955",
    "tokenB": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
    "amountAMax": "1000",
    "amountBMax": "10",
    "amountAMin": "0",
    "amountBMin": "0",
    "deadline": "19999999999",
    "liquidity": "10000",
    "gas": "10000",
    "amountOutMin": "100",
    "from": "0x176a7FCF400d3af85909e5A16ea9D04b4717C529",
    "tokenId": "1312988",
    "gasPriority": "medium"
}

back to top

Last updated