getHealth - Solana

This method reports whether the node is caught up with the cluster tip. A healthy node returns the string ok; an unhealthy node returns a JSON-RPC error.

Parameters

This method does not accept any parameters.

Request

bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "getHealth",
    "params": [],
    "id": "getblock.io"
}'

example.js

javascriptconst { Connection } = require('@solana/web3.js');

const connection = new Connection('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', 'confirmed');

const health = await connection._rpcRequest('getHealth', []);

console.log(health.result);

example.py

pythonimport requests

response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers={'Content-Type': 'application/json'},
    json={
        'jsonrpc': '2.0',
        'method': 'getHealth',
        'params': [],
        'id': 'getblock.io'
    }
)

print(response.json()['result'])

example.rs

rustuse reqwest::Client;
use serde_json::{json, Value};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();

    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .header("Content-Type", "application/json")
        .json(&json!({
            "jsonrpc": "2.0",
            "method": "getHealth",
            "params": [],
            "id": "getblock.io"
        }))
        .send()
        .await?
        .json::<Value>()
        .await?;

    println!("Result: {}", response["result"]);
    Ok(())
}

Response

json{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": "ok"
}

Response Parameters

ParameterTypeDescription
jsonrpcstringJSON-RPC protocol version ("2.0")
idstringRequest identifier matching the request
resultstringThe string ok when the node is within the healthy slot distance of the cluster tip

Use Cases

  • Load Balancer Probes: Drop an endpoint from rotation when it stops returning ok
  • Failover Logic: Switch to a backup provider before requests start returning stale data
  • Uptime Monitoring: Poll from an external checker to record node availability
  • Deployment Gates: Block a release pipeline while the target node is catching up

Error Handling

Error CodeMessageDescription
-32005Node is unhealthyThe node is behind the cluster tip by more than the configured slot distance
-32603Internal errorNode failed to evaluate its own health status