Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/FloresJesus/SS_RESTAURANT/llms.txt

Use this file to discover all available pages before exploring further.

The Customers API manages the restaurant’s guest directory. Customer records are linked to both orders and reservations, allowing staff to track visit history and personalise the dining experience. All endpoints require a valid JWT in the Authorization: Bearer <token> header. No additional role restriction is applied — any authenticated user may access these routes.

Endpoint overview

MethodPathDescription
GET/api/customersList all customers (supports search)
GET/api/customers/:idGet a customer by ID
POST/api/customersCreate a new customer
PUT/api/customers/:idUpdate a customer
DELETE/api/customers/:idDelete a customer

Customer object

id
number
Unique customer identifier.
nombre
string
Customer’s full name.
telefono
string
Customer’s phone number.
email
string | null
Customer’s email address, or null if not provided.
creado_en
string
ISO timestamp of when the record was created.

Example customer object

{
  "id": 8,
  "nombre": "Ana Torres",
  "telefono": "5598765432",
  "email": "[email protected]",
  "creado_en": "2024-06-01T09:15:00.000Z"
}

GET /api/customers

Returns all customer records sorted by creation time descending. Accepts an optional search query parameter to filter by name, phone, or email using a case-insensitive partial match.
# List all customers
curl https://your-api-host/api/customers \
  -H "Authorization: Bearer <token>"

# Search by name, phone, or email
curl "https://your-api-host/api/customers?search=torres" \
  -H "Authorization: Bearer <token>"

GET /api/customers/:id

Returns a single customer record. Returns 404 if no customer with the given ID exists.
curl https://your-api-host/api/customers/8 \
  -H "Authorization: Bearer <token>"

POST /api/customers

Creates a new customer record. Returns 201 on success.

Request body

nombre
string
required
Customer’s full name.
telefono
string
required
Customer’s phone number. Used as a natural key by the public reservations endpoint.
email
string
Customer’s email address. Optional — stored as null if omitted.

Example request

curl -X POST https://your-api-host/api/customers \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Marco Salinas",
    "telefono": "5544332211",
    "email": "[email protected]"
  }'

Example response

{
  "message": "Cliente creado correctamente",
  "id": 24
}

PUT /api/customers/:id

Replaces a customer record with the provided values. nombre and telefono are required. Returns 404 if the customer does not exist.
nombre
string
required
Updated full name.
telefono
string
required
Updated phone number.
email
string
Updated email address. Pass null explicitly to clear it.
curl -X PUT https://your-api-host/api/customers/24 \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Marco A. Salinas",
    "telefono": "5544332211",
    "email": "[email protected]"
  }'
{
  "message": "Cliente actualizado correctamente"
}

DELETE /api/customers/:id

Permanently removes a customer record. Returns 404 if not found.
curl -X DELETE https://your-api-host/api/customers/24 \
  -H "Authorization: Bearer <token>"
{
  "message": "Cliente eliminado correctamente"
}

Automatic customer creation

When a booking is submitted through the public reservation endpoint (POST /api/public/reservations), the server always creates a new customer record using the nombre, telefono, and email fields from the request. No de-duplication is performed — if a customer with that phone number already exists, a second record is inserted. Use GET /api/customers?search=<phone> to check for existing records before creating one manually.

Build docs developers (and LLMs) love