Skip to main content
DELETE
/
api
/
invoices
/
{id}
Delete Invoice
curl --request DELETE \
  --url https://api.example.com/api/invoices/{id}
{
  "message": "<string>"
}

Authentication

This endpoint requires authentication. Include your access token in the Authorization header.
Authorization: Bearer YOUR_ACCESS_TOKEN

Path Parameters

id
string
required
The unique identifier of the invoice to delete

Response

message
string
Success message confirming the deletion

Example Request

curl -X DELETE "https://api.contafy.com/api/invoices/inv_abc123" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
const response = await fetch('https://api.contafy.com/api/invoices/inv_abc123', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
  }
});

const data = await response.json();

Example Response

{
  "message": "Invoice deleted successfully"
}

Error Responses

401 Unauthorized
{
  "error": "Unauthorized",
  "message": "Invalid or missing access token"
}
404 Not Found
{
  "error": "Not Found",
  "message": "Invoice not found"
}
403 Forbidden
{
  "error": "Forbidden",
  "message": "You do not have permission to delete this invoice"
}
409 Conflict
{
  "error": "Conflict",
  "message": "Cannot delete invoice with associated payment complements"
}
500 Internal Server Error
{
  "error": "Internal Server Error",
  "message": "An unexpected error occurred"
}

Notes

  • Deleting an invoice is permanent and cannot be undone
  • If the invoice has associated payment complements (complementos de pago), you may need to delete those first
  • All related payment status calculations will be recalculated for affected invoices