The Ticket API powers the end-to-end support workflow for water dispenser incidents. Tickets are created by any authenticated user who spots a problem, automatically assigned SLA deadlines based on the client’s configuration, and then routed through aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/GianlucaBessone/HDB-Service/llms.txt
Use this file to discover all available pages before exploring further.
OPEN → IN_PROGRESS → RESOLVED → CLOSED lifecycle. The system emits push notifications (via OneSignal) and emails at key transition points.
Data-scope filtering is applied automatically per role: technicians see only tickets assigned to them; CLIENT_REQUESTER users see tickets from their plants plus any ticket they personally reported; higher roles see all tickets within their data scope.
GET /api/tickets
Returns a paginated list of tickets matching the supplied filters, ordered bypriority (descending) then createdAt (descending).
Required permission: tickets:read
Query parameters
Filter by status. Accepted values:
OPEN, IN_PROGRESS, RESOLVED, CLOSED.Filter by priority. Accepted values:
LOW, MEDIUM, HIGH, CRITICAL.Filter tickets assigned to a specific user ID.
Filter tickets linked to a specific dispenser ID.
SLA health filter. Accepted values:
BREACHED—slaResolutionBreachedistrue.NEAR_BREACH— resolution deadline is within the next 2 hours and the ticket is not closed.ON_TIME— no SLA filter (returns all SLA-healthy tickets).
Page number (1-indexed). Defaults to
1.Results per page. Defaults to
50.Response fields
Array of ticket objects. Each ticket includes a nested
dispenser (id, marca, modelo, status), location (with plant and client name), reportedBy (nombre, role), assignedTo (nombre), and a _count.comments integer.Total number of matching tickets across all pages.
Current page number, echoed from the request.
Page size, echoed from the request.
Example
Error cases
| Status | Description |
|---|---|
401 | Missing or invalid authentication session. |
403 | Caller lacks tickets:read. |
POST /api/tickets
Creates a new support ticket. SLA response and resolution deadlines are automatically calculated from the client’sSlaConfig based on the resolved location and requested priority. Supervisors and admins receive an in-app notification and a push notification (OneSignal) immediately after creation.
Supports idempotency via an Idempotency-Key request header.
Required permission: tickets:write
Request body
Short description of the problem (displayed as the ticket title).
ID of the affected dispenser. If
locationId is not provided, the dispenser’s current location is used automatically.ID of the affected location. Overrides automatic location resolution from
dispenserId.Extended description of the issue.
Ticket priority. Accepted values:
LOW, MEDIUM, HIGH, CRITICAL. Defaults to MEDIUM.If
true, the reporter opts in to push notifications for status updates on this ticket.If
true, the reporter opts in to email notifications for status updates on this ticket.Response fields
Generated ticket ID (CUID).
Ticket reason as submitted.
Resolved priority.
Always
OPEN on creation.ISO 8601 response deadline derived from the client’s SLA config.
ISO 8601 resolution deadline derived from the client’s SLA config.
Nested dispenser object (
id, marca, modelo) if dispenserId was provided.Nested location object with
plant.nombre if a location was resolved.ISO 8601 creation timestamp.
Example
Error cases
| Status | Description |
|---|---|
400 | reason is missing or blank. |
401 | Missing or invalid authentication session. |
403 | Caller lacks tickets:write. |
GET /api/tickets/{id}
Retrieves a single ticket with full relational detail. Required permission:tickets:read
CLIENT_REQUESTER users can fetch any ticket they reported, even if the dispenser is outside their normal plant scope.Response fields
Ticket ID.
Ticket title/reason.
Extended description.
Current priority.
Current status.
Nested dispenser with its current
location (including plant, client, and sector).Direct ticket location with nested
plant, client, and sector.Reporter details:
id, nombre, role.Assigned technician:
id, nombre. null if unassigned.All comments ordered oldest-first, each with
user.nombre, user.apellido, and user.role.Full status change history ordered oldest-first, including
fromStatus, toStatus, changedBy, changedAt, and notes.SLA response deadline.
SLA resolution deadline.
Whether the response SLA was breached.
Whether the resolution SLA was breached.
Timestamp when the ticket first moved to
IN_PROGRESS.Timestamp when the ticket was first moved to
RESOLVED or CLOSED.Example
Error cases
| Status | Description |
|---|---|
401 | Missing or invalid authentication session. |
403 | Caller lacks tickets:read or the ticket is outside their data scope. |
404 | No ticket found with the given ID. |
PUT /api/tickets/{id}
Updates a ticket’s status, assignment, priority, or a combination of these. Each status change creates aTicketStatusHistory record. SLA timestamps are tracked automatically:
- Transitioning to
IN_PROGRESSrecordsrespondedAtand checks the response SLA deadline. - Transitioning to
RESOLVEDorCLOSEDrecordsresolvedAtand checks the resolution SLA deadline. - Closing a ticket that was never
RESOLVEDtriggers notifications to the reporter and all supervisors.
tickets:writefor status and priority changes.tickets:assignto changeassignedToId.tickets:closeto set status toCLOSED.
Request body
New status. Accepted values:
OPEN, IN_PROGRESS, RESOLVED, CLOSED.User ID of the technician to assign. Pass
null to unassign. Triggers a push notification and email to the assigned user.Updated priority. Accepted values:
LOW, MEDIUM, HIGH, CRITICAL.Optional notes to attach to the status history record (e.g. resolution summary).
Response fields
Ticket ID.
Updated status.
Updated assignee ID.
Updated priority.
Set on the first
IN_PROGRESS transition.Set on the first
RESOLVED or CLOSED transition.Updated breach flag.
Updated breach flag.
Example
Error cases
| Status | Description |
|---|---|
400 | status value is not a valid TicketStatus. |
401 | Missing or invalid authentication session. |
403 | Caller lacks the required permission, is a technician trying to update a ticket not assigned to them, or attempting to close without tickets:close. |
404 | Ticket not found. |
POST /api/tickets/{id}/comments
Adds a comment to an existing ticket. Returns the created comment with the author’s display name and role. Required permission:tickets:write
Request body
Comment text. Cannot be blank.
Response fields
Comment ID (CUID).
Parent ticket ID.
Author’s user ID.
Comment content.
ISO 8601 creation timestamp.
Author details:
nombre, apellido, role.Example
Error cases
| Status | Description |
|---|---|
400 | message is missing or blank. |
401 | Missing or invalid authentication session. |
403 | Caller lacks tickets:write. |
POST /api/tickets/{id}/repair
Records a completed repair against the ticket’s dispenser. The operation is performed in a single database transaction that:- Optionally processes consumables/spare parts used during the repair, decrementing live inventory and writing
DispenserConsumableHistoryentries. - Creates a
DispenserRepairHistoryentry linked to the dispenser. - Posts an automatic comment summarising the repair.
- Advances the ticket status to
RESOLVEDand recordsresolvedAt.
tickets:write
The ticket must have a
dispenserId. Calling this endpoint on a ticket without an associated dispenser returns 400.Request body
Description of the problem that was repaired.
Technical diagnosis or root cause.
Consumables and spare parts consumed during the repair. Stock is deducted from the dispenser’s plant inventory.
Response fields
true when the repair was fully recorded and the ticket resolved.Example
Error cases
| Status | Description |
|---|---|
400 | descripcion is missing, or the ticket has no associated dispenser. |
401 | Missing or invalid authentication session. |
403 | Caller lacks tickets:write. |
404 | Ticket not found. |
500 | Insufficient stock or unknown material code — the error message describes the specific item. |