Factuarea APIDevelopers
Contract

Edit an expense in any state and correct its payments

An expense is now edited in draft, pending or paid status, and only a cancelled one answers 422. issued_on now applies, a quarter filed in the Modelo 130 locks the fiscal data, and the total cannot fall below what is already paid. A new operation edits a payment, with its MCP tool. One new operation and one updated.

1 December 2026 — An expense is no longer fixed once it leaves draft. Updating an expense now edits it in draft, pending or paid status, and only a cancelled one is rejected. A new operation, editing a payment of an expense, corrects the date, the method, the reference and the notes of a payment in force. The change is compatible, with one detail you should read: issued_on now applies.

Editing a pending or paid expense

Until now only a draft could be edited, and a PATCH on a pending or paid expense answered 422 purchase_invoice_not_editable_in_current_state. Now:

  • Draft, pending or paid. The expense accepts the same fields as before. Editing a paid expense changes neither its status nor its payments, except when its total goes up (see below).
  • Cancelled. It still answers 422 purchase_invoice_not_editable_in_current_state: its debt was released and its payments reversed. Create a new expense with the right data.

A filed quarter locks the fiscal data

The Modelo 130 adds up each expense in the quarter of its issue date. Once you mark that quarter as filed, a pending or paid expense answers 422 business_rule_violation with the subcode purchase_invoice_fiscal_period_filed when the PATCH changes a fiscal field, so a filed self-assessment never moves under you. The check looks at the quarter of the current issue date and, if you change it, at the quarter of the new one.

Locked in a filed quarterStill editable
supplier_id, external_invoice_number, issued_on, lines, deductible_percentage, operation_class, is_reverse_charge, exclude_347, tax_periodexpense_category_id, notes, internal_notes, due_on, received_on, internal_code, external_id, payment_method, payment_terms_days, bank_account_id, expense_account, tags, custom_fields, metadata and the payments
  • Drafts are never blocked. A draft is in no filing.
  • A value equal to the saved one is not a change. Resending the whole expense with the same fiscal data does not trigger the lock.
  • The way out. Reopen the filing of that quarter with POST /v1/companies/{company}/tax-reports/130/filing/reopen and repeat the change, or regularise it in a supplementary self-assessment.

The total against what is paid

  • Below what is paid. A change that leaves the total of the expense below what is already paid, with new lines or with an operation_class that recalculates it, answers 422 purchase_invoice_total_below_paid_amount and changes nothing. Reverse first, from the app, the payment that is in excess, and repeat the change.
  • A paid expense that owes more. If its total goes up, it returns to pending and the payment data of its header is cleared; its payments stay in the ledger. A total that stays the same or goes down, without falling below what is paid, does not reopen it.

issued_on now applies

issued_on was accepted in the PATCH and ignored. It is now applied when you send it. It is a fiscal field, so the lock above looks at the quarter of the previous date and at the one of the new date. A value equal to the saved one changes nothing.

Editing a payment

PATCH /v1/companies/{company}/purchase-invoices/{purchase_invoice}/payments/{payment} corrects a payment in force without reverting it. It needs purchase_invoices:transition, the same scope that registers a payment. Every field is optional: send only what changes.

FieldNotes
paid_onDate (YYYY-MM-DD), not later than today.
payment_methodOne of the nine values of the catalog: bank_transfer, direct_debit, sepa_direct_debit, cash, credit_card, check, paypal, bizum and other. Registering a payment still takes free text; this operation takes the closed catalog.
referenceUp to 255 characters. null clears it.
notesUp to 1,000 characters. null clears it.
PATCH /v1/companies/{company}/purchase-invoices/{purchase_invoice}/payments/{payment}

{
  "paid_on": "2026-11-28",
  "payment_method": "sepa_direct_debit",
  "reference": "REM-2026-11-0042",
  "notes": null
}
  • The amount is not editable. A wrong amount is corrected by reversing the payment from the app and registering another.
  • Answers. 200 with the payment under data. 422 for a payment that is already reverted (payment_already_reversed), for a cancelled expense (purchase_invoice_not_payable) and for a paid_on later than today. 404 payment_not_found for a payment that does not belong to that expense.
  • The expense follows. If the payment is the one that settled a paid expense, the payment date and method of the expense change with it.
  • A filed quarter does not block it. The Modelo 130 counts an expense by its issue date, not by the date of its payments.
  • MCP. The tool update_purchase_invoice_payment does the same, and update_purchase_invoice follows the rules above.

What to check in your integration

  • issued_on in the PATCH. If your client sent issued_on expecting it to be ignored, for instance when it resends the whole expense, the date now changes. Send it only when you want to change it.
  • Expenses that are not drafts. An integration that skipped the update, or expected a 422, for a pending or paid expense can now edit it. Only a cancelled one is rejected.
  • The new 422. Handle purchase_invoice_fiscal_period_filed and purchase_invoice_total_below_paid_amount by their subcode, and show the message to your user.
  • The status after the PATCH. A paid expense can come back as pending: read the status of the response instead of assuming it.
  • SDKs. They pin their own generated copy of the contract. Check the version you have installed before relying on the typed method for the new operation.

Operations in this release

OperationoperationIdMCP toolWhat changes
PATCH /v1/companies/{company}/purchase-invoices/{purchase_invoice}public-api.v1.purchase_invoices.updateupdate_purchase_invoiceIt edits an expense in draft, pending or paid status, applies issued_on, and answers 422 for a locked fiscal field in a filed quarter or for a total below what is paid.
PATCH /v1/companies/{company}/purchase-invoices/{purchase_invoice}/payments/{payment}public-api.v1.purchase_invoices.update_paymentupdate_purchase_invoice_paymentNew. It edits the date, the method, the reference and the notes of a payment in force.

New endpoints1

EndpointDescription
PATCH/v1/companies/{company}/purchase-invoices/{purchase_invoice}/payments/{payment}Edit an expense payment

Updated endpoints1

EndpointDescription
PATCH/v1/companies/{company}/purchase-invoices/{purchase_invoice}Update an expense

On this page

Need a hand?Contact support