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 }]
}
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
}