API Documentation
RESTful API for cryptocurrency market data with x402 micropayment support.
Base URL
https://cryptodata.example.com/api/v1Authentication
Option 1: API Key
Include your API key in the request header or query parameter.
curl -H "X-API-Key: your_api_key" https://api.example.com/v1/coinsOption 2: x402 Micropayments
Pay per request using USDC on Base. No subscription needed.
- Make request, receive 402 with payment requirement
- Send USDC to the provided address on Base
- Include tx hash in header:
X-Payment-Proof: {"txHash": "0x..."}
Endpoints
GET
/api/v1FreeAPI overview and pricing information
Response
{
"name": "Crypto Data Aggregator API",
"version": "1.0.0",
"tiers": [...],
"endpoints": [...]
}GET
/api/v1/coins$0.001List all coins with market data
Parameters
page | number | Page number(default: 1) |
per_page | number | Results per page (max 250)(default: 100) |
order | string | Sort order(default: market_cap_desc) |
Response
{
"success": true,
"data": [
{
"id": "bitcoin",
"symbol": "btc",
"name": "Bitcoin",
"current_price": 45000,
"market_cap": 850000000000,
...
}
],
"meta": { "page": 1, "perPage": 100 }
}GET
/api/v1/coin/:coinId$0.002Get detailed data for a single coin
Parameters
coinIdrequired | string | Coin ID (e.g., bitcoin, ethereum) |
Response
{
"success": true,
"data": {
"id": "bitcoin",
"symbol": "btc",
"name": "Bitcoin",
"market_data": {...},
"description": "...",
...
}
}GET
/api/v1/market-data$0.002Global market statistics and trending coins
Response
{
"success": true,
"data": {
"global": {
"total_market_cap": {...},
"total_volume": {...},
"market_cap_percentage": {...}
},
"trending": [...]
}
}GET
/api/v1/export$0.01Bulk data export in JSON or CSV format
Parameters
format | string | Export format: json or csv(default: json) |
type | string | Data type: coins or defi(default: coins) |
limit | number | Number of records (max 500)(default: 100) |
Response
JSON object or CSV file download
Error Codes
| Code | Name | Description |
|---|---|---|
| 400 | Bad Request | Invalid parameters provided |
| 401 | Unauthorized | Invalid or missing API key |
| 402 | Payment Required | x402 payment needed for this request |
| 404 | Not Found | Resource not found |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Server Error | Internal server error |
Rate Limits
Rate limits are enforced per API key. Check response headers for current status:
X-RateLimit-Limit: 10000
X-RateLimit-Remaining: 9542
X-RateLimit-Reset: 1706054400
SDKs & Examples
JavaScriptView SDK →
PythonView SDK →
GoView SDK →
PHPView SDK →
TypeScriptView SDK →
ReactView SDK →