/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_VARIABLE_HERE" \
-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_VARIABLE_HERE" \
-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.
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

