> For the complete documentation index, see [llms.txt](https://docs.tajirchain.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tajirchain.com/etherscan-compatible-explorer-api/logs.md).

# Logs

The Logs module retrieves event logs emitted by smart contracts.

### Endpoint

```
https://explorer.tajirchain.com/api?module=logs
```

### Get Event Logs

#### Action

```
getLogs
```

A request must include a block range and at least one contract address or event topic.

### Parameters

<table data-search="false"><thead><tr><th>Parameter</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td><code>fromBlock</code></td><td>Yes</td><td>Starting block number or <code>latest</code></td></tr><tr><td><code>toBlock</code></td><td>Yes</td><td>Ending block number or <code>latest</code></td></tr><tr><td><code>address</code></td><td>Conditional</td><td>Contract address</td></tr><tr><td><code>topic0</code></td><td>Conditional</td><td>Primary event-signature topic</td></tr><tr><td><code>topic1</code></td><td>No</td><td>Second topic</td></tr><tr><td><code>topic2</code></td><td>No</td><td>Third topic</td></tr><tr><td><code>topic3</code></td><td>No</td><td>Fourth topic</td></tr><tr><td><code>topic0_1_opr</code></td><td>No</td><td><code>and</code> or <code>or</code></td></tr><tr><td><code>topic0_2_opr</code></td><td>No</td><td><code>and</code> or <code>or</code></td></tr><tr><td><code>topic0_3_opr</code></td><td>No</td><td><code>and</code> or <code>or</code></td></tr><tr><td><code>topic1_2_opr</code></td><td>No</td><td><code>and</code> or <code>or</code></td></tr><tr><td><code>topic1_3_opr</code></td><td>No</td><td><code>and</code> or <code>or</code></td></tr><tr><td><code>topic2_3_opr</code></td><td>No</td><td><code>and</code> or <code>or</code></td></tr></tbody></table>

### Query by Contract Address

```bash
curl "https://explorer.tajirchain.com/api?module=logs&action=getLogs&fromBlock=100000&toBlock=100100&address=0xCONTRACT_ADDRESS"
```

### Query by Event Topic

```bash
curl "https://explorer.tajirchain.com/api?module=logs&action=getLogs&fromBlock=100000&toBlock=100100&topic0=0xEVENT_SIGNATURE_TOPIC"
```

### Query by Address and Multiple Topics

```bash
curl "https://explorer.tajirchain.com/api?module=logs&action=getLogs&fromBlock=100000&toBlock=100100&address=0xCONTRACT_ADDRESS&topic0=0xTOPIC0&topic1=0xTOPIC1&topic0_1_opr=and"
```

### Example Response

```json
{
  "message": "OK",
  "result": [
    {
      "address": "0x...",
      "blockNumber": "0x...",
      "data": "0x...",
      "gasPrice": "0x...",
      "gasUsed": "0x...",
      "logIndex": "0x...",
      "timeStamp": "0x...",
      "topics": [
        "0x..."
      ],
      "transactionHash": "0x...",
      "transactionIndex": "0x..."
    }
  ],
  "status": "1"
}
```

### Limits

A maximum of approximately 1,000 logs may be returned per request.

For reliable results:

* Keep block ranges limited
* Use an address or event topic
* Paginate the search through multiple block ranges
* Avoid repeatedly querying the entire chain
* Cache historical event results

A `"No logs found"` response can indicate a valid request with no matching events.
