> 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.md).

# Etherscan-Compatible Explorer API

The Tajir Chain Explorer provides an Etherscan-compatible API for applications that use the traditional `module` and `action` request format.

This interface supports account balances, blocks, transactions, tokens, smart contracts, event logs and network statistics.

### Base Endpoints

#### Mainnet

```
https://explorer.tajirchain.com/api
```

#### Testnet

```
https://explorer.testnet.tajirchain.com/api
```

No API key is currently required for standard public requests.

### Request Format

#### GET

```
https://explorer.tajirchain.com/api?module=MODULE&action=ACTION&PARAMETER=VALUE
```

#### POST

```bash
curl --request POST \
  --url https://explorer.tajirchain.com/api \
  --header "Content-Type: application/json" \
  --data '{
    "module": "block",
    "action": "eth_block_number"
  }'
```

### Quick Connectivity Test

```bash
curl --request GET \
  --url "https://explorer.tajirchain.com/api?module=block&action=eth_block_number"
```

Successful response:

```json
{
  "jsonrpc": "2.0",
  "result": "0x...",
  "id": 1
}
```

The result contains the latest indexed block number in hexadecimal format.

### API Modules

| Module                                                                                                                                                 | Description                                                   |
| ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------- |
| [Account](https://app.gitbook.com/o/w5Q87ZGYNeEKY9GUGNBA/s/AbtkglQlMKahYwDUwHV1/~/edit/~/changes/90/etherscan-compatible-explorer-api/account)         | Balances, address activity, token transfers and mined blocks  |
| [Logs](https://app.gitbook.com/o/w5Q87ZGYNeEKY9GUGNBA/s/AbtkglQlMKahYwDUwHV1/~/edit/~/changes/90/etherscan-compatible-explorer-api/logs)               | Smart-contract event logs and topic filtering                 |
| [Token](https://app.gitbook.com/o/w5Q87ZGYNeEKY9GUGNBA/s/AbtkglQlMKahYwDUwHV1/~/edit/~/changes/90/etherscan-compatible-explorer-api/token)             | Token information, supply and holders                         |
| [Stats](https://app.gitbook.com/o/w5Q87ZGYNeEKY9GUGNBA/s/AbtkglQlMKahYwDUwHV1/~/edit/~/changes/90/etherscan-compatible-explorer-api/stats)             | Native supply, token supply, prices and transaction fees      |
| [Block](https://app.gitbook.com/o/w5Q87ZGYNeEKY9GUGNBA/s/AbtkglQlMKahYwDUwHV1/~/edit/~/changes/90/etherscan-compatible-explorer-api/block)             | Block rewards, countdowns, timestamps and latest block number |
| [Contract](https://app.gitbook.com/o/w5Q87ZGYNeEKY9GUGNBA/s/AbtkglQlMKahYwDUwHV1/~/edit/~/changes/90/etherscan-compatible-explorer-api/contract)       | Contract information, ABI, source code and verification       |
| [Transaction](https://app.gitbook.com/o/w5Q87ZGYNeEKY9GUGNBA/s/AbtkglQlMKahYwDUwHV1/~/edit/~/changes/90/etherscan-compatible-explorer-api/transaction) | Transaction information, receipt status and errors            |

All module documentation is hosted directly inside Tajir Chain GitBook.

### Response Formats

Most actions return an Etherscan-compatible response:

```json
{
  "status": "1",
  "message": "OK",
  "result": {}
}
```

Some Ethereum-compatible actions return a JSON-RPC response:

```json
{
  "jsonrpc": "2.0",
  "result": "0x...",
  "id": 1
}
```

Applications using this compatibility API should support both formats.

### Empty Results

A valid request with no matching data may return:

```json
{
  "status": "0",
  "message": "No records found",
  "result": []
}
```

A `status` value of `"0"` does not always mean that the API failed. Check the `message` and `result` fields.

### HTTP Status Codes

|      Status | Meaning                                      |
| ----------: | -------------------------------------------- |
|       `200` | Request processed; inspect the response body |
|       `400` | Invalid module, action or parameters         |
|       `404` | API path not found                           |
|       `429` | Too many requests                            |
| `500`–`599` | Explorer or upstream service error           |

### Unsupported Proxy Module

The following Etherscan-style proxy format is not supported:

```
/api?module=proxy&action=eth_chainId
```

For Ethereum JSON-RPC requests, use:

```
https://rpc.tajirchain.com
```

Or use the limited Explorer RPC proxy:

```
https://explorer.tajirchain.com/api/eth-rpc
```

### Usage Guidelines

Public API endpoints may enforce pagination, block-range limits, rate limits, timeouts and response-size limits.

Applications should:

* Use pagination
* Cache historical responses
* Keep event-log block ranges limited
* Avoid unnecessary repeated requests
* Implement exponential backoff
* Handle HTTP `429` and temporary `5xx` responses
* Inspect the response body even when HTTP status is `200`

### Security

Never send the following information to an Explorer endpoint:

* Private keys
* Seed or recovery phrases
* Signing credentials
* Infrastructure credentials
* Internal server addresses
* Confidential user information

Contract verification publishes source code and metadata publicly. Confirm that the submitted source contains no private information before verification.
