Update invoice

Updates an existing invoice. Invoices can be updated as long as they are editable — this includes draft invoices, rejected invoices (so you can fix and resubmit), and issued invoices that have not yet been submitted to ANAF. Invoices with status cancelled or sent_to_provider, or that have already been uploaded to ANAF, cannot be updated.

PUT /api/v1/invoices/{uuid}

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

All fields are optional — only include the fields you want to update.

NameTypeDescription
clientIdstringClient UUID
receiverNamestringReceiver name (when no client entity selected)
receiverCifstringReceiver tax ID / CIF (used with receiverName)
documentSeriesIdstringInvoice series UUID (only changeable on draft invoices)
documentTypestringDocument type (e.g., invoice, credit_note)
issueDatestringInvoice issue date (ISO 8601: YYYY-MM-DD)
dueDatestringPayment due date (ISO 8601: YYYY-MM-DD)
currencystringISO 4217 currency code
exchangeRatenumberExchange rate
invoiceTypeCodestringUBL invoice type code
notesstringPublic notes visible to client
paymentTermsstringPayment terms description
paymentMethodstringPayment method: bank_transfer, cash, card, cheque, other
deliveryLocationstringDelivery address
projectReferencestringProject reference number
orderNumberstringPurchase order number
contractNumberstringContract reference number
issuerNamestringName of person issuing the invoice
issuerIdstringIssuer ID number
mentionsstringAdditional legal mentions
internalNotestringInternal note (not visible to client)
salesAgentstringSales agent name
deputyNamestringDeputy/representative name
deputyIdentityCardstringDeputy ID card number
deputyAutostringDeputy vehicle registration
languagestringDocument language for PDF generation: ro, en, de, fr
tvaLaIncasarebooleanVAT on collection (TVA la încasare)
platitorTvabooleanWhether sender is VAT payer
plataOnlinebooleanEnable online payment via Stripe
showClientBalancebooleanShow client balance on invoice
clientBalanceExistingstringExisting client balance amount
clientBalanceOverduestringOverdue client balance amount
autoApplyVatRulesbooleanAuto-apply EU VAT rules: reverse charge (0% VAT) for VIES-valid EU clients, OSS destination country VAT rate for non-VIES EU clients (default: false)
vatIncludedbooleanWhen used with autoApplyVatRules, sets whether unit prices include VAT on all lines. This ensures correct totals after VAT rules change rates (e.g., reverse charge sets VAT to 0%). Without this, use per-line vatIncluded instead.
ublExtensionsobjectUBL extension fields for advanced e-Factura compliance (see below). Pass null to clear.
linesarrayArray of invoice line items (replaces all lines)

Invoice line object

NameTypeRequiredDescription
descriptionstringYesLine item description
quantitynumberYesQuantity
unitPricenumberYesUnit price
vatRatenumberNoVAT rate percentage (default: 21.00)
vatCategoryCodestringNoUBL VAT category code (default: S). Usually not needed — auto-determined from vatRate: 0% rate auto-corrects to Z, and zero-rate codes with rate > 0 auto-correct to S. Only set explicitly for special categories like AE (reverse charge), E (exempt), K (intra-community), G (export).
vatRateIdstringNoVAT rate UUID
unitOfMeasurestringNoUnit of measure (e.g., "hours", "pcs", "kg")
productIdstringNoProduct UUID (optional reference)
discountnumberNoFixed discount amount
discountPercentnumberNoDiscount percentage
vatIncludedbooleanNoWhether price includes VAT (default: false)
productCodestringNoProduct code for reference
ublExtensionsobjectNoLine-level UBL extensions (see below)

e-Factura BT fields

These optional fields are used for advanced e-Factura (UBL) compliance:

NameTypeDescription
taxPointDatestringTax point date (ISO 8601: YYYY-MM-DD)
taxPointDateCodestringTax point date code
buyerReferencestringBuyer reference
receivingAdviceReferencestringReceiving advice reference
despatchAdviceReferencestringDespatch advice reference
tenderOrLotReferencestringTender or lot reference
invoicedObjectIdentifierstringInvoiced object identifier
buyerAccountingReferencestringBuyer accounting reference
businessProcessTypestringBusiness process type
payeeNamestringPayee name (if different from seller)
payeeIdentifierstringPayee identifier
payeeLegalRegistrationIdentifierstringPayee legal registration identifier

UBL extensions (document-level)

The ublExtensions object supports UBL XML elements that don't have dedicated invoice fields. All sub-fields are optional. Unknown keys are silently stripped. Pass null to clear all extensions.

NameTypeDescription
invoicePeriodobjectBilling period: startDate (YYYY-MM-DD), endDate (YYYY-MM-DD), descriptionCode (e.g., "35")
deliveryobjectDelivery info: actualDeliveryDate (YYYY-MM-DD), deliveryAddress object with streetName, cityName, countrySubentity, countryCode
allowanceChargesarrayDocument-level allowances/charges (max 20). Each: chargeIndicator (bool, false=discount), amount (numeric string), taxCategoryCode (S/Z/E/AE/K/G/O), taxRate (numeric string). Optional: reasonCode, reason, baseAmount, multiplierFactorNumeric
prepaidAmountstringPrepaid amount (numeric string >= 0). Reduces PayableAmount in UBL XML
additionalDocumentReferencesarrayAdditional references (max 10). Each: id (required, max 200), optional documentTypeCode, documentDescription

UBL extensions (line-level)

Each line item can include a ublExtensions object:

NameTypeDescription
invoicePeriodobjectLine billing period: startDate (YYYY-MM-DD), endDate (YYYY-MM-DD)
allowanceChargesarrayLine-level allowances/charges (max 10). Each: chargeIndicator (bool), amount (numeric string). Optional: reasonCode, reason, baseAmount, multiplierFactorNumeric
additionalItemPropertiesarrayItem properties (max 20). Each: name (max 50 chars), value (max 100 chars)
originCountrystringItem origin country (ISO 3166-1 alpha-2, e.g., "DE")
⚠️

When updating lines, the entire array is replaced. Include all line items you want to keep, not just the ones you're changing.

Request

curl -X PUT https://api.storno.ro/api/v1/invoices/7c9e6679-7425-40de-944b-e07fc1f90ae7 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "X-Company: 550e8400-e29b-41d4-a716-446655440000" \
  -H "Content-Type: application/json" \
  -d '{
    "dueDate": "2024-03-30",
    "notes": "Payment terms: 45 days net",
    "lines": [
      {
        "description": "Web Development Services - Updated",
        "quantity": 15,
        "unitPrice": 100.00,
        "unitOfMeasure": "hours",
        "vatIncluded": false
      }
    ]
  }'

Response

Returns the updated invoice object along with UBL validation results.

{
  "invoice": {
    "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
    "number": "FAC-2024-001",
    "status": "draft",
    "direction": "outgoing",
    "currency": "RON",
    "exchangeRate": 1.0,
    "issueDate": "2024-02-15",
    "dueDate": "2024-03-30",
    "subtotal": 1500.00,
    "vatTotal": 285.00,
    "total": 1785.00,
    "amountPaid": 0.00,
    "balance": 1785.00,
    "notes": "Payment terms: 45 days net",
    "lines": [
      {
        "id": "2b3c4d5e-6f7a-8b9c-0d1e-2f3a4b5c6d7e",
        "description": "Web Development Services - Updated",
        "quantity": 15.0,
        "unitPrice": 100.00,
        "unitOfMeasure": "hours",
        "vatRate": 19.0,
        "vatAmount": 285.00,
        "subtotal": 1500.00,
        "total": 1785.00
      }
    ],
    "updatedAt": "2024-02-15T10:45:00Z"
  },
  "validation": {
    "valid": true,
    "errors": [],
    "warnings": [],
    "schematronAvailable": true
  }
}

Error codes

CodeDescription
400Validation error - invalid data format
401Missing or invalid authentication token
403No access to the specified company
404Invoice not found
422Invoice is not editable (cancelled, sent to provider, or already uploaded to ANAF)