🔗 JSON-RPC API

JSON-RPC proxy for Exchange Rates REST endpoints.

Exchange Rates - JSON RPC

Overview

Our JSON-RPC implementation is a thin proxy around the Exchange Rates REST API. It does not introduce a separate RPC-specific domain model or extra business logic.

  • method is the REST path, for example v1/assets or v1/exchangerate/{asset_id_base}/{asset_id_quote}/history
  • params is converted into REST path parameters and query string parameters
  • Keys used in path placeholders are substituted into the path
  • Remaining keys are forwarded as standard query string parameters

This means JSON-RPC is just another way to call the same read-only REST resources.

Endpoint

To access Exchange Rates through JSON-RPC, use:

EnvironmentEncryptionValue
ProductionYeshttps://api-realtime.exrates.coinapi.io/jsonrpc
ProductionYeshttps://api-historical.exrates.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 contains the REST path and params is an object:

{
  "jsonrpc": "2.0",
  "method": "v1/exchangerate/{asset_id_base}/{asset_id_quote}/history",
  "params": {
    "asset_id_base": "BTC",
    "asset_id_quote": "USD",
    "period_id": "1HRS",
    "time_start": "2025-01-24T00:00:00Z",
    "time_end": "2025-01-24T01:00:00Z"
  },
  "id": "my-tracking-id-001"
}

The request above is proxied to:

GET /v1/exchangerate/BTC/USD/history?period_id=1HRS&time_start=2025-01-24T00:00:00Z&time_end=2025-01-24T01:00:00Z

API Design Mapping

  • Metadata endpoints such as v1/assets and v1/assets/{asset_id}
  • Realtime rate endpoints such as v1/exchangerate/{asset_id_base} and v1/exchangerate/{asset_id_base}/{asset_id_quote}
  • Historical timeseries endpoints such as v1/exchangerate/{asset_id_base}/{asset_id_quote}/history
  • Supporting endpoints such as v1/exchangerate/history/periods

Examples

List all assets

Request

https://api-realtime.exrates.coinapi.io/jsonrpc?apikey=YOUR-API-KEY

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

Proxied REST request:

GET /v1/assets

Get the current BTC/USD rate

Request

https://api-realtime.exrates.coinapi.io/jsonrpc?apikey=YOUR-API-KEY

{
  "jsonrpc": "2.0",
  "method": "v1/exchangerate/{asset_id_base}/{asset_id_quote}",
  "params": {
    "asset_id_base": "BTC",
    "asset_id_quote": "USD"
  },
  "id": "my-tracking-id-001"
}

Proxied REST request:

GET /v1/exchangerate/BTC/USD

Get historical BTC/USD timeseries

Request

https://api-historical.exrates.coinapi.io/jsonrpc?apikey=YOUR-API-KEY

{
  "jsonrpc": "2.0",
  "method": "v1/exchangerate/{asset_id_base}/{asset_id_quote}/history",
  "params": {
    "asset_id_base": "BTC",
    "asset_id_quote": "USD",
    "period_id": "1HRS",
    "time_start": "2025-01-24T00:00:00Z",
    "time_end": "2025-01-24T01:00:00Z"
  },
  "id": "my-tracking-id-001"
}

Proxied REST request:

GET /v1/exchangerate/BTC/USD/history?period_id=1HRS&time_start=2025-01-24T00:00:00Z&time_end=2025-01-24T01:00:00Z

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