The Suppliers API manages the vendor master for each company. Suppliers (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/eme2dev/Eme2App/llms.txt
Use this file to discover all available pages before exploring further.
proveedores) are the counterpart to clients: they appear as the payer on expense records (gastos) and purchase invoices. Like clients, every supplier is fully scoped to the authenticated company’s empresa_id and carries fiscal data including a fiscal territory (territorio_fiscal_id), an optional country (pais_id), and an optional purchase accounting sub-account (cuenta_contable_compras). The NIF is unique per company, and the API applies the same non-blocking advisory nif_existente pattern used by the Clients API.
Authentication
All endpoints require a valid JWT in theAuthorization header. The token must belong to an active user with role admin or user linked to an active empresa.
Endpoints
| Method | Path | Description |
|---|---|---|
GET | /api/proveedores | List all suppliers |
GET | /api/proveedores/siguiente-codigo | Get the next available numeric code |
GET | /api/proveedores/:id | Get a single supplier by ID |
POST | /api/proveedores | Create a new supplier |
PUT | /api/proveedores/:id | Update an existing supplier |
PATCH | /api/proveedores/:id/estado | Toggle active / inactive status |
DELETE | /api/proveedores/:id | Soft-delete a supplier |
GET /api/proveedores
Returns all supplier records for the authenticated company. Unlike clients, the list endpoint does not filter byestado at the route level — filtering behaviour follows the underlying repository query.
Response 200
Always
"exito" on success.Array of supplier objects.
Count of records returned.
GET /api/proveedores/siguiente-codigo
Returns the next sequential numeric code to assign to a new supplier, read from thecontadores table for the authenticated company.
Response 200
The next available integer code (current counter value + 1).
GET /api/proveedores/:id
Returns a single supplier. Returns404 if the record does not exist or belongs to a different company.
Path parameters
UUID of the supplier.
Response 200
Response 404
POST /api/proveedores
Creates a new supplier for the authenticated company.Body parameters
Full legal name of the supplier. Whitespace is trimmed automatically.
Tax identification number. Stored normalised to uppercase. Unique per
empresa at the database level (ux_proveedores_empresa_nif). See NIF advisory behaviour.UUID of a
territorios_fiscales record (e.g. Territorio Común, País Vasco, Navarra). Must belong to the authenticated company.Contact email address. Must pass standard email format validation when provided.
Phone number. Max 20 characters; whitespace is trimmed.
Street address. Max 500 characters.
Postal code. Max 10 characters; whitespace is trimmed.
City / municipality. Max 255 characters; whitespace is trimmed.
Province. Max 255 characters; whitespace is trimmed.
UUID of a
paises record. Used for intra-EU and international suppliers to set the correct fiscal treatment.Purchase sub-ledger account code. Max 12 characters.
Response 201
NIF advisory behaviour
Like the Clients API, creating or updating a supplier never fails solely because of a duplicate NIF within the same company. When another supplier record already holds the same NIF, the response includes a When
nif_existente advisory object alongside the written record.nif_existente.activo is true the conflicting supplier is still active; the frontend should warn the user to verify the correct record.Response 400 — validation failure
PUT /api/proveedores/:id
Full update of an existing supplier. Accepts the same body fields asPOST. Returns 404 if the supplier does not exist in the company scope.
Path parameters
UUID of the supplier to update.
POST /api/proveedores. The NIF advisory check is applied when the incoming NIF differs from the current stored value.
Response 200
PATCH /api/proveedores/:id/estado
Toggles the supplier between active and inactive. Inactive suppliers are hidden from lookup selectors in expense recording but continue to appear on historical expense records.Path parameters
UUID of the supplier.
Body parameters
true to activate the supplier, false to deactivate. Passing any non-boolean value returns a 400 error.Response 200
DELETE /api/proveedores/:id
Soft-deletes the supplier. The record remains in the database and can be re-activated viaPATCH /:id/estado. Returns 404 if the supplier is not found within the company.
Path parameters
UUID of the supplier to delete.
Response 200
Error reference
| HTTP status | estado | Typical mensaje |
|---|---|---|
400 | error | Validation error detail (e.g. "El NIF es requerido") |
400 | error | "El campo activo debe ser booleano" |
404 | error | "Proveedor no encontrado" |
500 | error | Internal server error message |