# Bitcoin Historical Metrics API
> The long-run on-chain economics of Bitcoin as time series, served from the public blockchain.com charts feed. Where snapshot APIs report the chain state right now, this is the history: how the hash rate, mining difficulty, miners' revenue, daily transaction count, transaction fees, market price, market capitalisation, circulating supply, mempool size, average block size, estimated on-chain transaction volume, daily unique addresses, UTXO count and median confirmation time have moved over months and years. The metric endpoint returns one metric's full daily time series over a chosen window (30 days to all-time) with summary statistics — first, last, change, percent change, minimum, maximum and average. The latest endpoint returns a metric's current value with its change versus the previous reading and versus 30 days ago. The metrics endpoint lists every available metric with its unit and category. This is the historical and charting view of Bitcoin's network economics — distinct from the live mempool-snapshot, the multi-chain network-stats and the price-feed APIs in the catalogue. Live, no key on the upstream, nothing stored.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/bitcoinmetrics-api/..."
```

## Pricing
- **Free** (Free) — 26,000 calls/Mo, 5 req/s
- **Starter** ($6/Mo) — 305,000 calls/Mo, 15 req/s
- **Pro** ($19/Mo) — 1,320,000 calls/Mo, 40 req/s
- **Scale** ($45/Mo) — 4,700,000 calls/Mo, 100 req/s

## Endpoints

### Metrics

#### `GET /v1/latest` — A metric current value + recent change

**Parameters:**
- `metric` (query, required, string) — Metric key Example: `difficulty`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/bitcoinmetrics-api/v1/latest?metric=difficulty"
```

**Response:**
```json
{
    "data": {
        "date": "2026-06-04",
        "name": "Difficulty",
        "unit": "",
        "value": 138955357012247.55,
        "metric": "difficulty",
        "source": "blockchain.com",
        "category": "mining",
        "change_pct_30d": 4.89,
        "change_pct_vs_prev": 0
    },
    "meta": {
        "timestamp": "2026-06-12T01:41:31.772Z",
        "request_id": "e89ea6ee-4ba8-4dfb-b81e-ef6e88c58721"
    },
    "status": "ok",
    "message": "Latest value retrieved successfully",
    "success": true
}
```

#### `GET /v1/metric` — One metric time series + summary

**Parameters:**
- `metric` (query, required, string) — Metric key (see /v1/metrics) Example: `hashrate`
- `timespan` (query, optional, string) — 30days, 90days, 1year, 2years, 5years, all Example: `1year`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/bitcoinmetrics-api/v1/metric?metric=hashrate&timespan=1year"
```

**Response:**
```json
{
    "data": {
        "name": "Hash Rate",
        "unit": "TH/s",
        "metric": "hashrate",
        "series": [
            {
                "date": "2025-06-12",
                "value": 934223897.6608
            },
            {
                "date": "2025-06-13",
                "value": 915286926.7623
            },
            {
                "date": "2025-06-14",
                "value": 949216466.5546
            },
            {
                "date": "2025-06-15",
                "value": 854616743.0405
            },
            {
                "date": "2025-06-16",
                "value": 917456209.4405
            },
            {
                "date": "2025-06-17",
                "value": 741505703.5204
            },
            {
                "date": "2025-06-18",
                "value": 879752529.6005
            },
            {
                "date": "2025-06-19",
                "value": 798061223.2805
            },
            {
                "date": "2025-06-20",
                "value": 948875942.6405
            },
            {
                "date": "2025-06-21",
                "value": 886036476.2405
            },
            {
                "date": "2025-06-22",
                "value": 672382290.4804
            },
            {
                "date": "2025-06-23",
                "value": 672382290.4804
            },
            {
                "date": "2025-06-24",
                "value": 735221756.8804
     
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/metrics` — Directory of available metrics

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/bitcoinmetrics-api/v1/metrics"
```

**Response:**
```json
{
    "data": {
        "count": 15,
        "source": "blockchain.com",
        "metrics": [
            {
                "name": "Market Price",
                "unit": "USD",
                "chart": "market-price",
                "metric": "price",
                "category": "market"
            },
            {
                "name": "Market Capitalization",
                "unit": "USD",
                "chart": "market-cap",
                "metric": "marketcap",
                "category": "market"
            },
            {
                "name": "Hash Rate",
                "unit": "TH/s",
                "chart": "hash-rate",
                "metric": "hashrate",
                "category": "mining"
            },
            {
                "name": "Difficulty",
                "unit": "",
                "chart": "difficulty",
                "metric": "difficulty",
                "category": "mining"
            },
            {
                "name": "Miners Revenue",
                "unit": "USD",
                "chart": "miners-revenue",
                "metric": "miners-revenue",
                "category": "mining"
            },
            {
                "name": "Transactions per Day",
                "unit": "count",
                "chart": "n-transactions",
                "metric": "transactions",
                "category": "network"
            },
            {
                "name": "Transaction Fees",
                "unit": "USD",
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Spec

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/bitcoinmetrics-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "note": "metric is one of the keys from /v1/metrics (hash-rate, difficulty, miners-revenue, transactions, fees-usd, market price, supply …). timespan is 30days, 90days, 1year (default), 2years, 5years or all. Each metric is a daily time series; values carry the unit shown in the metrics directory.",
        "source": "blockchain.com charts API (api.blockchain.info/charts, live)",
        "service": "bitcoinmetrics-api",
        "btc_price": 61450.38,
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/latest": "A metric's current value with recent change (metric=difficulty).",
            "GET /v1/metric": "One metric's time series + summary over a window (metric=hashrate, timespan=1year).",
            "GET /v1/metrics": "Directory of all available metrics with their units and categories."
        },
        "description": "The long-run on-chain economics of Bitcoin as time series, from blockchain.com. metric returns one metric's full time series over a chosen window with summary stats (first, last, change, min, max, average); latest returns a metric's current value with recent change; metrics lists every available metric (hash rate, difficulty, miners revenue, transactions, fees, market price/cap, supply, mempool size, block size, on-chain volume, unique addresses, UTXO count, confirmation time). Live, no key, nothing stored. The historical / charting view of Bitcoin's network economics — distinct from the li
…(truncated, see openapi.json for full schema)
```


---
Marketplace page: https://www.oanor.com/api/bitcoinmetrics-api
OpenAPI spec: https://www.oanor.com/api/bitcoinmetrics-api/openapi.json
