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

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# getHealth

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

<Info>
  **Source**

  [`get_health`](https://github.com/anza-xyz/agave/blob/v4.3.2/rpc/src/rpc.rs#L2892)
</Info>

<RequestExample>
  ```bash cURL
  curl https://api.devnet.solana.com -s -X POST \
    -H "Content-Type: application/json" \
    -d '
    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "getHealth"
    }
  '
  ```

  ```ts 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 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(())
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Healthy
  {
    "jsonrpc": "2.0",
    "result": "ok",
    "id": 1
  }
  ```

  ```json Unhealthy
  {
    "jsonrpc": "2.0",
    "error": {
      "code": -32005,
      "message": "Node is behind by 42 slots",
      "data": { "numSlotsBehind": 42 }
    },
    "id": 1
  }
  ```
</ResponseExample>

## Parameters

None

## Result

<ResponseField name="result" type="string" post={["Healthy"]}>
  Returns `"ok"` when the node is healthy.
</ResponseField>

<ResponseField name="result" type="object" post={["Unhealthy"]}>
  Returns a JSON-RPC error when the node is unhealthy. The exact error payload is
  **UNSTABLE** and may change.
</ResponseField>
