HTTP API
Getting Started
This documentation provides a comprehensive guide to using the TON HTTP API, including API endpoints, request and response formats, and error handling. Whether you're building a new application or integrating with an existing one, this documentation will help you get started with the TON HTTP API quickly and efficiently.
Get basic information about the address: balance, code, data, last_transaction_id.
Identifier of target TON account in any form.
GET /api/v2/getAddressInformation?address=text HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Accept: */*
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Similar to previous one but tries to parse additional information for known contract types. This method is based on tonlib's function getAccountState. For detecting wallets we recommend to use getWalletInformation.
Identifier of target TON account in any form.
GET /api/v2/getExtendedAddressInformation?address=text HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Accept: */*
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Retrieve wallet information. This method parses contract state and currently supports more wallet types than getExtendedAddressInformation: simple wallet, standart wallet, v3 wallet, v4 wallet.
Identifier of target TON account in any form.
GET /api/v2/getWalletInformation?address=text HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Accept: */*
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Get transaction history of a given address.
Identifier of target TON account in any form.
Maximum number of transactions in response.
10
Logical time of transaction to start with, must be sent with hash.
Hash of transaction to start with, in base64 or hex encoding , must be sent with lt.
Logical time of transaction to finish with (to get tx from lt to to_lt).
0
By default getTransaction request is processed by any available liteserver. If archival=true only liteservers with full history are used.
false
GET /api/v2/getTransactions?address=text HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Accept: */*
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Get balance (in nanotons) of a given address.
Identifier of target TON account in any form.
GET /api/v2/getAddressBalance?address=text HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Accept: */*
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Get state of a given address. State can be either unitialized, active or frozen.
Identifier of target TON account in any form.
GET /api/v2/getAddressState?address=text HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Accept: */*
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Convert an address from raw to human-readable format.
Identifier of target TON account in raw form.
0:83DFD552E63729B472FCBCC8C45EBCC6691702558B68EC7527E1BA403A0F31A8
GET /api/v2/packAddress?address=text HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Accept: */*
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Convert an address from human-readable to raw format.
Identifier of target TON account in user-friendly form
EQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqB2N
GET /api/v2/unpackAddress?address=text HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Accept: */*
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Get up-to-date masterchain state.
GET /api/v2/getMasterchainInfo HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Accept: */*
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Get up-to-date masterchain state.
GET /api/v2/getMasterchainBlockSignatures?seqno=1 HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Accept: */*
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Get merkle proof of shardchain block.
Block workchain id
Block shard id
Block seqno
Seqno of masterchain block starting from which proof is required. If not specified latest masterchain block is used.
GET /api/v2/getShardBlockProof?workchain=1&shard=1&seqno=1 HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Accept: */*
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Get consensus block and its update timestamp.
GET /api/v2/getConsensusBlock HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Accept: */*
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Look up block by either seqno, lt or unixtime.
Workchain id to look up block in
Shard id to look up block in
Block's height
Block's logical time
Block's unixtime
GET /api/v2/lookupBlock?workchain=1&shard=1 HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Accept: */*
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Get shards information.
Masterchain seqno to fetch shards of.
GET /api/v2/shards?seqno=1 HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Accept: */*
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Get transactions of the given block.
40
GET /api/v2/getBlockTransactions?workchain=1&shard=1&seqno=1 HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Accept: */*
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Get metadata of a given block.
GET /api/v2/getBlockHeader?workchain=1&shard=1&seqno=1 HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Accept: */*
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Get config by id.
Config id
Masterchain seqno. If not specified, latest blockchain state will be used.
GET /api/v2/getConfigParam?config_id=1 HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Accept: */*
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Get NFT or Jetton information.
Address of NFT collection/item or Jetton master/wallet smart contract
GET /api/v2/getTokenData?address=text HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Accept: */*
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Locate outcoming transaction of destination address by incoming message.
GET /api/v2/tryLocateTx?source=text&destination=text&created_lt=1 HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Accept: */*
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Same as previous. Locate outcoming transaction of destination address by incoming message
GET /api/v2/tryLocateResultTx?source=text&destination=text&created_lt=1 HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Accept: */*
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Locate incoming transaction of source address by outcoming message.
GET /api/v2/tryLocateSourceTx?source=text&destination=text&created_lt=1 HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Accept: */*
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Get all possible address forms.
Identifier of target TON account in any form.
GET /api/v2/detectAddress?address=text HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Accept: */*
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Send serialized boc file: fully packed and serialized external message to blockchain.
b64 encoded bag of cells
POST /api/v2/sendBoc HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 14
{
"boc": "text"
}
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Send serialized boc file: fully packed and serialized external message to blockchain. The method returns message hash.
b64 encoded bag of cells
POST /api/v2/sendBocReturnHash HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 14
{
"boc": "text"
}
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Send query - unpacked external message. This method takes address, body and init-params (if any), packs it to external message and sends to network. All params should be boc-serialized.
Address in any format
b64-encoded boc-serialized cell with message body
b64-encoded boc-serialized cell with init-code
""
b64-encoded boc-serialized cell with init-data
""
POST /api/v2/sendQuery HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 62
{
"address": "text",
"body": "text",
"init_code": "",
"init_data": ""
}
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Estimate fees required for query processing. body, init-code and init-data accepted in serialized format (b64-encoded).
Address in any format
b64-encoded cell with message body
b64-encoded cell with init-code
""
b64-encoded cell with init-data
""
If true during test query processing assume that all chksig operations return True
true
POST /api/v2/estimateFee HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 83
{
"address": "text",
"body": "text",
"init_code": "",
"init_data": "",
"ignore_chksig": true
}
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
Run get method on smart contract.
Contract address
Method name or method id
POST /api/v2/runGetMethod HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 47
{
"address": "text",
"method": "text",
"stack": [
[]
]
}
{
"ok": true,
"result": "text",
"error": "text",
"code": 1
}
All methods in the API are available through JSON-RPC protocol (spec).
{}
POST /api/v2/jsonRPC HTTP/1.1
Host:
X-API-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 58
{
"method": "text",
"params": {},
"id": "text",
"jsonrpc": "text"
}
{
"ok": true,
"result": null,
"error": "text",
"code": 1,
"id": "text",
"jsonrpc": "2.0"
}
Last updated
Was this helpful?