SumoRouter Admin API
Everything an admin can do in the SumoRouter dashboard, as a REST API: users and their balances, virtual (user) API keys, request logs, the model catalog and prices, finance reports and payments, analytics, coupons, the affiliate program, site settings, admin API keys and the audit log.
Authentication
Every request needs Authorization: Bearer <token>, where the token is either:
- an admin API key (
sk-admin-…), created in Admin → Admin API from a dashboard session. Keys can be read-only (onlyGET/HEADallowed, anything else returns403), can expire, can be limited to IP addresses / CIDR ranges (checked against theX-Real-IPheader set by the reverse proxy; without it an IP-restricted key is refused), and are rate-limited to 120 requests per minute per key (429beyond that). A key stops working when it is revoked or when its owner is disabled or no longer an admin. Admin API keys cannot manage admin API keys: the/api-keysroutes require a dashboard session. - an admin dashboard session (the JWT the dashboard gets at sign-in). Admin sessions are only issued after two-factor authentication; sessions without 2FA are refused.
User API keys (sk-… without admin-) do not work here (they are rejected with 401), and
admin API keys do not work on the AI endpoints (/v1/*).
Conventions
- Money is integer nano-USD:
1 USD = 1_000_000_000nano-USD (fields ending in_nano). Amounts ending in_idrare whole Indonesian Rupiah (top-ups are paid in IDR via QRIS). - Timestamps are RFC 3339 / ISO 8601 in UTC unless stated otherwise.
- Paginated lists take
limitandoffsetand return{ "items": [...], "total": n }(plus extra counters on some endpoints).limitis clamped to1..200; a negativeoffsetis treated as0. - Secrets in settings are never returned: responses carry a masked
*_hintinstead (e.g.sk-****-a1b2), ornullwhen unset. OnPUT, omitting a secret (or sending an empty string) keeps the stored value. - Errors use an OpenAI-style body:
{"error": {"message", "type", "code"}}. Requests whose JSON body is malformed or misses a required field are rejected by the framework before the handler runs, with400/415/422and a plain-text body. - Every successful change (non-
GET) is written to the audit log, with the admin API key id indetails.admin_api_keywhen one was used. Request bodies of settings are never logged.
MCP server
The same admin API is also available to AI agents as an MCP server at /mcp (e.g.
https://<your-domain>/mcp), using the Streamable HTTP transport (JSON responses, no SSE) and
authenticated with the same Authorization: Bearer sk-admin-… header. Each MCP tool call is
executed as a request to this REST API with the caller's key, so read-only keys, IP allow-lists,
validation and the audit log apply identically. See the MCP guide for the tool list and client setup.
ai, payment, auth, limits, retention,
branding, email and affiliate. Secrets are returned masked and kept when omitted on PUT.sk-admin-… keys for this API and the MCP server. These routes only accept a dashboard session
(with 2FA); an admin API key gets 403.