Admin API
Every -auth jwt|both + -db app also gets a Swagger-documented admin API wrapping the core functions above — hand-authored, not routed through nexler create <route>'s generic machinery, since these are infrastructure endpoints with real field definitions from day one. Wired into routes/protected/protected.go automatically, same as kgate's webhook route.
| Method & path | Calls |
|---|---|
| GET /admin/users | core.ListUsers — no pagination |
| POST /admin/users | core.CreateUser — create/upsert |
| GET /admin/users/{id} | core.GetUser |
| PATCH /admin/users/{id}/status | core.SetUserStatus |
| DELETE /admin/users/{id} | core.DeleteUser — hard delete, unlike the status toggle above |
| GET /admin/services | core.ListServices — metadata only, never keys; includes last_used_at (Mongo-backed apps only — see core.Service.LastUsedAt) |
| POST /admin/services | core.CreateService — key in the response exactly once |
| GET /admin/services/{name} | core.GetService — metadata only, same last_used_at caveat as above |
| POST /admin/services/{name}/revoke | core.RevokeService |
| DELETE /admin/services/{name} | core.DeleteService — hard delete, unlike revoke above |
Every route wraps in
middleware.RegisterTask with requireAuth true — that confirms the caller is authenticated, not that they're allowed to manage other users/services. RegisterTask's PermissionCheck hook is nil until nexler init kpass sets it (to services/kpass's CheckAccess) — before relying on this in production, run init kpass so it's a real check rather than authentication alone.curl -X POST /admin/services -H "Authorization: Bearer $TOKEN" \
-d '{"name":"billing-svc"}'
// {"name":"billing-svc","key":"a1b2c3..."} -- key shown exactly once