You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过API接口查询IOTA代币余额?

How to Fetch IOTA Coin Balance via Official API

Got it, let's walk through how to get your IOTA Coin balance directly using the official API step by step—no need to dig through docs for hours anymore.

Core Endpoint: getBalances

The official getBalances endpoint is designed specifically for pulling balance data for one or more IOTA addresses. It returns both total and confirmed balances based on your specified confirmation threshold.

Key Parameters

  • addresses (required): An array of IOTA addresses (in Bech32 format, starting with iota1q... for mainnet) you want to check. You can pass multiple addresses in a single request.
  • threshold (optional, default: 100): The number of confirmations needed for a transaction to be considered "confirmed". Higher values mean more secure, finalized balance data.

Example Request (curl)

Here's a quick command-line example to test the endpoint:

curl -X POST https://api.iota.org/api/v1/getBalances \
  -H "Content-Type: application/json" \
  -d '{
    "addresses": ["iota1qzxyz...your-full-address-here..."],
    "threshold": 100
  }'

Example Response

A successful response will structure data like this:

{
  "balances": ["987654321"],
  "references": ["txHash123..."],
  "milestoneIndex": 456789,
  "duration": 15
}
  • balances: An array matching the order of your input addresses, showing the total balance in IOTA tokens (1 IOTA = 10^-9 MIOTA).
  • references: The latest confirmed transaction hash for each address.
  • milestoneIndex: The current network milestone index when the balance was calculated.
  • duration: Time taken to process the request (in milliseconds).

Quick Tips

  • Double-check that your addresses are correctly formatted—invalid addresses will throw an error.
  • Stick to the default threshold value of 100 unless you have a specific need for more/less confirmations.
  • Add error handling in your code to account for network timeouts or invalid requests.

内容的提问来源于stack exchange,提问作者venkat venki

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 08:19:22