The Articles API manages the reusable product and service catalog for each company. An article (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.
articulo) stores a short codigo, a full descripcion, a unit precio, and a linked VAT rate (iva_id). Articles are referenced by invoice lines (detalles_facturas) and budget lines (detalles_presupuestos), so once an article is used in a document it cannot be hard-deleted — the API returns a 400 with a clear message instead of silently failing. Codes are unique per company (the ux_articulos_empresa_codigo constraint), making it safe to use them as human-readable identifiers in CSV imports or ERP integrations. Articles also support a bundles feature through associated articles (/:id/asociados), allowing a parent article to automatically expand into multiple child articles on a document line.
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/articulos | List all active articles |
GET | /api/articulos/:id | Get a single article by ID |
POST | /api/articulos | Create a new article |
PUT | /api/articulos/:id | Update an existing article |
PATCH | /api/articulos/:id/toggle-estado | Toggle active / inactive status |
DELETE | /api/articulos/:id | Hard-delete an article (blocked if referenced) |
GET | /api/articulos/:id/asociados | List associated (bundle) articles |
POST | /api/articulos/:id/asociados | Add an associated article |
DELETE | /api/articulos/:id/asociados/:asociadoId | Remove an associated article |
GET /api/articulos
Returns all articles withestado = true for the authenticated company.
Response 200
Always
"exito" on success.Array of active article objects.
Count of records returned.
GET /api/articulos/:id
Returns a single article. Returns404 if the article does not exist or belongs to a different company.
Path parameters
UUID of the article.
Response 200
Response 404
POST /api/articulos
Creates a new article in the company’s catalog.Body parameters
Short alphanumeric code for the article. Must be unique within the company — the pair
(empresa_id, codigo) is enforced by a database unique index (ux_articulos_empresa_codigo). Attempting to create a second article with the same code in the same company returns a 400 error.Full description of the product or service. Max 500 characters. Appears on invoice and budget lines.
Unit price. Must be a valid number (integer or decimal). Stored as
DECIMAL(10,2).UUID of an
iva record belonging to the authenticated company. Defines the VAT percentage applied when this article is added to a document line.Initial active status. Defaults to
true when omitted.Response 201
Response 400 — duplicate code
Response 400 — validation failure
PUT /api/articulos/:id
Full update of an existing article. Accepts the same body fields asPOST. Returns 404 if the article is not found within the company scope.
Path parameters
UUID of the article to update.
POST /api/articulos. Changing codigo to a value already used by another article in the same company will return a 400 error.
Response 200
PATCH /api/articulos/:id/toggle-estado
Flips the article’sestado from true to false or vice versa. No body required. Inactive articles are hidden from catalog lookups but remain referenced on existing document lines.
Path parameters
UUID of the article.
Response 200
DELETE /api/articulos/:id
Permanently (hard) deletes the article from the database. This operation is blocked if the article is referenced by one or more invoice lines (detalles_facturas) or budget lines (detalles_presupuestos). In that case the API returns a 400 error and the record is left untouched.
Path parameters
UUID of the article to delete.
Response 200
Response 400 — article is referenced
If you want to retire an article without deleting it, use
PATCH /api/articulos/:id/toggle-estado to set estado = false. The article will no longer appear in catalog selectors but its historical references remain valid.Associated articles (bundles)
An article can have child associations, each with acantidad multiplier. When a parent article is added to an invoice line the frontend can automatically expand it into its associated child articles.
GET /api/articulos/:id/asociados
Lists all associations for the given article.Response 200
POST /api/articulos/:id/asociados
Adds a new child association to the article.UUID of the child article to associate. Cannot be equal to the parent article’s own ID (self-association returns a
400).Multiplier quantity. Must be a valid number.
Response 201
DELETE /api/articulos/:id/asociados/:asociadoId
Removes a specific association record.UUID of the parent article.
UUID of the association record to remove (not the child article’s ID).
Response 200
Error reference
| HTTP status | estado | Typical mensaje |
|---|---|---|
400 | error | Validation error detail (e.g. "El código es requerido") |
400 | error | "No se puede eliminar: el artículo está usado en facturas o presupuestos" |
400 | error | "Un artículo no puede asociarse a sí mismo" |
404 | error | "Artículo no encontrado" |
500 | error | Internal server error message |