Skip to main content
Mesa de Ayuda tracks a Service Level Agreement (SLA) for every ticket. The SLA defines how many hours the team has to resolve a ticket after it is created. When the deadline passes, the ticket is flagged as overdue.

How SLA hours are assigned

SLA hours are set at ticket creation by the PostgreSQL function fn_crear_ticket. The function maps the ticket’s prioridad field to a number of hours according to rules defined in the database. You do not pass sla_horas directly — the API derives it from priority automatically.
fn_crear_ticket(...)  →  ticket_uuid
                          ticket_label
                          estado
                          tipo
                          prioridad
                          sla_horas        ← hours allowed from creation
                          fecha_creacion   ← timestamp the ticket was opened
                          fecha_limite_sla ← fecha_creacion + sla_horas
All four of these SLA-related fields are returned in the response to POST /tickets/crear.

SLA fields explained

FieldTypeDescription
sla_horasintegerTotal hours allocated for resolution, based on priority.
fecha_limite_sladatetimeThe absolute deadline: fecha_creacion + sla_horas.
horas_restantes / horas_restantes_slafloatHours remaining until the deadline at the time of the response. Negative if overdue.
vencido / sla_vencidobooleantrue when the current time has passed fecha_limite_sla.
The field names differ slightly between the two dashboard endpoints. See the table in the next section for the exact names each endpoint returns.

SLA in dashboard endpoints

Both dashboard endpoints expose SLA data, but they use slightly different field names.
The standard dashboard returns a summary row per ticket:
{
  "ticket_uuid": "3f7a1b2c-...",
  "ticket_label": "TK-2024-00042",
  "estado": "ASIGNADO",
  "prioridad": "ALTA",
  "sla_horas": 8,
  "horas_restantes": 2.5,
  "vencido": false
}
FieldNotes
sla_horasTotal hours allocated.
horas_restantesHours left at query time. Negative when overdue.
vencidotrue if the SLA deadline has passed.

What happens when the SLA expires

When the current server time exceeds fecha_limite_sla:
  • vencido (dashboard) and sla_vencido (metrics) are set to true.
  • horas_restantes / horas_restantes_sla becomes a negative number indicating how many hours overdue the ticket is.
  • The ticket remains in its current state — expiry does not automatically change the ticket workflow.
  • You can filter overdue tickets in the dashboard by checking vencido: true.
SLA expiry does not automatically escalate or reassign a ticket. Your integration is responsible for monitoring vencido and triggering any escalation workflows.

Priority and SLA allocation

The mapping between prioridad and sla_horas is configured in the database via fn_crear_ticket. The exact values depend on your deployment, but a common baseline is:
Priority (prioridad)Typical SLA (sla_horas)
CRITICA4
ALTA8
MEDIA24
BAJA72
Contact your database administrator to confirm the SLA values configured for your environment. The values above are illustrative only.

SLA lifecycle example

1

Ticket created

A requester submits a ticket with prioridad: ALTA. fn_crear_ticket calculates sla_horas = 8 and sets fecha_limite_sla = fecha_creacion + 8 hours.
2

Agent checks the dashboard

Three hours after creation, the agent queries /dashboard. The response shows horas_restantes: 5.0 and vencido: false.
3

SLA deadline passes

Nine hours after creation, the ticket is still open. The dashboard now returns horas_restantes: -1.0 and vencido: true.
4

Ticket resolved

The agent archives the ticket via POST /tickets/{ticket_id}/archivar. The historical fecha_limite_sla is preserved for reporting.

Build docs developers (and LLMs) love