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

# Get Event Logs by Address/Topics/Block Range

> Returns event logs for an address and topic combination.
Up to a maximum of 1,000 event logs.
Use topic operators (and/or) to specify topic retrieval options.




## OpenAPI

````yaml /openapi-specs/jsonrpc-endpoints.yaml get /?module=logs&action=getLogs
openapi: 3.1.0
info:
  title: Blockscout RPC API
  version: 1.0.0
  description: >
    Blockscout is an open-source blockchain explorer for Ethereum-based
    networks.


    This API is provided for developers transitioning applications from
    Etherscan to Blockscout 

    and applications requiring general API and data support. It supports GET and
    POST requests.


    ## Authentication


    **API keys are OPTIONAL** for all RPC endpoints. The API works without
    authentication but has different rate limits:


    - **Without API key:** 5 requests per second (shared pool across all users)

    - **With API key:** 10 requests per second per key (dedicated limit)

    - **Free tier:** Up to 3 API keys per account at no cost


    To use an API key, add `apikey=YOUR_API_KEY` to the query string:

    ```

    https://eth.blockscout.com/api?module=account&action=balance&address=0x123...&apikey=YOUR_API_KEY

    ```


    ## Base URL Format

    URLs vary by instance. With typical installations, access the API by adding
    `/api` to the end 

    of the instance URL.


    **Example:** `https://eth-sepolia.blockscout.com/api`


    ## Query Format


    ### RPC API (Module/Action format)

    An example query includes a module and action(s)/parameters:

    ```

    https://eth-sepolia.blockscout.com/api?module=account&action=balance&address=0x123...

    ```


    ### ETH RPC API (JSON-RPC format)

    Standard Ethereum JSON-RPC methods use POST requests to `/api/eth-rpc`:

    ```

    POST https://eth.blockscout.com/api/eth-rpc

    Content-Type: application/json


    {"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}

    ```


    Note: API keys can also be used with ETH RPC endpoints by adding
    `?apikey=YOUR_API_KEY` to the URL.
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  contact:
    name: Blockscout Community
    url: https://discord.gg/blockscout
servers:
  - url: https://eth.blockscout.com/api
    description: Ethereum Mainnet Explorer (RPC API)
  - url: https://eth-sepolia.blockscout.com/api
    description: Ethereum Sepolia Testnet Explorer (RPC API)
  - url: https://base.blockscout.com/api
    description: Base Mainnet Explorer (RPC API)
  - url: https://optimism.blockscout.com/api
    description: Optimism Mainnet Explorer (RPC API)
  - url: https://gnosis.blockscout.com/api
    description: Gnosis Chain Explorer (RPC API)
security:
  - {}
tags:
  - name: Account
    description: Account-related endpoints
  - name: Block
    description: Block-related endpoints
  - name: Contract
    description: Smart contract-related endpoints
  - name: Logs
    description: Event logs endpoints
  - name: Stats
    description: Network statistics endpoints
  - name: Token
    description: Token-related endpoints
  - name: Transaction
    description: Transaction-related endpoints
  - name: ETH RPC
    description: Ethereum JSON-RPC compatible endpoints
externalDocs:
  url: https://docs.blockscout.com/devs/apis/rpc
paths:
  /?module=logs&action=getLogs:
    get:
      tags:
        - Logs
      summary: Get Event Logs by Address/Topics/Block Range
      description: |
        Returns event logs for an address and topic combination.
        Up to a maximum of 1,000 event logs.
        Use topic operators (and/or) to specify topic retrieval options.
      operationId: get-event-logs
      parameters:
        - $ref: '#/components/parameters/module_logs'
        - $ref: '#/components/parameters/action_getLogs'
        - in: query
          name: fromBlock
          schema:
            type: string
          required: true
          description: Starting block number or 'latest'
          example: '1379224'
        - in: query
          name: toBlock
          schema:
            type: string
          required: true
          description: Ending block number or 'latest'
          example: '13792288'
        - in: query
          name: address
          schema:
            $ref: '#/components/schemas/AddressHash'
          required: false
          description: Contract address (address and/or topic is required)
        - in: query
          name: topic0
          schema:
            type: string
          required: false
          description: First topic (topic and/or address is required)
        - in: query
          name: topic1
          schema:
            type: string
          required: false
          description: Second topic
        - in: query
          name: topic2
          schema:
            type: string
          required: false
          description: Third topic
        - in: query
          name: topic3
          schema:
            type: string
          required: false
          description: Fourth topic
        - in: query
          name: topic0_1_opr
          schema:
            type: string
            enum:
              - and
              - or
          required: false
          description: Operator for topic0 and topic1
        - in: query
          name: topic0_2_opr
          schema:
            type: string
            enum:
              - and
              - or
          required: false
          description: Operator for topic0 and topic2
        - in: query
          name: topic0_3_opr
          schema:
            type: string
            enum:
              - and
              - or
          required: false
          description: Operator for topic0 and topic3
        - in: query
          name: topic1_2_opr
          schema:
            type: string
            enum:
              - and
              - or
          required: false
          description: Operator for topic1 and topic2
        - in: query
          name: topic1_3_opr
          schema:
            type: string
            enum:
              - and
              - or
          required: false
          description: Operator for topic1 and topic3
        - in: query
          name: topic2_3_opr
          schema:
            type: string
            enum:
              - and
              - or
          required: false
          description: Operator for topic2 and topic3
      responses:
        '200':
          description: Event logs retrieved successfully
          content:
            application/json:
              schema:
                oneOf:
                  - allOf:
                      - $ref: '#/components/schemas/ResponseOK'
                      - type: object
                        properties:
                          result:
                            type: array
                            items:
                              $ref: '#/components/schemas/Log'
                  - $ref: '#/components/schemas/ResponseNOTOK'
      externalDocs:
        url: https://docs.blockscout.com/devs/apis/rpc/logs
components:
  parameters:
    module_logs:
      name: module
      in: query
      required: true
      schema:
        type: string
        enum:
          - logs
      description: Module name (must be 'logs')
    action_getLogs:
      name: action
      in: query
      required: true
      schema:
        type: string
        enum:
          - getLogs
  schemas:
    AddressHash:
      type: string
      pattern: ^0x[a-fA-F0-9]{40}$
      example: '0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae'
      description: 40-character hexadecimal address hash with 0x prefix
    ResponseOK:
      type: object
      properties:
        status:
          type: string
          enum:
            - '1'
          description: Status code (1 = OK)
        message:
          type: string
          example: OK
          description: Response message
    Log:
      type: object
      properties:
        address:
          $ref: '#/components/schemas/AddressHash'
        topics:
          type: array
          items:
            type: string
        data:
          type: string
        blockNumber:
          type: string
        timeStamp:
          type: string
        gasPrice:
          type: string
        gasUsed:
          type: string
        logIndex:
          type: string
        transactionHash:
          $ref: '#/components/schemas/TransactionHash'
        transactionIndex:
          type: string
    ResponseNOTOK:
      type: object
      properties:
        status:
          type: string
          enum:
            - '0'
          description: Status code (0 = Error)
        message:
          type: string
          example: NOTOK
          description: Error message
        result:
          type: string
          nullable: true
          description: Error details
    TransactionHash:
      type: string
      pattern: ^0x[a-fA-F0-9]{64}$
      example: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'
      description: 64-character hexadecimal transaction hash with 0x prefix

````