Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Carlos-Gnd/FERRED-Inventario-y-Ventas/llms.txt

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

The suppliers API manages the list of suppliers and records goods reception (recepción de mercancía) which automatically updates branch stock levels when new inventory arrives.
When a goods reception is created, each item in the items array triggers an atomic upsert on StockSucursal — incrementing the cantidad in the specified branch if a record already exists, or creating a new one if it does not. The overall stockActual on the product is also recalculated after the transaction commits.

GET /api/proveedores

Returns all active suppliers ordered alphabetically by name. Roles: All authenticated users

Response

Returns an array of Proveedor records.
[]
object[]

POST /api/proveedores

Creates a new supplier. The nit field must be unique — the request fails if another supplier already has the same NIT. Roles: ADMIN, BODEGA

Body

nombre
string
required
Supplier name. Minimum 2 characters.
nit
string
Tax ID. Must be unique across all suppliers.
telefono
string
Contact phone number.
email
string
Contact email address. Must be a valid email format.
direccion
string
Physical address.

Response 201

mensaje
string
Confirmation message: "Proveedor creado".
proveedor
object
The newly created Proveedor record.

Errors

StatusCondition
400Validation failed (e.g., nombre too short, invalid email, or duplicate nit).

PUT /api/proveedores/:id

Updates an existing supplier. All fields are optional — only provided fields are changed. Roles: ADMIN, BODEGA

Path parameters

id
number
required
ID of the supplier to update.

Body

All body fields are optional (partial update).
nombre
string
Updated supplier name. Minimum 2 characters.
nit
string
Updated tax ID.
telefono
string
Updated phone number.
email
string
Updated email address. Must be valid format.
direccion
string
Updated address.

Response 200

mensaje
string
Confirmation message: "Proveedor actualizado".
proveedor
object
The updated Proveedor record.

DELETE /api/proveedores/:id

Soft-deletes a supplier by setting activo = false. The supplier’s historical reception records are preserved. Roles: ADMIN

Path parameters

id
number
required
ID of the supplier to deactivate.

Response 200

mensaje
string
Confirmation message: "Proveedor desactivado".

POST /api/proveedores/recepcion

Registers a goods reception from a supplier and atomically increments stock for each item in the specified branch. Roles: ADMIN, BODEGA Non-ADMIN users can only receive goods for their assigned branch. Passing a sucursalId that differs from the user’s assigned branch returns a 403.

Body

proveedorId
number
required
ID of the supplier delivering the goods. Must be active.
sucursalId
number
required
ID of the branch receiving the goods.
numeroFactura
string
Optional supplier invoice number for reference.
observaciones
string
Optional free-text notes about this reception.
items
object[]
required
List of products being received. Must contain at least one entry.

Response 201

ok
boolean
Always true on success.
recepcion
object
The created RecepcionMercancia record with full relations.

Errors

StatusCondition
400Validation failed (missing required fields or invalid values).
403Non-ADMIN user attempted to receive goods in a different branch, or has no branch assigned.
404Supplier or one or more products not found or inactive.

GET /api/proveedores/recepciones

Lists goods receptions. ADMIN users see all receptions; other roles see only receptions for their assigned branch. Returns up to 100 records ordered by creation date descending. Roles: All authenticated users

Response

Returns an array of RecepcionMercancia records.
[]
object[]

GET /api/proveedores/recepciones/:id

Returns a single goods reception with full detail, including all received items and their products. Roles: All authenticated users

Path parameters

id
number
required
ID of the reception to retrieve.

Response

The full RecepcionMercancia record including all relations.
id
number
Reception ID.
proveedor
object
Full supplier record.
sucursal
object
Branch name.
usuario
object
User name.
detalles
object[]

Errors

StatusCondition
403Non-ADMIN user attempted to view a reception belonging to a different branch.
404Reception not found.

Build docs developers (and LLMs) love