Create invoice
create_invoiceCreate a new client invoice with line items, optional draft mode, email delivery, and custom billing/due dates. Returns the invoice ID and stored invoice.
Instructions
Create a new invoice for a client with one or more line items. Wraps Invoices.add. Dates default to now (billed) and now+7 days (due). Set deliver_by_email to queue the invoice email (sent by Blesta's cron). Set draft to create it unissued. Returns the new numeric invoice ID and the invoice as stored.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| draft | No | Create as draft (not issued, not deliverable) | |
| lines | Yes | Line items | |
| currency | Yes | ISO 4217 currency code | |
| date_due | No | ISO 8601 with timezone; default 7 days from now | |
| client_id | Yes | Numeric client ID | |
| date_billed | No | ISO 8601 with timezone, e.g. 2026-09-15T00:00:00Z; default now | |
| note_public | No | Note visible to the client on the invoice | |
| note_private | No | Note visible to staff only | |
| deliver_by_email | No | Queue email delivery of the invoice |