Deletes a client record from the system. This is a physical deletion (hard delete).
Authentication
Admin only - This endpoint requires administrator privileges (DIRECTOR or GERENTE role).
Requires an active session with admin role. Non-admin users will receive a 403 error.
Path Parameters
The unique identifier of the client to delete
Dependency Checks
Before deletion, the system verifies whether the client has:
- Associated quotations (
quotations.client_id)
- Associated commercial agreements (
commercial_agreements.client_id)
If either exists, the deletion is rejected with a 409 Conflict error.
Response
Confirmation that the deletion was successful
curl -X DELETE https://your-domain.com/api/clientes/15 \
-H "Cookie: session=your-session-token"
The error message dynamically adjusts based on the number and type of dependencies found. Examples:
- “No se puede eliminar: el cliente tiene 1 cotización vinculada.”
- “No se puede eliminar: el cliente tiene 5 cotizaciones y 2 acuerdos comerciales vinculadas.”