Get ERC20 token balances
https://api.triport.io/v1/polygon/wallet/tokens/0x0000000000000000000000000000000000001010?include_zero=falseReturns the list of ERC20 token balances held by a Polygon address, each with its on-chain metadata.
Fetches every ERC20 token balance held by the given Polygon (PoS) address and
returns each balance together with the token's contract metadata — name,
symbol, decimals, a human-readable ui_balance, and a logo_uri when one
is known.
By default only tokens with a non-zero balance are returned. Set
include_zero=true to also include tokens the address has interacted with but
currently holds none of.
The balance field is the raw integer amount as a decimal string (it can
exceed 64-bit range), while ui_balance is the same value already scaled by
decimals for display. Use balance for any exact arithmetic and treat
ui_balance as a convenience for rendering.
This endpoint requires the basic tier or higher. Requests from a free-tier
key are rejected with 403 tier_insufficient.
Parameters
Path parameters
addressstringrequired0x-prefixed, 40 hex characters (ETH-compatible format). Pattern: ^0x[0-9a-fA-F]{40}$.Query parametersobjectinclude_zerobooleanoptionalfalse.Response
Response fields
| Field | Type | Description |
|---|---|---|
address | string | The address that was queried (echoed back). |
tokens | array | List of PolyTokenBalance objects (see below). |
Each entry in tokens is a PolyTokenBalance:
| Field | Type | Required | Description |
|---|---|---|---|
contract | string | yes | ERC20 token contract address. |
balance | string | yes | Raw balance as a decimal string (u256-safe; may exceed 64-bit). |
decimals | integer | yes | Token decimals (0–36). |
ui_balance | number | no | balance scaled by decimals, for display. |
name | string | no | Token name, when known. |
symbol | string | no | Token symbol, when known. |
logo_uri | string (uri) | no | URL to the token logo, when known. |
Errors
| Code | Meaning | When it happens |
|---|---|---|
401 | unauthorized / trial_expired / subscription_expired | No or invalid credentials, or the key's trial / subscription has ended. |
403 | tier_insufficient / method_unknown | The key's tier is below basic, or the method is not part of the Polygon product. |
429 | rate_limited | Sustained RPS for the tier exceeded; honor the Retry-After header. |
All errors share the standard envelope (error, message, request_id). See
the errors reference for the full schema and per-code fields.
Examples
JavaScript (fetch)
const address = "0x0000000000000000000000000000000000001010";
const res = await fetch(
`https://api.triport.io/v1/polygon/wallet/tokens/${address}?include_zero=false`,
{ headers: { Authorization: `Bearer ${process.env.TRIPORT_API_KEY}` } }
);
if (!res.ok) throw new Error(`${res.status}: ${(await res.json()).message}`);
const { tokens } = await res.json();
for (const t of tokens) {
console.log(`${t.symbol}: ${t.ui_balance}`);
}TypeScript SDK (@triport/sdk)
import { Triport } from "@triport/sdk";
const client = new Triport({ apiKey: process.env.TRIPORT_API_KEY });
const { tokens } = await client.polygon.wallet.tokens(
"0x0000000000000000000000000000000000001010",
{ includeZero: false }
);
tokens.forEach((t) => console.log(`${t.symbol}: ${t.ui_balance}`));Python (triport-sdk)
import os
from triport import Triport
client = Triport(api_key=os.environ["TRIPORT_API_KEY"])
result = client.polygon.wallet.tokens(
"0x0000000000000000000000000000000000001010",
include_zero=False,
)
for t in result.tokens:
print(f"{t.symbol}: {t.ui_balance}")Notes
- Only
contract,balance, anddecimalsare guaranteed present.name,symbol,ui_balance, andlogo_uriare best-effort metadata and may be absent for unindexed or non-standard tokens. - For exact math (transfers, comparisons), use the raw
balancestring and the token'sdecimalsrather thanui_balance, which is adoubleand may lose precision for very large balances. - This endpoint covers fungible (ERC20) tokens only. For ERC721 / ERC1155
holdings use
GET /v1/polygon/wallet/nfts/{address}(protier). For the native MATIC balance useGET /v1/polygon/wallet/balance/{address}. - Transaction history for an address is available via
GET /v1/polygon/wallet/history/{address}.