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

# List contracts logs across many contracts on the network

> Search the logs across many contracts with multiple contract calls. Chained logs are not
included but can be found by calling `/api/v1/contracts/{contractId}/results/{timestamp}`
or `/api/v1/contracts/results/{transactionId}`. When searching by topic a timestamp parameter must be supplied
and span a time range of at most seven days.

## Ordering
The order is governed by the combination of timestamp and index values. If the index param is omitted, the order is determined by the timestamp only.

Note: The default order for this API is currently DESC

## Filtering
When filtering there are some restrictions enforced to ensure correctness and scalability.

**The table below defines the restrictions and support for the endpoint**

| Query Param   | Comparison Operator | Support | Description           | Example |
| ------------- | ------------------- | ------- | --------------------- | ------- |
| index         | eq                  | Y       | Single occurrence only. Requires the presence of timestamp | ?index=X |
|               | ne                  | N       | | |
|               | lt(e)               | Y       | Single occurrence only. Requires the presence of timestamp | ?index=lte:X |
|               | gt(e)               | Y       | Single occurrence only. Requires the presence of timestamp | ?index=gte:X |
| timestamp     | eq                  | Y       | Single occurrence only. | ?timestamp=Y
|               | ne                  | N       | | |
|               | lt(e)               | Y       | Single occurrence only. Optional second timestamp **gt(e)** | ?timestamp=lte:Y
|               | gt(e)               | Y       | Single occurrence only. Optional second timestamp **lt(e)** | ?timestamp=gte:Y


Both filters must be a single occurrence of **gt(e)** or **lt(e)** which provide a lower and or upper boundary for search.




## OpenAPI

````yaml /openapi.yaml get /api/v1/contracts/results/logs
openapi: 3.0.3
info:
  title: Mirror Node REST API
  version: 0.154.0
  license:
    name: Apache-2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  description: >-
    The REST API offers the ability to query transactions and entity information
    from a mirror node.


    Base url: [/api/v1](/api/v1)


    OpenAPI Spec: [/api/v1/docs/openapi.yml](/api/v1/docs/openapi.yml)
  contact:
    name: Mirror Node Team
    email: mirrornode@hedera.com
    url: https://github.com/hiero-ledger/hiero-mirror-node
servers:
  - description: Hedera Mainnet Mirror Node
    url: https://mainnet.mirrornode.hedera.com
  - description: The production REST API servers
    url: '{scheme}://{network}.mirrornode.hedera.com'
    variables:
      scheme:
        default: https
        description: The URI scheme
        enum:
          - http
          - https
      network:
        default: testnet
        description: The Hedera network in use
        enum:
          - mainnet-public
          - mainnet
          - previewnet
          - testnet
security: []
tags:
  - name: accounts
    description: >-
      The accounts object represents the information associated with an account
      entity and returns a list of account information.The accounts list
      endpoint is cached and not updated as frequently as the account lookup by
      a specific ID endpoint.
    externalDocs:
      url: >-
        https://docs.hedera.com/guides/docs/mirror-node-api/cryptocurrency-api#accounts
  - name: balances
    description: >-
      The balance object represents the balance of accounts on the Hedera
      network.
    externalDocs:
      url: >-
        https://docs.hedera.com/guides/docs/mirror-node-api/cryptocurrency-api#balances
  - name: contracts
    description: >-
      The contracts objects represents the information associated with contract
      entities.The contracts list endpoint is cached and not updated as
      frequently as the contract lookup by a specific ID endpoint.
  - name: schedules
    description: >-
      The schedules object represents the information associated with a schedule
      entity.The schedules list endpoints is cached and not updated as
      frequently as the schedule lookup by a specific ID endpoint.
  - name: transactions
    description: >-
      The transaction object represents the transactions processed on the Hedera
      network.
    externalDocs:
      url: >-
        https://docs.hedera.com/guides/docs/mirror-node-api/cryptocurrency-api#transactions
  - name: topics
    description: >-
      The topics object represents the information associated with a topic
      entity and returns topic messages information.
    externalDocs:
      url: >-
        https://docs.hedera.com/guides/docs/mirror-node-api/cryptocurrency-api#topic-messages
  - name: tokens
    description: >-
      The tokens object represents the information associated with a token
      entity and returns a list of token information.The tokens list endpoint is
      cached and not updated as frequently as the token lookup by a specific ID.
externalDocs:
  description: REST API Docs
  url: https://docs.hedera.com/guides/docs/mirror-node-api/cryptocurrency-api
paths:
  /api/v1/contracts/results/logs:
    get:
      tags:
        - contracts
      summary: List contracts logs across many contracts on the network
      description: >
        Search the logs across many contracts with multiple contract calls.
        Chained logs are not

        included but can be found by calling
        `/api/v1/contracts/{contractId}/results/{timestamp}`

        or `/api/v1/contracts/results/{transactionId}`. When searching by topic
        a timestamp parameter must be supplied

        and span a time range of at most seven days.


        ## Ordering

        The order is governed by the combination of timestamp and index values.
        If the index param is omitted, the order is determined by the timestamp
        only.


        Note: The default order for this API is currently DESC


        ## Filtering

        When filtering there are some restrictions enforced to ensure
        correctness and scalability.


        **The table below defines the restrictions and support for the
        endpoint**


        | Query Param   | Comparison Operator | Support | Description          
        | Example |

        | ------------- | ------------------- | ------- | ---------------------
        | ------- |

        | index         | eq                  | Y       | Single occurrence
        only. Requires the presence of timestamp | ?index=X |

        |               | ne                  | N       | | |

        |               | lt(e)               | Y       | Single occurrence
        only. Requires the presence of timestamp | ?index=lte:X |

        |               | gt(e)               | Y       | Single occurrence
        only. Requires the presence of timestamp | ?index=gte:X |

        | timestamp     | eq                  | Y       | Single occurrence
        only. | ?timestamp=Y

        |               | ne                  | N       | | |

        |               | lt(e)               | Y       | Single occurrence
        only. Optional second timestamp **gt(e)** | ?timestamp=lte:Y

        |               | gt(e)               | Y       | Single occurrence
        only. Optional second timestamp **lt(e)** | ?timestamp=gte:Y



        Both filters must be a single occurrence of **gt(e)** or **lt(e)** which
        provide a lower and or upper boundary for search.
      operationId: getContractsLogs
      parameters:
        - $ref: '#/components/parameters/logIndexQueryParam'
        - $ref: '#/components/parameters/limitQueryParam'
        - $ref: '#/components/parameters/orderQueryParamDesc'
        - $ref: '#/components/parameters/timestampQueryParam'
        - $ref: '#/components/parameters/logTopic0QueryParam'
        - $ref: '#/components/parameters/logTopic1QueryParam'
        - $ref: '#/components/parameters/logTopic2QueryParam'
        - $ref: '#/components/parameters/logTopic3QueryParam'
        - $ref: '#/components/parameters/transactionHashQueryParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractLogsResponse'
        '400':
          $ref: '#/components/responses/InvalidParameterError'
components:
  parameters:
    logIndexQueryParam:
      name: index
      in: query
      description: Contract log index
      schema:
        type: string
        pattern: ^((eq|gt|gte|lt|lte):)?\d{1,10}$
      examples:
        noValue:
          summary: '--'
          value: ''
        indexNoOperator:
          summary: Example of index equals with no operator
          value: 2
        indexEqOperator:
          summary: Example of index equals with operator
          value: eq:2
        indexGtOperator:
          summary: Example of index greater than operator
          value: gt:2
        indexGteOperator:
          summary: Example of index greater than or equals operator
          value: gte:2
        indexLtOperator:
          summary: Example of index less than operator
          value: lt:2
        indexLteOperator:
          summary: Example of index less than or equals operator
          value: lte:2
    limitQueryParam:
      name: limit
      in: query
      description: The maximum number of items to return
      example: 2
      schema:
        format: int32
        type: integer
        default: 25
        minimum: 1
        maximum: 100
    orderQueryParamDesc:
      name: order
      in: query
      description: The order in which items are listed
      example: asc
      schema:
        enum:
          - asc
          - desc
        default: desc
    timestampQueryParam:
      description: >-
        The consensus timestamp as a Unix timestamp in seconds.nanoseconds
        format with an optional comparison operator. See
        [unixtimestamp.com](https://www.unixtimestamp.com/) for a simple way to
        convert a date to the 'seconds' part of the Unix time.
      name: timestamp
      in: query
      explode: true
      examples:
        noValue:
          summary: '--'
          value: ''
        secondsNoOperator:
          summary: Example of seconds equals with no operator
          value: 1234567890
        timestampNoOperator:
          summary: Example of timestamp equals with no operator
          value: 1234567890
        secondsEqOperator:
          summary: Example of seconds equals with operator
          value: eq:1234567890
        timestampEqOperator:
          summary: Example of timestamp equals with operator
          value: eq:1234567890.000000200
        secondsNeOperator:
          summary: Example of seconds not equals operator
          value: ne:1234567890
        timestampNeOperator:
          summary: Example of timestamp not equals operator
          value: ne:1234567890.000000300
        secondsGtOperator:
          summary: Example of seconds greater than operator
          value: gt:1234567890
        timestampGtOperator:
          summary: Example of timestamp greater than operator
          value: gt:1234567890.000000400
        secondsGteOperator:
          summary: Example of seconds greater than or equals operator
          value: gte:1234567890
        timestampGteOperator:
          summary: Example of timestamp greater than or equals operator
          value: gte:1234567890.000000500
        secondsLtOperator:
          summary: Example of seconds less than operator
          value: lt:1234567890
        timestampLtOperator:
          summary: Example of timestamp less than operator
          value: lt:1234567890.000000600
        secondsLteOperator:
          summary: Example of seconds less than or equals operator
          value: lte:1234567890
        timestampLteOperator:
          summary: Example of timestamp less than or equals operator
          value: lte:1234567890.000000700
      schema:
        type: array
        items:
          type: string
          pattern: ^((eq|gt|gte|lt|lte|ne):)?\d{1,10}(\.\d{1,9})?$
    logTopic0QueryParam:
      name: topic0
      in: query
      explode: true
      description: >-
        The first topic associated with a contract log. Requires a timestamp
        range also be populated.
      schema:
        $ref: '#/components/schemas/LogTopicQueryParam'
    logTopic1QueryParam:
      name: topic1
      in: query
      description: >-
        The second topic associated with a contract log. Requires a timestamp
        range also be populated.
      schema:
        $ref: '#/components/schemas/LogTopicQueryParam'
    logTopic2QueryParam:
      name: topic2
      in: query
      description: >-
        The third topic associated with a contract log. Requires a timestamp
        range also be populated.
      schema:
        $ref: '#/components/schemas/LogTopicQueryParam'
    logTopic3QueryParam:
      name: topic3
      in: query
      description: >-
        The fourth topic associated with a contract log. Requires a timestamp
        range also be populated.
      schema:
        $ref: '#/components/schemas/LogTopicQueryParam'
    transactionHashQueryParam:
      name: transaction.hash
      in: query
      schema:
        type: string
        pattern: ^(eq:)?(0x)?([0-9A-Fa-f]{64}|[0-9A-Fa-f]{96})$
      required: false
      description: >-
        A hex encoded 32-byte ethereum transaction hash or 48-byte hedera
        transaction hash.
      examples:
        transactionHash:
          value: ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
        transactionHashWith0xPrefix:
          value: '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
  schemas:
    ContractLogsResponse:
      type: object
      properties:
        logs:
          $ref: '#/components/schemas/ContractLogs'
        links:
          $ref: '#/components/schemas/Links'
    LogTopicQueryParam:
      type: array
      items:
        type: string
        pattern: ^(0x)?[0-9A-Fa-f]{1,64}$
    ContractLogs:
      type: array
      items:
        $ref: '#/components/schemas/ContractLog'
    Links:
      type: object
      properties:
        next:
          example: null
          nullable: true
          type: string
    Error:
      type: object
      properties:
        _status:
          type: object
          properties:
            messages:
              type: array
              items:
                type: object
                properties:
                  data:
                    description: Error message in hexadecimal
                    example: '0x3000'
                    format: binary
                    nullable: true
                    pattern: ^0x[0-9a-fA-F]+$
                    type: string
                  detail:
                    description: Detailed error message
                    example: Generic detailed error message
                    nullable: true
                    type: string
                  message:
                    description: Error message
                    example: Generic error message
                    nullable: false
                    type: string
    ContractLog:
      allOf:
        - $ref: '#/components/schemas/ContractResultLog'
        - type: object
          properties:
            block_hash:
              description: The hex encoded block (record file chain) hash
              example: >-
                0x553f9311833391c0a3b2f9ed64540a89f2190a511986cd94889f1c0cf7fa63e898b1c6730f14a61755d1fb4ca05fb073
              type: string
            block_number:
              description: >-
                The block height calculated as the number of record files
                starting from zero since network start.
              example: 10
              format: int64
              type: integer
            root_contract_id:
              allOf:
                - $ref: '#/components/schemas/EntityId'
                - description: The executed contract that created this contract log
            timestamp:
              $ref: '#/components/schemas/Timestamp'
            transaction_hash:
              type: string
              description: A hex encoded transaction hash
              example: >-
                0x397022d1e5baeb89d0ab66e6bf602640610e6fb7e55d78638db861e2c6339aa9
            transaction_index:
              description: The position of the transaction in the block
              nullable: true
              format: int32
              type: integer
              example: 1
    ContractResultLog:
      type: object
      properties:
        address:
          description: The hex encoded EVM address of the contract
          example: '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
          pattern: ^0x[0-9A-Fa-f]{40}$
          type: string
        bloom:
          allOf:
            - $ref: '#/components/schemas/Bloom'
            - description: The hex encoded bloom filter of the contract log
        contract_id:
          $ref: '#/components/schemas/EntityId'
        data:
          description: The hex encoded data of the contract log
          example: '0x00000000000000000000000000000000000000000000000000000000000000fa'
          nullable: true
          type: string
        index:
          description: The index of the contract log in the chain of logs for an execution
          example: 0
          type: integer
        topics:
          $ref: '#/components/schemas/ContractLogTopics'
    EntityId:
      type: string
      description: Network entity ID in the format of `shard.realm.num`
      pattern: ^\d{1,10}\.\d{1,10}\.\d{1,10}$
      example: 0.0.2
      nullable: true
    Timestamp:
      description: A Unix timestamp in seconds.nanoseconds format
      type: string
      example: '1586567700.453054000'
      pattern: ^\d{1,10}(\.\d{1,9})?$
    Bloom:
      example: '0x549358c4c2e573e02410ef7b5a5ffa5f36dd7398'
      format: binary
      nullable: true
      type: string
    ContractLogTopics:
      description: A list of hex encoded topics associated with this log event
      example:
        - '0xf4757a49b326036464bec6fe419a4ae38c8a02ce3e68bf0809674f6aab8ad300'
      items:
        type: string
      type: array
  responses:
    InvalidParameterError:
      description: Invalid parameter
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            _status:
              messages:
                - message: 'Invalid parameter: account.id'
                - message: >-
                    Invalid Transaction id. Please use \shard.realm.num-sss-nnn\
                    format where sss are seconds and nnn are nanoseconds

````