Skip to main content

PATCH /api/platos/:id

Updates one or both fields of an existing dish. All body fields are optional — include only the fields you want to change. Authentication: Bearer JWT required
Required role: admin

Request

Path parameters

id
string
required
The dish ID (nanoid format, 10 characters)

Body

At least one field must be provided.
nombre
string
New dish name. Maximum 60 characters.
precio
number
New dish price in BOB (min: 0)

Response

Success (200)

Returns the updated platos record.
id
string
Dish ID (unchanged)
nombre
string
Updated dish name
precio
string
Updated price as a decimal string (e.g. "30.00")
creado_en
string
Original creation timestamp (ISO 8601)
actualizado_en
string
Timestamp of this update (ISO 8601)
borrado_en
string | null
Soft-delete timestamp — null for active dishes

Error responses

StatusDescription
400Validation error
401Unauthorized — missing or invalid JWT
403Forbidden — role is not admin
404Dish not found or has been deleted

Example

curl -X PATCH http://localhost:3000/api/platos/aB3dEfGhIj \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{ "precio": 30.00 }'
{
  "id": "aB3dEfGhIj",
  "nombre": "Sopa de Maní",
  "precio": "30.00",
  "creado_en": "2026-02-04T09:00:00.000Z",
  "actualizado_en": "2026-02-04T11:00:00.000Z",
  "borrado_en": null
}

Build docs developers (and LLMs) love