For the complete documentation index, see llms.txt. This page is also available as Markdown.

account/balance - Cardano

Example code for the account/balance JSON-RPC method. Complete guide on how to use account/balance JSON-RPC in GetBlock Web3 documentation.

This endpoint returns the balance of an account, optionally at a historical block. Balances include ada and any native assets held by the address.

Parameters

The request body is a JSON object with the following fields.

Field
Type
Required
Description

network_identifier

object

Yes

The network to query

account_identifier

object

Yes

The account, with an address field

block_identifier

object

No

Partial identifier for a historical balance lookup

Request

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/account/balance' \
--header 'Content-Type: application/json' \
--data-raw '{
    "network_identifier": {
        "blockchain": "cardano",
        "network": "mainnet"
    },
    "account_identifier": {
        "address": "addr1qxy2lpan99fcnhhyzr8w8qk4dqz4mp7g6b8h3r2v5c9d0e1f2g3h4j5k6l7m8n9p0q"
    }
}'
example.js
const response = await fetch(
    'https://go.getblock.io/<ACCESS-TOKEN>/account/balance',
    {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({"network_identifier": {"blockchain": "cardano", "network": "mainnet"}, "account_identifier": {"address": "addr1qxy2lpan99fcnhhyzr8w8qk4dqz4mp7g6b8h3r2v5c9d0e1f2g3h4j5k6l7m8n9p0q"}})
    }
);
console.log(await response.json());
example.py
import requests

response = requests.post(
    'https://go.getblock.io/<ACCESS-TOKEN>/account/balance',
    headers={'Content-Type': 'application/json'},
    json={"network_identifier": {"blockchain": "cardano", "network": "mainnet"}, "account_identifier": {"address": "addr1qxy2lpan99fcnhhyzr8w8qk4dqz4mp7g6b8h3r2v5c9d0e1f2g3h4j5k6l7m8n9p0q"}}
)

print(response.json())

Response

Response Parameters

Field
Type
Description

block_identifier

object

The block the balance was read at

balances

array

Balances by currency, including ada and native assets

balances[].value

string

Balance amount in the currency's base unit

balances[].currency

object

Currency symbol, decimals, and native-asset metadata

Use Cases

  • Balance Display: Show an address's ada and token balances

  • Historical Balances: Read a balance at a past block

  • Exchange Accounting: Track deposit address balances

  • Portfolio Tools: Aggregate native-asset holdings

Error Handling

Error Code
Message
Description

12

Invalid account format

The requested account identifier is improperly formatted

4

Block not found

The requested block does not exist for a historical lookup

5

Internal error

The node failed to read account data

Last updated

Was this helpful?