List Tickets
GET /api/tickets
Retrieve a paginated list of tickets with optional filtering and sorting.
Query Parameters
Filter tickets by collection center ID. If not provided, uses the active center from configuration.
Number of tickets to return per page (max: 200)
Number of tickets to skip for pagination
Search term to filter by generator name or ticket number (case-insensitive)
Filter tickets by date (partial match supported)
Field to sort by:
ticketNumber, date, center, generatorName, quantity, or collectorNameSort direction:
ASC or DESCResponse
Array of ticket objects
Total count of tickets matching the filters
Example Request
Example Response
Get Ticket Count
GET /api/tickets/count
Retrieve the total count of tickets.
Query Parameters
Filter count by collection center ID. If not provided, uses the active center from configuration.
Response
Total number of tickets
Example Request
Example Response
Preview Next Ticket Number
GET /api/tickets/preview-number
Preview the next ticket number that will be generated without creating a ticket. Useful for displaying to users before they save.
Query Parameters
Collection center ID. If not provided, uses the active center from configuration.
Ticket date (DD/MM/YYYY or YYYY-MM-DD) - used to determine year in ticket number
Response
The next ticket number that will be generated (format: AV---)
Example Request
Example Response
Error Response
Get Ticket by ID
GET /api/tickets/:id
Retrieve a single ticket by its ID.
Path Parameters
Ticket ID
Response
Returns a single ticket object (see List Tickets for structure) ornull if not found.
Example Request
Create Ticket
POST /api/tickets
Create a new collection ticket. The ticket number is automatically generated based on the collection center’s state and the ticket date.
Request Body
Unique ticket identifier (UUID)
Collection date (DD/MM/YYYY or YYYY-MM-DD)
ID of the generator (waste oil producer)
Name of the generator (cached for historical records)
Type of material collected
Quantity collected in liters
State of material: “Filtrado”, “Bruto”, or “Mezcla”
Name of the person who collected
License plate of collection vehicle
Collection center ID. If not provided, uses the active center from configuration.
ID of the collection center member who collected
Response
Returns the created ticket object with the auto-generatedticket_number and created_at fields.
Example Request
Error Responses
Update Ticket
PUT /api/tickets/:id
Update an existing ticket. Unlike creation, this allows manual editing of the ticket number.
Path Parameters
Ticket ID
Request Body
Ticket number (can be manually edited)
Collection date
Generator ID
Generator name
Material type
Quantity in liters
Material state
Collector name
Vehicle plate
Collection center ID
Collector member ID
Response
Returns the updated ticket object.Example Request
Delete Ticket
DELETE /api/tickets/:id
Delete a ticket by its ID.
Path Parameters
Ticket ID
Response
Returns
true if deletion was successfulExample Request
Example Response
Get Tickets Report
GET /api/tickets/report
Retrieve all tickets matching the given filters, sorted by date ascending. Designed for generating reports.
Query Parameters
Filter by collection center ID
Start date filter (DD/MM/YYYY format)
End date filter (DD/MM/YYYY format)
Filter by month (1-12)
Filter by year
Filter by single generator ID
Filter by multiple generator IDs (comma-separated)