---
title: getHealth
description: >-
  Returns whether this RPC node is healthy. The node reports healthy when it is
  within the configured slot distance of the cluster tip.
url: /docs/rpc/http/gethealth
type: reference
hideTableOfContents: true
---

Returns whether this RPC node is healthy. The node reports healthy when it is
within the configured slot distance of the cluster tip.

<Callout type="info" title="Source">
  [`get_health`](https://github.com/anza-xyz/agave/blob/v3.1.8/rpc/src/rpc.rs#L2806)
</Callout>

<APIMethod>

```jsonc !!request curl
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getHealth"
}
```

```ts !!request title="Kit"
import { createSolanaRpc } from "@solana/kit";

const rpc_url = "https://api.devnet.solana.com";
const rpc = createSolanaRpc(rpc_url);

let health = await rpc.getHealth().send();

console.log(health);
```

```rs !!request title="Rust"
use anyhow::Result;
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_commitment_config::CommitmentConfig;

#[tokio::main]
async fn main() -> Result<()> {
    let client = RpcClient::new_with_commitment(
        String::from("https://api.devnet.solana.com"),
        CommitmentConfig::confirmed(),
    );

    let health = client.get_health().await?;

    println!("{:#?}", health);

    Ok(())
}
```

### !params

### !!result Healthy

```jsonc !response
{
  "jsonrpc": "2.0",
  // !hover result
  "result": "ok",
  "id": 1
}
```

!type string

Returns `"ok"` when the node is healthy.

### !!result Unhealthy

```jsonc !response
{
  "jsonrpc": "2.0",
  // !hover(1:5) result
  "error": {
    "code": -32005,
    "message": "Node is behind by 42 slots",
    "data": { "numSlotsBehind": 42 }
  },
  "id": 1
}
```

!type object

Returns a JSON-RPC error when the node is unhealthy. The exact error payload is
**UNSTABLE** and may change.

</APIMethod>
