Skip to main content

API Documentation

RESTful API for cryptocurrency market data with x402 micropayment support.

Base URL

https://cryptodata.example.com/api/v1

Authentication

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/coins

Option 2: x402 Micropayments

Pay per request using USDC on Base. No subscription needed.

  1. Make request, receive 402 with payment requirement
  2. Send USDC to the provided address on Base
  3. Include tx hash in header: X-Payment-Proof: {"txHash": "0x..."}

Endpoints

GET/api/v1Free

API overview and pricing information

Response

{
  "name": "Crypto Data Aggregator API",
  "version": "1.0.0",
  "tiers": [...],
  "endpoints": [...]
}
GET/api/v1/coins$0.001

List all coins with market data

Parameters

pagenumberPage number(default: 1)
per_pagenumberResults per page (max 250)(default: 100)
orderstringSort 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.002

Get detailed data for a single coin

Parameters

coinIdrequiredstringCoin ID (e.g., bitcoin, ethereum)

Response

{
  "success": true,
  "data": {
    "id": "bitcoin",
    "symbol": "btc",
    "name": "Bitcoin",
    "market_data": {...},
    "description": "...",
    ...
  }
}
GET/api/v1/market-data$0.002

Global market statistics and trending coins

Response

{
  "success": true,
  "data": {
    "global": {
      "total_market_cap": {...},
      "total_volume": {...},
      "market_cap_percentage": {...}
    },
    "trending": [...]
  }
}
GET/api/v1/export$0.01

Bulk data export in JSON or CSV format

Parameters

formatstringExport format: json or csv(default: json)
typestringData type: coins or defi(default: coins)
limitnumberNumber of records (max 500)(default: 100)

Response

JSON object or CSV file download

Error Codes

CodeNameDescription
400Bad RequestInvalid parameters provided
401UnauthorizedInvalid or missing API key
402Payment Requiredx402 payment needed for this request
404Not FoundResource not found
429Too Many RequestsRate limit exceeded
500Server ErrorInternal 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 →