Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Jesus-Puertos/h-ayuntamiento/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Tourism API provides endpoints for managing tourist experiences in Zongolica:
- Generate tourism tickets with unique share codes
- Verify visits with guide codes
- Rate tourism experiences
- Generate Open Graph images for social sharing
Generate Tourism Ticket
This endpoint creates a ticket in WordPress and returns a unique share code and ticket URL.
Endpoint
Authentication
No authentication required (public endpoint).
Request Body
Email address of the visitor
Unique share code for the ticket (generated client-side)
Phone number of the visitor (optional)
Response
Full URL to the ticket page
The share code for the ticket
WordPress post ID of the created ticket
Example Request
curl -X POST https://zongolica.gob.mx/api/turismo/ticket \
-H "Content-Type: application/json" \
-d '{
"name": "Juan Pérez",
"email": "juan@example.com",
"phone": "2721234567",
"shareCode": "ABCD1234"
}'
Example Response
{
"ticketUrl": "https://zongolica.gob.mx/ruta/ABCD1234",
"shareCode": "ABCD1234",
"wpId": 12345
}
Error Responses
{
"error": "Faltan campos requeridos"
}
Returned when name, email, or shareCode is missing.
Show 500 Internal Server Error
{
"error": "WP_BASE_URL o WP_TICKETS_ENDPOINT no configurado"
}
Returned when WordPress credentials are not configured.
Verify Visit
This endpoint verifies a visit using a guide code and unlocks badges. Requires authentication.
Endpoint
POST /api/turismo/verify-visit
Authentication
Required. Include access token in the Authorization header:
Authorization: Bearer <access_token>
Request Body
Guide code provided at the tourist attraction (case-insensitive)
UUID of the authenticated user
Response
Whether the visit was successfully verified
UUID of the created visit record
Slug of the tourist attraction visited
Badge information (null if no badge unlocked)
Display name of the badge
Example Request
const { data: { session } } = await supabase.auth.getSession();
const response = await fetch('/api/turismo/verify-visit', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${session.access_token}`
},
body: JSON.stringify({
code: 'CASCADA123',
userId: session.user.id
})
});
const data = await response.json();
Example Response
{
"success": true,
"visitId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"atractivo": "cascada-atlahuitzia",
"badge": {
"id": "visit_atlahuitzia",
"name": "Cascada Atlahuitzía",
"icon": "💧"
}
}
Milestone Badges
The endpoint automatically checks for milestone badges:
- 5 visits → Explorador badge
- 10 visits → Veterano badge
- 17 visits → Leyenda badge (all attractions)
Error Responses
{
"error": "No autenticado"
}
Returned when Authorization header is missing or invalid.
{
"error": "Código inválido o no encontrado"
}
Returned when the guide code doesn’t exist in the database.
{
"error": "Este código ha expirado"
}
or{
"error": "Ya has verificado esta visita"
}
Returned when the code is expired or already used by the user.
Rate Visit
This endpoint allows users to rate and leave notes about their verified visits.
Endpoint
POST /api/turismo/rate-visit
Authentication
Required. Include access token in the Authorization header.
Request Body
UUID of the authenticated user
Slug of the tourist attraction (e.g., “cascada-atlahuitzia”)
Rating from 1 to 5 (optional, null to skip)
User notes about the experience (optional)
Response
Whether the rating was successfully saved
The saved rating (null if not provided or invalid)
The saved notes (null if not provided)
Example Request
const response = await fetch('/api/turismo/rate-visit', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${accessToken}`
},
body: JSON.stringify({
userId: user.id,
atractivoSlug: 'cascada-atlahuitzia',
rating: 5,
notes: 'Experiencia inolvidable, la cascada es impresionante'
})
});
Example Response
{
"success": true,
"rating": 5,
"notes": "Experiencia inolvidable, la cascada es impresionante"
}
Generate OG Image
This endpoint generates Open Graph images for social sharing of tourism tickets.
Endpoint
GET /api/turismo/og/[code]
Parameters
Share code of the user route
Response
Returns a PNG image (1200x630 pixels) with:
- User name
- Number of places visited
- Number of badges earned
- Completion percentage (out of 17 attractions)
- Zongolica branding
Example Usage
<!-- Meta tags for social sharing -->
<meta property="og:image" content="https://zongolica.gob.mx/api/turismo/og/ABCD1234" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content="https://zongolica.gob.mx/api/turismo/og/ABCD1234" />
Images are cached for 24 hours:
Cache-Control: public, max-age=86400, s-maxage=86400
Error Responses
Returned when the code parameter is missing.
Returned when the share code doesn’t exist in the database.
Data Types
For detailed type definitions, see: