Beacon API
/eth/v1/beacon/states/{state_id}/validators
Get validators from state, with the validator IDs and statuses in the request body
POST
/
eth
/
v1
/
beacon
/
states
/
{state_id}
/
validators
Get validators from state
curl --request POST \
--url 'https://mainnet.ethereum.validationcloud.io/v1/<YOUR_API_KEY_HERE>/eth/v1/beacon/states/{state_id}/validators' \
--header 'Content-Type: application/json' \
--data '
{
"ids": [
"<string>"
],
"statuses": [
"active_ongoing"
]
}
'import requests
url = "https://mainnet.ethereum.validationcloud.io/v1/<YOUR_API_KEY_HERE>/eth/v1/beacon/states/{state_id}/validators"
payload = {
"ids": ["<string>"],
"statuses": ["active_ongoing"]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({ids: ['<string>'], statuses: ['active_ongoing']})
};
fetch('https://mainnet.ethereum.validationcloud.io/v1/<YOUR_API_KEY_HERE>/eth/v1/beacon/states/{state_id}/validators', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mainnet.ethereum.validationcloud.io/v1/<YOUR_API_KEY_HERE>/eth/v1/beacon/states/{state_id}/validators",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'ids' => [
'<string>'
],
'statuses' => [
'active_ongoing'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://mainnet.ethereum.validationcloud.io/v1/<YOUR_API_KEY_HERE>/eth/v1/beacon/states/{state_id}/validators"
payload := strings.NewReader("{\n \"ids\": [\n \"<string>\"\n ],\n \"statuses\": [\n \"active_ongoing\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://mainnet.ethereum.validationcloud.io/v1/<YOUR_API_KEY_HERE>/eth/v1/beacon/states/{state_id}/validators")
.header("Content-Type", "application/json")
.body("{\n \"ids\": [\n \"<string>\"\n ],\n \"statuses\": [\n \"active_ongoing\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mainnet.ethereum.validationcloud.io/v1/<YOUR_API_KEY_HERE>/eth/v1/beacon/states/{state_id}/validators")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"ids\": [\n \"<string>\"\n ],\n \"statuses\": [\n \"active_ongoing\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"execution_optimistic": false,
"finalized": false,
"data": [
{
"index": "1",
"balance": "1",
"status": "active_ongoing",
"validator": {
"pubkey": "0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a",
"withdrawal_credentials": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
"effective_balance": "1",
"slashed": false,
"activation_eligibility_epoch": "1",
"activation_epoch": "1",
"exit_epoch": "1",
"withdrawable_epoch": "1"
}
}
]
}{
"code": 400,
"message": "Invalid state ID: current"
}{
"code": 404,
"message": "State not found"
}{
"code": 500,
"message": "Internal server error"
}Use POST instead of GET when you ask for many validators at once, because the IDs go in the request body instead of the URL.
curl -X POST \
"https://mainnet.ethereum.validationcloud.io/v1/<YOUR_API_KEY_HERE>/eth/v1/beacon/states/head/validators" \
-H "Content-Type: application/json" \
-d '{"ids": ["1", "2"], "statuses": ["active_ongoing"]}'
curl -X POST \
"https://sepolia.ethereum.validationcloud.io/v1/<YOUR_API_KEY_HERE>/eth/v1/beacon/states/head/validators" \
-H "Content-Type: application/json" \
-d '{"ids": ["1", "2"], "statuses": ["active_ongoing"]}'
Path Parameters
Body
application/json
The lists of validator IDs and statuses to filter on. Either or both may be null to signal that no filtering on that attribute is desired.
An array of validator statuses to filter on.
If the supplied list is empty (i.e. the value is []) or the property is omitted then validators with all statuses will be returned.
Possible statuses:
- pending_initialized - When the first deposit is processed, but not enough funds are available (or not yet the end of the first epoch) to get validator into the activation queue.
- pending_queued - When validator is waiting to get activated, and have enough funds etc. while in the queue, validator activation epoch keeps changing until it gets to the front and make it through (finalization is a requirement here too).
- active_ongoing - When validator must be attesting, and have not initiated any exit.
- active_exiting - When validator is still active, but filed a voluntary request to exit.
- active_slashed - When validator is still active, but have a slashed status and is scheduled to exit.
- exited_unslashed - When validator has reached regular exit epoch, not being slashed, and doesn't have to attest any more, but cannot withdraw yet.
- exited_slashed - When validator has reached regular exit epoch, but was slashed, have to wait for a longer withdrawal period.
- withdrawal_possible - After validator has exited, a while later is permitted to move funds, and is truly out of the system.
- withdrawal_done - (not possible in phase0, except slashing full balance) - actually having moved funds away
Available options:
pending_initialized, pending_queued, active_ongoing, active_exiting, active_slashed, exited_unslashed, exited_slashed, withdrawal_possible, withdrawal_done Example:
"active_ongoing"
Response
Success
Get validators from state
curl --request POST \
--url 'https://mainnet.ethereum.validationcloud.io/v1/<YOUR_API_KEY_HERE>/eth/v1/beacon/states/{state_id}/validators' \
--header 'Content-Type: application/json' \
--data '
{
"ids": [
"<string>"
],
"statuses": [
"active_ongoing"
]
}
'import requests
url = "https://mainnet.ethereum.validationcloud.io/v1/<YOUR_API_KEY_HERE>/eth/v1/beacon/states/{state_id}/validators"
payload = {
"ids": ["<string>"],
"statuses": ["active_ongoing"]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({ids: ['<string>'], statuses: ['active_ongoing']})
};
fetch('https://mainnet.ethereum.validationcloud.io/v1/<YOUR_API_KEY_HERE>/eth/v1/beacon/states/{state_id}/validators', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mainnet.ethereum.validationcloud.io/v1/<YOUR_API_KEY_HERE>/eth/v1/beacon/states/{state_id}/validators",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'ids' => [
'<string>'
],
'statuses' => [
'active_ongoing'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://mainnet.ethereum.validationcloud.io/v1/<YOUR_API_KEY_HERE>/eth/v1/beacon/states/{state_id}/validators"
payload := strings.NewReader("{\n \"ids\": [\n \"<string>\"\n ],\n \"statuses\": [\n \"active_ongoing\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://mainnet.ethereum.validationcloud.io/v1/<YOUR_API_KEY_HERE>/eth/v1/beacon/states/{state_id}/validators")
.header("Content-Type", "application/json")
.body("{\n \"ids\": [\n \"<string>\"\n ],\n \"statuses\": [\n \"active_ongoing\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mainnet.ethereum.validationcloud.io/v1/<YOUR_API_KEY_HERE>/eth/v1/beacon/states/{state_id}/validators")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"ids\": [\n \"<string>\"\n ],\n \"statuses\": [\n \"active_ongoing\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"execution_optimistic": false,
"finalized": false,
"data": [
{
"index": "1",
"balance": "1",
"status": "active_ongoing",
"validator": {
"pubkey": "0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a",
"withdrawal_credentials": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
"effective_balance": "1",
"slashed": false,
"activation_eligibility_epoch": "1",
"activation_epoch": "1",
"exit_epoch": "1",
"withdrawable_epoch": "1"
}
}
]
}{
"code": 400,
"message": "Invalid state ID: current"
}{
"code": 404,
"message": "State not found"
}{
"code": 500,
"message": "Internal server error"
}