Since nodes communicate through the binary ADNL protocol, an intermediate layer is needed for web-based access. API v2 provides this bridge by using
tonlib
to query data from liteservers and exposes it through a standard REST interface.
Base URLs
| API | Mainnet | Testnet |
|---|---|---|
| API v2 | https://toncenter.com/api/v2 | https://testnet.toncenter.com/api/v2 |
Versioning
API v2 uses semantic versioning in the formata.b.c (for example, 2.1.1):
| Segment | Example | Meaning |
|---|---|---|
| Major | 2.x.x | Fixed at 2 to avoid confusion (“API v2 v3.x.x”). Will not change. |
| Minor | 2.1.x | Implementation variant: 0 = Python version, 1 = C++ version. |
| Patch | 2.1.1 | Bumped with every release on GitHub. |
Typical use cases
- Query account balances and state
- Run get-methods on smart contracts
- Send or broadcast messages
- Retrieve latest transactions and block information
Endpoints
| Category | Method | Description |
|---|---|---|
| Accounts | GET /getAddressInformation | Get account state and balance |
| Accounts | GET /getExtendedAddressInformation | Get detailed account state (extended) |
| Accounts | GET /getWalletInformation | Get wallet information |
| Accounts | GET /getTransactions | List account transactions |
| Accounts | GET /getAddressBalance | Get account balance only |
| Accounts | GET /getAddressState | Get account lifecycle state |
| Accounts | GET /packAddress | Convert raw address to user-friendly format |
| Accounts | GET /unpackAddress | Convert user-friendly address to raw format |
| Accounts | GET /getTokenData | Get NFT or Jetton metadata |
| Accounts | GET /detectAddress | Detect all address formats |
| Blocks | GET /getMasterchainInfo | Get latest masterchain info |
| Blocks | GET /getMasterchainBlockSignatures | Get masterchain block signatures |
| Blocks | GET /getShardBlockProof | Get shard block proof |
| Blocks | GET /getConsensusBlock | Get latest consensus block |
| Blocks | GET /lookupBlock | Look up block by height, LT, or timestamp |
| Blocks | GET /shards | Get shards at masterchain seqno |
| Blocks | GET /getBlockTransactions | List block transactions |
| Blocks | GET /getBlockTransactionsExt | List block transactions (extended details) |
| Blocks | GET /getBlockHeader | Get block header metadata |
| Blocks | GET /getLibraries | Get smart contract libraries |
| Blocks | GET /getOutMsgQueueSizes | Get outgoing message queue sizes |
| Transactions | GET /tryLocateTx | Locate transaction by incoming message |
| Transactions | GET /tryLocateResultTx | Locate result transaction by incoming message |
| Transactions | GET /tryLocateSourceTx | Locate source transaction by outgoing message |
| JSON-RPC | POST /jsonRPC | JSON-RPC handler |
| Config | GET /getConfigParam | Get single config parameter |
| Config | GET /getConfigAll | Get all config parameters |
| Messages and transactions | POST /sendBoc | Send external message (BoC) |
| Messages and transactions | POST /sendBocReturnHash | Send external message and return hash |
| Messages and transactions | POST /sendQuery | Send unpacked external query |
| Messages and transactions | POST /estimateFee | Estimate transaction fees |
| Smart contracts | POST /runGetMethod | Run get-method on contract |