Skip to content

Stats

const TOKEN = "hv_..."; // your API key
const headers = { Authorization: `Bearer ${TOKEN}` };
GET /admin/stats
interface CollectionCount {
collection: string;
count: number;
}
interface Stats {
total_records: number;
collections: CollectionCount[];
}
const response = await fetch("http://127.0.0.1:3000/admin/stats", {
headers,
});
const data: Stats = await response.json();

Response: 200 OK

{
"total_records": 12345,
"collections": [{ "collection": "xyz.statusphere.status", "count": 500, "indexed": true }]
}

indexed is false for a collection that still has records but is no longer indexed.

GET /admin/stats/counts

Returns the number of operators (seats, including those with superadmin) and registered API clients. It is cheap to call often, unlike the record counts above. Requires stats:read.

Terminal window
curl http://127.0.0.1:3000/admin/stats/counts -H "$AUTH"

Response: 200 OK

{
"users": 3,
"api_clients": 2
}
GET /admin/jetstream/status

The live Jetstream consumer’s state since the process started. Requires stats:read; the platform key may call it too. This route exists only when the instance’s records come from Jetstream, which is the default.

Response: 200 OK

{
"protocol": "v2",
"host": "jetstream1.us-east.bsky.network",
"connected": true,
"compression": true,
"dictionary_id": 3,
"applied_seq": 18300422,
"applied_time_us": 1793390000000000,
"lag_ms": 412,
"worker_queue_depths": [0, 2, 0, 0, 1, 0, 0, 0],
"worker_busy_since_ms": [null, 1793390000100, null, null, null, null, null, null],
"now_ms": 1793390000512
}

Unknown values are an explicit null: protocol, host, dictionary_id, applied_seq, applied_time_us and lag_ms are all null before the first connection or event, and the two worker arrays are empty until the worker pool starts.

FieldMeaning
protocolv2 (subscribeEvents) or v1 (/subscribe); null before the first connection
hostThe Jetstream host from JETSTREAM_URL
connectedWhether a subscription is open now
compressionWhether frames arrive zstd-compressed
dictionary_idThe zstd dictionary in use, or null
applied_seqThe newest event that it and every event before it have been applied: the position saved for a restart. null on v1, which has no seq
applied_time_usWhen Jetstream witnessed that event, in microseconds since the Unix epoch
lag_msMilliseconds from applied_time_us to now
worker_queue_depthsEvents waiting in each worker’s queue, one entry per JETSTREAM_WORKERS. The event a worker is applying or retrying is not counted
now_msServer time when the snapshot was taken, in milliseconds since the Unix epoch. Subtract worker_busy_since_ms from it rather than using your own clock
worker_busy_since_msOne entry per worker: when its current event started, in milliseconds since the Unix epoch, or null when idle. An old value with an empty queue means the worker is stuck retrying