Skip to main content
DELETE
/
v1
/
invoices
/
retail
/
{invoice_id}
curl --request DELETE \
  --url https://api.paypulse.io/v1/invoices/retail/inv_abc123 \
  --header 'Authorization: Bearer <token>'
{
  "message": "Invoice deleted successfully",
  "code": 200,
  "data": {
    "deleted_invoice": {
      "invoice_id": "inv_abc123",
      "vendor_name": "Domino's Pizza",
      "sub_type": "food-delivery",
      "invoice_date": "2025-03-10",
      "total_amount": 149,
      "currency": "SEK"
    }
  }
}
This action is irreversible. The invoice record, its parsed details, and the source HTML file in S3 are all permanently deleted.

Authentication

All requests to this endpoint must include a valid JWT in the Authorization header.
Authorization: Bearer <token>

Path parameters

invoice_id
string
required
The unique identifier of the retail invoice to delete.

What gets deleted

Deleting a retail invoice removes the following:
  • The invoice record from the RetailInvoices DynamoDB table.
  • The invoice’s parsed detail record from the corresponding category detail table (e.g., FoodDeliveryInvoices, ClothingInvoices, TechnologyInvoices, SubscriptionInvoices, GroceryInvoices, MiscUtilityInvoices, MiscInvoices, TravelInvoices).
  • The raw HTML invoice file from S3.
Ownership is validated before deletion — you can only delete invoices that belong to the authenticated user.

Response

message
string
A human-readable confirmation message. Example: "Invoice deleted successfully"
code
number
HTTP status code. 200 on success.
data
object

Error responses

StatusError codeDescription
400MISSING_FIELDSThe invoice_id path parameter is absent.
401INVALID_CREDENTIALSThe Authorization header is missing or the token is invalid.
401TOKEN_EXPIREDThe JWT has expired.
404INVALID_REQUESTNo invoice found for the given invoice_id, or the invoice belongs to a different user.
502DEPENDENCY_FAILUREA downstream dependency (DynamoDB or S3) returned an error during deletion.
500INTERNAL_SERVER_ERRORAn unexpected server-side error occurred.
Error responses follow this structure:
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "Invoice not found or you don't have permission to delete it"
  }
}
curl --request DELETE \
  --url https://api.paypulse.io/v1/invoices/retail/inv_abc123 \
  --header 'Authorization: Bearer <token>'
{
  "message": "Invoice deleted successfully",
  "code": 200,
  "data": {
    "deleted_invoice": {
      "invoice_id": "inv_abc123",
      "vendor_name": "Domino's Pizza",
      "sub_type": "food-delivery",
      "invoice_date": "2025-03-10",
      "total_amount": 149,
      "currency": "SEK"
    }
  }
}