getHealth
Returns the current health of the node. A healthy node is one that is within HEALTH_CHECK_SLOT_DISTANCE slots of the latest cluster confirmed slot. This endpoint is essential for load balancers, monitoring systems, and health checks to ensure that RPC nodes are synchronized and capable of serving accurate data. It returns "ok" when healthy or an error when the node is behind.
Parameters
This method does not accept any parameters.
Response
Returns a single value:
| Field | Type | Description |
|---|---|---|
result | string | "ok" if the node is healthy; error response if unhealthy |
Code Examples
cURL
curl http://88.216.36.108:7999 -X POST -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getHealth",
"params": []
}'TypeScript
const response = await fetch("http://88.216.36.108:7999", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "getHealth",
params: []
}),
});
const { result } = await response.json();
console.log("Health:", result);Python
import requests
response = requests.post("http://88.216.36.108:7999", json={
"jsonrpc": "2.0",
"id": 1,
"method": "getHealth",
"params": []
})
result = response.json()["result"]
print(f"Health: {result}")Rust
use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let res = client.post("http://88.216.36.108:7999")
.json(&json!({
"jsonrpc": "2.0",
"id": 1,
"method": "getHealth",
"params": []
}))
.send().await?
.text().await?;
println!("{}", res);
Ok(())
}Example Response
{
"jsonrpc": "2.0",
"result": "ok",
"id": 1
}