Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/juadariasmar/inventory_project/llms.txt

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

The Customers API manages client profiles for your tenant. Each customer can be linked to sales (Venta) and quotations (Cotizacion), enabling you to track purchase history per client. The documento field is enforced as unique within a tenant, preventing duplicate client records. A dedicated /historial sub-resource returns the client’s most recent sales and active quotations in a single request, suitable for driving a customer detail panel. All customer endpoints require an active authenticated session. No ADMIN role is required — any active tenant member can create and manage customers.

Endpoints

MethodPathDescription
GET/api/clientesList customers for the tenant
POST/api/clientesCreate a new customer
GET/api/clientes/[id]Get a customer by ID
PUT/api/clientes/[id]Update a customer
GET/api/clientes/[id]/historialGet purchase history for a customer

GET /api/clientes

Returns all customers belonging to the authenticated user’s tenant. Supports an optional text search across name, document number, email, and phone. Results are ordered by ID descending (newest first). The default limit is 200 records; pass limite to adjust it up to a maximum of 500.

Query parameters

busqueda
string
Case-insensitive search string. Matched against nombre, documento, email, and telefono fields.
limite
number
Maximum number of results to return. Defaults to 200; capped at 500.

Response fields

Returns an array of Cliente objects.
id
number
Unique customer ID.
nombre
string
Customer full name.
documento
string | null
National ID or tax document number. Unique within the tenant.
email
string | null
Customer email address.
telefono
string | null
Contact phone number.
direccion
string | null
Physical address.
notas
string | null
Free-text notes about the customer.
creadoEn
string
ISO 8601 timestamp of when the customer was created.
curl -b 'session=...' \
  'https://your-domain.com/api/clientes?busqueda=garcia&limite=50'

POST /api/clientes

Creates a new customer record scoped to the tenant. Returns the created Cliente (HTTP 201). If documento is provided and a customer with the same document already exists in the tenant, the request returns 409 Conflict.

Request body

nombre
string
required
Customer full name. Cannot be empty.
documento
string
National ID or tax document number. Must be unique within the tenant.
email
string
Email address.
telefono
string
Phone number.
direccion
string
Physical address.
notas
string
Free-text internal notes.

Response fields

id
number
Assigned customer ID.
nombre
string
Customer name.
documento
string | null
Document number.
email
string | null
Email address.
telefono
string | null
Phone number.
direccion
string | null
Address.
notas
string | null
Notes.
creadoEn
string
Creation timestamp (ISO 8601).
curl -b 'session=...' \
  -X POST 'https://your-domain.com/api/clientes' \
  -H 'Content-Type: application/json' \
  -d '{
    "nombre": "Ana Rodríguez",
    "documento": "1020304050",
    "email": "[email protected]",
    "telefono": "3156789012",
    "direccion": "Cl 100 #10-50, Medellín",
    "notas": "Cliente frecuente, prefiere facturas electrónicas"
  }'

GET /api/clientes/[id]

Returns a single customer by numeric ID. The lookup is scoped to the tenant; a valid ID belonging to a different company returns 404.

Path parameters

id
number
required
Numeric customer ID.

Response fields

id
number
Customer ID.
nombre
string
Customer name.
documento
string | null
Document number.
email
string | null
Email address.
telefono
string | null
Phone number.
direccion
string | null
Address.
notas
string | null
Notes.
creadoEn
string
Creation timestamp (ISO 8601).
curl -b 'session=...' \
  'https://your-domain.com/api/clientes/15'

PUT /api/clientes/[id]

Updates a customer record. Only fields included in the request body are changed. If documento is updated, uniqueness within the tenant is re-validated; providing a document already in use by another customer returns 409 Conflict.

Path parameters

id
number
required
Numeric customer ID.

Request body

nombre
string
Updated customer name.
documento
string
Updated document number. Must remain unique within the tenant.
email
string
Updated email address. Pass "" or null to clear.
telefono
string
Updated phone number. Pass "" or null to clear.
direccion
string
Updated address. Pass "" or null to clear.
notas
string
Updated notes. Pass "" or null to clear.
curl -b 'session=...' \
  -X PUT 'https://your-domain.com/api/clientes/15' \
  -H 'Content-Type: application/json' \
  -d '{
    "telefono": "3001112233",
    "notas": "Solicita descuento por volumen"
  }'

GET /api/clientes/[id]/historial

Returns the customer’s purchase history — the 20 most recent sales and up to 10 active (PENDIENTE) quotations — alongside aggregate counts of their total sales and quotations. All data is scoped to the tenant.

Path parameters

id
number
required
Numeric customer ID.

Response fields

id
number
Customer ID.
nombre
string
Customer name.
documento
string | null
Document number.
email
string | null
Email address.
telefono
string | null
Phone number.
ventas
array
Array of the 20 most recent Venta records for this customer, ordered newest first. Each entry includes id, total, notas, creadoEn, and canceladaEn.
cotizaciones
array
Array of up to 10 active (PENDIENTE) Cotizacion records, ordered newest first.
_count.ventas
number
Total number of sales linked to this customer (across all time).
_count.cotizaciones
number
Total number of quotations linked to this customer.
curl -b 'session=...' \
  'https://your-domain.com/api/clientes/15/historial'

Build docs developers (and LLMs) love