Skip to main content

Admin API

Administrative endpoints for user management, system settings, and database operations. All endpoints require system admin authentication.

User Management

List Users

Get all users with optional filtering.

GET /api/admin/users

Query Parameters

ParameterTypeDescription
searchstringSearch by username, name, or email
statusstringFilter by active or disabled
rolestringFilter by admin or user
sortBystringSort field: username, name, email, createdAt
sortOrderstringSort direction: asc or desc

Response

[
{
"id": "clx1user1",
"username": "johndoe",
"email": "john@example.com",
"name": "John Doe",
"avatar": "/uploads/avatars/abc.webp",
"isSystemAdmin": false,
"isActive": true,
"createdAt": "2024-01-01T00:00:00.000Z"
}
]

Create User

Create a new user account (bypasses registration).

POST /api/admin/users

Request Body

{
"username": "newuser",
"email": "new@example.com",
"name": "New User",
"password": "SecurePass123",
"isSystemAdmin": false,
"confirmPassword": "AdminPassword123"
}
FieldTypeRequiredDescription
usernamestringYes3-30 chars, alphanumeric/dash/underscore
emailstringNoValid email, must be unique
namestringNoDisplay name
passwordstringYesNew user's password
isSystemAdminbooleanNoGrant admin privileges
confirmPasswordstringYesYour admin password for confirmation

Get User

Get a specific user by ID.

GET /api/admin/users/[userId]

Update User

Update user details.

PATCH /api/admin/users/[userId]

Request Body

{
"name": "Updated Name",
"email": "newemail@example.com",
"isSystemAdmin": true,
"isActive": false
}

All fields are optional. Only include fields you want to update.

Restrictions

  • Cannot demote yourself from admin (if sole admin)
  • Cannot disable your own account
  • Cannot delete your own account

Delete User

Permanently delete a user.

DELETE /api/admin/users/[userId]

Request Body

{
"confirmPassword": "YourAdminPassword"
}
danger

User deletion is permanent and removes all user data.

System Settings

Get Settings

Retrieve current system settings.

GET /api/admin/settings

Response

{
"id": "system-settings",
"maxImageSize": 5242880,
"maxVideoSize": 52428800,
"maxDocumentSize": 10485760,
"maxAttachmentsPerTicket": 20,
"allowedImageTypes": ["image/jpeg", "image/png", "image/gif", "image/webp"],
"allowedVideoTypes": ["video/mp4", "video/webm", "video/ogg", "video/quicktime"],
"allowedDocumentTypes": ["application/pdf", "text/plain", "text/csv"]
}

Update Settings

Update system settings.

PATCH /api/admin/settings

Request Body

{
"maxImageSize": 10485760,
"maxAttachmentsPerTicket": 30
}
FieldTypeDescription
maxImageSizenumberMax image size in bytes
maxVideoSizenumberMax video size in bytes
maxDocumentSizenumberMax document size in bytes
maxAttachmentsPerTicketnumberMax attachments per ticket
allowedImageTypesstring[]Allowed image MIME types
allowedVideoTypesstring[]Allowed video MIME types
allowedDocumentTypesstring[]Allowed document MIME types

Database Operations

All database operations require password confirmation and are destructive.

Export Database

Create a full database backup.

POST /api/admin/database/export

Request Body

{
"confirmPassword": "YourAdminPassword"
}

Response

Returns a JSON file download containing all database data.

Import Database

Restore from a backup file.

POST /api/admin/database/import
Content-Type: multipart/form-data
FieldTypeDescription
fileFileBackup JSON file
confirmPasswordstringYour admin password

Response

{
"success": true,
"imported": {
"users": 5,
"projects": 3,
"tickets": 42,
"sprints": 8
}
}
warning

Import replaces all existing data. All users will be signed out.

Wipe Database

Completely reset the database.

POST /api/admin/database/wipe

Request Body

{
"confirmPassword": "YourAdminPassword",
"confirmation": "wipe all data"
}

Response

{
"success": true,
"newAdminCredentials": {
"username": "admin",
"temporaryPassword": "generated-temp-password"
}
}

A new admin account is created after wipe.

danger

This permanently deletes all data including users, projects, and tickets.

Wipe Projects Only

Remove all projects while keeping users.

POST /api/admin/database/wipe-projects

Request Body

{
"confirmPassword": "YourAdminPassword"
}

Response

{
"success": true,
"wiped": {
"projects": 3,
"tickets": 42,
"sprints": 8
}
}

This preserves:

  • User accounts and passwords
  • System settings

Error Responses

401 Unauthorized

{
"error": "Authentication required"
}

403 Forbidden

{
"error": "System admin access required"
}

400 Bad Request

{
"error": "Invalid password confirmation"
}

Or for self-modification restrictions:

{
"error": "Cannot disable your own account"
}