> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orbitflare.com/llms.txt
> Use this file to discover all available pages before exploring further.

# getHealth

> Returns the current health status of the node

## Parameters

This method does not take any parameters.

## Response

<ResponseField name="result" type="string">
  One of the following status values:

  * `"ok"`: Node is healthy and up-to-date
  * `"behind"`: Node is behind by some number of slots
  * `"unknown"`: Node health cannot be determined
</ResponseField>

## Code Examples

### Basic Request

```bash theme={null}
curl https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY -X POST -H "Content-Type: application/json" -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getHealth"
}'
```

### Alternative HTTP GET Request

```bash theme={null}
curl https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY/health
```

### Using web3.js

```typescript theme={null}
import { Connection } from '@solana/web3.js';

const connection = new Connection('https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY');

const health = await connection.getHealth();
console.log('Node health:', health);

// Example: Check if node is healthy
const isHealthy = health === 'ok';
if (!isHealthy) {
  console.warn('Node is not healthy:', health);
}
```

## Notes

1. This method is commonly used for load balancer health checks
2. The HTTP GET endpoint `/health` provides the same information
3. A node is considered "behind" if it's more than `HEALTH_CHECK_SLOT_DISTANCE` slots from the latest cluster slot
4. The "unknown" status typically indicates the node is bootstrapping or having issues

## Best Practices

1. Use this endpoint for basic health monitoring
2. Implement circuit breakers based on health status
3. Consider using more detailed methods for specific health metrics:
   * `getVersion` for software version
   * `getSlot` for slot progress
   * `getBlockHeight` for block height
4. Set appropriate timeouts for health checks
5. Handle all possible response values

## Common Errors

| Code   | Message             | Solution                                     |
| ------ | ------------------- | -------------------------------------------- |
| -32601 | Method not found    | Verify you're connected to a Solana RPC node |
| -32603 | Internal error      | Node may be experiencing issues              |
| 503    | Service Unavailable | Node is not ready to handle requests         |

## Use Cases

1. **Load Balancer Configuration**
   ```nginx theme={null}
   location /health {
     proxy_pass http://backend;
     proxy_next_upstream error timeout http_503;
   }
   ```

2. **Health Monitoring**
   ```typescript theme={null}
   async function monitorHealth(endpoint: string) {
     const connection = new Connection(endpoint);
     try {
       const health = await connection.getHealth();
       if (health !== 'ok') {
         alertNodeUnhealthy(endpoint, health);
       }
     } catch (error) {
       alertNodeError(endpoint, error);
     }
   }
   ```

3. **Client-Side Load Balancing**
   ```typescript theme={null}
   async function getHealthyEndpoint(endpoints: string[]) {
     for (const endpoint of endpoints) {
       const connection = new Connection(endpoint);
       try {
         const health = await connection.getHealth();
         if (health === 'ok') {
           return endpoint;
         }
       } catch (error) {
         continue;
       }
     }
     throw new Error('No healthy endpoints available');
   }
   ```

4. **System Status Dashboard**
   ```typescript theme={null}
   interface NodeStatus {
     endpoint: string;
     health: string;
     lastChecked: Date;
   }

   async function updateDashboard(nodes: NodeStatus[]) {
     for (const node of nodes) {
       const connection = new Connection(node.endpoint);
       try {
         node.health = await connection.getHealth();
       } catch (error) {
         node.health = 'error';
       }
       node.lastChecked = new Date();
     }
     renderDashboard(nodes);
   }
   ```
