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

At least one of `address` or `topic0` is required.




## OpenAPI

````yaml /openapi-specs/pro-rpc-api-universal.json get /v2/api?module=logs&action=getLogs
openapi: 3.1.0
info:
  title: 'Blockscout PRO API: RPC and ETH RPC'
  version: 2.0.0
  description: >
    Blockscout's Etherscan-compatible RPC API and standard ETH JSON-RPC methods,
    served from the multichain PRO API.


    ## Base URL


    All requests go to `https://api.blockscout.com`. Choose the network with
    `chain_id` (for example `1` for Ethereum or `8453` for Base).


    ## Authentication


    A PRO API key is required on every request, including the free tier. Get one
    at [dev.blockscout.com](https://dev.blockscout.com).

    Send it as the `apikey` query parameter or as an `Authorization: Bearer
    YOUR_KEY` header. See [API rate
    limits](https://docs.blockscout.com/rate-limits) for plan limits.


    Requests without a key are not served: the API responds with HTTP `402`. To
    call without an API key, pay per call with [x402
    payments](https://docs.blockscout.com/devs/x402-payments).


    ## RPC API (module and action)


    Etherscan-style requests. Pass `chain_id`, `module` and `action`:


    ```

    https://api.blockscout.com/v2/api?chain_id=1&module=account&action=balance&address=0x...&apikey=YOUR_KEY

    ```


    The same calls are also available at
    `https://api.blockscout.com/{chain_id}/api?module=...&action=...`.


    ## ETH RPC API (JSON-RPC)


    Standard Ethereum JSON-RPC methods use `POST` requests:


    ```

    POST https://api.blockscout.com/{chain_id}/json-rpc

    Content-Type: application/json

    Authorization: Bearer YOUR_KEY


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

    ```


    ## Migrating from Etherscan


    Replace the base URL with `https://api.blockscout.com/v2/api` and rename
    `chainid` to `chain_id`. Module and action names are the same for most
    calls.
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  contact:
    name: Blockscout Community
    url: https://discord.gg/blockscout
servers:
  - url: https://api.blockscout.com
security:
  - bearerAuth: []
  - apiKeyAuth: []
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:
  /v2/api?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.

        At least one of `address` or `topic0` is required.
      operationId: get-event-logs
      parameters:
        - $ref: '#/components/parameters/chain_id_query'
        - $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: '18000000'
        - in: query
          name: toBlock
          schema:
            type: string
          required: true
          description: Ending block number or 'latest'
          example: '18000100'
        - in: query
          name: address
          schema:
            $ref: '#/components/schemas/AddressHash'
          required: false
          description: Contract address (address and/or topic is required)
          example: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
        - in: query
          name: topic0
          schema:
            type: string
          required: false
          description: First topic (topic and/or address is required)
          example: '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
        - 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'
          headers:
            x-credits-remaining:
              description: >-
                Number of credits remaining in your plan. Resets daily on the
                free plan, monthly otherwise.
              schema:
                type: integer
            x-ratelimit-limit:
              description: >-
                Available requests per second with your plan. Returns -1 on
                internal error.
              schema:
                type: integer
            x-ratelimit-remaining:
              description: >-
                Remaining rate limit based on your queries. Returns -1 on
                internal error.
              schema:
                type: integer
            x-ratelimit-reset:
              description: >-
                Time in milliseconds until the rate limit resets. Returns -1 on
                internal error.
              schema:
                type: integer
      externalDocs:
        url: https://docs.blockscout.com/devs/apis/rpc/logs
components:
  parameters:
    chain_id_query:
      name: chain_id
      in: query
      required: true
      description: The ID of the blockchain
      schema:
        type: string
      example: '1'
    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
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT
      description: API key passed as a Bearer token in the Authorization header.
      scheme: bearer
      type: http
    apiKeyAuth:
      description: API key passed as the `apikey` query parameter.
      in: query
      name: apikey
      type: apiKey

````

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