Skip to main content
All admin endpoints require authentication with an admin role.

List Users

Get paginated list of users with optional filters.

Endpoint

curl -X GET 'https://api.ceboelha.com/admin/users?page=1&limit=20&status=active' \
  -H 'Authorization: Bearer YOUR_ADMIN_TOKEN' \
  -H 'Content-Type: application/json'

Query Parameters

page
integer
default:"1"
Page number for pagination
limit
integer
default:"20"
Number of users per page (1-100)
Search by name or email
role
string
Filter by role: user, admin, or all
status
string
Filter by status: active, inactive, banned, or all

Response

success
boolean
required
Indicates if the request was successful
data
array
required
Array of user objects
pagination
object
required
Pagination information

Get User by ID

Get detailed user information by ID.

Endpoint

GET /admin/users/:id

Path Parameters

id
string
required
User’s MongoDB ObjectId

Response Example

{
  "success": true,
  "data": {
    "id": "60d5ec49f1a4c3b6d8e9f0a2",
    "email": "[email protected]",
    "name": "John Doe",
    "avatar": "https://example.com/avatar.jpg",
    "role": "user",
    "status": "active",
    "stats": {
      "daysUsingApp": 45,
      "totalMealsLogged": 234,
      "totalSymptomsLogged": 156,
      "lastActive": "2024-03-01T10:30:00Z"
    },
    "createdAt": "2024-01-15T09:00:00Z",
    "updatedAt": "2024-03-01T10:30:00Z"
  }
}

Create User

Create a new user (admin can set role).

Endpoint

curl -X POST 'https://api.ceboelha.com/admin/users' \
  -H 'Authorization: Bearer YOUR_ADMIN_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "email": "[email protected]",
    "name": "Jane Smith",
    "password": "SecurePassword123",
    "role": "user"
  }'

Request Body

email
string
required
User’s email address (must be unique)
name
string
required
User’s full name (2-100 characters)
password
string
required
User’s password (minimum 8 characters)
role
string
default:"user"
User role: user or admin

Response

success
boolean
required
Indicates if the request was successful
data
object
required
Created user object

Update User

Update user information (name, email, role, status).

Endpoint

curl -X PATCH 'https://api.ceboelha.com/admin/users/60d5ec49f1a4c3b6d8e9f0a2' \
  -H 'Authorization: Bearer YOUR_ADMIN_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "John Updated",
    "status": "inactive"
  }'

Path Parameters

id
string
required
User’s MongoDB ObjectId

Request Body

All fields are optional. Only include fields you want to update.
name
string
User’s full name (2-100 characters)
email
string
User’s email address (must be unique)
role
string
User role: user or admin
status
string
User status: active, inactive, or banned

Response

success
boolean
required
Indicates if the request was successful
data
object
required
Updated user object

Delete User

Permanently delete a user and all associated data.

Endpoint

curl -X DELETE 'https://api.ceboelha.com/admin/users/60d5ec49f1a4c3b6d8e9f0a2' \
  -H 'Authorization: Bearer YOUR_ADMIN_TOKEN' \
  -H 'Content-Type: application/json'

Path Parameters

id
string
required
User’s MongoDB ObjectId

Response

{
  "success": true
}
This action is irreversible! Deleting a user will permanently remove:
  • User account and profile
  • All diary entries (meals and symptoms)
  • All problematic foods marked by the user
  • All achievement progress
  • All user settings

User Status Values

StatusDescription
activeUser can log in and use the app normally
inactiveUser account is temporarily disabled
bannedUser is permanently banned from the platform

User Role Values

RoleDescription
userRegular user with standard permissions
adminAdministrator with full access to admin panel

Notes

  • All endpoints require admin authentication
  • Email addresses must be unique across all users
  • Password changes via admin panel are logged in activity log
  • Deleting a user cannot be undone
  • Changing a user’s role takes effect immediately

Build docs developers (and LLMs) love