Skip to main content

Revert Generated Invoice API

Introduction​

Reverts a generated invoice back into the invoicing workflow (pending/draft side) using InvoiceService.revertToInvoiceFromGenerated, after the same e-invoice cancel preconditions used by delete generated invoice. The response includes invoiceType, set from the customer’s invoiceFrequency after a successful revert, so the client can refresh the correct list (individual vs summary behaviour).

Source: InvoiceHomePageAPI.revertFromGeneratedInvoice (@Path("revertGeneratedInvoice")).

See also: Invoice Home — all endpoints.


HTTP Endpoint​

PropertyValue
URL/rest/invoicehome/revertGeneratedInvoice
MethodPOST
ConsumesRaw JSON body
Producestext/plain (JSON string entity)

Request Body (JSON)​

FieldTypeRequiredDescription
userIdStringYesActing user for activity log and mail.
userNameStringYesAuth username.
authKeyStringYesAuth key.
revertReasonStringYesPassed to e-invoice cancel as the reason.
invoiceOriginalDataStringYesLookup string for getInvoiceOriginalForUpload.

Authentication​

ConditionHTTP status
Invalid credentials401 Unauthorized (Access-Control-Allow-Origin: *)
Success200 OK

Behaviour (high level)​

  1. Same e-invoice cancel branch as deleteGeneratedInvoice when UUID is present (including possible cancel mail).
  2. When the same combined condition on status / empty UUID holds, calls revertToInvoiceFromGenerated(invoiceOriginal, tenantId).
  3. Loads Customer by invoiceOriginal.getCustomerId() and sets invoiceType = customerDetails.getInvoiceFrequency().
  4. On successful revert, saves activity: reverted invoice number.

Response​

Code: 200 OK

Body (JSON string):

{
"reverted": true,
"invoiceType": "..."
}
  • reverted: result of revertToInvoiceFromGenerated.
  • invoiceType: customer invoice frequency string (may be empty if customer lookup or revert path does not set it as expected).

Headers: Access-Control-Allow-Origin: *


Example Request​

POST /rest/invoicehome/revertGeneratedInvoice HTTP/1.1
Host: {base}
Content-Type: application/json

{
"userId": "42",
"userName": "alice",
"authKey": "secretKey",
"revertReason": "Regenerate invoice",
"invoiceOriginalData": "INV-2026-001"
}