/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
}'
Response format
The endpoint returns an array of token price objects.
[
{
"identifier": "ETH.ETH",
"provider": "",
"cg": {
"id": "ethereum",
"name": "Ethereum",
"market_cap": 197138665861,
"total_volume": 12560864823,
"price_change_24h_usd": -39.89,
"price_change_percentage_24h_usd": -2.38,
"sparkline_in_7d": [...],
"timestamp": "2025-04-15T12:30:44.643Z"
},
"price_usd": 1653.61,
"timestamp": 1744720254562
}
]
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:
[
{
"identifier": "ETH.EHT",
"provider": "",
"price_usd": 0,
"timestamp": 0
}
]
Last updated