ZeroCopyZeroCopy
API reference

getHealth and getSlot

Check regional readiness and the current observed slot.

getHealth

Request
{"jsonrpc":"2.0","id":1,"method":"getHealth"}

params, when present, is ignored. The method needs an API key.

Region stateHTTPResponse
Ready200{"jsonrpc":"2.0","result":"ok","id":1}
Not ready503{"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

Request
{"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:

Result shape
{"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 stateHTTPBody
Ready200ok
Not ready503unhealthy

It applies the same readiness test as getHealth.

The SWQoS agent serves getHealth, getSlot and GET /health for its own state.

Errors

ReasonHTTPCodeWhen
unauthorized401-32000getHealth or getSlot without a valid key. GET /health never needs one.
invalid_request200see codesThe body is not a valid JSON-RPC request.

Examples

curl
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"}'
health.ts
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'))

On this page