/blocks - Polkadot
Example code for the /blocks REST method. Complete guide on how to use /blocks REST in GetBlock Web3 documentation.
This endpoint returns a range of blocks in a single call, decoded like /blocks/{blockId}. The range is limited to keep responses bounded.
Endpoint
GET /blocksQuery Parameters
Parameter
Type
Required
Description
range
string
Yes
Inclusive block-number range, such as 0-1
Request
curl --location 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/blocks?range=6754360-6754362'const response = await fetch('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/blocks?range=6754360-6754362');
const data = await response.json();
console.log(data);import requests
response = requests.get('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/blocks?range=6754360-6754362')
print(response.json())Response
[
{
"number": "6754360",
"hash": "0xabc...",
"extrinsics": []
},
{
"number": "6754361",
"hash": "0xdef...",
"extrinsics": []
}
]Response Fields
Field
Type
Description
[]
array
Array of decoded block objects, one per block in the range
[].number
string
Block number
[].hash
string
Block hash
[].extrinsics
array
Decoded extrinsics for the block
Use Cases
Batch Indexing: Ingest several blocks in one request
Backfilling: Backfill a historical range efficiently
Analytics: Scan a window of blocks for activity
Reduced Round-Trips: Avoid per-block requests
Last updated
Was this helpful?