Create invoice from previous
create_invoice_from_previousCreates a new invoice by copying the most recently created invoice for a recipient (exact company name): its recipient details, line items and discounts. Use it for recurring work, such as the same invoice as last month with different hours. Invoice number, dates, line items, currency, VAT rate, shipping, note, style and buyer reference can be overridden; recipient details and discounts cannot; update_invoice can change those afterwards. invoiceDate and dueDate are written in the sender's date format, the dateFormat field of get_sender_settings (for example DD.MM.YYYY). A date that cannot be read as day, month and year in that format is rejected. The check goes no further: a date written in another format with the same separator is read in the expected order (03/04/2026 is 3 April in DD/MM/YYYY and 4 March in MM/DD/YYYY), a day past the end of its month rolls into the next one (31.02.2026 becomes 3 March), and a two-digit year is read as 19xx (26 is 1926). By default it creates a draft, which is free. With isDraft=false it creates a finalized invoice and spends credits. Finalizing uses one free invoice if any remain, otherwise it deducts the per-invoice price from the credit balance. It fails when the balance is too low, and the charge is not refunded. It fails if the recipient has no earlier invoice. Side effect: the recipient gets a customer record if none exists under that company name, created from the recipient details of the invoice, and the invoice is linked to it. An existing customer record is not changed. It does not email anyone. Each call creates another invoice.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dueDate | No | Override due date, in the sender's date format (dateFormat from get_sender_settings). Defaults to today + payment terms. | |
| isDraft | No | Create as draft (free, default) or final (charges credits) | |
| currency | No | Override currency | |
| lineItems | No | Override line items. If omitted, copies from previous invoice. | |
| vatRateBps | No | Override VAT rate | |
| invoiceDate | No | Override invoice date, in the sender's date format (dateFormat from get_sender_settings). Defaults to today. | |
| invoiceNote | No | Override invoice note | |
| invoiceStyle | No | Override invoice style | |
| invoiceNumber | No | Override invoice number | |
| shippingCents | No | Override shipping | |
| buyerReference | No | Override buyer reference | |
| recipientCompanyName | Yes | Recipient company name to find the previous invoice for |