Four functions are available for querying tickets. All read from the PostgreSQL tickets table.
Functions overview
| Function | Query | Returns |
|---|
tickets_list_event | All tickets for an event | Full ticket rows |
tickets_individual | Single ticket by ticket_id | Full ticket row |
tickets_list_event_sales | All tickets for an event with live availability | Tickets joined with tickets_blocked |
tickets_list_access_control | Sold tickets for an event | Tickets with status = false |
tickets_list_event
Returns all tickets for the specified event.
Endpoint
POST https://{region}-{project}.cloudfunctions.net/tickets_list_event
Request body
The event ID to list tickets for. Matches the event_id column in the tickets table.
Example
curl -X POST https://{region}-{project}.cloudfunctions.net/tickets_list_event \
-H "Content-Type: application/json" \
-d '{"data": {"event_id": "JAOTIiQrtU1fMWZZY2IZ"}}'
Response
Success (200):
{
"message": "Evento Encontrado",
"status": 200,
"data": {
"valido": true,
"response": [
{
"id": 1,
"ticket_id": "JAOTIiQrtU1fMWZZY2IZ-nGxHQ00YzCg9PphEwlYb",
"event_id": "JAOTIiQrtU1fMWZZY2IZ",
"event_name": "Festival TMT 2025",
"zone": "VIP",
"color": "#FFD700",
"seat_id": "VIP-1",
"seat_row": "por asignar",
"status": true,
"date_start": "2025-06-01T18:00:00-04:00",
"date_end": "2025-06-01T23:00:00-04:00",
"date_created": "2025-03-01T10:00:00-04:00",
"date_updated": "2025-03-01T10:00:00-04:00"
}
]
}
}
Event not found (400):
{
"message": "Evento no Encontrado",
"status": 400,
"data": { "valido": false }
}
tickets_individual
Returns a single ticket by its ticket_id.
Endpoint
POST https://{region}-{project}.cloudfunctions.net/tickets_individual
Request body
The full ticket ID (for example, JAOTIiQrtU1fMWZZY2IZ-nGxHQ00YzCg9PphEwlYb).
Example
curl -X POST https://{region}-{project}.cloudfunctions.net/tickets_individual \
-H "Content-Type: application/json" \
-d '{"data": {"ticket_id": "JAOTIiQrtU1fMWZZY2IZ-nGxHQ00YzCg9PphEwlYb"}}'
Response
Success (200):
{
"message": "Ticket Encontrado",
"status": 200,
"data": {
"valido": true,
"response": [
{
"ticket_id": "JAOTIiQrtU1fMWZZY2IZ-nGxHQ00YzCg9PphEwlYb",
"event_id": "JAOTIiQrtU1fMWZZY2IZ",
"event_name": "Festival TMT 2025",
"zone": "VIP",
"color": "#FFD700",
"seat_id": "VIP-1",
"status": true
}
]
}
}
Ticket not found (400):
{
"message": "Ticket no Encontrado",
"status": 400,
"data": { "valido": false }
}
tickets_list_event_sales
Returns all tickets for an event, joined with the tickets_blocked table to compute live availability. Use this for the ticket sales view where you need to know which tickets are currently locked by an in-progress purchase.
Endpoint
POST https://{region}-{project}.cloudfunctions.net/tickets_list_event_sales
Request body
The event ID to list tickets for.
Response fields
Returns the same columns as tickets_list_event plus:
| Column | Type | Description |
|---|
status | boolean | Computed availability: false if blocked, true if available (uses status_d from join). |
status_real | boolean | Raw status from the tickets table. |
status_offline | boolean | Offline availability flag. |
Example
curl -X POST https://{region}-{project}.cloudfunctions.net/tickets_list_event_sales \
-H "Content-Type: application/json" \
-d '{"data": {"event_id": "JAOTIiQrtU1fMWZZY2IZ"}}'
Response
Success (200):
{
"message": "Evento Encontrado",
"status": 200,
"data": {
"valido": true,
"response": [
{
"ticket_id": "JAOTIiQrtU1fMWZZY2IZ-nGxHQ00YzCg9PphEwlYb",
"event_id": "JAOTIiQrtU1fMWZZY2IZ",
"zone": "VIP",
"color": "#FFD700",
"seat_id": "VIP-1",
"status": true,
"status_real": true,
"status_offline": false
}
]
}
}
Event not found (400):
{
"message": "Evento no Encontrado",
"status": 400,
"data": { "valido": false }
}
tickets_list_access_control
Returns all sold (used) tickets for an event. Queries tickets where status = false, which indicates the ticket has been sold and is no longer available for purchase.
Endpoint
POST https://{region}-{project}.cloudfunctions.net/tickets_list_access_control
Request body
The event ID to retrieve sold tickets for.
Example
curl -X POST https://{region}-{project}.cloudfunctions.net/tickets_list_access_control \
-H "Content-Type: application/json" \
-d '{"data": {"event_id": "JAOTIiQrtU1fMWZZY2IZ"}}'
Response
Success (200):
{
"message": "Evento Encontrado",
"status": 200,
"data": {
"valido": true,
"response": [
{
"ticket_id": "JAOTIiQrtU1fMWZZY2IZ-nGxHQ00YzCg9PphEwlYb",
"event_id": "JAOTIiQrtU1fMWZZY2IZ",
"status": false,
"access_status": false,
"access_entry": false,
"customer_email": "[email protected]",
"customer_name": "Juan Martínez"
}
]
}
}
No sold tickets found (400):
{
"message": "Evento no Encontrado",
"status": 400,
"data": { "valido": false }
}
status = false means the ticket has been sold. access_status and access_entry track whether the attendee has entered or exited the venue.