Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/15aozzz/Lab-Nova-Salud/llms.txt

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

The client endpoints let you manage the pharmacy’s customer directory. The list and search endpoints power the register screen’s client lookup; the create and update endpoints are used from the Clientes management page.
All routes require a valid JWT in the Authorization: Bearer <token> header.

GET /api/clientes

Returns all client records. Accepts an optional search term to filter the results server-side. Calls sp_get_todos_clientes.

Query parameters

busqueda
string
default:""
Optional search term matched against the client’s document number or name. Omit or pass an empty string to return all clients.

Response

200 OK — returns an array of client records.
id_cliente
number
Internal client ID.
numero_documento
string
Client’s DNI or RUC number.
nombres_razon_social
string
Full name or business name.

Example

curl --request GET \
  --url http://localhost:3000/api/clientes \
  --header 'Authorization: Bearer <token>'

GET /api/clientes/buscar

Looks up a customer by their DNI (8 digits) or RUC (11 digits). Calls sp_buscar_cliente and returns either the matching record or a { "encontrado": false } sentinel — it never returns a 404 for a missing customer, making it safe to call optimistically as the cashier types.

Query parameters

doc
string
required
Customer document number. Accepts DNI (8 digits) or RUC (11 digits).

Response

200 OK — customer found
encontrado
boolean
required
true when a matching customer record exists.
id_cliente
number
Internal customer ID.
numero_documento
string
Stored document number.
nombres_razon_social
string
Full name or business name on file.
200 OK — customer not found
encontrado
boolean
required
false when no record matches the document number. No other fields are returned.

Errors

StatusConditionBody
400doc query parameter missing{ "error": "El parámetro \"doc\" es requerido" }
500Database or server error{ "error": "<message>" }
An unknown document number is not an error condition. The register allows sales to unregistered customers; when encontrado is false the cashier can type the name manually.

Example — found

curl --request GET \
  --url 'http://localhost:3000/api/clientes/buscar?doc=12345678' \
  --header 'Authorization: Bearer <token>'
Response (found)
{
  "encontrado": true,
  "id_cliente": 5,
  "numero_documento": "12345678",
  "nombres_razon_social": "Juan Pérez"
}

Example — not found

curl --request GET \
  --url 'http://localhost:3000/api/clientes/buscar?doc=99999999' \
  --header 'Authorization: Bearer <token>'
Response (not found)
{
  "encontrado": false
}

POST /api/clientes

Creates a new client record. Calls sp_crear_cliente. Returns a conflict error if the document number already exists.

Request body

numero_documento
string
required
DNI (8 digits) or RUC (11 digits) of the new client. Must be unique.
nombres_razon_social
string
required
Full name (individual) or registered business name.

Response

201 Created
id_cliente
number
Internal ID of the newly created client.
message
string
Confirmation message ("Cliente creado exitosamente").

Errors

StatusConditionBody
400numero_documento or nombres_razon_social missing{ "error": "Número de documento y nombre son obligatorios" }
409Document number already exists{ "error": "Ya existe un cliente con ese número de documento" }
500Database or server error{ "error": "<message>" }

Example

curl --request POST \
  --url http://localhost:3000/api/clientes \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "numero_documento": "12345678",
    "nombres_razon_social": "Juan Pérez"
  }'
Response
{
  "id_cliente": 12,
  "message": "Cliente creado exitosamente"
}

PUT /api/clientes/:id

Updates an existing client’s document number or name. Calls sp_actualizar_cliente.

Path parameters

id
number
required
Internal client ID.

Request body

numero_documento
string
required
Updated DNI or RUC number.
nombres_razon_social
string
required
Updated full name or business name.

Response

200 OK
message
string
Confirmation message ("Cliente actualizado exitosamente").

Errors

StatusConditionBody
400numero_documento or nombres_razon_social missing{ "error": "Número de documento y nombre son obligatorios" }
500Database or server error{ "error": "<message>" }

Example

curl --request PUT \
  --url http://localhost:3000/api/clientes/12 \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "numero_documento": "12345678",
    "nombres_razon_social": "Juan Pérez Rodríguez"
  }'
Response
{
  "message": "Cliente actualizado exitosamente"
}

Build docs developers (and LLMs) love