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

# Get Block

> Get a single block by block number or block hash



## OpenAPI

````yaml GET /api/v1/customer/{chain}/block
openapi: 3.1.0
info:
  title: SonarX EVM API - Blocks
  description: >-
    Query block data, receipts, and transaction counts for EVM-compatible
    networks.
  version: 1.0.0
servers:
  - url: https://api-gateway.sonarx.com
    description: Production API
security:
  - apiKey: []
tags:
  - name: Blocks
    description: Query block data, receipts, and transaction counts
paths:
  /api/v1/customer/{chain}/block:
    get:
      tags:
        - Blocks
      summary: Get Block
      description: Get a single block by block number.
      operationId: getBlock
      parameters:
        - $ref: '#/components/parameters/ChainPath'
        - name: block_number
          in: query
          description: Block number to query (>= 0)
          required: true
          schema:
            type: integer
            minimum: 0
            example: 81901165
        - name: full_transactions
          in: query
          description: >-
            If true, returns full transaction objects; if false, returns only
            block data
          required: false
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: Block data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlockResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    ChainPath:
      name: chain
      in: path
      description: The blockchain network to query
      required: true
      schema:
        type: string
        enum:
          - polygon
        example: polygon
  schemas:
    BlockResponse:
      allOf:
        - $ref: '#/components/schemas/Block'
        - type: object
          properties:
            transactions:
              type: array
              nullable: true
              description: Array of transaction objects (when full_transactions=true)
              items:
                type: object
    Block:
      type: object
      properties:
        block_number:
          type: integer
          description: The block number
        timestamp:
          type: integer
          description: Unix timestamp of the block
        datetime:
          type: string
          format: date-time
          description: ISO 8601 formatted datetime
        block_hash:
          type: string
          description: Hash of the block
        block_parent_hash:
          type: string
          description: Hash of the parent block
        version:
          type: integer
          description: Block version
        logs_bloom:
          type: string
          description: Bloom filter for the logs
        transactions_root:
          type: string
          description: Root hash of the transactions trie
        state_root:
          type: string
          description: Root hash of the state trie
        receipts_root:
          type: string
          description: Root hash of the receipts trie
        miner:
          type: string
          description: Address of the block miner/validator
        extra_data:
          type: string
          description: Extra data included in the block
        size:
          type: integer
          description: Size of the block in bytes
        gas_limit:
          type: integer
          description: Maximum gas allowed in this block
        gas_used:
          type: integer
          description: Total gas used by all transactions
        transaction_count:
          type: integer
          description: Number of transactions in the block
        base_fee_per_gas:
          type: integer
          description: Base fee per gas in wei
      example:
        block_number: 81901165
        timestamp: 1768922302
        datetime: '2026-01-20T15:18:22'
        block_hash: '0x70977f71168a51813978584b23cccd0fa86cdc1239ab403feafc68e85733af1a'
        block_parent_hash: '0x8ee5ee7b7256f12f985f8dcdc2a3ca26a494be30ca6ba379cba2a5a06c6cd311'
        version: 0
        transactions_root: '0xb11abe9386303f977bbfa935f4b2c4924a45b41095c24b207828c12e2cb7f058'
        state_root: '0x7850f2b1d88f135ca3b7506add74ab738c168748ce825543d43d49ad2471c584'
        receipts_root: '0x74dd7cda82d48726b16c25560a00d11d37e525e35c060b6958e7350a53b47dd1'
        miner: '0x0000000000000000000000000000000000000000'
        size: 188062
        gas_limit: 65000000
        gas_used: 39500751
        transaction_count: 176
        base_fee_per_gas: 600795160350
    ErrorResponse:
      type: object
      properties:
        detail:
          type: string
          description: Error message
      required:
        - detail
  responses:
    BadRequest:
      description: Bad Request - Invalid parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingBlockNumber:
              summary: Missing block number
              value:
                detail: block_number is required
            mixedRangeParams:
              summary: Mixed block and datetime parameters
              value:
                detail: >-
                  Cannot mix block and datetime parameters. Use either
                  from_block/to_block or from_datetime/to_datetime, not both
            missingRangeParams:
              summary: No range parameters provided
              value:
                detail: >-
                  Either block range (from_block/to_block) or datetime range
                  (from_datetime/to_datetime) must be provided
            incompleteBlockRange:
              summary: Incomplete block range
              value:
                detail: Both from_block and to_block must be provided together
            incompleteDatetimeRange:
              summary: Incomplete datetime range
              value:
                detail: Both from_datetime and to_datetime must be provided together
            invalidBlockOrder:
              summary: Invalid block range order
              value:
                detail: to_block must be >= from_block
            blockRangeTooLarge:
              summary: Block range exceeds limit
              value:
                detail: Block range cannot exceed 100 blocks
    Unauthorized:
      description: Unauthorized - Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            detail: Invalid API key
    NotFound:
      description: Not Found - Resource does not exist
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            detail: Block not found
    InternalError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            detail: Internal server error
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: apikey
      description: API key for authentication. Contact SonarX to obtain your API key.

````