Skip to main content

POST /api/platos

Creates a new dish. After creating a dish, use the ingredient endpoints to define its recipe. Authentication: Bearer JWT required
Required role: admin

Request

Body

nombre
string
required
Dish name. Maximum 60 characters.
precio
number
required
Dish price in BOB (min: 0). Accepts a numeric value; stored as a decimal.

Response

Success (201)

Returns the created platos record.
id
string
Unique dish ID (nanoid, 10 characters)
nombre
string
Dish name
precio
string
Dish price as a decimal string (e.g. "25.00")
creado_en
string
Creation timestamp (ISO 8601)
actualizado_en
string
Last update timestamp (ISO 8601)
borrado_en
string | null
Soft-delete timestamp — null for active dishes

Error responses

StatusDescription
400Validation error — check nombre and precio
401Unauthorized — missing or invalid JWT
403Forbidden — role is not admin

Example

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

Build docs developers (and LLMs) love