Create invoice
Create a draft invoice for a client with line items, dates and notes.
POST https://cotlet.dev/api/v1/invoice-ninja/clients/{client_id}/invoices
Creates an invoice as a draft and returns its number and totals. A draft is invisible to the client, stays out of the client balance and cannot reach anyone until you send it with send_invoice. Invoice Ninja numbers the invoice from the pattern in Settings > Generated Numbers, and without a due date the invoice is due immediately. Totals are quantity times unit cost per line, in the client currency. create_invoice runs without asking first: a draft reaches nobody and you can delete it in Invoice Ninja.
Parameters
| Name | Type | Description |
|---|---|---|
| company string | string | Company name, for accounts with several companies. Default: the company open when you signed in. |
| client_id string required | string | Client ID from list_clients or create_client. |
| items array required | array | Line items. Each has product (name from list_products or free text), description, unit_cost and quantity (decimals allowed). |
| invoice_date date | date | Default: today. |
| due_date date | date | Default: none, which makes the invoice due immediately. |
| po_number string | string | The client's purchase order number, printed on the PDF. |
| public_notes string | string | Note the client sees on the invoice. |
Request
curl -X POST https://cotlet.dev/api/v1/invoice-ninja/clients/Wp3xq8Rnd5/invoices \
-H "Authorization: Bearer $COTLET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"items":[{"product":"Design sprint","description":"Design sprint, 10 hours","unit_cost":90,"quantity":10},{"product":"Hosting setup","description":"Hosting setup","unit_cost":150,"quantity":1}],"invoice_date":"2026-10-14","due_date":"2026-11-13"}' result = client.call("invoice-ninja", "create_invoice", {"client_id":"Wp3xq8Rnd5","items":[{"product":"Design sprint","description":"Design sprint, 10 hours","unit_cost":90,"quantity":10},{"product":"Hosting setup","description":"Hosting setup","unit_cost":150,"quantity":1}],"invoice_date":"2026-10-14","due_date":"2026-11-13"}) const result = await cotlet.call('invoice-ninja', 'create_invoice', {"client_id":"Wp3xq8Rnd5","items":[{"product":"Design sprint","description":"Design sprint, 10 hours","unit_cost":90,"quantity":10},{"product":"Hosting setup","description":"Hosting setup","unit_cost":150,"quantity":1}],"invoice_date":"2026-10-14","due_date":"2026-11-13"}); cotlet call invoice-ninja create_invoice --data '{"client_id":"Wp3xq8Rnd5","items":[{"product":"Design sprint","description":"Design sprint, 10 hours","unit_cost":90,"quantity":10},{"product":"Hosting setup","description":"Hosting setup","unit_cost":150,"quantity":1}],"invoice_date":"2026-10-14","due_date":"2026-11-13"}' Example response
{
"invoice_number": "INV-0043",
"client": "Northwind Studio",
"status": "draft",
"invoice_date": "2026-10-14",
"due_date": "2026-11-13",
"currency": "USD",
"items": [
{
"product": "Design sprint",
"description": "Design sprint, 10 hours",
"unit_cost": 90,
"quantity": 10,
"line_total": 900
},
{
"product": "Hosting setup",
"description": "Hosting setup",
"unit_cost": 150,
"quantity": 1,
"line_total": 150
}
],
"amount": 1050,
"balance": 1050
}