Restore cancelled invoice

Restores a cancelled invoice back to draft status. This endpoint should only be used for accidental cancellations. Changes the invoice status from cancelled back to draft, allowing it to be edited and reissued.

POST /api/v1/invoices/{uuid}/restore

Headers

NameTypeRequiredDescription
AuthorizationstringYesBearer token for authentication
X-CompanystringYesCompany UUID to scope the request

Path parameters

NameTypeRequiredDescription
uuidstringYesInvoice UUID
⚠️

Restoring an invoice should be done carefully. If the invoice was already sent to clients or submitted to ANAF, restoring may cause confusion. Consider creating a new invoice instead.

Request

curl -X POST https://api.storno.ro/api/v1/invoices/7c9e6679-7425-40de-944b-e07fc1f90ae7/restore \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "X-Company: 550e8400-e29b-41d4-a716-446655440000"

Response

Returns the updated invoice object with status draft.

{
  "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "number": "FAC-2024-001",
  "status": "draft",
  "direction": "outgoing",
  "currency": "RON",
  "issueDate": "2024-02-15",
  "dueDate": "2024-03-15",
  "subtotal": 1000.00,
  "vatTotal": 190.00,
  "total": 1190.00,
  "amountPaid": 0.00,
  "balance": 1190.00,
  "cancellationReason": null,
  "cancelledAt": null,
  "cancelledBy": null,
  "restoredAt": "2024-02-16T15:00:00Z",
  "restoredBy": {
    "id": "5e6f7a8b-9c0d-1e2f-3a4b-5c6d7e8f9a0b",
    "name": "John Doe",
    "email": "[email protected]"
  },
  "events": [
    {
      "id": "7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d",
      "type": "status_change",
      "status": "draft",
      "timestamp": "2024-02-16T15:00:00Z",
      "details": "Invoice restored from cancelled status"
    }
  ],
  "updatedAt": "2024-02-16T15:00:00Z"
}

What happens when you restore an invoice

  1. Status change - Invoice status changes from cancelled to draft
  2. Cancellation data cleared - Cancellation reason, date, and user are cleared
  3. Balance restored - Invoice balance is recalculated based on payments
  4. Editable again - Invoice can now be edited and reissued
  5. Event logged - Restoration event recorded with timestamp and user

After restoration, you can:

  • Edit invoice details
  • Modify line items
  • Delete the invoice
  • Reissue the invoice

When to use restore vs. create new

ScenarioAction
Accidental cancellationRestore
Invoice number must be preservedRestore
Invoice not yet sentRestore (safe)
Invoice sent to clientCreate new invoice
Invoice submitted to ANAFCreate new invoice
Need different amountsCreate new invoice

Error codes

CodeDescription
401Missing or invalid authentication token
403No access to the specified company or insufficient permissions
404Invoice not found
409Invoice is not cancelled or cannot be restored
422Business rule violation (e.g., invoice has payments or was submitted to ANAF)

Restrictions

An invoice cannot be restored if:

  • It was submitted to ANAF and validated
  • It has associated credit notes
  • It has recorded payments (payments must be removed first)
  • It was cancelled more than 30 days ago (configurable)
  • The invoice series has been deleted