RPC API
Query the local node through JSON-RPC.
Overview
The node exposes a JSON-RPC interface on the configured admin port (default 5005). Commands are submitted as HTTP POST requests with a JSON body. The interface supports ledger queries, account state, transaction submission, and server status.
server_info
Returns server status, ledger index, uptime, and peer count. The primary command for checking node health.
{
"method": "server_info",
"params": [{}]
}
The response includes validated_ledger_seq (the last closed ledger), uptime, and peers.
account_info
Returns the current state of an account: XRP balance, sequence number, and flags.
{
"method": "account_info",
"params": [{
"account": "rXXXXXXXXXXXXXXXXXXXXXXXX",
"ledger_index": "validated"
}]
}
ledger
Returns a ledger version by hash or sequence number, including close time and transaction count.
{
"method": "ledger",
"params": [{
"ledger_index": "validated",
"transactions": false,
"expand": false
}]
}
server_state
Detailed server state: consensus status, load factor, connection info. Used for monitoring and diagnostics beyond server_info.
Ports
Admin commands are restricted to localhost by default. For port configuration, see Configuration: Ports.