OpenOcean DEX API 3.0
Instruction of OpenOcean DEX API 3.0
API & SDK info page: https://openocean.finance/api/api-sdk/ API & SDK demo: https://demo-api.openocean.finance/guide/select.html
We strongly recommend that users deploy it themselves, rather than simply call it!

1.quote

  • url: https://open-api.openocean.finance/v3/:chain/quote
  • method: get
  • params:
parameter
type
example
description
chain
string
bsc
bsc, eth, polygon, fantom, avax, heco, okex, xdai, arbitrum, optimism, moonriver, boba, ont, tron, solana, terra, aurora
inTokenAddress
string
0x783C08b5F26E3daf8C4681F3bf49844e425b6393
token address
outTokenAddress
string
0xD81D45E7635400dDD9c028839e9a9eF479006B28
out token address
amount
string
5
token amount(without decimals)
gasPrice
string
5
without decimals
slippage
number?
1
1 equals 1%, 1%-100%
  • example:
    • request: https://open-api.openocean.finance/v3/avax/quote?inTokenAddress=0x783C08b5F26E3daf8C4681F3bf49844e425b6393&outTokenAddress=0xD81D45E7635400dDD9c028839e9a9eF479006B28&amount=5&gasPrice=5&slippage=100
    • response:
    1
    {
    2
    "code": 200,
    3
    "data": {
    4
    "inToken": {
    5
    "symbol": "AUSD",
    6
    "name": "Avaware USD",
    7
    "address": "0x783C08b5F26E3daf8C4681F3bf49844e425b6393",
    8
    "decimals": 18
    9
    },
    10
    "outToken": {
    11
    "symbol": "EMBR",
    12
    "name": "EmbrToken",
    13
    "address": "0xD81D45E7635400dDD9c028839e9a9eF479006B28",
    14
    "decimals": 18
    15
    },
    16
    "inAmount": "5000000000000000000",
    17
    "outAmount": "126261357830302882735",
    18
    "estimatedGas": "189669",
    19
    "dexes": [
    20
    {
    21
    "dexIndex": 1,
    22
    "dexCode": "SushiSwap",
    23
    "swapAmount": "0"
    24
    },
    25
    ...
    26
    ],
    27
    "path": {
    28
    }
    29
    }
    Copied!

2.swap_quote

  • url: https://open-api.openocean.finance/v3/:chain/swap_quote
  • method: get
  • params:
parameter
type
example
description
chain
string
bsc
bsc, eth, polygon, fantom, avax, heco, okex, xdai, arbitrum, optimism, moonriver, boba, ont, tron, solana, terra, aurora
inTokenAddress
string
0x783C08b5F26E3daf8C4681F3bf49844e425b6393
token address
outTokenAddress
string
0xD81D45E7635400dDD9c028839e9a9eF479006B28
out token address
amount
string
5
token amount(without decimals)
gasPrice
string
5
without decimals
slippage
number
1
1 equals 1%, 1%-100%
account
string
0x929B44e589AC4dD99c0282614e9a844Ea9483C69
user's address
referrer
string?
0x0000000000000000000000000000000000000000
Please contact us for a unique referrer parameter
  • example:
    • request:https://open-api.openocean.finance/v3/bsc/swap_quote?inTokenAddress=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&outTokenAddress=0x55d398326f99059ff775485246999027b3197955&amount=5&gasPrice=5&slippage=100&account=0x929B44e589AC4dD99c0282614e9a844Ea9483C69&referrer=0x0000000000000000000000000000000000000000
    • response:
    1
    {
    2
    "code": 200,
    3
    "data": {
    4
    "inToken": {
    5
    "symbol": "BNB",
    6
    "name": "Binance Coin",
    7
    "address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
    8
    "decimals": 18
    9
    },
    10
    "outToken": {
    11
    "symbol": "USDT",
    12
    "name": "Binance-Peg USD (T)",
    13
    "address": "0x55d398326f99059ff775485246999027b3197955",
    14
    "decimals": 18
    15
    },
    16
    "inAmount": "5000000000000000000",
    17
    "outAmount": "1854329353330546150894",
    18
    "estimatedGas": "353007",
    19
    "minOutAmount": "0",
    20
    "from": "0x929B44e589AC4dD99c0282614e9a844Ea9483C69",
    21
    "to": "0x6352a56caadC4F1E25CD6c75970Fa768A3304e64",
    22
    "value": "5000000000000000000",
    23
    "gasPrice": "5000000000",
    24
    "data": ""
    25
    }
    Copied!

3.getTransaction

  • url: https://open-api.openocean.finance/v3/:chain/getTransaction
  • method: get
  • params:
parameter
type
example
description
chain
string
bsc
bsc, eth, polygon, fantom, avax, heco, okex, xdai, arbitrum, optimism, moonriver, boba, ont, tron, solana, terra, aurora
hash
string
0x57e752d311c347008a5d66286096b62d6a0687834a3df8b0dd06265ff16ee575
transaction hash
  • example:
    • request: https://open-api.openocean.finance/v3/avax/getTransaction?hash=0x57e752d311c347008a5d66286096b62d6a0687834a3df8b0dd06265ff16ee575
    • response:
    1
    {
    2
    "code": 200,
    3
    "data": {
    4
    "id": 25144,
    5
    "tx_id": null,
    6
    "block_number": 12091885,
    7
    "tx_index": 8,
    8
    "address": "0x6352a56caadC4F1E25CD6c75970Fa768A3304e64",
    9
    "tx_hash": "0x57e752d311c347008a5d66286096b62d6a0687834a3df8b0dd06265ff16ee575",
    10
    "sender": "0x7fFadA80929a732f93D648D92cc4E052e2b9C4Aa",
    11
    "in_token_address": "0x0000000000000000000000000000000000000000",
    12
    "in_token_symbol": "AVAX",
    13
    "out_token_address": "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664",
    14
    "out_token_symbol": "USDC.e",
    15
    "referrer": "0x40603469C577B1Db3D401155901A276F604436f4",
    16
    "in_amount": "1400000000000000000",
    17
    "out_amount": "97659580",
    18
    "fee": "",
    19
    "referrer_fee": "",
    20
    "usd_valuation": 97.38,
    21
    "create_at": "2022-03-14T08:39:18.000Z",
    22
    "update_at": "2022-03-14T08:39:18.000Z",
    23
    "tx_fee": "0.010181825",
    24
    "tx_fee_valuation": "0.72993503",
    25
    "in_token_decimals": 18,
    26
    "out_token_decimals": 6,
    27
    "in_amount_value": "1.4",
    28
    "out_amount_value": "97.65958"
    29
    }
    30
    }
    Copied!

4.token list

  • url: https://open-api.openocean.finance/v3/:chain/tokenList
  • method: get
  • params:
parameter
type
example
description
chain
string
bsc
bsc, eth, polygon, fantom, avax, heco, okex, xdai, arbitrum, optimism, moonriver, boba, ont, tron, solana, terra, aurora
  • example:
    • request: https://open-api.openocean.finance/v3/avax/tokenList
    • response:
    1
    {
    2
    "code": 200,
    3
    "data": [
    4
    {
    5
    "id": 1619,
    6
    "code": "avaware-usd",
    7
    "name": "Avaware USD",
    8
    "address": "0x783C08b5F26E3daf8C4681F3bf49844e425b6393",
    9
    "decimals": 18,
    10
    "symbol": "AUSD",
    11
    "icon": "https://cloudstorage.openocean.finance/images/1646208600388_8016544631355003.png",
    12
    "chain": "avax",
    13
    "createtime": "2022-03-02T08:10:07.000Z",
    14
    "hot": null,
    15
    "sort": "2022-03-02T08:10:07.000Z",
    16
    "chainId": null
    17
    },
    18
    ...
    19
    ]
    20
    }
    Copied!

5.dex list

  • url: https://open-api.openocean.finance/v3/:chain/dexList
  • method: get
  • params:
parameter
type
example
description
chain
string
bsc
bsc, eth, polygon, fantom, avax, heco, okex, xdai, arbitrum, optimism, moonriver, boba, ont, tron, solana, terra, aurora
  • example:
    • request: https://open-api.openocean.finance/v3/avax/dexList
    • response:
    1
    {
    2
    "code": 200,
    3
    "data": [
    4
    {
    5
    "index": 1,
    6
    "code": "SushiSwap",
    7
    "name": "SushiSwap"
    8
    },
    9
    {
    10
    "index": 2,
    11
    "code": "Pangolin",
    12
    "name": "Pangolin"
    13
    },
    14
    ...
    15
    ]
    Copied!

6.getTxs

parameter
type
example
description
chain
string
bsc
bsc, eth, polygon, fantom, avax, heco, okex, xdai, arbitrum, optimism, moonriver, boba, ont, tron, solana, terra, aurora
account
string
0x929B44e589AC4dD99c0282614e9a844Ea9483C69
user's wallet address
pageSize
number
5
you want to get count
  • example:
    1
    {
    2
    "code": 200,
    3
    "data": [
    4
    {
    5
    "account": "0x929B44e589AC4dD99c0282614e9a844Ea9483C69",
    6
    "block": 16017430,
    7
    "inAmount": "1",
    8
    "inToken": "OOE",
    9
    "outAmount": "0.098904137685202557",
    10
    "outToken": "USDT",
    11
    "txFee": "0.00070697",
    12
    "txFeeValuation": "0.26521273",
    13
    "txHash": "0x9302b5d877b82ab27cfad776311294bb55f539f676385ce0470891063a3ee398",
    14
    "inTokenAddress": "0x9029FdFAe9A03135846381c7cE16595C3554e10A",
    15
    "outTokenAddress": "0x55d398326f99059fF775485246999027B3197955",
    16
    "tradeTime": "2022-03-13T07:42:19.000Z"
    17
    },
    18
    ...
    19
    ]
    20
    }
    Copied!

7.getBalance

parameter
type
example
description
chain
string
bsc
bsc, eth, polygon, fantom, avax, heco, okex, xdai, arbitrum, optimism, moonriver,boba
account
string
0x929B44e589AC4dD99c0282614e9a844Ea9483C69
user's wallet address
inTokenAddress
string
0x9029FdFAe9A03135846381c7cE16595C3554e10A,0x55d398326f99059ff775485246999027b3197955
token address(supports one to five tokens, separated from each other
)

8.createWallet

parameter
type
example
description
chain
string
bsc
bsc, eth, polygon, fantom, avax, heco, okex, xdai, arbitrum, optimism, moonriver,boba