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.
Common use cases
| RPC load balancer health checks | Verify endpoint availability before routing traffic. Production systems call getHealth every 1-5 seconds to detect node lag and automatically failover to healthy RPC providers. |
| Pre-transaction validation | Ensure RPC node has current chain state before submitting critical transactions. Trading bots and dApps use getHealth to avoid transaction failures caused by outdated RPC nodes that are behind by slots. |
| Validator monitoring dashboards | Display real-time node synchronization status in monitoring systems. Validator operators track getHealth alongside getSlot to verify their nodes remain in sync with the cluster. |
Parameters
No parameters required.
Request
- cURL
- JavaScript
- Python
curl https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getHealth"
}'
// Using fetch
const response = await fetch('https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
"jsonrpc": "2.0",
"id": 1,
"method": "getHealth"
})
});
const data = await response.json();
console.log(data);
import requests
import json
url = 'https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY'
headers = {'Content-Type': 'application/json'}
data = {
"jsonrpc": "2.0",
"id": 1,
"method": "getHealth"
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
Replace mainnet with devnet in the URL to query devnet instead.
Response
{
"jsonrpc": "2.0",
"result": "ok",
"id": 1
}
FAQ and Troubleshooting
What's the difference between getHealth and solana catchup command?
getHealth compares your node's slot to known validators in the cluster, while solana catchup compares to a specific RPC endpoint. Use getHealth for simple availability checks in application code.
What does error -32005 mean?
Error code -32005 (NODE_UNHEALTHY) means the node is behind by too many slots, determined by the HEALTH_CHECK_SLOT_DISTANCE configuration. The error response includes num_slots_behind indicating how far the node is lagging.
Should I call getHealth before every RPC request?
No. getHealth is designed for periodic monitoring (every 1-5 seconds) by load balancers or health check systems, not per-request validation. Calling it before every request adds unnecessary latency.
Related Methods
getSlot
Returns the current slot number. Use getSlot together with getHealth to validate an RPC node is both healthy and processing recent slots that match other providers.
getVersion
Returns node software version. Often called alongside getHealth in health monitoring systems to track which validator versions are running.
External Resources
- Solana Official Documentation
- Agave RPC Health Implementation - Official source code showing how getHealth compares optimistically confirmed slots and defines the health_check_slot_distance parameter.