Stats
const TOKEN = "hv_..."; // your API keyconst headers = { Authorization: `Bearer ${TOKEN}` };const TOKEN = "hv_..."; // your API keyconst headers = { Authorization: `Bearer ${TOKEN}` };let token = "hv_..."; // your API keytoken := "hv_..." // your API key# All examples assume $TOKEN is an API key (hv_...)AUTH="Authorization: Bearer $TOKEN"Record counts
Section titled “Record counts”GET /admin/statsinterface 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();const response = await fetch("http://127.0.0.1:3000/admin/stats", { headers,});const data = await response.json();let client = reqwest::Client::new();let response = client .get("http://127.0.0.1:3000/admin/stats") .bearer_auth(token) .send() .await?;let data: serde_json::Value = response.json().await?;req, _ := http.NewRequest("GET", "http://127.0.0.1:3000/admin/stats", nil)req.Header.Set("Authorization", "Bearer "+token)resp, err := http.DefaultClient.Do(req)curl http://127.0.0.1:3000/admin/stats -H "$AUTH"Response: 200 OK
{ "total_records": 12345, "collections": [{ "collection": "xyz.statusphere.status", "count": 500 }]}Admin and client counts
Section titled “Admin and client counts”GET /admin/stats/countsReturns 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.
curl http://127.0.0.1:3000/admin/stats/counts -H "$AUTH"Response: 200 OK
{ "users": 3, "api_clients": 2}
