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

> Get execution trace for a specific transaction

**Supported chains**: `ethereum`, `polygon`, `base`, `arbitrum`, `optimism`, `binance`, `avalanche`, `gnosis`

> [!NOTE]
>
> **Per-chain trace fields**: On `arbitrum`, `avalanche`, `base`, and `optimism`, the fields `call_type`, `subtraces`, `balance`, `refund_address`, `author`, `reward_type`, and `init` are always `null` — the underlying trace data does not carry them.

> [!TIP]
>
> Pass the optional `block_number` query parameter whenever you know it — it makes the lookup significantly faster, especially on high-volume chains.

> [!NOTE]
>
> **Polygon Data Availability**: Polygon traces are only available from January 2025 onwards.


## OpenAPI

````yaml GET /api/v1/customer/{chain}/transactions/{transaction_hash}/traces
openapi: 3.1.0
info:
  title: SonarX EVM API - Traces
  description: >-
    Query execution traces for transactions and blocks on EVM-compatible
    networks. All endpoints require an `apikey` enabled for the data API;
    requests with a missing or unrecognized key receive 403.
  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}/transactions/{transaction_hash}/traces:
    get:
      tags:
        - Traces
      summary: Get Transaction Traces
      description: >-
        Get execution trace for a specific transaction. Traces provide detailed
        information about all internal calls made during transaction execution.
        On arbitrum, avalanche, base, and optimism the fields `call_type`,
        `subtraces`, `balance`, `refund_address`, `author`, `reward_type`, and
        `init` are always null (the underlying trace data does not carry them).
      operationId: getTransactionTraces
      parameters:
        - $ref: '#/components/parameters/ChainPath'
        - name: transaction_hash
          in: path
          description: Transaction hash (66 character hex string starting with 0x)
          required: true
          schema:
            type: string
            pattern: ^0x[a-fA-F0-9]{64}$
            example: '0x00dcc066aad65ae4f10c0fc4ec1fac5d3693c12c01d98a9f6a87448be9b26200'
        - name: block_number
          in: query
          description: >-
            Block number of the transaction. Optional but strongly recommended —
            providing it makes the lookup significantly faster, especially on
            high-volume chains.
          required: false
          schema:
            type: integer
            minimum: 0
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/Offset'
      responses:
        '200':
          description: Transaction traces
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionTracesResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '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:
          - ethereum
          - polygon
          - base
          - arbitrum
          - optimism
          - binance
          - avalanche
          - gnosis
        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:
    TransactionTracesResponse:
      type: object
      properties:
        transaction_hash:
          type: string
        offset:
          type: integer
        limit:
          type: integer
        result:
          type: array
          items:
            $ref: '#/components/schemas/Trace'
        count:
          type: integer
      example:
        transaction_hash: '0x0063079708b5fab44762765a01c17ab2754ebc15cb9ecd0e14fcbbd520452c27'
        offset: 0
        limit: 10
        result:
          - 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
        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: number
          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)
      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
    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'
    Forbidden:
      description: Forbidden - the API key is not enabled for this endpoint
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            detail: API key is not enabled for this endpoint
    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

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.