api/v2/block - Bitcoin

This endpoint returns a block by height or hash, including its metadata and a paged list of the transactions it contains.

Parameters

ParameterTypeLocationRequiredDescription
blockHashstringpathYesBlock height or block hash
pageintegerqueryNo1-based page index for the block's transactions. Default 1

Request

bashcurl --location --request GET 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/api/v2/block/000000000000000000046b9302e08c16ea186950f42a5498320ddd1bd7ab3428?page=1'

example.js

javascriptconst response = await fetch(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/api/v2/block/000000000000000000046b9302e08c16ea186950f42a5498320ddd1bd7ab3428?page=1'
);
console.log(await response.json());

example.py

pythonimport requests

response = requests.get('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/api/v2/block/000000000000000000046b9302e08c16ea186950f42a5498320ddd1bd7ab3428?page=1')

print(response.json())

Response

json{
    "page": 1,
    "totalPages": 3,
    "itemsOnPage": 1000,
    "hash": "000000000000000000046b9302e08c16ea186950f42a5498320ddd1bd7ab3428",
    "previousBlockHash": "000000000000000001d3a318372df5d1eec54462a0d7471ae1cdf49838f793dd",
    "nextBlockHash": "000000000000000000006d8e1eb870bd281b30ed621acf6b8d6af2a3c7ab61f1",
    "height": 830000,
    "confirmations": 1197,
    "size": 1350854,
    "time": 1617180599,
    "version": 1073733632,
    "merkleRoot": "d14c9f467c4bdd5135837696150ab5f52f3f5043de324ca4e5766b195b9f8f37",
    "nonce": "3669423616",
    "bits": "170cdf6f",
    "difficulty": "21865558044610.55",
    "txCount": 2815,
    "txs": [
        {
            "txid": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
            "value": "9407625",
            "fees": "2938345"
        }
    ]
}

Response Parameters

FieldTypeDescription
hashstringBlock hash
heightintegerBlock height
confirmationsintegerNumber of confirmations
timeintegerBlock time as a Unix timestamp
txCountintegerNumber of transactions in the block
txsarrayPaged transactions in the block
previousBlockHashstringHash of the parent block

Use Cases

  • Block Explorers: Render block metadata and its transaction list
  • Chain Indexing: Page through block transactions into an off-chain store
  • Confirmation Context: Read block height and time for a transaction's block
  • Throughput Analysis: Read transaction counts per block over a range

Error Handling

HTTP StatusMessageDescription
400Bad requestThe block height or hash is malformed
404Not foundNo block matches the requested height or hash
500Internal errorThe indexer failed to read the block