API reference
getHealth and getSlot
Check regional readiness and the current observed slot.
getHealth
{"jsonrpc":"2.0","id":1,"method":"getHealth"}params, when present, is ignored. The method needs an API key.
| Region state | HTTP | Response |
|---|---|---|
| Ready | 200 | {"jsonrpc":"2.0","result":"ok","id":1} |
| Not ready | 503 | {"jsonrpc":"2.0","error":{"code":-32005,"message":"Node is unhealthy"},"id":1} |
Ready means the region can send to at least one upcoming leader, not that your transaction will land. The unhealthy error has no data member.
getSlot
{"jsonrpc":"2.0","id":1,"method":"getSlot"}params, when present, is ignored, so a commitment has no effect. The method needs an API key. The result is an integer:
{"jsonrpc":"2.0","result":SLOT,"id":1}This is the region's highest observed slot, not a committed slot. Use your Solana RPC provider for confirmation and block heights.
GET /health
GET /health needs no key and answers in plain text.
| Region state | HTTP | Body |
|---|---|---|
| Ready | 200 | ok |
| Not ready | 503 | unhealthy |
It applies the same readiness test as getHealth.
The SWQoS agent serves getHealth, getSlot and GET /health for its own state.
Errors
| Reason | HTTP | Code | When |
|---|---|---|---|
unauthorized | 401 | -32000 | getHealth or getSlot without a valid key. GET /health never needs one. |
invalid_request | 200 | see codes | The body is not a valid JSON-RPC request. |
Examples
curl -sS "https://fra.sol.zerocopy.sh/health"
curl -sS "https://fra.sol.zerocopy.sh" \
-H "x-api-key: $SWQOS_API_KEY" \
-H 'content-type: application/json' \
--data '{"jsonrpc":"2.0","id":1,"method":"getSlot"}'import { call, SwqosError } from './swqos.ts'
try {
console.log('health', await call<string>('getHealth'))
} catch (error) {
if (error instanceof SwqosError && error.code === -32005) console.log('region not ready')
else throw error
}
console.log('slot', await call<number>('getSlot'))