The Donaciones API is the core of the Banco Alimentos workflow. A donación represents a single donation event: a dated record linking a donor company to one or more item lines (items), carrying a supplier remittance number (nroRemitoProveedor), optional notes, and a lifecycle state. Donations begin inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/alvarezlautaro/BancoAlimentos/llms.txt
Use this file to discover all available pages before exploring further.
PENDIENTE state and must be explicitly confirmed via the /confirmar endpoint before downstream processes such as invoice generation can proceed. All endpoints require a valid JWT and enforce specific Spring Security authorities.
Base URL: /api/donaciones
Endpoints
GET /api/donaciones
Returns the full list of donation records. Required authority:DONACION_VER
Response
Returns an array of DonacionResponseDTO objects with HTTP200 OK.
GET /api/donaciones/{id}
Returns a single donation by its numeric ID. Required authority:DONACION_VER
Path parameters
The unique numeric identifier of the donation.
Response
Returns a single DonacionResponseDTO with HTTP200 OK. Throws a runtime exception (404) if the donation does not exist.
POST /api/donaciones
Creates a new donation record, including its initial set of line items. Required authority:DONACION_CREAR
Request body
Donation date in
YYYY-MM-DD format. Cannot be null.Initial lifecycle state. Must be one of
PENDIENTE, CONFIRMADA, or CANCELADA. Typically set to PENDIENTE on creation. Cannot be null.Supplier remittance / delivery note number. Cannot be null.
Optional free-text notes about the donation.
List of line items included in this donation. Must contain at least one item. Each item object requires:
fechaVencimiento(date, future) — product expiry datevalorUnitario(number, positive) — unit valuecantidad(integer, ≥ 1) — quantityproductoId(Long) — ID of the associated product
ID of the donor company associated with this donation.
Response
Returns the created DonacionResponseDTO with HTTP201 Created.
PUT /api/donaciones/{id}
Fully replaces an existing donation record. Provide all fields including the complete items list. Required authority:DONACION_ACTUALIZAR
Path parameters
The unique numeric identifier of the donation to update.
Request body
Same structure as POST /api/donaciones. All required fields must be supplied.Response
Returns the updated DonacionResponseDTO with HTTP200 OK.
DELETE /api/donaciones/{id}
Permanently deletes a donation record and its associated items. Required authority:DONACION_ELIMINAR
Path parameters
The unique numeric identifier of the donation to delete.
Response
Returns HTTP200 OK with the plain-text body "Donación eliminada correctamente".
PUT /api/donaciones/{id}/confirmar
Transitions a donation’sestado from PENDIENTE to CONFIRMADA. This action is required before the donation can be used for invoice generation or stock update processes.
Required authority: DONACION_ACTUALIZAR
A donation must be confirmed via this endpoint before it is eligible for invoice generation or any downstream inventory workflow. Attempting to generate an invoice for a
PENDIENTE or CANCELADA donation will fail.Path parameters
The unique numeric identifier of the donation to confirm.
Response
Returns the updated DonacionResponseDTO withestado set to CONFIRMADA and HTTP 200 OK.
Schemas
EstadoDonacion
Theestado field uses the following enumerated values:
| Value | Description |
|---|---|
PENDIENTE | Default state when a donation is first created. Awaiting confirmation. |
CONFIRMADA | Donation has been confirmed and is eligible for invoice generation. |
CANCELADA | Donation has been cancelled and is no longer active. |
Donacion request schema
Donation date in
YYYY-MM-DD format. Required; cannot be null.Lifecycle state. One of
PENDIENTE, CONFIRMADA, CANCELADA. Required; cannot be null.Supplier remittance number. Required; cannot be null.
Optional free-text notes.
List of
ItemDonacionRequestDTO objects. At least one item is required.ID of the associated donor company.
Donacion response schema
Unique numeric identifier assigned by the server.
Donation date in
YYYY-MM-DD format.Current lifecycle state:
PENDIENTE, CONFIRMADA, or CANCELADA.Supplier remittance number.
Optional notes attached to the donation.
Line items included in this donation. See Items Donación for the full item schema.
Error responses
| HTTP Status | Condition |
|---|---|
400 Bad Request | Validation failure — e.g. null fecha, empty items array, invalid estado value. |
401 Unauthorized | Missing or invalid JWT. |
403 Forbidden | Valid JWT but the user lacks the required authority. |
404 Not Found | No donation found for the supplied id. |