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

# Get Event Logs by Topics

> Retrieves event logs within a specified block range, filtered by topics.

export const chain = '1';

<ResponseExample>
  ```json Example response theme={null}
  {
    "status": "1",
    "message": "OK",
    "result": [
      {
        "address": "0xbd3531da5cf5857e7cfaa92426877b022e612cf8",
        "topics": [
          "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
          "0x0000000000000000000000000000000000000000000000000000000000000000",
          "0x000000000000000000000000c45a4b3b698f21f88687548e7f5a80df8b99d93d",
          "0x00000000000000000000000000000000000000000000000000000000000000b5"
        ],
        "data": "0x",
        "blockNumber": "0xc48174",
        "blockHash": "0x837e109ab8b1b40ec7d1032bff82397325d85e719b97d900fa0d9aa9745b2c27",
        "timeStamp": "0x60f9ce56",
        "gasPrice": "0x2e90edd000",
        "gasUsed": "0x247205",
        "logIndex": "0x",
        "transactionHash": "0x4ffd22d986913d33927a392fe4319bcd2b62f3afe1c15a2c59f77fc2cc4c20a9",
        "transactionIndex": "0x"
      }
    ]
  }
  ```
</ResponseExample>


## OpenAPI

````yaml openapi/api-reference/endpoint/getlogs-topics.json GET /v2/api
openapi: 3.1.0
info:
  title: Get Event Logs by Topics
  version: 2.0.0
  description: Retrieves event logs within a specified block range, filtered by topics.
  license:
    name: Etherscan API Terms
    url: https://etherscan.io/terms
servers:
  - url: https://api.etherscan.io
    description: Etherscan API.
security:
  - apiKey: []
paths:
  /v2/api:
    get:
      summary: Get Event Logs by Topics
      description: Retrieves event logs within a specified block range, filtered by topics.
      operationId: getGetlogsTopics
      parameters:
        - name: chainid
          in: query
          required: true
          description: >-
            Chain ID to query, eg 1 for Ethereum, 42161 for Arbitrum from our
            [supported chains](/supported-chains).
          schema:
            type: string
          example: '1'
        - name: module
          in: query
          required: true
          description: Set to logs for this endpoint.
          schema:
            type: string
            default: logs
          example: logs
        - name: action
          in: query
          required: true
          description: Set to getLogs for this endpoint.
          schema:
            type: string
            default: getLogs
          example: getLogs
        - name: fromBlock
          in: query
          required: true
          description: Starting block number to search from.
          schema:
            type: integer
          example: 12878196
        - name: toBlock
          in: query
          required: true
          description: Ending block number to search to.
          schema:
            type: integer
          example: 12879196
        - name: topic0
          in: query
          required: false
          description: >-
            The first topic to filter by. Provide at least one of topic0,
            topic1, topic2, or topic3.
          schema:
            type: string
          example: '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
        - name: topic0_1_opr
          in: query
          required: false
          description: Topic operator between topic0 and topic1, either and or or.
          schema:
            type: string
          example: and
        - name: topic1
          in: query
          required: false
          description: Second topic to filter by.
          schema:
            type: string
          example: '0x0000000000000000000000000000000000000000000000000000000000000000'
        - name: topic1_2_opr
          in: query
          required: false
          description: Topic operator between topic1 and topic2, either and or or.
          schema:
            type: string
          example: and
        - name: topic2
          in: query
          required: false
          description: Third topic to filter by.
          schema:
            type: string
          example: '0x000000000000000000000000c45a4b3b698f21f88687548e7f5a80df8b99d93d'
        - name: topic2_3_opr
          in: query
          required: false
          description: Topic operator between topic2 and topic3, either and or or.
          schema:
            type: string
          example: and
        - name: topic3
          in: query
          required: false
          description: Fourth topic to filter by.
          schema:
            type: string
          example: '0x00000000000000000000000000000000000000000000000000000000000000b5'
        - name: topic0_2_opr
          in: query
          required: false
          description: Topic operator between topic0 and topic2, either and or or.
          schema:
            type: string
          example: and
        - name: topic0_3_opr
          in: query
          required: false
          description: Topic operator between topic0 and topic3, either and or or.
          schema:
            type: string
          example: and
        - name: topic1_3_opr
          in: query
          required: false
          description: Topic operator between topic1 and topic3, either and or or.
          schema:
            type: string
          example: and
        - name: page
          in: query
          required: false
          description: Page number for pagination.
          schema:
            type: integer
          example: 1
        - name: offset
          in: query
          required: false
          description: >-
            Number of records per page. Use the page parameter for subsequent
            records.
          schema:
            type: integer
          example: 100
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: >-
                      1 if the request returned data, 0 otherwise. A status of 0
                      can indicate an error or a valid request that returned no
                      records.
                  message:
                    type: string
                    description: >-
                      OK on success, otherwise an error description such as
                      NOTOK. See [common error
                      messages](/common-error-messages).
                  result:
                    type: array
                    items:
                      type: object
                      properties:
                        address:
                          type: string
                          description: Address of the contract that emitted the log.
                        topics:
                          type: array
                          description: >-
                            Array of indexed log topics. The first topic is the
                            event signature hash.
                        data:
                          type: string
                          description: Non-indexed event data, as a hex string.
                        blockNumber:
                          type: string
                          description: >-
                            Block number in which the log was recorded, in
                            hexadecimal.
                        blockHash:
                          type: string
                          description: Hash of the block containing the log.
                        timeStamp:
                          type: string
                          description: >-
                            Time the block was mined, as a UNIX timestamp in
                            hexadecimal.
                        gasPrice:
                          type: string
                          description: >-
                            Gas price of the transaction that produced the log,
                            in wei (hexadecimal).
                        gasUsed:
                          type: string
                          description: >-
                            Gas used by the transaction that produced the log,
                            in hexadecimal.
                        logIndex:
                          type: string
                          description: >-
                            Index position of the log within the block, in
                            hexadecimal.
                        transactionHash:
                          type: string
                          description: Hash of the transaction that produced the log.
                        transactionIndex:
                          type: string
                          description: >-
                            Index of the transaction within the block, in
                            hexadecimal.
      security:
        - apiKey: []
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: query
      name: apikey
      description: >-
        Enter your Etherscan API key, or [set one up](/set-up-your-api-key) if
        you don't have one.

````