Create an invoice in Well from data you extracted by reading an invoice (your own OCR) — you send the structured fields, not the file.
Well persists the invoice + its line items + payment means using the same pipeline as uploaded documents. Fill every field you can read from the document:
- issuer / receiver: { name (required), company_id?, domain?, tax_id? }
- reference_number, issue_date (YYYY-MM-DD), due_date? (YYYY-MM-DD), currency (ISO 4217)
- totals?: { items_total?, tax_total?, grand_total }
- line_items[]: { name, quantity?, unit_price, currency?, tax_rate? }
- payment_means?[]: { type, iban?, bic?, scheme? }
- status?: draft | issued | paid | canceled
ONE CALL IS THE WHOLE WRITE. This tool takes the invoice's status and both
parties' company ids, so a create never needs a well_update_invoice after it:
- The user asked to DRAFT an invoice → pass status: "draft" here.
- You already found the company (well_query_records, well_get_entity) → pass its
company_id on that party. Naming the party without its id re-resolves it, which
can attach the invoice to the wrong company or create a duplicate one.
Creating and then patching the same invoice writes twice and shows the user two
confirmations for one action. Put the intent in this call.