Cancel invoice

Cancels an issued invoice by changing its status to cancelled. Cancelled invoices remain in the system for record-keeping but are marked as void. A cancellation reason is required.

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

Headers

NameTypeRequiredDescription
AuthorizationstringYesBearer token for authentication
X-CompanystringYesCompany UUID to scope the request
Content-TypestringYesMust be application/json

Path parameters

NameTypeRequiredDescription
uuidstringYesInvoice UUID

Request body

NameTypeRequiredDescription
reasonstringYesReason for cancellation (minimum 10 characters)
⚠️

Cancelled invoices cannot be edited or reissued. To reverse a cancelled invoice, you must create a new invoice. Use the restore endpoint only for accidental cancellations.

Request

curl -X POST https://api.storno.ro/api/v1/invoices/7c9e6679-7425-40de-944b-e07fc1f90ae7/cancel \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "X-Company: 550e8400-e29b-41d4-a716-446655440000" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "Client requested cancellation due to incorrect billing information"
  }'

Response

Returns the updated invoice object with status cancelled.

{
  "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "number": "FAC-2024-001",
  "status": "cancelled",
  "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": 0.00,
  "cancellationReason": "Client requested cancellation due to incorrect billing information",
  "cancelledAt": "2024-02-16T14:30:00Z",
  "cancelledBy": {
    "id": "5e6f7a8b-9c0d-1e2f-3a4b-5c6d7e8f9a0b",
    "name": "John Doe",
    "email": "[email protected]"
  },
  "events": [
    {
      "id": "6f7a8b9c-0d1e-2f3a-4b5c-6d7e8f9a0b1c",
      "type": "status_change",
      "status": "cancelled",
      "timestamp": "2024-02-16T14:30:00Z",
      "details": "Invoice cancelled",
      "metadata": {
        "reason": "Client requested cancellation due to incorrect billing information"
      }
    }
  ],
  "updatedAt": "2024-02-16T14:30:00Z"
}

What happens when you cancel an invoice

  1. Status change - Invoice status changes to cancelled
  2. Balance zeroed - Any remaining balance is set to zero
  3. Event logged - Cancellation event recorded with reason and user
  4. Audit trail - Cancellation cannot be undone (except via restore for accidental cancellations)
  5. Provider notification - If the invoice was submitted to the e-invoice provider, a cancellation notice may be sent (depending on provider requirements)
ℹ️

To properly reverse an invoice for accounting purposes, consider creating a credit note instead of cancelling. Credit notes provide a proper audit trail and are the preferred method for invoice corrections.

When to cancel vs. credit note

ScenarioAction
Invoice not yet sent to clientCancel
Duplicate invoice createdCancel
Invoice created in errorCancel
Need to correct amounts/itemsCreate credit note
Partial refund requiredCreate credit note
Already recorded in accountingCreate credit note

Error codes

CodeDescription
400Validation error - missing or invalid cancellation reason
401Missing or invalid authentication token
403No access to the specified company or insufficient permissions
404Invoice not found
409Invoice cannot be cancelled in current status (e.g., already cancelled)
422Business rule violation (e.g., invoice has associated credit notes)