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

> Get traces for all transactions in a block

<Info>
  **Polygon Data Availability**: Polygon traces are only available from January 2025 onwards.
</Info>


## OpenAPI

````yaml GET /api/v1/customer/{chain}/blocks/traces
openapi: 3.1.0
info:
  title: SonarX EVM API - Traces
  description: >-
    Query execution traces for transactions and blocks on EVM-compatible
    networks.
  version: 1.0.0
servers:
  - url: https://api-gateway.sonarx.com
    description: Production API
security:
  - apiKey: []
tags:
  - name: Traces
    description: Query execution traces for transactions and blocks
paths:
  /api/v1/customer/{chain}/blocks/traces:
    get:
      tags:
        - Traces
      summary: Get Block Traces
      description: Get traces for all transactions in a block.
      operationId: getBlockTraces
      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
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/Offset'
      responses:
        '200':
          description: Block traces
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlockTracesResponse'
        '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
    Limit:
      name: limit
      in: query
      description: Maximum number of results (1-50)
      required: false
      schema:
        type: integer
        minimum: 1
        maximum: 50
        default: 10
    Offset:
      name: offset
      in: query
      description: Number of results to skip for pagination
      required: false
      schema:
        type: integer
        minimum: 0
        default: 0
  schemas:
    BlockTracesResponse:
      type: object
      properties:
        block_number:
          type: integer
        offset:
          type: integer
        limit:
          type: integer
        result:
          type: array
          items:
            $ref: '#/components/schemas/Trace'
        count:
          type: integer
      example:
        block_number: 81901165
        offset: 0
        limit: 10
        result:
          - block_number: 81901165
            timestamp: 1768922302
            datetime: '2026-01-20T15:18:22'
            transaction_hash: '0x6a9cb0071fe44d7cf50962bc9ea05dfe45662d34c71f4f8b12fb3918f62f9692'
            transaction_index: 0
            trace_address: 0.0.0.0
            transaction_from: '0x17fc3813d8761eab20e8d16ba7d38b92547dec91'
            transaction_to: '0x4eb48fecfb61873809270972f7d9d5a90c23752d'
            transaction_status: false
            call_type: delegatecall
            from_address: '0x3c499c542cef5e3811e1192ce70d8cc03d5c3359'
            to_address: '0x235ae97b28466db30469b89a9fe4cff0659f82cb'
            gas: 168760
            gas_used: 16263
            gas_refund: 152497
            value: '0'
            subtraces: 0
            type: call
            input: >-
              0xa9059cbb0000000000000000000000004eb48fecfb61873809270972f7d9d5a90c23752d000000000000000000000000000000000000000000000000000000000a6751f4
            output: '0x0000000000000000000000000000000000000000000000000000000000000001'
            error: null
            function_signature: '0xa9059cbb'
            version: 0
        count: 1
    Trace:
      type: object
      properties:
        block_number:
          type: integer
          description: Block number
        timestamp:
          type: integer
          description: Unix timestamp
        datetime:
          type: string
          format: date-time
        transaction_hash:
          type: string
          description: Transaction hash
        transaction_index:
          type: integer
        trace_address:
          type: string
          description: Position in trace tree (e.g., '0', '0.0', '0.0.0')
        transaction_from:
          type: string
          description: Original transaction sender
        transaction_to:
          type: string
          description: Original transaction recipient
        transaction_status:
          type: boolean
          description: Overall transaction success
        call_type:
          type: string
          description: Type of call (call, delegatecall, staticcall, create)
        from_address:
          type: string
          description: Sender of this trace call
        to_address:
          type: string
          description: Recipient of this trace call
        gas:
          type: integer
          description: Gas provided
        gas_used:
          type: integer
          description: Gas used
        gas_refund:
          type: integer
          description: Gas refunded
        value:
          type: string
          description: Value in wei
        subtraces:
          type: integer
          description: Number of sub-calls
        type:
          type: string
          description: Trace type (call, create, suicide)
        input:
          type: string
          description: Input data
        output:
          type: string
          description: Output data
        error:
          type: string
          nullable: true
          description: Error message if failed
        function_signature:
          type: string
          description: Function selector (first 4 bytes of input)
        version:
          type: integer
      example:
        block_number: 81911103
        timestamp: 1768942178
        datetime: '2026-01-20T20:49:38'
        transaction_hash: '0x0063079708b5fab44762765a01c17ab2754ebc15cb9ecd0e14fcbbd520452c27'
        transaction_index: 80
        trace_address: ''
        transaction_from: '0xb63c1246a11edc1e784c39ab95295e4180c5071b'
        transaction_to: '0x9ead30c8518a19f0b493eea1bd5af8fcc5fd4ba2'
        transaction_status: true
        call_type: call
        from_address: '0xb63c1246a11edc1e784c39ab95295e4180c5071b'
        to_address: '0x9ead30c8518a19f0b493eea1bd5af8fcc5fd4ba2'
        gas: 200
        gas_used: 0
        gas_refund: 200
        value: '100000000000'
        subtraces: 0
        type: call
        input: 0x
        output: 0x
        error: null
        function_signature: 0x
        version: 0
    ErrorResponse:
      type: object
      properties:
        detail:
          type: string
      required:
        - detail
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: apikey
      description: API key for authentication

````