PancakeSwap V2

Supported Chains

Available on Aptos, Binance Mainnet, and Binance Testnet.

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.

  • /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.

  • /getliquidityholders GET - Returns the swap quotation for a given token pair. - Returns the total number of liquidity holders in the specified pool. Currently Available on Binance.

  • /getindividualposition GET - Returns the swap quotation for a given token pair. - Returns the total number of liquidity holders in the specified pool. Currently Available on Binance.

  • /gethistoricaltimeseries GET - Returns the swap quotation for a given token pair. - Returns the total number of liquidity holders in the specified pool. Currently Available on Binance.

  • /gethistoricaltransactions GET - Returns the swap quotation for a given token pair. - Returns the total number of liquidity holders in the specified pool. Currently Available on Binance.

  • /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.

Endpoint Details

/getprice

Returns the swap quotation for the given token pair.

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

Query Parameters

https://api.expand.network/dex/getprice?dexId=1200&path=0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c,0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82&amountIn=10000000000000000000

/getuserliquidity

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

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

Query Parameters

https://api.expand.network/dex/getuserliquidity?address=0x6fb447ae94f5180254d436a693907a1f57696900&dexId=1200&tokenA=0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c&tokenB=0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82

Query Parameters for APTOS

https://api.expand.network/dex/getuserliquidity?dexId=2901&poolAddress=0xc7efb4076dbe143cbcd98cfaaa929ecfc8f299203dfff63b95ccb6bfe19850fa%3A%3Aswap%3A%3ALPToken%3C0x1%3A%3Aaptos_coin%3A%3AAptosCoin%2C0x8c805723ebc0a7fc5b7d3e7b75d567918e806b3461cb9fa21941a9edc0220bf%3A%3Adevnet_coins%3A%3ADevnetBNB%3E&address=0xa182b65f4bf10be7ef870496893c170af3079a2540c63b470445417fcfb21c5b

/getpoolliquidity

Returns the total liquidity for a specified pool.

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

Query Parameters

https://api.expand.network/dex/getpoolliquidity?dexId=1200&poolAddress=0x460b4193Ec4C1a17372Aa5FDcd44c520ba658646

/gettokenliquidity

Returns the individual token liquidity within the specified liquidity pool.

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

Query Parameters

https://api.expand.network/dex/gettokenliquidity?dexId=1200&poolAddress=0x460b4193Ec4C1a17372Aa5FDcd44c520ba658646

/getliquidityholders

Returns the total number of liquidity holders in the specified pool. Currently Available on Binance.

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

Query Parameters

https://api.expand.network/dex/getliquidityholders?dexId=1200&poolAddress=0x460b4193Ec4C1a17372Aa5FDcd44c520ba658646

/getindividualposition

Returns the liquidity position for a specified user address across all the pools for the DEX. Currently available on Binance

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

Query Parameters

https://api.expand.network/dex/getindividualposition?poolAddresses=0xC05654C66756eBB82c518598c5f1ea1a0199a563&address=0x8f295a22a4a5ef346192d2b2d4c483d9f76b2a67&poolSize=1000&dexId=1200

/gethistoricaltimeseries

Get the historical time series transactions for a specific pool address. Currently available on Binance

GET https://historicaltrade.api.expand.network/dex/gethistoricaltimeseries

Query Parameters

https://historicaltrade.api.expand.network/dex/gethistoricaltimeseries?dexId=1200&poolAddress=0x16b9a82891338f9ba80e2d6970fdda79d1eb0dae&startBlock=18675000&endBlock=18675639

/gethistoricaltransactions

Get the historical transactions focusing on swaps associated with a specific pool address. Currently available on Binance

GET https://historicaltrade.api.expand.network/dex/gethistoricaltransactions

Query Parameters

https://historicaltrade.api.expand.network/dex/gethistoricaltransactions?poolAddress=0x05616b7b6da03fb4c773b76663816b360ccaede4&dexId=1200&startBlock=34544519&endBlock=34548560

/swap

Initiate a swap transaction on a specified DEX.

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

Request Body

{
    "dexId": "1200",
    "amountIn": "120000000",
    "amountOutMin": "0",
    "path": ["0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", "0xCC42724C6683B7E57334c4E856f4c9965ED682bD"],
    "to": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "deadline": "1664529286",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "gas": "29880"
}

With gasPriority:

{
    "dexId": "1200",
    "amountIn": "120000000",
    "amountOutMin": "0",
    "path": [
        "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
        "0xCC42724C6683B7E57334c4E856f4c9965ED682bD"
    ],
    "to": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "deadline": "1704529286",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "gas": "298800",
    "gasPriority": "medium"
}

Request Body for APTOS

{
    "amountIn": "100000000",
    "from": "0x1c3266eca38df87026255884192b5979eac24cf0dac7a33cfa7af0d27651fb4c",
    "path": [
        "0x1::aptos_coin::AptosCoin",
        "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDC"
    ],
    "slippage": "100",
    "dexId": "2900",
    "gas": "1000"
}

/addliquidity

Add liquidity to a specified pool in a specified DEX.

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

Request Body

{
    "dexId": "1200",
    "tokenA": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
    "tokenB": "0xCC42724C6683B7E57334c4E856f4c9965ED682bD",
    "amountADesired": "50000000000000000",
    "amountBDesired": "77926115",
    "amountAMin": "0",
    "amountBMin": "0",
    "to": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "deadline": "1663181575",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "gas": "2307200"
}

With gasPriority:

{
    "dexId": "1200",
    "tokenA": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
    "tokenB": "0xCC42724C6683B7E57334c4E856f4c9965ED682bD",
    "amountADesired": "50000000000000000",
    "amountBDesired": "77926115",
    "amountAMin": "0",
    "amountBMin": "0",
    "to": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "deadline": "1663181575",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "gas": "2307200",
    "gasPriority": "medium"
}

Request Body for APTOS

{
    "amountIn": ["10000000","15299"],
    "from": "0x1c3266eca38df87026255884192b5979eac24cf0dac7a33cfa7af0d27651fb4c",
    "path": [
        "0x1::aptos_coin::AptosCoin",
        "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDC"
    ],
    "slippage": "100",
    "dexId": "2900",
    "gas":"1000"
}

/removeliquidity

Remove liquidity from a specified pool for a specified DEX.

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

Request Body

{
    "dexId": "1200",
    "tokenA": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
    "tokenB": "0xCC42724C6683B7E57334c4E856f4c9965ED682bD",
    "liquidity": "163742355742154761",
    "amountAMin": "0",
    "amountBMin": "0",
    "to": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "deadline": "1663231732",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "gas": "842720"
}

With gasPriority:

{
    "dexId": "1200",
    "tokenA": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
    "tokenB": "0xCC42724C6683B7E57334c4E856f4c9965ED682bD",
    "liquidity": "163742355742154761",
    "amountAMin": "0",
    "amountBMin": "0",
    "to": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "deadline": "1703231732",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "gas": "842720",
    "gasPriority": "medium"
}

Request Body for APTOS

{
    "liquidity": "1000",
    "from": "0x1c3266eca38df87026255884192b5979eac24cf0dac7a33cfa7af0d27651fb4c",
    "path": [
        "0x1::aptos_coin::AptosCoin",
        "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDC"
    ],
    "slippage": "10",
    "dexId": "2900",
    "gas":"1000"
}

Last updated