# Bitcoin Blockchain API
> The Bitcoin blockchain as an API, powered by mempool.space. Get live transaction-fee estimates in sat/vB (fastest, 30-minute, 1-hour, economy and minimum) plus a projection of the next mempool blocks, inspect the current mempool size and fee histogram, list recent blocks with their mining pool, size and fees, look up any block by height or hash, check any Bitcoin address for its confirmed balance, total received/sent and recent transactions, fetch any transaction with its inputs, outputs, fee and confirmation status, read the current difficulty adjustment and network hashrate, and get the live BTC price in major currencies. Every amount is in satoshis. Perfect for wallets and fee estimators, block explorers, address and payment monitoring, on-chain dashboards and analytics, and Bitcoin bots. No accounts, no upstream key. For coin market prices use the Crypto API and for DeFi TVL the DeFi API.

## 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/bitcoin-api/..."
```

## Pricing
- **Free** (Free) — 3,300 calls/Mo, 2 req/s
- **Starter** ($6/Mo) — 41,500 calls/Mo, 6 req/s
- **Pro** ($18/Mo) — 207,000 calls/Mo, 16 req/s
- **Mega** ($49/Mo) — 1,030,000 calls/Mo, 40 req/s

## Endpoints

### Fees

#### `GET /v1/fees` — Recommended fees + projections

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

**Response:**
```json
{
    "data": {
        "unit": "sat/vB",
        "recommended": {
            "hour": 1,
            "economy": 1,
            "fastest": 3,
            "minimum": 1,
            "half_hour": 3
        },
        "projected_blocks": [
            {
                "n_tx": 3536,
                "fee_range": [
                    1.5686274509803921,
                    445.0970970970971
                ],
                "median_fee": 2.28,
                "block_vsize": 997948,
                "total_fees_sats": 6557447
            },
            {
                "n_tx": 4661,
                "fee_range": [
                    0.5745062836624776,
                    1.6214121699196327
                ],
                "median_fee": 1,
                "block_vsize": 997952,
                "total_fees_sats": 948100
            },
            {
                "n_tx": 7067,
                "fee_range": [
                    0.46017699115044247,
                    0.5840695252459959
                ],
                "median_fee": 0.52,
                "block_vsize": 997984,
                "total_fees_sats": 518292
            },
            {
                "n_tx": 7167,
                "fee_range": [
                    0.4563279857397504,
                    0.47533555612550227
                ],
                "median_fee": 0.48,
                "block_vsize": 997978,
                "total_fees_sats": 474342
            },
            {
                "n_tx": 7129,
 
…(truncated, see openapi.json for full schema)
```

### Mempool

#### `GET /v1/mempool` — Mempool size & fee histogram

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

**Response:**
```json
{
    "data": {
        "vsize": 44811489,
        "tx_count": 113188,
        "fee_histogram": [
            {
                "vsize": 50001,
                "fee_rate": 27.489208
            },
            {
                "vsize": 50018,
                "fee_rate": 6.0225224
            },
            {
                "vsize": 50025,
                "fee_rate": 4.1637425
            },
            {
                "vsize": 50782,
                "fee_rate": 3.6824925
            },
            {
                "vsize": 58733,
                "fee_rate": 3.342956
            },
            {
                "vsize": 53918,
                "fee_rate": 3.0489357
            },
            {
                "vsize": 50023,
                "fee_rate": 3.015873
            },
            {
                "vsize": 50011,
                "fee_rate": 2.7104073
            },
            {
                "vsize": 50447,
                "fee_rate": 2.4142857
            },
            {
                "vsize": 61311,
                "fee_rate": 2.272966
            },
            {
                "vsize": 50463,
                "fee_rate": 2.1486487
            },
            {
                "vsize": 54383,
                "fee_rate": 2.046887
            },
            {
                "vsize": 52337,
                "fee_rate": 2.0142858
            },
            {
                "vsize": 92411,
                "fee_rate": 2.0067406
            },
            {
      
…(truncated, see openapi.json for full schema)
```

### Blocks

#### `GET /v1/block` — One block by height or hash

**Parameters:**
- `id` (query, required, string) — Height or hash Example: `700000`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/bitcoin-api/v1/block?id=700000"
```

**Response:**
```json
{
    "data": {
        "block": {
            "hash": "0000000000000000000590fc0f3eba193a278534220b2b37e9849e1a770ca959",
            "pool": null,
            "size": 1276422,
            "nonce": 2881644503,
            "height": 700000,
            "weight": 3998094,
            "tx_count": 1276,
            "timestamp": 1631333672,
            "difficulty": 18415156832118.24,
            "median_fee": null,
            "reward_btc": null,
            "merkle_root": "1f8d213c864bfe9fb0098cecc3165cce407de88413741b0300d56ea0f4ec9c65",
            "reward_sats": null,
            "total_fees_sats": null
        }
    },
    "meta": {
        "timestamp": "2026-06-01T00:03:50.649Z",
        "request_id": "8689785e-f912-41ce-8e75-c73b2be37f93"
    },
    "status": "ok",
    "message": "Block retrieved",
    "success": true
}
```

#### `GET /v1/blocks` — Recent blocks

**Parameters:**
- `height` (query, optional, string) — Start from height Example: `850000`
- `limit` (query, optional, string) — Max 1-15 Example: `15`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/bitcoin-api/v1/blocks?height=850000&limit=15"
```

**Response:**
```json
{
    "data": {
        "count": 15,
        "blocks": [
            {
                "hash": "00000000000000000002a0b5db2a7f8d9087464c2586b546be7bce8eb53b8187",
                "pool": "Braiins Pool",
                "size": 1939011,
                "nonce": 2096869482,
                "height": 850000,
                "weight": 3993288,
                "tx_count": 3163,
                "timestamp": 1719689674,
                "difficulty": 83675262295059.9,
                "median_fee": 9,
                "reward_btc": 3.24421978,
                "merkle_root": "71cff5c1fda5d6dd820a025fc19f2619638e91c259a26902c36bcf69d66b1ad5",
                "reward_sats": 324421978,
                "total_fees_sats": 11921978
            },
            {
                "hash": "000000000000000000026b072f9347d86942f6786dd1fc362acfd9522715b313",
                "pool": "Foundry USA",
                "size": 1740661,
                "nonce": 3448999128,
                "height": 849999,
                "weight": 3993238,
                "tx_count": 1527,
                "timestamp": 1719688529,
                "difficulty": 83675262295059.9,
                "median_fee": 8,
                "reward_btc": 3.22582991,
                "merkle_root": "8bfc4aa03893d330a0e56f232847bd57e3a68f2a427659dc134f9e96cb9e6462",
                "reward_sats": 322582991,
                "total_fees_sats": 10082991
            },
            {
                "hash": "00000000000000000000ec8da633f1fb0f8f281
…(truncated, see openapi.json for full schema)
```

### Addresses

#### `GET /v1/address` — Address balance & txs

**Parameters:**
- `address` (query, required, string) — Bitcoin address Example: `1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa`
- `txs` (query, optional, string) — Include recent txs Example: `true`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/bitcoin-api/v1/address?address=1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa&txs=true"
```

**Response:**
```json
{
    "data": {
        "address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
        "tx_count": 62988,
        "sent_sats": 0,
        "recent_txs": [
            {
                "fee": 945,
                "txid": "602fd0336a1fa857ec57e39c308754429490e338d1e45cfde14a9a8b078944cf",
                "confirmed": false,
                "value_out_sats": 20934
            },
            {
                "fee": 406,
                "txid": "99ae52ff3a0af081419d8fbd1afc30ee8a99cb48bd8760a6574f5073dc0bb0b8",
                "confirmed": true,
                "block_height": 951911,
                "value_out_sats": 43081
            },
            {
                "fee": 564,
                "txid": "207de94e894b75e70c3e15ba285c9538f6a9593d2e3ac65fe022741693f27632",
                "confirmed": true,
                "block_height": 951892,
                "value_out_sats": 429059
            },
            {
                "fee": 755,
                "txid": "245032c26b39274264e2f441787430f47c1ac7d6f6a846049e85396e2ab6a6a6",
                "confirmed": true,
                "block_height": 951876,
                "value_out_sats": 1546
            },
            {
                "fee": 728,
                "txid": "7308d7da18989c1fdd3250eb6f6bd635299d27f47edea5e4787610683a7829fc",
                "confirmed": true,
                "block_height": 951869,
                "value_out_sats": 1546
            },
            {
                "fee": 580,
                "txid": "d62aa
…(truncated, see openapi.json for full schema)
```

### Transactions

#### `GET /v1/tx` — Transaction detail

**Parameters:**
- `txid` (query, required, string) — Transaction id (64 hex) Example: `cca7507897abc89628f450e8b1e0c6fca4ec3f7b34cccf55f3f531c659ff4d79`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/bitcoin-api/v1/tx?txid=cca7507897abc89628f450e8b1e0c6fca4ec3f7b34cccf55f3f531c659ff4d79"
```

**Response:**
```json
{
    "data": {
        "transaction": {
            "size": 300,
            "txid": "cca7507897abc89628f450e8b1e0c6fca4ec3f7b34cccf55f3f531c659ff4d79",
            "inputs": [
                {
                    "address": "17SkEw2md5avVNyYgj6RiXuQKNwkXaxFyQ",
                    "value_sats": 1000000000000
                }
            ],
            "weight": 1200,
            "fee_btc": 0,
            "outputs": [
                {
                    "type": "p2pkh",
                    "address": "1MLh2UVHgonJY4ZtsakoXtkcXDJ2EPU6RY",
                    "value_sats": 577700000000
                },
                {
                    "type": "p2pk",
                    "address": null,
                    "value_sats": 422300000000
                }
            ],
            "version": 1,
            "fee_sats": 0,
            "confirmed": true,
            "block_time": 1274552768,
            "input_count": 1,
            "block_height": 57044,
            "output_count": 2,
            "total_in_sats": 1000000000000,
            "total_out_sats": 1000000000000
        }
    },
    "meta": {
        "timestamp": "2026-06-01T00:03:51.766Z",
        "request_id": "e064b5af-5dab-48cc-9d55-8abe43bfcef9"
    },
    "status": "ok",
    "message": "Transaction retrieved",
    "success": true
}
```

### Network

#### `GET /v1/difficulty` — Difficulty & hashrate

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

**Response:**
```json
{
    "data": {
        "current_hashrate": 1.010240014129629e+21,
        "progress_percent": 17.91,
        "remaining_blocks": 1655,
        "current_difficulty": 138955357012247.3,
        "average_block_time_s": 614,
        "next_retarget_height": 953568,
        "estimated_retarget_date": 1781273566580,
        "difficulty_change_percent": -0.64
    },
    "meta": {
        "timestamp": "2026-06-01T00:03:52.866Z",
        "request_id": "55091d2f-9729-4836-ba2f-b2139a8a1eb9"
    },
    "status": "ok",
    "message": "Difficulty retrieved",
    "success": true
}
```

#### `GET /v1/price` — BTC price

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

**Response:**
```json
{
    "data": {
        "time": 1780272008,
        "prices": {
            "AUD": 102562,
            "CAD": 101577,
            "CHF": 57519,
            "EUR": 63172,
            "GBP": 54711,
            "JPY": 11725148,
            "USD": 73582
        }
    },
    "meta": {
        "timestamp": "2026-06-01T00:03:52.940Z",
        "request_id": "5a0c9f3b-284d-462c-8415-37d1d3af0de2"
    },
    "status": "ok",
    "message": "Price retrieved",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Usage notes

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

**Response:**
```json
{
    "data": {
        "note": "The Bitcoin blockchain. /v1/fees = recommended fee rates (sat/vB) + projected next blocks; /v1/mempool = current mempool size & fee histogram; /v1/blocks (?height= to start lower) = recent blocks with mining pool & fees; /v1/block?id=700000 (height or hash) = one block; /v1/address?address=bc1... (&txs=true) = balance, totals & recent transactions; /v1/tx?txid=... = a transaction's inputs, outputs, fee & confirmation; /v1/difficulty = the difficulty adjustment & network hashrate; /v1/price = the BTC price in major currencies. All amounts in satoshis (1 BTC = 100,000,000 sats). For coin market prices use the Crypto API; for DeFi TVL the DeFi API.",
        "source": "mempool.space",
        "endpoints": [
            "/v1/fees",
            "/v1/mempool",
            "/v1/blocks",
            "/v1/block",
            "/v1/address",
            "/v1/tx",
            "/v1/difficulty",
            "/v1/price",
            "/v1/meta"
        ]
    },
    "meta": {
        "timestamp": "2026-06-01T00:03:53.013Z",
        "request_id": "c0611d09-559a-478f-a297-b45d6a9b108a"
    },
    "status": "ok",
    "message": "Meta retrieved",
    "success": true
}
```


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