Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Medinaallan/ContabilidadISV/llms.txt

Use this file to discover all available pages before exploring further.

The logs API exposes ContabilidadISV’s system audit trail (bitácora del sistema). Only users with role='admin' can access either endpoint. Log entries are formatted for human readability before being returned: raw action codes are translated to friendly Spanish titles, dates are localised to Honduras time (UTC-6), and each entry carries a category and priority label suitable for display in the admin dashboard.
Both GET /api/logs and POST /api/logs require admin role. A 403 response is returned for any caller with role='user'.
Entries with action = 'api_request' or action = 'API_REQUEST' are automatically filtered out of GET /api/logs responses. Only meaningful business events (logins, consolidation changes, user management, etc.) are returned.

GET /api/logs

Retrieves a paginated list of audit log entries, optionally filtered by user or action type. Query parameters
limit
number
Maximum number of entries to return. Defaults to 100.
userId
number
Filter to entries generated by a specific user (numeric user ID).
action
string
Filter to entries with a specific action code (e.g. "USER_LOGIN", "consolidacion_created").
Response
success
boolean
Always true on a successful response.
logs
array
Array of formatted log entry objects. Each entry contains:
statistics
object
Aggregate statistics for the returned (filtered) log set.
total
number
Total count of log entries in the response array (mirrors statistics.total).
# Last 100 entries (default)
curl -X GET "https://your-host/api/logs" \
  -H "Authorization: Bearer $TOKEN"

# Last 50 login events for user ID 3
curl -X GET "https://your-host/api/logs?limit=50&userId=3&action=USER_LOGIN" \
  -H "Authorization: Bearer $TOKEN"
{
  "success": true,
  "logs": [
    {
      "id": 1024,
      "username": "contadora",
      "action": "USER_LOGIN",
      "description": "Inicio de sesión exitoso",
      "ip_address": "192.168.1.42",
      "created_at": "2024-07-10T20:15:00.000Z",
      "formatted_title": "Inicio de sesión de usuario",
      "formatted_message": "Inicio de sesión exitoso",
      "category": "Inicio de Sesión",
      "priority": "importante",
      "friendly_date": "10/07/2024 2:15:00 PM",
      "location_info": "Desde: 192.168.1.42"
    }
  ],
  "statistics": {
    "total": 1,
    "today": 1,
    "thisWeek": 8,
    "byCategory": { "Inicio de Sesión": 1 },
    "byPriority": { "normal": 0, "importante": 1, "critico": 0 }
  },
  "total": 1
}

POST /api/logs

Allows an admin to manually insert a log entry — useful for recording out-of-band administrative actions or annotating the audit trail. Admin only. Request body
action
string
required
Action code to record (e.g. "manual_audit", "database_backup"). Will be stored verbatim and mapped to a category/priority using the same rules as system-generated events.
description
string
required
Human-readable description of the event being logged.
Response201 Created
success
boolean
true on successful creation.
message
string
"Log creado exitosamente".
log
object
The newly created log entry in fully formatted form (all fields from GET /api/logs plus id and created_at).
curl -X POST https://your-host/api/logs \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "manual_audit",
    "description": "Revisión manual de consolidaciones Q2 completada por administrador."
  }'
{
  "success": true,
  "message": "Log creado exitosamente",
  "log": {
    "id": 1025,
    "username": "admin",
    "action": "manual_audit",
    "description": "Revisión manual de consolidaciones Q2 completada por administrador.",
    "ip_address": "10.0.0.1",
    "created_at": "2024-07-10T21:00:00.000Z",
    "formatted_title": "Manual Audit",
    "formatted_message": "Revisión manual de consolidaciones Q2 completada por administrador.",
    "category": "Sistema",
    "priority": "importante",
    "friendly_date": "10/07/2024 3:00:00 PM",
    "location_info": "Desde: 10.0.0.1"
  }
}

Log categories and priorities

The formatting layer maps raw action codes to categories and priorities using the rules shown in the tables below.

Categories

CategoryTriggered by
Inicio de SesiónUSER_LOGIN, login, or api_request containing "login"
Cierre de SesiónUSER_LOGOUT, logout, or api_request containing "logout"
ContabilidadActions containing "consolidacion"
Gestión de UsuariosActions containing "user" or requests to /users
Gestión de ClientesActions containing "cliente"
ReportesActions containing "reporte" or requests to /report
SistemaSYSTEM_INIT or actions containing "system"
Erroreserror action code

Priorities

PriorityLabelUsed when
normalStandard eventLogouts, user lookups, client lookups, reports
importanteNotable eventLogins, consolidation changes, system init
criticoCritical eventError events (action = "error")

  • Features → Audit Logs — UI walkthrough of the bitácora module
  • Admin API — security stats and database management (also admin-only)
  • Auth API — login and logout endpoints that generate log entries
  • Users API — user management operations tracked in the audit log

Build docs developers (and LLMs) love