header_by_hash - Cosmos

Example code for the header_by_hash JSON-RPC method. Complete guide on how to use header_by_hash JSON-RPC in GetBlock Web3 documentation.

Returns the block header by its hash. Same response shape as header.

Parameters

Parameter
Type
Required
Description

hash

string

Yes

Block hash (hex-encoded)

Request Example

# JSON-RPC over HTTP POST (canonical)
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "header_by_hash",
    "params": {
        "hash": "6E2A2A6FE7A5B4C2D4E6F8A0B2C4D6E8F0A2C4E6F8B0D2E4F6A8C0E2F4B6D8E0"
    },
    "id": "getblock.io"
}'

# URI over HTTP GET (alternate, for simple methods)
curl --location --request GET 'https://go.getblock.io/<ACCESS-TOKEN>/header_by_hash?hash="6E2A2A6FE7A5B4C2D4E6F8A0B2C4D6E8F0A2C4E6F8B0D2E4F6A8C0E2F4B6D8E0"'

Response Example

Response Parameters

Field
Type
Description

result.header

object

Block header (same schema as header)

Use Cases

  • Resolving a header from a known block hash

  • Building header-chain verification tools

Error Handling

Status Code
Error Message
Cause

404

Not Found

Missing or invalid <ACCESS-TOKEN>

-32602

Invalid params

Request parameters are missing or malformed

-32603

Internal error

Server-side error while processing the request

429

Too Many Requests

Rate limit exceeded for your plan

SDK Integration

Last updated

Was this helpful?