/price - Lookup token prices

Endpoint

Method: POST URL: https://api.swapkit.dev/price


Request parameters

Parameter
Type
Description

tokens

array

List of token identifiers to fetch price for. Each item is an object with an identifier field (e.g., { "identifier": "ETH.ETH" }).

metadata

boolean

If true, includes extended CoinGecko metadata (currently always included, even if set to false).

circle-info

Identifiers follow the format Chain.Asset, such as ETH.ETH, BTC.BTC or SOL.SOL, with the contract address added at the end when necessary, such as ARB.PENDLE-0x0c880f6761F1af8d9Aa9C466984b80DAb9a8c9e8. This is the same formatting used in our /quote endpoint.


Example requests

curl -X POST \
  'https://api.swapkit.dev/price' \
  -H 'Content-Type: application/json' \
  -H "x-api-key: YOUR_VARIABLE_HERE" \
  -d '{
    "tokens": [
      { "identifier": "ETH.ETH" },
      { "identifier": "BTC.BTC" },
      { "identifier": "SOL.SOL" },
      {"identifier": "BSC.CAKE-0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82"}
    ],
    "metadata": true
  }'

Response format

The endpoint returns an array of token price objects.

For each token, it includes the following fields:

Field
Type
Description

identifier

string

The token identifier you queried (e.g., ETH.ETH).

price_usd

number

The current price of the token in USD.

timestamp

number

Millisecond timestamp of the price fetch.

cg

object

(If metadata: true β€” currently always present) CoinGecko metadata.

└─ id

string

CoinGecko’s internal ID.

└─ name

string

Full name of the token.

└─ market_cap

number

Total market capitalization in USD.

└─ total_volume

number

24-hour trading volume in USD.

└─ price_change_24h_usd

number

Price change in absolute USD over the last 24 hours.

└─ price_change_percentage_24h_usd

number

Percentage price change over the last 24 hours.

└─ sparkline_in_7d

array

7-day price history (useful for drawing sparkline charts).

└─ timestamp

string

Timestamp of the CoinGecko data.

When a token's price is not found, or the token name is not correctly specified, the endpoint will return a price of 0 USD for that token. Not how ETH.HTE is not a correct identifier so the example response here fails to return a correct price:

Last updated