Admin

Smoke-check the admin authentication gate

Returns the AUTHENTICATED CALLER's own GitHub identity along with admin: true when (and only when) that caller (AuthInfo.UserID, joined to admins via users.github_id) has a row in the admins table (keyed on the immutable GitHub numeric ID, see migration 018). Used to confirm the admin gate is wired and working — the same auth.RequireAdmin middleware composes future admin-only routes (e.g., announcement CRUD, admin SSE). Team accounts B1 (issue #323) made non-owner admins possible, so this is NOT necessarily the identity of the account the request happens to be scoped to — a viewer/member admin inspecting another user's account sees their own identity here.

Responses split cleanly:

  • 200 — caller is admin; payload includes the caller's own github_id/github_username (both null if the caller has no GitHub identity), and admin: true.
  • 401 — produced by the upstream Bearer middleware when the request has no Authorization header or the token is invalid.
  • 403 — opaque {"error":"forbidden"} when the request is authenticated but the account is not in the admins table. Same envelope on every non-admin path: do not leak whether the route requires admin or whether the caller happens to not be one.
  • 429 — the global per-account rate limiter still applies to admin routes (200/min cap shared with the rest of /api/v1).

Admin membership is sourced from the immutable numeric GitHub ID (accounts.github_id), not the mutable username. A renamed admin retains access; a non-admin who happens to claim a freed username does not inherit it.

get/api/v1/admin/ping

Request

  • Base URL: https://api.uptimemonitoring.com
  • URL: https://api.uptimemonitoring.com/api/v1/admin/ping
  • Auth: HTTP bearer

Response

Caller is an admin.

github_idinteger nullable required

GitHub numeric ID of the AUTHENTICATED CALLER (sourced from users.github_id for the user identified by AuthInfo.UserID) — never the account owner's. Team accounts B1 (issue #323) made non-owner admins possible, so a viewer/member admin inspecting someone else's account must see their own identity here, not the account's. Display-only — the gate itself keys on AuthInfo.UserID, not this field. null if the caller has no GitHub identity (an email- or Google-only user who is still an admin via their users.id).

github_usernamestring nullable required

GitHub username of the authenticated caller, sourced the same way as github_id. Display-only; the gate does not key on this value because GitHub usernames are mutable. null under the same condition as github_id.

adminboolean required

Always true on a 200 response.

Example response

{
  "github_id": 19820,
  "github_username": "dlucian",
  "admin": true
}

Changes

No recorded changes to this operation across all 1 revision of this API.