Skip to main content
All admin endpoints require authentication with an admin role. Users with the user role will receive a 403 Forbidden error.

Authentication

Admin endpoints require a valid Bearer token from a user with the admin role.
Authorization: Bearer YOUR_ADMIN_ACCESS_TOKEN
You can obtain an access token by logging in with admin credentials via the Login endpoint.

Dashboard Statistics

Get comprehensive statistics for the admin dashboard.

Endpoint

curl -X GET 'https://api.ceboelha.com/admin/dashboard/stats' \
  -H 'Authorization: Bearer YOUR_ADMIN_TOKEN' \
  -H 'Content-Type: application/json'

Response

success
boolean
required
Indicates if the request was successful
data
object
required
Dashboard statistics

Response Example

{
  "success": true,
  "data": {
    "users": {
      "total": 1543,
      "active": 1421,
      "new_today": 12,
      "new_week": 87
    },
    "content": {
      "total_articles": 145,
      "published_articles": 132,
      "total_foods": 5432
    },
    "activity": {
      "meals_logged_today": 234,
      "symptoms_logged_today": 156,
      "total_diary_entries": 45678
    }
  }
}

Activity Log

Get paginated activity logs with optional filters.

Endpoint

curl -X GET 'https://api.ceboelha.com/admin/activity-log?page=1&limit=20&type=user' \
  -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 logs per page (1-100)
type
string
Filter by activity type: user, content, food, admin, or all
userId
string
Filter by specific user ID
startDate
string
Filter logs from this date (ISO 8601 format)
endDate
string
Filter logs until this date (ISO 8601 format)

Response

success
boolean
required
Indicates if the request was successful
data
array
required
Array of activity log objects
pagination
object
required
Pagination information (page, limit, total, totalPages, hasMore)

Response Example

{
  "success": true,
  "data": [
    {
      "id": "60d5ec49f1a4c3b6d8e9f0a1",
      "type": "user",
      "action": "user_created",
      "details": "New user registered",
      "userId": "60d5ec49f1a4c3b6d8e9f0a2",
      "userName": "John Doe",
      "userEmail": "[email protected]",
      "ip_address": "192.168.1.1",
      "user_agent": "Mozilla/5.0...",
      "timestamp": "2024-03-01T10:30:00Z"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 543,
    "totalPages": 28,
    "hasMore": true
  }
}

Analytics

Get analytics data for the specified period.

Endpoint

curl -X GET 'https://api.ceboelha.com/admin/analytics?period=week' \
  -H 'Authorization: Bearer YOUR_ADMIN_TOKEN' \
  -H 'Content-Type: application/json'

Query Parameters

period
string
default:"week"
Time period for analytics: day, week, or month

Response

success
boolean
required
Indicates if the request was successful
data
object
required
Analytics data including time series data for users, entries, and engagement metrics

Rate Limiting

Admin endpoints have enhanced rate limiting:
  • Read operations (GET): 100 requests per minute
  • Write operations (POST, PATCH, DELETE): 30 requests per minute

Error Responses

Unauthorized (401)

{
  "success": false,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Autenticação necessária"
  }
}

Forbidden (403)

{
  "success": false,
  "error": {
    "code": "FORBIDDEN",
    "message": "Acesso restrito a administradores"
  }
}

Available Admin Sections

The admin panel provides management for:
  • Users - Create, update, delete, and manage users
  • System Settings - Configure system-wide settings
  • News Articles - Manage news and recipe content
  • Foods - Manage food database
  • Diary Entries - View and moderate user diary entries
  • Problematic Foods - View user-reported problematic foods
  • Achievements - Manage achievement definitions

Build docs developers (and LLMs) love