TON billing: full vs archive
v2, v3, and v4 are priced the same, and all data is available. Billing follows the request: most TON requests are full (1 request unit), while requests that read historical data are archive (2 request units).getTransactions, getTransactionsStd, and the v4 account transaction routes are always archive; block/seqno methods are archive when the requested block is 128 or more seqno behind the tip. See Request units — TON method scope for the full method list.- TON API v2 endpoints serve real-time requests. TON API v2 requests serve off a node.
- TON API v3 endpoints serve indexed requests. TON API v3 requests serve off an indexer.
- TON API v4 endpoints serve block-pinned requests: each account-state read and get-method call names a masterchain block seqno in the URL. TON API v4 requests serve off a node.
Which one to choose
If speed and real-time freshness are crucial (for example, you need near-instant visibility of new transactions), go with v2. If you need highly stable, processed, and precise data, and can tolerate a slight indexing delay—v3 is likely the better option. If your code usesTonClient4 from @ton/ton, or you need account state and get-method results as of a specific block, use v4. v4 also streams new blocks over WebSocket.
Tip: If the data provided by v2 is sufficient for your use case, it should remain your best choice for simplicity and quick data access.
Key differences detailed
Indexing latency (data freshness)
v2: Delivers raw data more quickly, effectively providing the “freshest” data at any given moment. Feels more “native” because it uses the ADNL protocol directly, which often lets it react faster to blockchain changes. This native ADNL access is available on Chainstack Dedicated Nodes, enabling direct low-level network communication. v3: Performs additional data processing and indexing. As a result, it may have a slight lag compared to raw data sources. Offers well-structured and cleaned data, which can be advantageous for complex queries. If ultra-fresh data is a priority (for instance, if you need to see changes at near real-time), use v2 tends to have the edge. v4: Reads from the node over lite-server connections, with no indexing step.Request latency
Our TON RPC node network is global and we strive to always have the shortest travel time for your requests based on our highly tuned infrastructure. See also Available clouds, regions, and locations.TON API v4
TON API v4 is an HTTP and WebSocket API in which block, account-state, and get-method routes take a masterchain block seqno in the URL, so each result is pinned to that block. Chainstack serves the open-source ton-api-v4 server maintained by the TON community (originally built by Whales Corp), which reads from the TON node over lite-server connections. TON API v4 is available on TON Global Nodes on Mainnet and Testnet. TheTonClient4 class in @ton/ton is a client for TON API v4.
TON API v4 endpoint
The TON API v4 base URL isYOUR_CHAINSTACK_ENDPOINT/api/v4 — your node endpoint, which ends with your auth token, followed by /api/v4:
wss:// scheme. The full URLs for your node are in node access and credentials.
TON API v4 routes
Each route is relative to the TON API v4 base URL. Routes that take{seqno} return data as of that masterchain block.
Consecutive WebSocket messages can skip seqnos; fetch a skipped block with
/block/{seqno}. The ton-api-v4 README documents the routes with example responses.
Responses from block-pinned routes do not change and are returned with Cache-Control: public, max-age=31536000. /block/latest is returned with a max-age of 5 seconds or less.
Call TON API v4 with curl
Get the latest masterchain block:Call TON API v4 with TonClient4
Install the packages:index.mjs. It reads the latest block, then the wallet’s balance and seqno get-method result at that block:
index.mjs
node index.mjs:
TON API v4 billing
TON API v4 requests follow the TON full and archive rules. Block-pinned/block/{seqno}/... routes are archive when the seqno is 128 or more behind the masterchain tip, the /account/{address}/tx/... routes are always archive, and all other routes are full. See Request units — TON method scope.
