The CoinPerps API provides unified access to perpetual futures data from multiple decentralized exchanges (DEXes). To get access sign up and get your API key.
Base URL:
https://api.coinperps.com/api/v1
Authentication
All API requests require an API key. Include your API key in the request header:
X-API-Key: your_api_key_here
Example:
curl -X GET "https://api.coinperps.com/api/v1/exchanges" \
-H "X-API-Key: cpk_live_your_api_key_here"
Rate Limits
Rate limit headers are included in all responses:
X-RateLimit-Limit: Maximum requests allowedX-RateLimit-Remaining: Requests remainingX-RateLimit-Reset: Unix timestamp when the limit resets
Response Format
Success Response:
{
"success": true,
"data": { ... },
"meta": {
"timestamp": 1704067200000,
"cached": false,
"cacheAge": null
}
}
Error Response:
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Human-readable error message"
}
}
Supported Exchanges
Endpoints
Exchanges
List All Exchanges
Returns a list of all supported DEX perpetual exchanges.
GET/exchanges
Get Exchange Details
Returns detailed information about a specific exchange.
GET/exchanges/{exchangeId}
Tickers
Get All Tickers
Returns ticker data for all trading pairs across all exchanges.
GET/tickers
Get Tickers by Exchange
Returns all ticker data for a specific exchange.
GET/tickers/{exchangeId}
Get Single Ticker
Returns ticker data for a specific trading pair.
GET/ticker/{exchangeId}/{symbol}
Example Response:
{
"success": true,
"data": {
"exchange": "hyperliquid",
"symbol": "BTC-PERP",
"price": "43250.50",
"indexPrice": "43248.00",
"markPrice": "43250.50",
"bid": "43249.00",
"ask": "43251.00",
"volume24h": "15234.567",
"volumeUsd24h": "658234567.89",
"priceChange24h": "250.50",
"priceChangePercent24h": "0.58",
"openInterest": "5000.25",
"openInterestUsd": "216256343.13",
"fundingRate": "0.0001",
"nextFundingTime": 1704070800000,
"timestamp": 1704067200000,
"iconUrl": "https://static.edgex.exchange/icons/coin/BTC.png"
}
}
Metrics
Get Aggregated Metrics
Returns comprehensive metrics for all DEX perpetual exchanges.
GET/metrics
Get DEX Rankings
Returns DEX rankings sorted by various metrics.
GET/metrics/rankings
Get Total Metrics
Returns aggregated totals across all DEX exchanges.
GET/metrics/totals
Get Volume History
Returns historical daily trading volume.
GET/metrics/volume/history
Get Cumulative Volume
Returns cumulative (running total) trading volume over time.
GET/metrics/volume/cumulative
Get DEX to CEX Ratio
Returns the current ratio of DEX perpetual trading volume compared to CEX volume.
GET/metrics/dex-cex-ratio
Get DEX to CEX Ratio History
Returns historical DEX vs CEX perpetual trading volume ratios.
GET/metrics/dex-cex-ratio/history
Get Single Exchange Metrics
Returns detailed metrics for a specific exchange.
GET/metrics/{exchangeId}
Logos
Get All Exchange Logos
Returns logo URLs for all supported exchanges.
GET/logos/exchanges
Get Exchange Logo
Returns logo URL for a specific exchange.
GET/logos/exchanges/{exchangeId}
Get All Coin Logos
Returns logo URLs for all supported coins.
GET/logos/coins
Get Coin Logo
Returns logo URL for a specific coin.
GET/logos/coins/{symbol}
Icons (Alternative)
Get All Crypto Icons
Returns a map of crypto symbols to their icon URLs.
GET/tickers/icons
Get Icon for Symbol
Returns the icon URL for a specific crypto symbol.
GET/tickers/icons/{symbol}
Error Codes
Code Examples
JavaScript / Node.js
const API_KEY = 'cpk_live_your_api_key_here';
const BASE_URL = 'https://api.coinperps.com/api/v1';
async function getMetrics() {
const response = await fetch(`${BASE_URL}/metrics`, {
headers: {
'X-API-Key': API_KEY,
},
});
const data = await response.json();
if (!data.success) {
throw new Error(data.error.message);
}
return data.data;
}
async function getTicker(exchangeId, symbol) {
const response = await fetch(`${BASE_URL}/ticker/${exchangeId}/${symbol}`, {
headers: {
'X-API-Key': API_KEY,
},
});
return response.json();
}
// Usage
getMetrics().then(metrics => {
console.log('Total 24h Volume:', metrics.totalVolume24h);
console.log('Top Exchange:', metrics.exchanges[0].displayName);
});
Python
import requests
API_KEY = 'cpk_live_your_api_key_here'
BASE_URL = 'https://api.coinperps.com/api/v1'
headers = {
'X-API-Key': API_KEY
}
def get_metrics():
response = requests.get(f'{BASE_URL}/metrics', headers=headers)
data = response.json()
if not data['success']:
raise Exception(data['error']['message'])
return data['data']
def get_ticker(exchange_id, symbol):
response = requests.get(
f'{BASE_URL}/ticker/{exchange_id}/{symbol}',
headers=headers
)
return response.json()
# Usage
metrics = get_metrics()
print(f"Total 24h Volume: ${metrics['totalVolume24h']:,.2f}")
print(f"Top Exchange: {metrics['exchanges'][0]['displayName']}")
cURL
# Get all metrics
curl -X GET "https://api.coinperps.com/api/v1/metrics" \
-H "X-API-Key: cpk_live_your_api_key_here"
# Get specific ticker
curl -X GET "https://api.coinperps.com/api/v1/ticker/hyperliquid/BTC-PERP" \
-H "X-API-Key: cpk_live_your_api_key_here"
# Get volume history
curl -X GET "https://api.coinperps.com/api/v1/metrics/volume/history?startDate=2024-01-01" \
-H "X-API-Key: cpk_live_your_api_key_here"
Support
For questions or issues:
- Email: [email protected]
- Website: https://coinperps.com