total_slots and occupied_slots.
Endpoints
| Method | Path | Auth | Description |
|---|---|---|---|
GET | /api/tickets/ | Public | List all tickets |
GET | /api/tickets/available/ | Public | List tickets with available stock |
GET | /api/tickets/{id}/ | Public | Retrieve a single ticket |
POST | /api/tickets/create/ | Admin | Create a new ticket |
PUT | /api/tickets/{id}/update/ | Admin | Update a ticket |
DELETE | /api/tickets/{id}/delete/ | Admin | Delete a ticket |
GET /api/tickets/
Returns all ticket types. No authentication required.GET /api/tickets/available/
Returns only tickets with remaining stock (total_slots - occupied_slots > 0). Each object includes a computed available_slots field.
The
AvailableTicketsView in the source references is_active as a filter, but the Tickets model does not define an is_active field — the serializer exposes all model fields (fields = '__all__'). If the database includes an is_active migration not yet reflected in the model file, this filter will apply; otherwise all tickets with available stock are returned.Response
Array of available ticket objects.
Count of ticket types returned in this response.
GET /api/tickets//
Returns a single ticket by its primary key. No authentication required.Path parameters
The numeric ID of the ticket.
POST /api/tickets/create/
Creates a new ticket type. Requires admin authentication (IsAuthenticatedAndRole).
Request body
Unique display name for this ticket type. Maximum 30 characters.
Short description shown during checkout. Maximum 100 characters.
Unit price. Up to 10 total digits with 2 decimal places.
Currency for this ticket. Either
CRC (colones) or USD (dollars).Maximum tickets available for this type.
Pre-occupied slots. Normally left at
0 on creation.Model reference
| Field | Type | Description |
|---|---|---|
id | integer | Auto-generated primary key |
name | string | Unique ticket name, max 30 chars |
description | string | Buyer-facing description, max 100 chars |
price | decimal(10,2) | Unit price |
currency | string | CRC or USD |
total_slots | integer | Capacity ceiling, default 1276 |
occupied_slots | integer | Count of sold/reserved tickets, default 0 |
The
available endpoint filters by is_active=True in the queryset. Inactive tickets are stored in the database but hidden from buyers.