Skip to main content
GET
/
v1
/
chains
/
{chainId}
/
addresses
/
{address}
/
balances:getNative
JavaScript
import { Avalanche } from "@avalanche-sdk/chainkit";

const avalanche = new Avalanche({
  chainId: "43114",
});

async function run() {
  const result = await avalanche.data.evm.address.balances.getNative({
    blockNumber: "6479329",
    address: "0x71C7656EC7ab88b098defB751B7401B5f6d8976F",
    currency: "usd",
  });

  console.log(result);
}

run();
curl --request GET \
--url https://glacier-api.avax.network/v1/chains/{chainId}/addresses/{address}/balances:getNative \
--header 'x-glacier-api-key: <api-key>'
import requests

url = "https://glacier-api.avax.network/v1/chains/{chainId}/addresses/{address}/balances:getNative"

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/chains/{chainId}/addresses/{address}/balances:getNative",
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/chains/{chainId}/addresses/{address}/balances:getNative"

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/chains/{chainId}/addresses/{address}/balances:getNative")
.header("x-glacier-api-key", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://glacier-api.avax.network/v1/chains/{chainId}/addresses/{address}/balances:getNative")

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
{
  "nativeTokenBalance": {
    "name": "<string>",
    "symbol": "<string>",
    "decimals": 123,
    "chainId": "<string>",
    "balance": "<string>",
    "logoUri": "<string>",
    "price": {
      "value": 123
    },
    "balanceValue": {
      "value": 123
    }
  }
}
{
"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

chainId
string
required

A supported evm chain id or blockchain id. Use the /chains endpoint to get a list of supported chain ids.

address
string
required

A wallet address.

Query Parameters

blockNumber
string

The block number, if not defined the block number will be the latest block.

currency
enum<string>

The currency that return values should use. Defaults to USD. ISO 4217 currency code.

Available options:
usd,
eur,
aud,
cad,
chf,
clp,
cny,
czk,
dkk,
gbp,
hkd,
huf,
jpy,
nzd

Response

Successful response

nativeTokenBalance
object
required

The native token balance for the address.