TRON HTTP API Reference: Essential Endpoints for Developers — TRON Wiki

TRON HTTP API Reference: Essential Endpoints for Developers

11 min read · ⌘K search

TRON full nodes expose a JSON-over-HTTP API similar in spirit to Ethereum's JSON-RPC but method-oriented — wallet/getaccount, wallet/createtransaction, wallet/triggersmartcontract, and dozens more. TronGrid hosts load-balanced endpoints so most developers never run their own node.

This reference lists the endpoints you will use daily for balances, transactions, contract calls, and event indexing.

Base URLs

NetworkTronGrid base URL
Mainnethttps://api.trongrid.io
Shasta testnethttps://api.shasta.trongrid.io
Nile testnethttps://nile.trongrid.io

All paths append /wallet/... or use /v1/... REST wrappers.

Register API key: trongrid.io — header TRON-PRO-API-KEY.

Deep dive: TronGrid API guide.

Request format

Most wallet/* endpoints:

Code
POST /wallet/getaccount
Content-Type: application/json

{"address": "TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7", "visible": true}

visible: true → Base58 addresses. false → hex with 41 prefix.

Account endpoints

EndpointPurpose
wallet/getaccountTRX balance, frozen, votes, permissions
wallet/getaccountresourceEnergy, bandwidth available
wallet/validateaddressChecksum validation
wallet/createaccountActivate new account (costs TRX)

getaccount example

Code
curl -X POST https://api.trongrid.io/wallet/getaccount \
  -H "TRON-PRO-API-KEY: $KEY" \
  -d '{"address":"TYourAddress","visible":true}'

TRC-20 balances use contract calls or v1 API — query TRC-20 balance.

Transaction endpoints

EndpointPurpose
wallet/createtransactionBuild TRX transfer
wallet/broadcasttransactionSubmit signed tx
wallet/gettransactionbyidRaw transaction by txid
wallet/gettransactioninfobyidReceipt, fee, logs, result
wallet/gettransactioncountbyblocknumBlock tx count

Verify flow: verify transaction API.

Code
const info = await fetch('https://api.trongrid.io/wallet/gettransactioninfobyid', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', 'TRON-PRO-API-KEY': key },
  body: JSON.stringify({ value: txid })
}).then(r => r.json());

// info.receipt.result === 'SUCCESS'

Smart contract endpoints

EndpointPurpose
wallet/triggersmartcontractState-changing call
wallet/triggerconstantcontractRead-only call
wallet/deploycontractDeploy bytecode
wallet/getcontractContract metadata

Guide: trigger smart contract.

v1 REST API

Higher-level REST at /v1/:

PathPurpose
GET /v1/accounts/{address}Account summary
GET /v1/accounts/{address}/transactionsTRX txs
GET /v1/accounts/{address}/transactions/trc20TRC-20 transfers
GET /v1/contracts/{address}/eventsContract events

Example TRC-20 history:

Code
GET /v1/accounts/TAddr.../transactions/trc20?only_confirmed=true&contract_address=TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t&limit=20

Event endpoints

Code
GET /v1/contracts/{contract}/events?event_name=Transfer&only_confirmed=true

Filter client-side for to address or use block timestamp filters.

Event listeners patterns.

Block endpoints

EndpointPurpose
wallet/getnowblockLatest block
wallet/getblockbynumBlock by number
wallet/getblockbyidBlock by hash

Useful for confirmation counting in payment systems — accept USDT payments.

Signing workflow

Typical server flow:

  1. createtransaction or triggersmartcontract → unsigned tx
  2. Sign with private key (TronWeb trx.sign)
  3. broadcasttransaction → txid

TronWeb wraps all three — TronWeb introduction.

Rate limits and errors

HTTP codeMeaning
429Rate limited — backoff, upgrade key
503Node overload — retry
400Malformed request — check visible and address format

Production: cache reads, websocket alternatives limited — poll with discipline.

TronWeb vs raw HTTP

Use TronWebUse raw HTTP
Node.js / browser dAppPython, Go, Rust services
ABI encodingCustom microservices
Rapid prototypingStrict dependency control

Security

  • Never POST private keys to TronGrid
  • Sign locally or HSM
  • API key is not secret like private key but don't commit to Git
  • Validate all addresses server-side — check address valid

Testnet differences

Same endpoint paths, different base URL. USDT contract address differs on testnet — use faucet tokens.

Mainnet vs testnet.

FAQ

What is the base URL for TRON mainnet API?

https://api.trongrid.io for TronGrid. Self-hosted nodes use same paths on your host.

Do I need an API key for TronGrid?

Recommended for production — higher rate limits via TRON-PRO-API-KEY header.

Is TRON API REST or JSON-RPC?

Hybrid — legacy wallet/* POST JSON plus v1 REST resources. Not identical to Ethereum JSON-RPC.

How do I get USDT balance via API?

triggerconstantcontract balanceOf(address) or v1 trc20 account token list endpoints.

Where is official API documentation?

TronGrid docs at developers.tron.network and trongrid.io — this article summarizes common endpoints.