Superadmin BE - #10
Open
nikhilgosavi-josh wants to merge 1 commit into
Open
Conversation
Add organizations, user provisioning, system health/settings endpoints, JWT access tokens with httpOnly refresh cookies and revocation table, and merge refresh_token_revocations into the initial Alembic migration. Co-authored-by: Cursor <cursoragent@cursor.com>
nikhilgosavi-josh
force-pushed
the
feat/superadmin-api
branch
from
August 14, 2026 06:23
4cf2150 to
ef84578
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EZScreen Super Admin APIs — Request & Response
Base URL: /api/v1
Auth: Authorization: Bearer <access_token>
Refresh cookie: ezscreen_refresh (httpOnly, path=/api/v1/auth)
================================================================================
AUTH
Auth: none
Request:
{
"email": "admin@ezscreen.io",
"password": "your-password"
}
Response 200:
{
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"token_type": "bearer",
"expires_in": 3600,
"user": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"organization_id": null,
"role": "super_admin",
"email": "admin@ezscreen.io",
"first_name": "Platform",
"last_name": "Admin",
"phone": null,
"status": "active"
}
}
Also sets cookie: ezscreen_refresh
Auth: refresh cookie only
Request: (no body)
Response 200:
{
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"token_type": "bearer",
"expires_in": 3600
}
Also rotates cookie: ezscreen_refresh
Auth: Bearer
Request: (no body)
Response 200:
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"organization_id": null,
"role": "super_admin",
"email": "admin@ezscreen.io",
"first_name": "Platform",
"last_name": "Admin",
"phone": null,
"status": "active"
}
Auth: Bearer
Request:
{}
Response 200:
{
"message": "Successfully logged out"
}
Also clears cookie: ezscreen_refresh
Auth: Bearer (super_admin only)
Request: (no body)
Response 200:
{
"message": "Super admin access confirmed"
}
================================================================================
ORGANIZATIONS
Auth: Bearer (super_admin)
Query: page=1&limit=20&q=acme&status=active
Request: (no body)
Response 200:
[
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "Acme Corp",
"domain": "acme",
"logo_url": null,
"is_active": true,
"created_at": "2026-08-12T10:00:00+00:00",
"user_count": 3,
"job_count": 12,
"application_count": 45
}
]
Auth: Bearer (super_admin)
Request:
{
"name": "Acme Corp",
"domain": "acme",
"logo_url": "https://cdn.example.com/acme.png"
}
Response 201:
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "Acme Corp",
"domain": "acme",
"logo_url": "https://cdn.example.com/acme.png",
"is_active": true,
"created_at": "2026-08-12T10:00:00+00:00",
"user_count": 0,
"job_count": 0,
"application_count": 0
}
Auth: Bearer (super_admin or org_admin for own org)
Request: (no body)
Response 200:
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "Acme Corp",
"domain": "acme",
"logo_url": null,
"is_active": true,
"created_at": "2026-08-12T10:00:00+00:00",
"user_count": 3,
"job_count": 12,
"application_count": 45
}
Auth: Bearer (super_admin or org_admin for own org)
Request (all fields optional):
{
"name": "Acme Corporation",
"domain": "acme-corp",
"logo_url": "https://cdn.example.com/new-logo.png",
"is_active": true
}
Response 200:
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "Acme Corporation",
"domain": "acme-corp",
"logo_url": "https://cdn.example.com/new-logo.png",
"is_active": true,
"created_at": "2026-08-12T10:00:00+00:00",
"user_count": 3,
"job_count": 12,
"application_count": 45
}
Auth: Bearer (super_admin)
Request: (no body)
Response 200:
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"is_active": false,
"message": "Organization deactivated"
}
Auth: Bearer (super_admin or org_admin for own org)
Request: (no body)
Response 200:
[
{
"id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"organization_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"role": "organization_admin",
"email": "admin@acme.com",
"first_name": "Jane",
"last_name": "Doe",
"phone": null,
"status": "active",
"temporary_password": null
}
]
Auth: Bearer (super_admin or org_admin for own org)
Request:
{
"email": "hr@acme.com",
"password": "OptionalMin8Chars",
"first_name": "Jane",
"last_name": "Doe",
"phone": "+91-9876543210",
"role": "organization_admin"
}
Notes:
Response 201:
{
"id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"organization_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"role": "organization_admin",
"email": "hr@acme.com",
"first_name": "Jane",
"last_name": "Doe",
"phone": "+91-9876543210",
"status": "active",
"temporary_password": "xK9#mP2qL8nR"
}
Note: temporary_password is set only when password was auto-generated.
================================================================================
SYSTEM
Auth: none
Request: (no body)
Response 200:
{
"status": "healthy",
"service": "core-api",
"database_url_configured": true,
"jwt_configured": true
}
Auth: Bearer (super_admin)
Request: (no body)
Response 200:
{
"status": "healthy",
"service": "core-api",
"database": {
"name": "PostgreSQL",
"detail": "primary database",
"status": "healthy"
},
"api": {
"name": "API gateway",
"detail": "core-api local",
"status": "healthy"
},
"parse_workers": {
"name": "Parse workers (JD / resume)",
"detail": "Workers and Attendee bot are not deployed yet — shown as pending/healthy stub.",
"status": "healthy"
},
"screening_bot": {
"name": "Screening bot dispatch",
"detail": "Attendee integration not configured",
"status": "degraded"
},
"object_storage": {
"name": "Object storage (S3)",
"detail": "MinIO / S3 not required for platform ops API",
"status": "healthy"
},
"stats": {
"organizations": 5,
"users": 42,
"jobs": 18,
"applications": 120,
"uptime_seconds": 8642,
"jwt_ttl_minutes": 60
},
"recent_events": [
{
"time": "14:30",
"message": "Health check · 5 orgs · 42 users"
},
{
"time": "12:00",
"message": "Core API process started"
}
]
}
Auth: Bearer (super_admin)
Request: (no body)
Response 200:
{
"platform_name": "EZScreen",
"support_email": "support@ezscreen.io",
"timezone": "Asia/Kolkata",
"extraction_model": "gemma-parse-v2",
"screening_model": "gemma-screen-v3",
"auto_retry_failed_jobs": true,
"require_mfa_super_admin": true,
"invite_expiry_days": 7
}
Auth: Bearer (super_admin)
Request (all fields optional):
{
"platform_name": "EZScreen",
"support_email": "support@ezscreen.io",
"timezone": "UTC",
"extraction_model": "gemma-parse-v2",
"screening_model": "gemma-screen-v3",
"auto_retry_failed_jobs": true,
"require_mfa_super_admin": false,
"invite_expiry_days": 14
}
Response 200:
{
"platform_name": "EZScreen",
"support_email": "support@ezscreen.io",
"timezone": "UTC",
"extraction_model": "gemma-parse-v2",
"screening_model": "gemma-screen-v3",
"auto_retry_failed_jobs": true,
"require_mfa_super_admin": false,
"invite_expiry_days": 14
}