🔗 JSON-RPC API

JSON-RPC proxy for Market Data REST endpoints.

Market Data - JSON RPC

Overview

Our JSON-RPC implementation is a thin proxy around the Market Data REST API. It forwards JSON-RPC calls to the same REST resources and returns the REST payload inside the JSON-RPC response.

  • method is the REST path, for example v1/exchanges or v1/quotes/{symbol_id}/history
  • params is converted into REST path parameters and query string parameters
  • Placeholder values from method are taken from params
  • Any remaining params keys are appended to the proxied REST request as query string values

There are no JSON-RPC-only methods. If an endpoint exists in the Market Data REST API, it can be reached through this proxy by using the same path.

Endpoint

To access Market Data through JSON-RPC, use:

EnvironmentEncryptionValue
ProductionYeshttps://rest.coinapi.io/jsonrpc

Authentication

Authentication is exactly the same as for the REST API. See the authentication section.

Request Format

Use a JSON-RPC 2.0 request where method is the REST path and params is an object:

{
  "jsonrpc": "2.0",
  "method": "v1/quotes/{symbol_id}/history",
  "params": {
    "symbol_id": "BITSTAMP_SPOT_BTC_USD",
    "time_start": "2025-01-24T00:00:00Z",
    "time_end": "2025-01-24T01:00:00Z",
    "limit": 100
  },
  "id": "my-tracking-id-001"
}

The request above is proxied to:

GET /v1/quotes/BITSTAMP_SPOT_BTC_USD/history?time_start=2025-01-24T00:00:00Z&time_end=2025-01-24T01:00:00Z&limit=100

API Design Mapping

The proxy follows the REST structure of the Market Data API, including namespaces such as:

  • Metadata: v1/exchanges, v1/assets, v1/symbols, v1/chains
  • Exchange rates: v1/exchangerate/{asset_id_base} and related endpoints
  • Quotes: v1/quotes/{symbol_id}/history
  • Trades: v1/trades/{symbol_id}/history
  • Order books: v1/orderbooks/{symbol_id}/depth/current and historical snapshots
  • OHLCV: v1/ohlcv/{symbol_id}/latest and related timeseries endpoints
  • Metrics and options endpoints available in the REST reference

Examples

Get exchanges

Request

https://rest.coinapi.io/jsonrpc?apikey=YOUR-API-KEY

{
  "jsonrpc": "2.0",
  "method": "v1/exchanges",
  "params": {},
  "id": "my-tracking-id-001"
}

Proxied REST request:

GET /v1/exchanges

Get historical quotes for a symbol

Request

https://rest.coinapi.io/jsonrpc?apikey=YOUR-API-KEY

{
  "jsonrpc": "2.0",
  "method": "v1/quotes/{symbol_id}/history",
  "params": {
    "symbol_id": "BITSTAMP_SPOT_BTC_USD",
    "time_start": "2025-01-24T00:00:00Z",
    "time_end": "2025-01-24T01:00:00Z",
    "limit": 100
  },
  "id": "my-tracking-id-001"
}

Proxied REST request:

GET /v1/quotes/BITSTAMP_SPOT_BTC_USD/history?time_start=2025-01-24T00:00:00Z&time_end=2025-01-24T01:00:00Z&limit=100

Get current order book depth

Request

https://rest.coinapi.io/jsonrpc?apikey=YOUR-API-KEY

{
  "jsonrpc": "2.0",
  "method": "v1/orderbooks/{symbol_id}/depth/current",
  "params": {
    "symbol_id": "BITSTAMP_SPOT_BTC_USD",
    "limit_levels": 20
  },
  "id": "my-tracking-id-001"
}

Proxied REST request:

GET /v1/orderbooks/BITSTAMP_SPOT_BTC_USD/depth/current?limit_levels=20

Responses and Errors

Successful JSON-RPC responses return the underlying REST payload in the result field. If the proxied REST request fails, the error is returned as a JSON-RPC error object.

{
  "jsonrpc": "2.0",
  "result": {},
  "id": "my-tracking-id-001"
}
Service StatusGitHub SDK