The Admin API provides platform-level visibility into user metrics and account management. All endpoints require superuser authentication and are mounted under /api/admin/.
These endpoints are restricted to superuser accounts. Regular users receive a 403 Forbidden response.
GET /api/admin/stats
Return aggregate statistics for the admin dashboard.
Headers:
Bearer <access_token> — must be a superuser token.
curl --request GET \
--url http://localhost:8000/api/admin/stats \
--header "Authorization: Bearer <access_token>"
Response:
Total number of registered user accounts.
Number of users with subscription_status set to active.
Number of users who registered in the last 7 days.
Number of users who have verified their email address.
{
"total_users" : 1250 ,
"active_subscriptions" : 340 ,
"new_users_7d" : 42 ,
"verified_users" : 980
}
GET /api/admin/users
Return a paginated list of all user accounts, ordered by creation date (newest first).
Headers:
Bearer <access_token> — must be a superuser token.
Query parameters:
Page number. Must be 1 or greater.
Number of users per page. Must be between 1 and 100.
curl --request GET \
--url "http://localhost:8000/api/admin/users?page=1&limit=20" \
--header "Authorization: Bearer <access_token>"
import requests
response = requests.get(
"http://localhost:8000/api/admin/users" ,
headers = { "Authorization" : f "Bearer { access_token } " },
params = { "page" : 1 , "limit" : 20 },
)
data = response.json()
print ( f "Showing { len (data[ 'users' ]) } of { data[ 'total' ] } users" )
Response:
Array of user objects for the requested page. Whether the account is active.
Whether the email is verified.
Current subscription status.
Current subscription tier.
ISO 8601 account creation timestamp.
ISO 8601 timestamp of the last login, or null.
Total number of users across all pages.
Number of users per page.
{
"users" : [
{
"id" : "3fa85f64-5717-4562-b3fc-2c963f66afa6" ,
"email" : "user@example.com" ,
"full_name" : "Jane Smith" ,
"is_active" : true ,
"is_verified" : true ,
"subscription_status" : "active" ,
"subscription_tier" : "pro" ,
"created_at" : "2026-04-01T10:30:00Z" ,
"last_login_at" : "2026-04-09T09:00:00Z"
}
],
"total" : 1250 ,
"page" : 1 ,
"limit" : 20 ,
"pages" : 63
}