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

# getBlocks

> Returns a list of confirmed blocks between two slots.

## Request Parameters

<ParamField body="slot" type="number" required>
  Start slot (required).
</ParamField>

<ParamField body="slot" type="number" required>
  End slot (optional, must be ≤ 500,000 blocks from start slot).
</ParamField>

<ParamField body="commitment" type="string" default="finalized">
  The commitment level for the request.

  * `confirmed`
  * `finalized`
</ParamField>


## OpenAPI

````yaml openapi/rpc-http/getBlocks.yaml POST /
openapi: 3.1.0
info:
  title: Solana RPC API
  version: 1.0.0
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://mainnet.helius-rpc.com
    description: Mainnet RPC endpoint
  - url: https://devnet.helius-rpc.com
    description: Devnet RPC endpoint
security: []
paths:
  /:
    post:
      tags:
        - RPC
      summary: getBlocks
      description: Returns confirmed blocks between a start and end slot.
      operationId: getBlocks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - jsonrpc
                - id
                - method
                - params
              properties:
                jsonrpc:
                  type: string
                  enum:
                    - '2.0'
                  description: The JSON-RPC protocol version.
                  example: '2.0'
                  default: '2.0'
                id:
                  type: string
                  description: A unique identifier for the request.
                  example: '1'
                  default: '1'
                method:
                  type: string
                  enum:
                    - getBlocks
                  description: The name of the RPC method to invoke.
                  example: getBlocks
                  default: getBlocks
                params:
                  type: array
                  description: Request parameters for the method.
                  default:
                    - 5
                    - 10
                    - commitment: finalized
                  items:
                    oneOf:
                      - type: integer
                        description: Start slot (required).
                        example: 5
                      - type: integer
                        description: >-
                          End slot (optional, must be ≤ 500,000 blocks from
                          start slot).
                        example: 10
                      - type: object
                        description: >-
                          The commitment describes how finalized a block is at
                          that point in time. "processed" is not supported.
                        properties:
                          commitment:
                            type: string
                            description: The commitment level for the request.
                            enum:
                              - confirmed
                              - finalized
                            default: finalized
      responses:
        '200':
          description: Successfully retrieved confirmed blocks.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    enum:
                      - '2.0'
                    example: '2.0'
                  id:
                    type: string
                    description: Identifier matching the request.
                    example: '1'
                  result:
                    type: array
                    description: List of confirmed blocks between start_slot and end_slot.
                    items:
                      type: integer
                    example:
                      - 5
                      - 6
                      - 7
                      - 8
                      - 9
                      - 10
        '400':
          description: Bad Request - Invalid request parameters or malformed request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32602
                  message: Invalid params
        '401':
          description: Unauthorized - Invalid or missing API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32001
                  message: Unauthorized
                id: '1'
        '429':
          description: Too Many Requests - Rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32005
                  message: Too many requests
                id: '1'
        '500':
          description: Internal Server Error - An error occurred on the server.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32603
                  message: Internal error
                id: '1'
        '503':
          description: Service Unavailable - The service is temporarily unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32002
                  message: Service unavailable
                id: '1'
        '504':
          description: Gateway Timeout - The request timed out.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32003
                  message: Gateway timeout
                id: '1'
      security:
        - ApiKeyQuery: []
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        jsonrpc:
          type: string
          enum:
            - '2.0'
          description: The JSON-RPC protocol version.
          example: '2.0'
        error:
          type: object
          properties:
            code:
              type: integer
              description: The error code.
              example: -32602
            message:
              type: string
              description: The error message.
              example: Invalid params
        id:
          type: string
          description: A unique identifier for the request.
          example: '1'
  securitySchemes:
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api-key
      description: >-
        Your Helius API key. You can get one for free in the
        [dashboard](https://dashboard.helius.dev/api-keys).

````