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

# API Overview

## RPC (JSON-RPC / WebSocket)

Standard EVM JSON-RPC over HTTPS/WSS. Testnet: `https://z2-test-node.zetrix.com` (Chain ID `938748`). Production: `https://z2-node.zetrix.com`.

| Method                      | Purpose                         |
| --------------------------- | ------------------------------- |
| `eth_chainId`               | Return the Z2 chain ID          |
| `eth_blockNumber`           | Latest block height             |
| `eth_getBalance`            | Account balance                 |
| `eth_sendRawTransaction`    | Submit signed tx                |
| `eth_call`                  | Read-only contract call         |
| `eth_getTransactionReceipt` | Tx receipt/status               |
| `eth_getLogs`               | Event logs                      |
| `eth_subscribe` (WS)        | Subscribe to heads/logs/pending |

## Bridge API (Deposit/Withdraw)

| Operation | Direction | Notes                                             |
| --------- | --------- | ------------------------------------------------- |
| Deposit   | L1 → L2   | Lock on L1, mint on L2 (Relayer)                  |
| Withdraw  | L2 → L1   | Burn on L2, finalize on L1 after challenge window |
| Status    | —         | Track deposit/withdraw state                      |

## MCP API (`z2-zetrix-mcp`)

| Tool               | Purpose                        |
| ------------------ | ------------------------------ |
| deposit            | Initiate L1→L2 deposit         |
| withdraw           | Initiate L2→L1 withdrawal      |
| nft                | NFT query/transfer             |
| transaction status | Track soft/final status        |
| L2 info            | Blocks, balances, network info |

Install: `npm install -g z2-zetrix-mcp`.

## Explorer API

| Endpoint (illustrative) | Purpose                    |
| ----------------------- | -------------------------- |
| `/api/blocks`           | List/query blocks          |
| `/api/tx/{hash}`        | Transaction detail         |
| `/api/address/{addr}`   | Account/tx history         |
| `/api/tokens`           | Token metadata/holders     |
| `/api/contracts/{addr}` | Contract info/verification |

## Monitoring API

| Endpoint                 | Purpose                  |
| ------------------------ | ------------------------ |
| `/metrics` (per service) | Prometheus scrape        |
| Prometheus HTTP API      | Query time-series        |
| Grafana API              | Dashboards/alerts (auth) |

> \[!NOTE] Explorer and Monitoring endpoint paths above are illustrative; actual routes depend on the deployment.

***

[← Scaling Strategy](/zetrix-l2-documentation/reliability-and-security/scaling-strategy.md) · [Index](/zetrix-l2-documentation/readme.md) · [Appendix →](/zetrix-l2-documentation/reference/appendix.md)
