Administration routes

Admin-only routes behind the Thundera admin role: models, packs, users, usage, audit and settings.

Admin role required

These routes return 403 for anyone without the Thundera admin role. They power the Swarm system pages.

GET /api/v1/admin/models

All models including disabled ones.

Auth
Admin role
Body / query
—
Response
{models:[...]}
Errors
401, 403

PATCH /api/v1/admin/models

Enable/disable models, edit multipliers, context window and output cap.

Auth
Admin role
Body / query
{models:[{id, enabled?, display_name?, input_credit_multiplier?, output_credit_multiplier?, ...}]}
Response
Updated models
Errors
400, 401, 403

GET /api/v1/admin/plans

All credit packs.

Auth
Admin role
Body / query
—
Response
{plans:[...]}
Errors
401, 403

PATCH /api/v1/admin/plans

Edit pack name, price, credits and active flag.

Auth
Admin role
Body / query
{plans:[{id, name?, price_cents?, credits?, active?}]}
Response
Updated plans
Errors
400, 401, 403

GET /api/v1/admin/users

Users with balances.

Auth
Admin role
Body / query
Query: q, limit, offset
Response
{users:[...], total}
Errors
401, 403

PATCH /api/v1/admin/users/:id/credits

Manual grant or adjustment. Always audited.

Auth
Admin role
Body / query
delta_credits (non-zero integer), reason
Response
New balance
Errors
400, 401, 403, 404

GET /api/v1/admin/usage

Usage events across all users.

Auth
Admin role
Body / query
Query: user_id, model, from, to, status, limit, offset
Response
{events:[...], total}
Errors
401, 403

GET /api/v1/admin/stats

Aggregate usage and spend for a period.

Auth
Admin role
Body / query
Query: from, to
Response
Stats object
Errors
401, 403

GET /api/v1/admin/audit-log

Audit trail.

Auth
Admin role
Body / query
Query: user_id, action, limit, offset
Response
{entries:[...], total}
Errors
401, 403

GET /api/v1/admin/settings

Key/value settings.

Auth
Admin role
Body / query
—
Response
{settings:{...}}
Errors
401, 403

PATCH /api/v1/admin/settings

Update settings.

Auth
Admin role
Body / query
{settings:{key: value}}
Response
Updated settings
Errors
400, 401, 403
Source of truth: the Swarm repository