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

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

async function run() {
  const result = await avalanche.data.primaryNetwork.rewards.listHistoricalRewards({
    addresses: "avax1h2ccj9f5ay5acl6tyn9mwmw32p8wref8vl8ctg",
    pageSize: 10,
    nodeIds: "NodeID-111111111111111111116DBWJs,NodeID-222222222222222222227DBWJs",
    sortOrder: "asc",
    currency: "usd",
  });

  for await (const page of result) {
    console.log(page);
  }
}

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

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

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}/rewards",
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}/rewards"

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}/rewards")
.header("x-glacier-api-key", "<api-key>")
.asString();
require 'uri'
require 'net/http'

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

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
{
  "historicalRewards": [
    {
      "addresses": [
        "<string>"
      ],
      "txHash": "<string>",
      "amountStaked": "<string>",
      "nodeId": "<string>",
      "startTimestamp": 123,
      "endTimestamp": 123,
      "utxoId": "<string>",
      "outputIndex": 123,
      "reward": {
        "assetId": "<string>",
        "name": "<string>",
        "symbol": "<string>",
        "denomination": 123,
        "amount": "<string>",
        "historicalPrice": {
          "value": 123
        }
      },
      "rewardTxHash": "<string>"
    }
  ],
  "nextPageToken": "<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>"
}
{
"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

network
enum<string>
required

Either mainnet or testnet/fuji.

Available options:
mainnet,
fuji,
testnet

Query Parameters

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". Optional, but at least one of addresses or nodeIds is required.

pageToken
string

A page token, received from a previous list call. Provide this to retrieve the subsequent page.

pageSize
integer
default:10

The maximum number of items to return. The minimum page size is 1. The maximum pageSize is 100.

Required range: 1 <= x <= 100
nodeIds
string

A comma separated list of node ids to filter by. Optional, but at least one of addresses or nodeIds is required.

sortOrder
enum<string>

The order by which to sort results. Use "asc" for ascending order, "desc" for descending order. Sorted by timestamp or the sortBy query parameter, if provided.

Available options:
asc,
desc
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

historicalRewards
object[]
required
nextPageToken
string

A token, which can be sent as pageToken to retrieve the next page. If this field is omitted or empty, there are no subsequent pages.