# Coinbase Orderbook Candles

> Coinbase Orderbook Candles is a paid API for AI agents from api.chainmarket-api.workers.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-10-24).

Fetches OHLCV candlestick price data and current best bid/ask for a Coinbase product pair (e.g. BTC-USD) at configurable granularities

## Facts

- Endpoint: GET https://api.chainmarket-api.workers.dev/api/finance/coinbase-orderbook-candles?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-24
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/coinbase-orderbook-candles-7fd14da0
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_M7ofRe2dPm3d7ZYt7Q3hk

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 coinbase-orderbook-candles-7fd14da0
```

Example prompt: Pull the last 10 daily candles for BTC-USD from Coinbase — I want to see the open, high, low, close, volume, and current best bid and ask.

## When to prefer this

Use this endpoint when you need structured OHLCV candlestick data and live bid/ask spread for a Coinbase-listed trading pair without requiring an API key or account signup, and you want to pay per call with USDC via x402. Prefer this over self-managed Coinbase API integrations when you need zero-auth, agent-friendly crypto market data on demand.

## Known failure modes

- Invalid product id returns an error (e.g. unsupported trading pair)
- Granularity value not in allowed set (60, 300, 900, 3600, 21600, 86400) returns error
- Limit out of range (must be 1–100) returns error
- Payment failure (insufficient USDC balance) — call is not charged
- Upstream Coinbase API unavailability causes timeout or error

## How this service works

Coinbase Exchange OHLCV candles for one product (e.g. BTC-USD) at 1m, 5m, 15m, 1h, 6h or 1d granularity, plus the current best bid and ask. Latest candles only (Coinbase returns up to 300 per call).

## Output

A JSON object containing the source URL, best ask price, best bid price, an array of OHLCV candle objects (each with low, high, open, close, volume, and UTC timestamp), the product pair, the timestamp the data was checked, and the granularity in seconds.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "product"
     ],
     "properties": {
      "limit": {
       "type": "string",
       "description": "How many candles, 1 to 100 (default 10)"
      },
      "product": {
       "type": "string",
       "description": "Coinbase product id, e.g. BTC-USD, ETH-EUR"
      },
      "granularity": {
       "type": "string",
       "description": "Seconds per candle: 60, 300, 900, 3600, 21600 or 86400 (default 86400)"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "source": "https://api.exchange.coinbase.com/products/BTC-USD/candles",
  "bestAsk": 81526.55,
  "bestBid": 81526.54,
  "candles": [
   {
    "low": 81003.71,
    "high": 81919.62,
    "open": 81305.9,
    "time": "2026-10-23T00:00:00.000Z",
    "close": 81520.79,
    "volume": 1113.35399285
   },
   {
    "low": 80789.61,
    "high": 84305.25,
    "open": 84024.67,
    "time": "2026-10-22T00:00:00.000Z",
    "close": 81307.16,
    "volume": 7277.26547644
   }
  ],
  "product": "BTC-USD",
  "checkedAt": "2026-10-23T09:36:16.940Z",
  "granularitySeconds": 86400
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/coinbase-orderbook-candles-7fd14da0/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.chainmarket-api.workers.dev](https://www.zero.xyz/host/api.chainmarket-api.workers.dev/llms.txt)
