Skip to main content

Delete Invoice

This endpoint is used to delete an existing invoice by its ID. Deleting an invoice will permanently remove it from the system.

Endpoint

  • URL: /invoices/{id}
  • Method: DELETE

Replace {id} with the specific invoice ID you want to delete.

Authentication

  • Header: accessToken
  • Type: Bearer Token
  • Value: <ACCESS-TOKEN>

Request Headers

HeaderTypeDescription
accessTokenstringAccess token for authentication. (required)

Path Parameters

ParameterTypeDescription
idstringThe unique identifier of the invoice to be deleted.

Request Body

  • None

Response

  • Status Code: 200 OK

Success Response Fields

FieldTypeDescription
successbooleanIndicates whether the invoice was deleted successfully.
messagestringA message conveying the outcome of the operation.
dataobjectOptional - May contain details of the deleted invoice.

Example Success Response

{
"success": true,
"message": "Invoice deleted successfully",
"data": {
"id": "693738682fa9114d9af87d29",
"entityId": "1"
}
}

Example Request

Here is an example using curl to delete an invoice:

curl --location --request DELETE '<BASE-URL>/invoices/693738682fa9114d9af87d29' \
--header 'accessToken: <ACCESS-TOKEN>'

Note

  • Replace the placeholder in the URL with the actual invoice ID.
  • Ensure you include a valid accessToken in the request to authenticate.
  • Deleting an invoice is a permanent action and cannot be undone.

Error Responses

404 Not Found

{
"success": false,
"message": "Invoice not found"
}

401 Unauthorized

{
"success": false,
"message": "Invalid or missing access token"
}

403 Forbidden

{
"success": false,
"message": "You do not have permission to delete this invoice"
}

500 Internal Server Error

{
"success": false,
"message": "An error occurred while deleting the invoice"
}

Important Notes

  • Permanent Deletion: Once an invoice is deleted, it cannot be recovered.
  • Order Reference: Deleting an invoice does not affect the associated order.
  • Audit Trail: Consider maintaining an audit log of deleted invoices for compliance purposes.
  • Permissions: Ensure the user has appropriate permissions to delete invoices.