Create invoice from data
well_create_invoice_from_dataCreate 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.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| issuer | Yes | ||
| status | No | The invoice's lifecycle status. Set it here when the user asked for one ("draft an invoice") — do NOT create and then call well_update_invoice to change it. Omitted, the status is derived from the document type. | |
| totals | No | ||
| currency | Yes | ISO 4217 (3 letters). | |
| due_date | No | ISO 8601 YYYY-MM-DD. | |
| receiver | Yes | ||
| issue_date | Yes | ISO 8601 YYYY-MM-DD. | |
| line_items | Yes | ||
| workspace_id | No | Target workspace. Omit when the token authorizes one workspace. Required when it authorizes several — a write lands in exactly one workspace and this call would not say which. | |
| payment_means | No | ||
| idempotency_key | No | Optional client-supplied key. A retried write with the same key returns the original result instead of re-applying the operation. | |
| reference_number | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | No | ||
| success | Yes | ||
| invoice_id | No | ||
| document_id | No | ||
| payment_means | No | ||
| reference_number | No | ||
| invoice_item_count | No |