TriportRPC

Get ERC20 token balances

GEThttps://api.triport.io/v1/polygon/wallet/tokens/0x0000000000000000000000000000000000001010?include_zero=false

Returns the list of ERC20 token balances held by a Polygon address, each with its on-chain metadata.

Polygonbasic+ (category polygon_wallet); RPS-per-tier with burst

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

addressstringrequired
Polygon address, 0x-prefixed, 40 hex characters (ETH-compatible format). Pattern: ^0x[0-9a-fA-F]{40}$.
Query parametersobject
include_zerobooleanoptional
Include tokens with a zero balance. Default false.

Response

Response fields

FieldTypeDescription
addressstringThe address that was queried (echoed back).
tokensarrayList of PolyTokenBalance objects (see below).

Each entry in tokens is a PolyTokenBalance:

FieldTypeRequiredDescription
contractstringyesERC20 token contract address.
balancestringyesRaw balance as a decimal string (u256-safe; may exceed 64-bit).
decimalsintegeryesToken decimals (0–36).
ui_balancenumbernobalance scaled by decimals, for display.
namestringnoToken name, when known.
symbolstringnoToken symbol, when known.
logo_uristring (uri)noURL to the token logo, when known.

Errors

CodeMeaningWhen it happens
401unauthorized / trial_expired / subscription_expiredNo or invalid credentials, or the key's trial / subscription has ended.
403tier_insufficient / method_unknownThe key's tier is below basic, or the method is not part of the Polygon product.
429rate_limitedSustained 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, and decimals are guaranteed present. name, symbol, ui_balance, and logo_uri are best-effort metadata and may be absent for unindexed or non-standard tokens.
  • For exact math (transfers, comparisons), use the raw balance string and the token's decimals rather than ui_balance, which is a double and 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} (pro tier). For the native MATIC balance use GET /v1/polygon/wallet/balance/{address}.
  • Transaction history for an address is available via GET /v1/polygon/wallet/history/{address}.