Skip to main content
GET
/
v2
/
chains
JavaScript
import { Avalanche } from "@avalanche-sdk/chainkit";

const avalanche = new Avalanche();

async function run() {
  const result = await avalanche.metrics.chains.list({
    network: "mainnet",
  });

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

run();
curl --request GET \
--url https://metrics.avax.network/v2/chains
import requests

url = "https://metrics.avax.network/v2/chains"

response = requests.get(url)

print(response.text)
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://metrics.avax.network/v2/chains",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);

$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://metrics.avax.network/v2/chains"

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

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://metrics.avax.network/v2/chains")
.asString();
require 'uri'
require 'net/http'

url = URI("https://metrics.avax.network/v2/chains")

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

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
{
  "chains": [
    {
      "evmChainId": 123,
      "chainName": "<string>",
      "blockchainId": "<string>",
      "subnetId": "<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>"
}

Query Parameters

pageToken
string

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

network
enum<string>

Either mainnet or testnet/fuji.

Available options:
mainnet,
fuji,
testnet

Response

Successful response

chains
object[]
required

Array of Subnet - EVM Chain ID mappings whose metrics we support.

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.