> ## 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

> Retorna uma lista de blocos confirmados entre dois slots.

## Parâmetros da Requisição

<ParamField body="slot" type="number" required>
  Slot inicial (obrigatório).
</ParamField>

<ParamField body="slot" type="number" required>
  Slot final (opcional, deve ser ≤ 500.000 blocos do slot inicial).
</ParamField>

<ParamField body="commitment" type="string" default="finalized">
  O nível de commitment para a requisição.

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


## OpenAPI

````yaml pt-BR/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: Endpoint RPC Mainnet
  - url: https://devnet.helius-rpc.com
    description: Endpoint RPC Devnet
security: []
paths:
  /:
    post:
      tags:
        - RPC
      summary: getBlocks
      description: Retorna blocos confirmados entre um slot inicial e final.
      operationId: getBlocks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - jsonrpc
                - id
                - method
                - params
              properties:
                jsonrpc:
                  type: string
                  enum:
                    - '2.0'
                  description: A versão do protocolo JSON-RPC.
                  example: '2.0'
                  default: '2.0'
                id:
                  type: string
                  description: Um identificador único para a solicitação.
                  example: '1'
                  default: '1'
                method:
                  type: string
                  enum:
                    - getBlocks
                  description: O nome do método RPC a ser invocado.
                  example: getBlocks
                  default: getBlocks
                params:
                  type: array
                  description: Parâmetros de solicitação para o método.
                  default:
                    - 5
                    - 10
                    - commitment: finalized
                  items:
                    oneOf:
                      - type: integer
                        description: Slot inicial (obrigatório).
                        example: 5
                      - type: integer
                        description: >-
                          Slot final (opcional, deve ser ≤ 500.000 blocos do
                          slot inicial).
                        example: 10
                      - type: object
                        description: >-
                          O compromisso descreve quão finalizado um bloco está
                          naquele momento. "processed" não é suportado.
                        properties:
                          commitment:
                            type: string
                            description: O nível de compromisso para a solicitação.
                            enum:
                              - confirmed
                              - finalized
                            default: finalized
      responses:
        '200':
          description: Blocos confirmados recuperados com sucesso.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    enum:
                      - '2.0'
                    example: '2.0'
                  id:
                    type: string
                    description: Identificador correspondente à solicitação.
                    example: '1'
                  result:
                    type: array
                    description: Lista de blocos confirmados entre start_slot e end_slot.
                    items:
                      type: integer
                    example:
                      - 5
                      - 6
                      - 7
                      - 8
                      - 9
                      - 10
        '400':
          description: >-
            Requisição inválida - Parâmetros de solicitação inválidos ou
            requisição malformada.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32602
                  message: Parâmetros inválidos
        '401':
          description: Não autorizado - Chave API inválida ou ausente.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32001
                  message: Não autorizado
                id: '1'
        '429':
          description: Muitas solicitações - Limite de taxa excedido.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32005
                  message: Muitas solicitações
                id: '1'
        '500':
          description: Erro Interno do Servidor - Ocorreu um erro no servidor.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32603
                  message: Erro interno
                id: '1'
        '503':
          description: Serviço Indisponível - O serviço está temporariamente indisponível.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32002
                  message: Serviço indisponível
                id: '1'
        '504':
          description: Tempo Limite do Gateway - A solicitação expirou.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32003
                  message: Tempo limite do gateway
                id: '1'
      security:
        - ApiKeyQuery: []
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        jsonrpc:
          type: string
          enum:
            - '2.0'
          description: A versão do protocolo JSON-RPC.
          example: '2.0'
        error:
          type: object
          properties:
            code:
              type: integer
              description: O código de erro.
              example: -32602
            message:
              type: string
              description: A mensagem de erro.
              example: Parâmetros inválidos
        id:
          type: string
          description: Um identificador único para a solicitação.
          example: '1'
  securitySchemes:
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api-key
      description: >-
        Sua chave API Helius. Você pode obter uma gratuitamente no
        [dashboard](https://dashboard.helius.dev/api-keys).

````