Skip to main content
GET
/
v1
/
networks
/
{network}
/
blockchains
/
{blockchainId}
/
balances
JavaScript
import { Avalanche } from "@avalanche-sdk/chainkit";

const avalanche = new Avalanche({
  network: "mainnet",
});

async function run() {
  const result = await avalanche.data.primaryNetwork.balances.listByAddresses({
    blockTimestamp: 1599696000,
    addresses: "avax1h2ccj9f5ay5acl6tyn9mwmw32p8wref8vl8ctg",
    blockchainId: "p-chain",
  });

  console.log(result);
}

run();
curl --request GET \
  --url https://glacier-api.avax.network/v1/networks/{network}/blockchains/{blockchainId}/balances \
  --header 'x-glacier-api-key: <api-key>'
import requests

url = "https://glacier-api.avax.network/v1/networks/{network}/blockchains/{blockchainId}/balances"

headers = {"x-glacier-api-key": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.text)
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://glacier-api.avax.network/v1/networks/{network}/blockchains/{blockchainId}/balances",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "x-glacier-api-key: <api-key>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://glacier-api.avax.network/v1/networks/{network}/blockchains/{blockchainId}/balances"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-glacier-api-key", "<api-key>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://glacier-api.avax.network/v1/networks/{network}/blockchains/{blockchainId}/balances")
  .header("x-glacier-api-key", "<api-key>")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://glacier-api.avax.network/v1/networks/{network}/blockchains/{blockchainId}/balances")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-glacier-api-key"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "balances": {
    "unlockedUnstaked": [
      {
        "assetId": "<string>",
        "name": "<string>",
        "symbol": "<string>",
        "denomination": 123,
        "amount": "<string>",
        "utxoCount": 123
      }
    ],
    "unlockedStaked": [
      {
        "assetId": "<string>",
        "name": "<string>",
        "symbol": "<string>",
        "denomination": 123,
        "amount": "<string>",
        "utxoCount": 123
      }
    ],
    "lockedPlatform": [
      {
        "assetId": "<string>",
        "name": "<string>",
        "symbol": "<string>",
        "denomination": 123,
        "amount": "<string>",
        "utxoCount": 123
      }
    ],
    "lockedStakeable": [
      {
        "assetId": "<string>",
        "name": "<string>",
        "symbol": "<string>",
        "denomination": 123,
        "amount": "<string>",
        "utxoCount": 123
      }
    ],
    "lockedStaked": [
      {
        "assetId": "<string>",
        "name": "<string>",
        "symbol": "<string>",
        "denomination": 123,
        "amount": "<string>",
        "utxoCount": 123
      }
    ],
    "pendingStaked": [
      {
        "assetId": "<string>",
        "name": "<string>",
        "symbol": "<string>",
        "denomination": 123,
        "amount": "<string>",
        "utxoCount": 123
      }
    ],
    "atomicMemoryUnlocked": [
      {
        "assetId": "<string>",
        "name": "<string>",
        "symbol": "<string>",
        "denomination": 123,
        "amount": "<string>",
        "utxoCount": 123,
        "sharedWithChainId": "<string>",
        "status": "<string>"
      }
    ],
    "atomicMemoryLocked": [
      {
        "assetId": "<string>",
        "name": "<string>",
        "symbol": "<string>",
        "denomination": 123,
        "amount": "<string>",
        "utxoCount": 123,
        "sharedWithChainId": "<string>",
        "status": "<string>"
      }
    ]
  },
  "chainInfo": {}
}
{
  "message": "<string>",
  "statusCode": 123,
  "error": "<string>"
}
{
  "message": "<string>",
  "statusCode": 123,
  "error": "<string>"
}
{
  "message": "<string>",
  "statusCode": 123,
  "error": "<string>"
}
{
  "message": "<string>",
  "statusCode": 123,
  "error": "<string>"
}
{
  "message": "<string>",
  "statusCode": 123,
  "error": "<string>"
}
{
  "message": "<string>",
  "statusCode": 123,
  "error": "<string>"
}
{
  "message": "<string>",
  "statusCode": 123,
  "error": "<string>"
}
{
  "message": "<string>",
  "statusCode": 123,
  "error": "<string>"
}

Authorizations

x-glacier-api-key
string
header
required

Api keys provide higher access to rate limits. To obtain an api key, sign up for an account at https://avacloud.io/.

Path Parameters

blockchainId
enum<string>
required

A primary network blockchain id or alias.

Available options:
11111111111111111111111111111111LpoYY,
2oYMBNV4eNHyqk2fjjV5nVQLDbtmNJzq5s3qs3Lo6ftnC6FByM,
2JVSBoinj9C2J33VntvzYtVJNZdN2NKiwwKjcumHUWEb5DbBrm,
2q9e4r6Mu3U68nU1fYjgbR6JvwrRx36CohpAX5UQxse55x1Q5,
yH8D7ThNJkxmtkuv2jgBa4P1Rn3Qpr4pPr7QYNfcdoS6k6HWp,
p-chain,
x-chain,
c-chain
network
enum<string>
required

Either mainnet or testnet/fuji.

Available options:
mainnet,
fuji,
testnet

Query Parameters

blockTimestamp
integer

An epoch timestamp in seconds. Balance will be calculated at this timestamp.

addresses
string

A comma separated list of X-Chain or P-Chain wallet addresses, starting with "avax"/"fuji", "P-avax"/"P-fuji" or "X-avax"/"X-fuji".

Response

Successful response

balances
object
required
chainInfo
object
required