For the complete documentation index, see llms.txt. This page is also available as Markdown.

system_health - Midnight

Example code for the system_health JSON-RPC method. Complete guide on how to use system_health JSON-RPC in GetBlock Web3 documentation.

This method returns the current health and sync status of the node, including peer count and whether the node is still syncing.

Parameters

  • None

Request Example

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "system_health",
    "params": [],
    "id": "getblock.io"
}'

Response Example

{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "peers": 19,
        "isSyncing": false,
        "shouldHavePeers": true
    }
}

Response Parameters

Field
Type
Description

result.peers

integer

Number of peers connected to the node

result.isSyncing

boolean

true if the node is still importing blocks, false if synced to tip

result.shouldHavePeers

boolean

Whether the node configuration expects to have peers

Use Cases

  • Health checks before routing reads to this node

  • Monitoring dashboards that show RPC provider status

  • Detecting stale or partitioned nodes in multi-provider setups

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid <ACCESS-TOKEN>

-32602

Invalid params

Request parameters are missing or malformed

-32601

Method not found

The method is not enabled on this node or has been deprecated

429

Too Many Requests

Rate limit exceeded for your plan

SDK Integration

Was this helpful?