Skip to main content

DELETE /api/invoices/:id

Deletes a specific invoice from the database. This operation is permanent and cannot be undone.

Authentication

Requires Bearer token authentication. The token must be included in the Authorization header.

Path Parameters

id
string
required
UUID of the invoice to delete

Response

message
string
Success message: “Factura eliminada exitosamente”

Error Codes

401
error
Unauthorized - User not authenticated
404
error
Not Found - Invoice not found or doesn’t belong to authenticated user
500
error
Internal Server Error - Error deleting invoice

Example Request

curl -X DELETE https://api.tresacontafy.com/api/invoices/7c9e6679-7425-40de-944b-e07fc1f90ae7 \
  -H "Authorization: Bearer YOUR_TOKEN"

Example Response (Success)

{
  "message": "Factura eliminada exitosamente"
}

Example Response (Not Found)

{
  "error": "Factura no encontrada"
}

Example Response (Internal Error)

{
  "error": "Error al eliminar factura",
  "message": "Database connection error"
}

Notes

  • The endpoint verifies that the invoice belongs to one of the authenticated user’s profiles before deletion
  • Deletion is permanent and cannot be undone
  • Related payment complements and payment history may be affected by this operation
  • Consider the impact on financial reports and metrics before deleting invoices

Build docs developers (and LLMs) love