Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/luisllatas-dev/Proyecto_Pasteleria_DonMamino/llms.txt

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

The Users API lets you manage the staff accounts that operate the Don Mamino bakery system. Each user is assigned a role (such as administrador or vendedor) and is linked to a specific bakery location (id_sede). All five endpoints require a valid JWT Bearer token.
Every endpoint on this page requires a valid JWT token. Include the token in the Authorization header as Bearer <token> on every request.

GET /api/usuarios

Returns a list of all users registered in the system. Auth required: Yes

Response fields

id_usuario
number
Unique identifier for the user.
nombre_usuario
string
Full name of the user.
email
string
Email address of the user. Must be unique across the system.
rol
string
Role assigned to the user, for example administrador or vendedor.
id_sede
number
ID of the bakery location this user belongs to. References the Sedes table.
The contraseña field is never returned in API responses. Passwords are stored securely and are write-only.
curl --request GET \
  --url http://localhost:3000/api/usuarios \
  --header 'Authorization: Bearer <token>'
Example response
[
  {
    "id_usuario": 1,
    "nombre_usuario": "Ana Torres",
    "email": "[email protected]",
    "rol": "administrador",
    "id_sede": 2
  },
  {
    "id_usuario": 2,
    "nombre_usuario": "Carlos Mendoza",
    "email": "[email protected]",
    "rol": "vendedor",
    "id_sede": 1
  }
]

GET /api/usuarios/:id

Returns a single user by their unique ID. Auth required: Yes

Path parameters

id
number
required
The id_usuario of the user to retrieve.

Response fields

id_usuario
number
Unique identifier for the user.
nombre_usuario
string
Full name of the user.
email
string
Email address of the user.
rol
string
Role assigned to the user.
id_sede
number
ID of the bakery location this user belongs to.
curl --request GET \
  --url http://localhost:3000/api/usuarios/1 \
  --header 'Authorization: Bearer <token>'
Example response
{
  "id_usuario": 1,
  "nombre_usuario": "Ana Torres",
  "email": "[email protected]",
  "rol": "administrador",
  "id_sede": 2
}

Error responses

StatusDescription
404No user found with the given ID. Response body: { "message": "Usuario no encontrado" }
500Internal server error.

POST /api/usuarios

Creates a new user. The password is stored securely — you do not need to hash it before sending. Auth required: Yes

Request body

nombre_usuario
string
required
Full name of the new user.
email
string
required
Email address of the new user. Must be unique across the system.
rol
string
required
Role for the new user, for example administrador or vendedor.
contraseña
string
required
Password for the new user. Send as plain text — it is hashed before storage and never returned in responses.
id_sede
number
ID of the bakery location to associate this user with. References the Sedes table.

Response fields

id
number
The auto-generated id_usuario of the newly created user.
mensaje
string
Confirmation message: "Usuario creado exitosamente".
curl --request POST \
  --url http://localhost:3000/api/usuarios \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "nombre_usuario": "Laura Ríos",
    "email": "[email protected]",
    "rol": "vendedor",
    "contraseña": "password123",
    "id_sede": 1
  }'
Example response
{
  "id": 3,
  "mensaje": "Usuario creado exitosamente"
}

PUT /api/usuarios/:id

Updates all fields of an existing user. All body fields must be provided. Auth required: Yes

Path parameters

id
number
required
The id_usuario of the user to update.

Request body

nombre_usuario
string
required
Updated full name of the user.
email
string
required
Updated email address. Must remain unique across the system.
rol
string
required
Updated role for the user.
contraseña
string
required
New password. Send as plain text — it is hashed before storage.
id_sede
number
Updated bakery location ID for the user.

Response fields

mensaje
string
Confirmation message: "Usuario actualizado exitosamente".
curl --request PUT \
  --url http://localhost:3000/api/usuarios/3 \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "nombre_usuario": "Laura Ríos",
    "email": "[email protected]",
    "rol": "administrador",
    "contraseña": "newpassword456",
    "id_sede": 2
  }'
Example response
{
  "mensaje": "Usuario actualizado exitosamente"
}

Error responses

StatusDescription
404No user found with the given ID. Response body: { "message": "Usuario no encontrado" }
500Internal server error.

DELETE /api/usuarios/:id

Permanently deletes a user from the system. Auth required: Yes

Path parameters

id
number
required
The id_usuario of the user to delete.

Response fields

mensaje
string
Confirmation message: "Usuario eliminado exitosamente".
This action is permanent. Deleted users cannot be recovered.
curl --request DELETE \
  --url http://localhost:3000/api/usuarios/3 \
  --header 'Authorization: Bearer <token>'
Example response
{
  "mensaje": "Usuario eliminado exitosamente"
}

Error responses

StatusDescription
404No user found with the given ID. Response body: { "message": "Usuario no encontrado" }
500Internal server error.

Build docs developers (and LLMs) love