---
updatedAt: 2025-06-11T20:38:30.000Z
agentTools:
  projectIndex: https://docs.allthatnode.com/llms.txt
---

# Get block headers (max: 20) for minHeight <= height <= maxHeight.

Get block headers for minHeight <= height <= maxHeight.

At most 20 items will be returned.

Upon success, the `Cache-Control` header will be set with the default
maximum age.

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "CometBFT RPC",
    "contact": {
      "name": "CometBFT",
      "url": "https://cometbft.com/"
    },
    "description": "CometBFT supports the following RPC protocols:\n\n* URI over HTTP\n* JSONRPC over HTTP\n* JSONRPC over websockets\n\n## Configuration\n\nRPC can be configured by tuning parameters under `[rpc]` table in the\n`$CMTHOME/config/config.toml` file or by using the `--rpc.X` command-line\nflags.\n\nThe default RPC listen address is `tcp://127.0.0.1:26657`.\nTo set another address, set the `laddr` config parameter to desired value.\nCORS (Cross-Origin Resource Sharing) can be enabled by setting\n`cors_allowed_origins`, `cors_allowed_methods`, `cors_allowed_headers`\nconfig parameters.\n\nIf testing using a local RPC node, under the `[rpc]`\nsection change the `cors_allowed_origins` property, please add the URL of\nthe site where this OpenAPI document is running, for example:\n\n  `cors_allowed_origins = [\"http://localhost:8088\"]`\n\nor if testing from the official documentation site:\n\n  `cors_allowed_origins = [\"https://docs.cometbft.com\"]`\n\n## Arguments\n\nArguments which expect strings or byte arrays may be passed as quoted\nstrings, like `\"abc\"` or as `0x`-prefixed strings, like `0x616263`.\n\n## URI/HTTP\n\nA REST like interface.\n\n    curl localhost:26657/block?height=5\n\n## JSONRPC/HTTP\n\nJSONRPC requests can be POST'd to the root RPC endpoint via HTTP.\n\n    curl --header \"Content-Type: application/json\" --request POST --data '{\"method\": \"block\", \"params\": [\"5\"], \"id\": 1}' localhost:26657\n\n## JSONRPC/websockets\n\nJSONRPC requests can be also made via websocket.\nThe websocket endpoint is at `/websocket`, e.g. `localhost:26657/websocket`.\nAsynchronous RPC functions like event `subscribe` and `unsubscribe` are\nonly available via websockets.\n\nFor example using the [websocat](https://github.com/vi/websocat) tool, you can subscribe for 'NewBlock` events\nwith the following command:\n\n    echo '{ \"jsonrpc\": \"2.0\",\"method\": \"subscribe\",\"id\": 0,\"params\": {\"query\": \"tm.event='\"'NewBlock'\"'\"} }' | websocat -n -t ws://127.0.0.1:26657/websocket\n",
    "version": "v0.38.x",
    "license": {
      "name": "Apache 2.0",
      "url": "https://github.com/cometbft/cometbft/blob/v0.38.x/LICENSE"
    }
  },
  "servers": [
    {
      "url": "https://rpc.cosmos.directory/cosmoshub",
      "description": "Interact with the CometBFT RPC from a public node in the Cosmos registry"
    },
    {
      "url": "http://localhost:26657",
      "description": "Interact with CometBFT RPC node running locally"
    }
  ],
  "tags": [
    {
      "name": "Info",
      "description": "Informations about the node APIs"
    }
  ],
  "paths": {
    "/blockchain": {
      "get": {
        "summary": "Get block headers (max: 20) for minHeight <= height <= maxHeight.",
        "operationId": "blockchain",
        "parameters": [
          {
            "in": "query",
            "name": "minHeight",
            "description": "Minimum block height to return",
            "schema": {
              "type": "integer",
              "example": 1
            }
          },
          {
            "in": "query",
            "name": "maxHeight",
            "description": "Maximum block height to return",
            "schema": {
              "type": "integer",
              "example": 2
            }
          }
        ],
        "tags": [
          "Info"
        ],
        "description": "Get block headers for minHeight <= height <= maxHeight.\n\nAt most 20 items will be returned.\n\nUpon success, the `Cache-Control` header will be set with the default\nmaximum age.\n",
        "responses": {
          "200": {
            "description": "Block headers, returned in descending order (highest first).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BlockchainResponse"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "JSONRPC": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "example": 0
          },
          "jsonrpc": {
            "type": "string",
            "example": "2.0"
          }
        }
      },
      "ErrorResponse": {
        "description": "Error Response",
        "allOf": [
          {
            "$ref": "#/components/schemas/JSONRPC"
          },
          {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "example": "Description of failure"
              }
            }
          }
        ]
      },
      "BlockMeta": {
        "type": "object",
        "properties": {
          "block_id": {
            "$ref": "#/components/schemas/BlockID"
          },
          "block_size": {
            "type": "integer",
            "example": 1000000
          },
          "header": {
            "$ref": "#/components/schemas/BlockHeader"
          },
          "num_txs": {
            "type": "string",
            "example": "54"
          }
        }
      },
      "Blockchain": {
        "type": "object",
        "required": [
          "last_height",
          "block_metas"
        ],
        "properties": {
          "last_height": {
            "type": "string",
            "example": "1276718"
          },
          "block_metas": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BlockMeta"
            }
          }
        }
      },
      "BlockchainResponse": {
        "description": "Blockchain info",
        "allOf": [
          {
            "$ref": "#/components/schemas/JSONRPC"
          },
          {
            "type": "object",
            "properties": {
              "result": {
                "$ref": "#/components/schemas/Blockchain"
              }
            }
          }
        ]
      },
      "BlockHeader": {
        "required": [
          "version",
          "chain_id",
          "height",
          "time",
          "last_block_id",
          "last_commit_hash",
          "data_hash",
          "validators_hash",
          "next_validators_hash",
          "consensus_hash",
          "app_hash",
          "last_results_hash",
          "evidence_hash",
          "proposer_address"
        ],
        "properties": {
          "version": {
            "required": [
              "block",
              "app"
            ],
            "properties": {
              "block": {
                "type": "string",
                "example": "10"
              },
              "app": {
                "type": "string",
                "example": "0"
              }
            },
            "type": "object"
          },
          "chain_id": {
            "type": "string",
            "example": "cosmoshub-2"
          },
          "height": {
            "type": "string",
            "example": "12"
          },
          "time": {
            "type": "string",
            "example": "2019-04-22T17:01:51.701356223Z"
          },
          "last_block_id": {
            "$ref": "#/components/schemas/BlockID"
          },
          "last_commit_hash": {
            "type": "string",
            "example": "21B9BC845AD2CB2C4193CDD17BFC506F1EBE5A7402E84AD96E64171287A34812"
          },
          "data_hash": {
            "type": "string",
            "example": "970886F99E77ED0D60DA8FCE0447C2676E59F2F77302B0C4AA10E1D02F18EF73"
          },
          "validators_hash": {
            "type": "string",
            "example": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0"
          },
          "next_validators_hash": {
            "type": "string",
            "example": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0"
          },
          "consensus_hash": {
            "type": "string",
            "example": "0F2908883A105C793B74495EB7D6DF2EEA479ED7FC9349206A65CB0F9987A0B8"
          },
          "app_hash": {
            "type": "string",
            "example": "223BF64D4A01074DC523A80E76B9BBC786C791FB0A1893AC5B14866356FCFD6C"
          },
          "last_results_hash": {
            "type": "string",
            "example": ""
          },
          "evidence_hash": {
            "type": "string",
            "example": ""
          },
          "proposer_address": {
            "type": "string",
            "example": "D540AB022088612AC74B287D076DBFBC4A377A2E"
          }
        },
        "type": "object"
      },
      "BlockID": {
        "required": [
          "hash",
          "parts"
        ],
        "properties": {
          "hash": {
            "type": "string",
            "example": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7"
          },
          "parts": {
            "required": [
              "total",
              "hash"
            ],
            "properties": {
              "total": {
                "type": "integer",
                "example": 1
              },
              "hash": {
                "type": "string",
                "example": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
              }
            },
            "type": "object"
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```