Skip to main content

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

POST /api/turismo/ticket

Authentication

No authentication required (public endpoint).

Request Body

name
string
required
Full name of the visitor
email
string
required
Email address of the visitor
shareCode
string
required
Unique share code for the ticket (generated client-side)
phone
string
Phone number of the visitor (optional)

Response

ticketUrl
string
Full URL to the ticket page
shareCode
string
The share code for the ticket
wpId
number
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


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

code
string
required
Guide code provided at the tourist attraction (case-insensitive)
userId
string
required
UUID of the authenticated user

Response

success
boolean
Whether the visit was successfully verified
visitId
string
UUID of the created visit record
atractivo
string
Slug of the tourist attraction visited
badge
object
Badge information (null if no badge unlocked)

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


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

userId
string
required
UUID of the authenticated user
atractivoSlug
string
required
Slug of the tourist attraction (e.g., “cascada-atlahuitzia”)
rating
number
Rating from 1 to 5 (optional, null to skip)
notes
string
User notes about the experience (optional)

Response

success
boolean
Whether the rating was successfully saved
rating
number
The saved rating (null if not provided or invalid)
notes
string
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

code
string
required
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" />

Cache Headers

Images are cached for 24 hours:
Cache-Control: public, max-age=86400, s-maxage=86400

Error Responses


Data Types

For detailed type definitions, see: