Every change to a product’s stock quantity is represented as a movement (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.
Movimiento). Movements come in two varieties: manual ones created directly through this API, and automatic ones generated by other workflows — for example, confirming a sale (POST /api/ventas) produces a salida movement for each line item, and receiving a purchase order creates corresponding entrada movements. This design means the full stock history is always auditable. The Movements API exposes three endpoints: listing, manual creation, and bulk deletion of manual records only.
Endpoints
| Method | Path | Description | Auth required |
|---|---|---|---|
| GET | /api/movimientos | List movements (cursor pagination) | Active session |
| POST | /api/movimientos | Create a manual movement | REGISTRAR_MOVIMIENTOS permission or ADMIN |
| POST | /api/movimientos/bulk-delete | Delete multiple manual movements | ADMIN |
GET /api/movimientos
Returns a paginated list of all movements for the authenticated user’s company, ordered by most recent first. Uses cursor-based pagination for efficient traversal of large movement logs.The
id of the last movement received. Omit to start from the most recent.Number of movements to return. Maximum
100.Array of movement objects for this page.
Pass as
cursor in the next request. null when there are no more results.Number of items in this page.
items contains:
Unique movement identifier.
"entrada" (stock in) or "salida" (stock out).Number of units moved.
Optional description of the reason for the movement.
ID of the affected product.
ID of the originating sale, if this movement was created automatically by a sale or sale cancellation.
ID of the originating purchase order, if this movement was created when a purchase order was received.
ISO 8601 timestamp when the movement was recorded.
Company tenant identifier (always matches the session).
| Status | Cause |
|---|---|
401 | No active session, or user is not in ACTIVO state. |
403 | User has no company assigned. |
500 | Unexpected server error. |
POST /api/movimientos
Records a manual inventory movement and immediately adjusts the product’s current stock count. This is the correct way to correct stock discrepancies, record breakage, or add stock received outside of the purchase order flow. Permissions: The user must have theREGISTRAR_MOVIMIENTOS permission, or be an ADMIN. Users with REALIZAR_VENTAS permission may create salida movements only.
Movements created automatically by sales, sale cancellations, or received purchase orders are also
Movimiento records, but they are linked via ventaId or ordenCompraId. Those linkages are set only by the system — this endpoint creates unlinked manual records.ID of the product to adjust. Must belong to the authenticated user’s company.
Movement direction:
"entrada" to add stock, "salida" to remove stock.Number of units to add or remove. Must be a positive integer.
Optional human-readable note explaining the reason for this movement (e.g.
"Ajuste de inventario físico", "Merma por caducidad").201 Created.
Error cases
| Status | Cause |
|---|---|
400 | Missing or invalid fields (e.g. cantidad ≤ 0, unknown tipo). |
401 | No active session. |
403 | Insufficient permissions for the requested movement type. |
404 | Product not found or belongs to a different company. |
500 | Unexpected server error. |
POST /api/movimientos/bulk-delete
Deletes multiple manual movements in a single operation. Only movements whereventaId is null (i.e. not linked to any sale or sale cancellation) are eligible for deletion. If the selection includes any sale-linked movements, the entire request is rejected and nothing is deleted.
Deleting movement records does not adjust the product’s current stock count (
cantidad). The Producto.cantidad field is a denormalized running total that reflects stock as of the time movements were applied. Use this endpoint only to clean up erroneous manual entries; do not use it to reverse stock adjustments — create a compensating movement instead.Array of movement IDs to delete. Must contain at least one valid positive integer.
Number of movements deleted.
The movement IDs that were actually removed.
| Status | Cause |
|---|---|
400 | Empty or invalid ids array. |
403 | Not an ADMIN. |
404 | None of the given IDs exist in the company. |
409 | One or more movements are linked to sales or cancellations and cannot be deleted. |
500 | Unexpected server error. |