Create Invoice
Creates and optionally sends a new invoice. Two request shapes are accepted (see below).
Authentication: X-API-KEY header (see Authentication).
Request body
| Field | Type | Description |
|---|---|---|
| invoiceNumber | string | Optional explicit invoice number. |
| clientName | string | Client to bill. |
| templateName | string | Invoice template to apply. |
| description | string | Invoice description. |
| dueDate | date | Due date. |
| taxRate | number | Tax rate applied. |
| discountPercent | number | Discount percentage. |
| paymentInstructions | string | Payment instructions text. |
| items[] | LineItem[] | Line items: description, quantity, rate, taxable, projectName, type. |
| items[].type | string | ADHOC (default) or DEPOSIT. Deposit lines are tracked as client deposits when the invoice is paid. Any other value is rejected with 400. |
| sendTo | object | Optional delivery configuration (see below). |
| sendTo.markAsSent | boolean | Set true to finalize without sending invoice email or Peppol. Takes precedence over send. No recipients or email template required. Default false. |
| sendTo.send | boolean | Set true to email the invoice. Default false; the invoice stays in DRAFT unless markAsSent is true. |
| sendTo.contacts | string[] | Recipient email addresses. When emailing, an omitted or empty list uses the client's default/invoice contacts. |
| sendTo.emailTemplateName | string | Optional email template name used when emailing. |
Request
curl -X POST https://api.withmoxie.com/public/action/invoices/create \
-H "X-API-KEY: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"clientName": "Acme Kft.", "dueDate": "2026-08-01", "items": [{"description": "Website design", "quantity": 1, "rate": 1000, "taxable": true}], "sendTo": {"send": true}}'
Create a payable deposit invoice without emailing
{
"clientName": "Acme Kft.",
"items": [
{"description": "Deposit paid elsewhere", "quantity": 1, "rate": 500, "type": "DEPOSIT"}
],
"sendTo": {"markAsSent": true}
}
This finalizes the invoice using the normal Mark as sent operation and returns its updated status and online URL. Normal reminders, auto-pay, accounting synchronization, and invoice-sent webhooks still apply. For money already received elsewhere, use Apply Payment next to record that payment. Marking as sent alone does not record payment or fund the client's deposit balance.
Response
Returns an InvoiceMini including id, invoiceNumber, invoiceNumberFormatted, totals, currency, viewOnlineUrl, and the lineItems array (see Search Payable Invoices for the line-item shape).
{
"id": "66b0f2a1c3a9e40012ab34cd",
"invoiceNumber": 1042,
"invoiceNumberFormatted": "E-2026-042",
"clientId": "66b0f2a1c3a9e40012ab3400",
"status": "DRAFT",
"invoiceType": "STANDARD",
"currency": "HUF",
"subTotal": 1000.00,
"tax": 270.00,
"total": 1270.00,
"amountDue": 1270.00,
"viewOnlineUrl": "https://pay.withmoxie.com/i/...",
"payments": [],
"lineItems": [
{
"id": "line_1",
"description": "Website design",
"quantity": 1,
"unitPrice": 1000.00,
"taxable": true,
"lineTotal": 1000.00,
"type": "ADHOC",
"visible": true
}
]
}
A simpler shape (clientId, amount, dateDue, description, notes, sendTo) is also accepted and returns the full Invoice object.