JavaScript
import { Avalanche } from "@avalanche-sdk/chainkit";
const avalanche = new Avalanche({
network: "mainnet",
});
async function run() {
const result = await avalanche.data.primaryNetwork.getSubnetById({
subnetId: "11111111111111111111111111111111LpoYY",
});
console.log(result);
}
run();curl --request GET \
--url https://glacier-api.avax.network/v1/networks/{network}/subnets/{subnetId} \
--header 'x-glacier-api-key: <api-key>'import requests
url = "https://glacier-api.avax.network/v1/networks/{network}/subnets/{subnetId}"
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}/subnets/{subnetId}",
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}/subnets/{subnetId}"
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}/subnets/{subnetId}")
.header("x-glacier-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://glacier-api.avax.network/v1/networks/{network}/subnets/{subnetId}")
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{
"createBlockTimestamp": 123,
"createBlockIndex": "<string>",
"subnetId": "<string>",
"ownerAddresses": [
"<string>"
],
"threshold": 123,
"locktime": 123,
"subnetOwnershipInfo": {
"locktime": 0,
"threshold": 1,
"addresses": [
"avax1qm2a25eytsrj235hxg6jc0mwk99tss64eqevsw"
]
},
"isL1": true,
"blockchains": [
{
"createBlockTimestamp": 123,
"createBlockNumber": "<string>",
"blockchainId": "<string>",
"vmId": "<string>",
"subnetId": "<string>",
"blockchainName": "<string>",
"evmChainId": 43114,
"genesisData": "{\"chainId\": 43114}"
}
],
"l1ConversionTransactionHash": "<string>",
"l1ValidatorManagerDetails": {
"blockchainId": "<string>",
"contractAddress": "<string>"
}
}{
"message": "<string>",
"statusCode": 400,
"error": "Bad Request"
}{
"message": "<string>",
"statusCode": 401,
"error": "Unauthorized"
}{
"message": "<string>",
"statusCode": 403,
"error": "Forbidden"
}{
"message": "<string>",
"statusCode": 404,
"error": "Not Found"
}{
"message": "<string>",
"statusCode": 429,
"error": "Too Many Requests"
}{
"message": "<string>",
"statusCode": 500,
"error": "Internal Server Error"
}{
"message": "<string>",
"statusCode": 502,
"error": "Bad Gateway"
}{
"message": "<string>",
"statusCode": 503,
"error": "Service Unavailable"
}Network, Chains & subnet
Get Subnet details by ID
Get details of the Subnet registered on the network.
GET
/
v1
/
networks
/
{network}
/
subnets
/
{subnetId}
JavaScript
import { Avalanche } from "@avalanche-sdk/chainkit";
const avalanche = new Avalanche({
network: "mainnet",
});
async function run() {
const result = await avalanche.data.primaryNetwork.getSubnetById({
subnetId: "11111111111111111111111111111111LpoYY",
});
console.log(result);
}
run();curl --request GET \
--url https://glacier-api.avax.network/v1/networks/{network}/subnets/{subnetId} \
--header 'x-glacier-api-key: <api-key>'import requests
url = "https://glacier-api.avax.network/v1/networks/{network}/subnets/{subnetId}"
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}/subnets/{subnetId}",
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}/subnets/{subnetId}"
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}/subnets/{subnetId}")
.header("x-glacier-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://glacier-api.avax.network/v1/networks/{network}/subnets/{subnetId}")
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{
"createBlockTimestamp": 123,
"createBlockIndex": "<string>",
"subnetId": "<string>",
"ownerAddresses": [
"<string>"
],
"threshold": 123,
"locktime": 123,
"subnetOwnershipInfo": {
"locktime": 0,
"threshold": 1,
"addresses": [
"avax1qm2a25eytsrj235hxg6jc0mwk99tss64eqevsw"
]
},
"isL1": true,
"blockchains": [
{
"createBlockTimestamp": 123,
"createBlockNumber": "<string>",
"blockchainId": "<string>",
"vmId": "<string>",
"subnetId": "<string>",
"blockchainName": "<string>",
"evmChainId": 43114,
"genesisData": "{\"chainId\": 43114}"
}
],
"l1ConversionTransactionHash": "<string>",
"l1ValidatorManagerDetails": {
"blockchainId": "<string>",
"contractAddress": "<string>"
}
}{
"message": "<string>",
"statusCode": 400,
"error": "Bad Request"
}{
"message": "<string>",
"statusCode": 401,
"error": "Unauthorized"
}{
"message": "<string>",
"statusCode": 403,
"error": "Forbidden"
}{
"message": "<string>",
"statusCode": 404,
"error": "Not Found"
}{
"message": "<string>",
"statusCode": 429,
"error": "Too Many Requests"
}{
"message": "<string>",
"statusCode": 500,
"error": "Internal Server Error"
}{
"message": "<string>",
"statusCode": 502,
"error": "Bad Gateway"
}{
"message": "<string>",
"statusCode": 503,
"error": "Service Unavailable"
}Authorizations
Api keys provide higher access to rate limits. To obtain an api key, sign up for an account at https://avacloud.io/.
Path Parameters
Either mainnet or testnet/fuji.
Available options:
mainnet, fuji, testnet Subnet ID to fetch details for
Response
Successful response
This field is deprecated. Use subnetOwnershipInfo instead.
This field is deprecated. Use subnetOwnershipInfo instead.
This field is deprecated. Use subnetOwnershipInfo instead.
Latest subnet owner details for this Subnet.
Show child attributes
Show child attributes
Whether the subnet is an L1 or not.
Show child attributes
Show child attributes
Transaction hash of ConvertSubnetToL1Tx which converted this Subnet to L1.
L1 validator manager details.
Show child attributes
Show child attributes
Was this page helpful?
⌘I