Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/lerichardv/patolab-platform/llms.txt

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

Customers in PatoLab represent the patients or institutions that submit specimens for analysis. A customer record is required before a specimen can be registered — it provides the billing identity on invoices, the phone number for WhatsApp status notifications, and the geographic data used for demographic reporting. Customers can be individual patients (cliente) or corporate entities (empresa), and both types share the same record model.

Customer Resource Routes

MethodEndpointDescription
GET/customersPaginated list with search and filters
POST/customersCreate a new customer
PUT/customers/{id}Update an existing customer
DELETE/customers/{id}Soft-delete (sets active = false)
GET/customers/exportDownload all customers as a CSV spreadsheet
All routes require the patients.view, patients.create, patients.edit, or patients.delete permission respectively.

Customer Fields

FieldTypeRequiredDescription
namestringFull name of the patient or company
id_numberstringNational identity number or RTN (must be unique)
typestringcliente (individual patient) or empresa (institution)
ageinteger✅ (if type=cliente)Patient age, used for age-based discounts
genderstringPatient gender
phonestringPrimary phone number; used for WhatsApp notifications
stateinteger (FK)Department ID from departments table
cityinteger (FK)Municipality ID from municipalities table
secondary_phonestringAlternate contact number
addressstringStreet address
emailemailEmail address
activebooleanManaged by the system; false = soft-deleted

Searching and Filtering

The customers list supports the following query parameters:
ParameterDescription
searchMatches against name, phone, or email
typeFilter by cliente or empresa
genderFilter by gender value
stateFilter by department name or ID
cityFilter by municipality name or ID
Results are paginated at 10 per page, ordered by most recently created.

Referrers

Referrers are the doctors or institutions that send patients to the laboratory. Each specimen must have a referrer assigned at registration. Referrers belong to a referrer type (e.g. “General Practitioner”, “Hospital”, “Clinic”).

Referrers

Full CRUD via GET/POST/PUT/DELETE /referrers. Referrer records include name, contact information, and type classification.

Referrer Types

Manage referrer categories via GET/POST/PUT/DELETE /referrer-types. Used to group and filter referrers on the specimen creation form.

Geographic Data

PatoLab ships with a seeded geographic hierarchy used to populate state and city dropdowns on the customer form.
GET /departments
Returns all departments (states) in the system.
GET /departments/{department}/municipalities
Returns the municipalities belonging to a specific department. Use this endpoint to lazily load the city dropdown after the user selects a department.

Locations

Locations represent physical lab branches or collection sites. They are linked to CAI ranges and invoice sequences.
# Full CRUD
GET    /locations
POST   /locations
PUT    /locations/{location}
DELETE /locations/{location}
Location records are also passed to the specimen creation form so the correct active CAI range can be matched to the branch issuing the invoice.

Export

GET /customers/export
Streams a UTF-8 CSV file (clientes_patolab.csv) with all active customers matching the current filter state. Exported columns: Nombre, Identidad/RTN, Tipo, Edad, Género, Teléfono, Estado/Departamento, Ciudad, Correo.
The active flag is set to false when a customer is “deleted” through the UI — PatoLab never permanently removes customer records. Inactive customers no longer appear in the active list or specimen creation dropdowns, but all their historical specimens, invoices, and reports remain fully accessible through those modules’ own filters. To re-activate a customer, update active to true directly via the API or database.

Build docs developers (and LLMs) love