> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ton.org/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.ton.org/feedback

```json
{
  "path": "/ecosystem/api/toncenter/v3/blockchain-data/get-blocks",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Get blocks

> Returns blocks by specified filters.



## OpenAPI

````yaml get /api/v3/blocks
openapi: 3.0.0
info:
  title: TON Index (Go)
  description: >-
    TON Index collects data from a full node to PostgreSQL database and provides
    convenient API to an indexed blockchain.
  version: 1.2.4-rc
  contact: {}
servers:
  - url: https://toncenter.com
  - url: https://testnet.toncenter.com
security: []
paths:
  /api/v3/blocks:
    get:
      tags:
        - Blockchain Data
      summary: Get blocks
      description: Returns blocks by specified filters.
      operationId: api_v3_get_blocks
      parameters:
        - name: workchain
          in: query
          description: Block workchain.
          schema:
            type: integer
            format: int32
        - name: shard
          in: query
          description: >-
            Block shard id. Must be sent with *workchain*. Example:
            `8000000000000000`.
          schema:
            type: string
        - name: seqno
          in: query
          description: Block block seqno. Must be sent with *workchain* and *shard*.
          schema:
            type: integer
            format: int32
        - name: root_hash
          in: query
          description: Block root hash.
          schema:
            type: string
        - name: file_hash
          in: query
          description: Block file hash.
          schema:
            type: string
        - name: mc_seqno
          in: query
          description: Masterchain block seqno
          schema:
            type: integer
            format: int32
        - name: start_utime
          in: query
          description: >-
            Query blocks with generation UTC timestamp **after** given
            timestamp.
          schema:
            type: integer
            format: int32
            minimum: 0
        - name: end_utime
          in: query
          description: >-
            Query blocks with generation UTC timestamp **before** given
            timestamp.
          schema:
            type: integer
            format: int32
            minimum: 0
        - name: start_lt
          in: query
          description: Query blocks with `lt >= start_lt`.
          schema:
            type: integer
            format: int64
            minimum: 0
        - name: end_lt
          in: query
          description: Query blocks with `lt <= end_lt`.
          schema:
            type: integer
            format: int64
            minimum: 0
        - name: limit
          in: query
          description: Limit number of queried rows. Use with *offset* to batch read.
          schema:
            type: integer
            format: int32
            default: 10
            minimum: 1
            maximum: 1000
        - name: offset
          in: query
          description: Skip first N rows. Use with *limit* to batch read.
          schema:
            type: integer
            format: int32
            default: 0
            minimum: 0
        - name: sort
          in: query
          description: Sort results by UTC timestamp.
          schema:
            type: string
            default: desc
            enum:
              - asc
              - desc
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlocksResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RequestError'
      security: []
components:
  schemas:
    BlocksResponse:
      type: object
      properties:
        blocks:
          type: array
          items:
            $ref: '#/components/schemas/Block'
    RequestError:
      type: object
      properties:
        code:
          type: integer
        error:
          type: string
    Block:
      type: object
      properties:
        after_merge:
          type: boolean
        after_split:
          type: boolean
        before_split:
          type: boolean
        created_by:
          type: string
        end_lt:
          type: string
          example: '0'
        file_hash:
          type: string
        flags:
          type: integer
        gen_catchain_seqno:
          type: integer
        gen_utime:
          type: string
          example: '0'
        global_id:
          type: integer
        key_block:
          type: boolean
        master_ref_seqno:
          type: integer
        masterchain_block_ref:
          $ref: '#/components/schemas/BlockId'
        min_ref_mc_seqno:
          type: integer
        prev_blocks:
          type: array
          items:
            $ref: '#/components/schemas/BlockId'
        prev_key_block_seqno:
          type: integer
        rand_seed:
          type: string
        root_hash:
          type: string
        seqno:
          type: integer
        shard:
          type: string
          example: '0'
        start_lt:
          type: string
          example: '0'
        tx_count:
          type: integer
        validator_list_hash_short:
          type: integer
        version:
          type: integer
        vert_seqno:
          type: integer
        vert_seqno_incr:
          type: boolean
        want_merge:
          type: boolean
        want_split:
          type: boolean
        workchain:
          type: integer
    BlockId:
      type: object
      properties:
        seqno:
          type: integer
        shard:
          type: string
          example: '0'
        workchain:
          type: integer

````