Skip to main content
GET
/
api
/
v1
/
blocks
/
{hashOrNumber}
Get block by hash or number
curl --request GET \
  --url https://mainnet.mirrornode.hedera.com/api/v1/blocks/{hashOrNumber}
import requests

url = "https://mainnet.mirrornode.hedera.com/api/v1/blocks/{hashOrNumber}"

response = requests.get(url)

print(response.text)
const options = {method: 'GET'};

fetch('https://mainnet.mirrornode.hedera.com/api/v1/blocks/{hashOrNumber}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://mainnet.mirrornode.hedera.com/api/v1/blocks/{hashOrNumber}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://mainnet.mirrornode.hedera.com/api/v1/blocks/{hashOrNumber}"

req, _ := http.NewRequest("GET", url, nil)

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://mainnet.mirrornode.hedera.com/api/v1/blocks/{hashOrNumber}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://mainnet.mirrornode.hedera.com/api/v1/blocks/{hashOrNumber}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
{
  "count": 3,
  "gas_used": 300000,
  "hapi_version": "0.11.0",
  "hash": "0x3c08bbbee74d287b1dcd3f0ca6d1d2cb92c90883c4acf9747de9f3f3162ad25b999fc7e86699f60f2a3fb3ed9a646c6b",
  "logs_bloom": "0x00000020002000001000000000000000000000000000000000000000000010000000000004000000000000000000000000108000000000000000000080000000000004000000000000000000000000880000000000000000000101000000000000000000000000000000000000008000000000000400000080000000000001000000000000000000000000000000000000000000002000000000100000100000200000040000100000001000000000000000000000000000000001001000004000000000000000000001000000000000000000100000000000100000000000000000000000000000000000000000000000080000100800000000000000120080",
  "name": "2022-05-03T06_46_26.060890949Z.rcd",
  "number": 77,
  "previous_hash": "0xf7d6481f659c866c35391ee230c374f163642ebf13a5e604e04a95a9ca48a298dc2dfa10f51bcbaab8ae23bc6d662a0b",
  "size": 8192,
  "timestamp": {
    "from": "1651560386.060890949",
    "to": "1651560386.661997287"
  }
}
{
"_status": {
"messages": [
{
"message": "Invalid parameter: account.id"
},
{
"message": "Invalid Transaction id. Please use \\shard.realm.num-sss-nnn\\ format where sss are seconds and nnn are nanoseconds"
}
]
}
}
{
"_status": {
"messages": [
{
"message": "Not found"
}
]
}
}

Path Parameters

hashOrNumber
string
required

Accepts both eth and hedera hash format or block number

Pattern: ^(\d{1,10}|(0x)?([A-Fa-f0-9]{64}|[A-Fa-f0-9]{96}))$

Response

OK

count
integer
Required range: x >= 0
gas_used
integer<int64> | null
Required range: x >= 0
hapi_version
string | null
hash
string
logs_bloom
string | null

A hex encoded 256-byte array with 0x prefix

Pattern: ^0x[0-9a-fA-F]{512}$
name
string
number
integer
Required range: x >= 0
previous_hash
string
size
integer | null
timestamp
object

A timestamp range an entity is valid for