Get account balance​

Retrieves account balance for coins / fungible asset (only for primary fungible asset store) for a given account, asset type and a specific ledger version.

The Aptos nodes prune account state history, via a configurable time window. If the requested ledger version has been pruned, the server responds with a 410.

Path Parameters:

address string <hex> required

Address of account with or without a 0x prefix

asset_type string <hex> required

A hex encoded 32 byte Aptos account address or a struct tag.

This is represented in a string as a 64 character hex string, sometimes shortened by stripping leading 0s, and adding a 0x or Format: {address}::{module name}::{struct name}

Query Parameters:

ledger_version string<uint64>

Ledger version to get state of account. If not provided, it will be the latest version

Response Header:

X-APTOS-BLOCK-HEIGHT integer

Current block height of the chain

X-APTOS-CHAIN-ID integer

Chain ID of the current chain

X-APTOS-EPOCH integer

Current epoch of the chain

X-APTOS-LEDGER-OLDEST-VERSION integer

Oldest non-pruned ledger version of the chain

X-APTOS-LEDGER-TIMESTAMPUSEC integer

Current timestamp of the chain

X-APTOS-LEDGER-VERSION integer

Current ledger version of the chain

X-APTOS-OLDEST-BLOCK-HEIGHT integer

Oldest non-pruned block height of the chain

Response Body:

integer uint64

Example:

// Request
curl -X GET -H 'Content-Type: application/json' https://aptos.blockpi.network/aptos/v1/your_api_key/v1/accounts/0x21746fce17b3a44156107bdc483bfeabb0bc4a37b8ceabaff93ed454bdea9653/balance/0x1::aptos_coin::AptosCoin

// Result
1817122

Last updated

Was this helpful?