Market API

Get Price#

Retrieve the latest price of a token.

Request URL#

GET https://web3.okx.com/api/v5/dex/market/price

Request Parameters#

ParameterTypeRequiredDescription
chainIndexStringYesUnique identifier for the chain.
e.g., 1: Ethereum.
See more here.
tokenContractAddressStringYesToken contract address (e.g., 0x382bb369d343125bfb2117af9c149795c6c65c50)

Response Parameters#

ParameterTypeDescription
chainIndexStringUnique identifier for the chain
tokenContractAddressStringToken contract address
timeStringTimestamp of the price, Unix timestamp format in milliseconds
priceStringLatest token price

Request Example#

shell
curl --location --request POST 'https://web3.okx.com/api/v5/dex/market/price' \
--header 'Content-Type: application/json' \
--header 'OK-ACCESS-PROJECT: 86af********d1bc' \
--header 'OK-ACCESS-KEY: 37c541a1-****-****-****-10fe7a038418' \
--header 'OK-ACCESS-SIGN: leaV********3uw=' \
--header 'OK-ACCESS-PASSPHRASE: 1****6' \
--header 'OK-ACCESS-TIMESTAMP: 2023-10-18T12:21:41.274Z' \
--data-raw '[
      {
          "chainIndex": "66",
          "tokenContractAddress":"0x382bb369d343125bfb2117af9c149795c6c65c50"
      }
  ]'

Response Example#

200
{
    "code":"0",
    "data":[
    {
    "chainIndex": "1",
    "tokenContractAddress": "0x382bb369d343125bfb2117af9c149795c6c65c50",
    "time": "1716892020000",
    "price": "26.458143090226812"
    }
    ],
    "msg":""
}