Skip to main content
The Admin API allows SuperAdmins to create, list, and delete administrator accounts.
All Admin endpoints require SuperAdmin authorization. Regular admins and other roles cannot access these endpoints.

Get All Admins

Retrieve a paginated list of all administrator accounts.
curl -X GET "https://api.example.com/api/admins/page/1?pageSize=50" \
  -H "Authorization: Bearer YOUR_SUPER_ADMIN_TOKEN"

Request

Method: GET
Route: /api/admins/page/{page}
Auth: SuperAdmin required
page
integer
required
Page number (1-based)
pageSize
integer
default:"50"
Number of admins per page

Response

items
array
List of admin accounts
totalCount
integer
Total number of admin accounts
page
integer
Current page number
pageSize
integer
Items per page
totalPages
integer
Total number of pages

Example Response

200 OK
{
  "items": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "email": "[email protected]",
      "fullName": "John Admin",
      "createdAt": "2024-01-15T10:30:00Z"
    }
  ],
  "totalCount": 1,
  "page": 1,
  "pageSize": 50,
  "totalPages": 1
}

Create Admin

Create a new administrator account.
curl -X POST "https://api.example.com/api/admins" \
  -H "Authorization: Bearer YOUR_SUPER_ADMIN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "SecurePass123!",
    "firstName": "Jane",
    "lastName": "Admin"
  }'

Request

Method: POST
Route: /api/admins
Auth: SuperAdmin required
email
string
required
Admin email address (must be unique)
password
string
required
Admin password (minimum 8 characters, must contain uppercase, lowercase, digit, and special character)
firstName
string
required
Admin first name
lastName
string
required
Admin last name

Response

204 No Content

Error Responses

400 Bad Request
{
  "detail": "Email already exists"
}
400 Bad Request
{
  "detail": "Password does not meet security requirements"
}

Delete Admin

Delete an administrator account.
This action is permanent and cannot be undone. Ensure you want to delete the admin before proceeding.
curl -X DELETE "https://api.example.com/api/admins/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer YOUR_SUPER_ADMIN_TOKEN"

Request

Method: DELETE
Route: /api/admins/{adminId}
Auth: SuperAdmin required
adminId
string
required
Admin account ID (Guid) to delete

Response

204 No Content

Error Responses

404 Not Found
{
  "detail": "Admin not found"
}
400 Bad Request
{
  "detail": "Cannot delete your own admin account"
}
500 Internal Server Error
{
  "detail": "Failed to delete admin account"
}

Authorization

All Admin endpoints require the SuperAdmin role:
Authorization: Bearer YOUR_SUPER_ADMIN_TOKEN
To obtain a SuperAdmin token, log in with a SuperAdmin account using the Login endpoint and select the SuperAdmin role.

Identity Module

Learn about the Identity module and role management

Authentication

Understand JWT authentication and role-based access

Build docs developers (and LLMs) love