# x402 Crypto Market Data – Historical Klines

> x402 Crypto Market Data – Historical Klines is a paid API for AI agents from x402-crypto-market-data.up.railway.app, paid per call via x402, $0.005/call, status unknown (last checked 2026-10-13).

Returns historical OHLCV candlestick data for a given crypto trading pair over a specified time range and interval

## Facts

- Endpoint: POST https://x402-crypto-market-data.up.railway.app/historical-klines?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-crypto-market-data-historical-klines-2e243ade
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_EJkUkGdw_ifrZ0b03TJOx

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability x402-crypto-market-data-historical-klines-2e243ade -d '<json body>'
```

Example prompt: Can you pull the hourly candlestick data for BTCUSDT from January 1, 2024 00:00 to January 2, 2024 00:00? I want to see the open, high, low, close, and volume for each candle.

## When to prefer this

Choose this endpoint when you need structured OHLCV candlestick history for a specific crypto trading pair over a defined time window. It is ideal for quantitative analysis, backtesting, charting, and reporting use cases where precise historical price data at a chosen interval (from 1-minute to monthly) is required. Prefer this over live price endpoints when the query is retrospective rather than real-time.

## Known failure modes

- Invalid or unsupported trading symbol returns an error — use the free discovery endpoint first to validate pairs
- Malformed date/time format (not %Y-%m-%d %H:%M) causes a parse error
- Time range with no available data returns empty klines array
- Very large time ranges with short intervals may return partial results or be rejected
- Payment failure via x402 protocol results in 402 response and no data returned

## How this service works

On-demand crypto market data. Discover available trading pairs for free, then retrieve live prices, market metadata, and historical candlesticks when you need them.

## Output

Returns a JSON object containing the requested symbol, interval, and an array of candlestick objects each with open_time, close_time, open_price, high_price, low_price, close_price, volume, quote_asset_volume, amount_trades, taker_buy_base_volume, and taker_buy_quote_volume fields.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "symbol": {
   "type": "string",
   "pattern": "^[A-Z0-9]+$",
   "examples": [
    "BTCUSDT"
   ],
   "description": "Trading symbol, e.g. BTCUSDT."
  },
  "to_time": {
   "type": "string",
   "examples": [
    "2024-01-02 00:00"
   ],
   "description": "End of the time range, format: %Y-%m-%d %H:%M"
  },
  "interval": {
   "enum": [
    "1m",
    "3m",
    "5m",
    "15m",
    "30m",
    "1h",
    "2h",
    "4h",
    "6h",
    "8h",
    "12h",
    "1d",
    "3d",
    "1w",
    "1M"
   ],
   "type": "string",
   "title": "KlineInterval",
   "default": "1h",
   "description": "Candlestick interval"
  },
  "from_time": {
   "type": "string",
   "examples": [
    "2024-01-01 00:00"
   ],
   "description": "Start of the time range, format: %Y-%m-%d %H:%M"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "klines": [
   {
    "volume": 125.5,
    "low_price": 41800,
    "open_time": "2024-01-01T00:00:00",
    "close_time": "2024-01-01T01:00:00",
    "high_price": 42500,
    "open_price": 42000,
    "close_price": 42200,
    "amount_trades": 1250,
    "quote_asset_volume": 5290000,
    "taker_buy_base_volume": 60.3,
    "taker_buy_quote_volume": 2541800
   },
   {
    "volume": 118.2,
    "low_price": 42100,
    "open_time": "2024-01-01T01:00:00",
    "close_time": "2024-01-01T02:00:00",
    "high_price": 42800,
    "open_price": 42200,
    "close_price": 42600,
    "amount_trades": 1180,
    "quote_asset_volume": 5037600,
    "taker_buy_base_volume": 58.1,
    "taker_buy_quote_volume": 2479000
   }
  ],
  "symbol": "BTCUSDT",
  "interval": "1h"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-crypto-market-data-historical-klines-2e243ade/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-crypto-market-data.up.railway.app](https://www.zero.xyz/host/x402-crypto-market-data.up.railway.app/llms.txt)
