Add an Invoice
POST/api/invoices
Headers
| Field | Type | Description |
|---|---|---|
| authtoken | String | Authentication token, generated from admin area |
Parameters
| Field | Type | Description |
|---|---|---|
| invoice_bill_date | string | Optional invoice bill date |
| invoice_due_date | string | Mandatory invoice due date |
| invoice_client_id | string | Mandatory invoice client id |
| invoice_project_id | string | Optional invoice project id |
| tax_id | string | Optional invoice tax id |
| tax_id2 | string | Optional invoice tax id2 |
| tax_id3 | string | Optional invoice tax id3 |
| recurring | string | Optional invoice recurring |
| invoice_note | string | Optional invoice note |
| labels | string | Optional invoice labels |
| items | Object[] | optional Optional invoice lines, in the same shape GET /api/invoices/:id/items returns. Omit the key to keep the previous behaviour of creating a header with no lines. An empty array is rejected with a 400. |
| items.title | String | Mandatory line title. A description is accepted instead. |
| items.description | String | optional Optional line description |
| items.quantity | Number | Mandatory quantity, numeric |
| items.rate | Number | Mandatory unit rate, numeric |
| items.unit_type | String | optional Optional unit type, maximum 20 characters |
| items.sort | Number | optional Optional display order. Defaults to the array position. |
| items.item_id | Number | optional Optional items library ID |
| items.taxable | Number | optional Optional, 1 (default) or 0 |
curl -X POST "https://yoursite.com/api/invoices" \
-H "authtoken: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "invoice_bill_date": "...", "invoice_due_date": "...", "invoice_client_id": "...", "invoice_project_id": "...", "tax_id": "...", "tax_id2": "...", "tax_id3": "...", "recurring": "...", "invoice_note": "...", "labels": "...", "items.title": "...", "items.quantity": "...", "items.rate": "..." }' Success-Response:
HTTP/1.1 200 OK
{
"status": true,
"message": "Invoice add successful."
}
HTTP/1.1 404 Not Found
{
"status": false,
"message": "Invoice add fail."
}