/price - Lookup token prices
Endpoint
Method: POST
URL: https://api.swapkit.dev/price
Request parameters
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).
Example requests
curl -X POST \
'https://api.swapkit.dev/price' \
-H 'Content-Type: application/json' \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"tokens": [
{ "identifier": "ETH.ETH" },
{ "identifier": "BTC.BTC" },
{ "identifier": "SOL.SOL" },
{"identifier": "BSC.CAKE-0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82"}
],
"metadata": true
}'curl -X POST \
'https://api.swapkit.dev/price' \
-H 'Content-Type: application/json' \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"tokens": [
{ "identifier": "ETH.ETH" }
],
"metadata": true
}'Response format
The endpoint returns an array of token price objects.
For each token, it includes the following fields:
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.
One unusable identifier doesn't fail the request — the rest come back priced as normal. Results stay in the order you sent, repeats included.
A well-formed identifier with no price comes back priced at 0:
An identifier SwapKit cannot parse at all comes back as an error entry instead — no price_usd, no timestamp:
Branch on error before reading price_usd, and don't treat a 0 as the same thing: one says the token is unpriced, the other says the identifier was never understood.
Last updated

