Invoice
Core invoice CRUD and lifecycle actions (send, mark paid/sent, PDF, duplicate)
Display a listing of invoices
GET /api/v1/invoices
Nécessite une authentification (jeton Bearer) et l’en-tête X-Organization-Id.
Paramètres
| Nom |
Emplacement |
Type |
Requis |
Description |
status |
query |
string |
non |
|
date_from |
query |
string |
non |
|
date_to |
query |
string |
non |
|
per_page |
query |
string |
non |
|
Réponses
| Statut |
Description |
| 200 |
For non-paginated data, return as before |
Exemple de requête
curl -X GET "https://kworia.com/api/v1/invoices" \
-H "Authorization: Bearer {{access_token}}" \
-H "X-Organization-Id: {{organization_id}}" \
-H "Accept: application/json"
Store a newly created invoice
POST /api/v1/invoices
Nécessite une authentification (jeton Bearer) et l’en-tête X-Organization-Id.
Per-line tax handling (Epic #617): each item may set tax_exempt: true (no tax on that line) or supply tax_rate_ids (explicit organization TaxRate ids). When a line provides neither, the organization's default tax rates are auto-applied. Item responses return the resolved unified tax-lines in tax_rates.
Corps de la requête
| Champ |
Type |
Requis |
Description |
customer_id |
integer |
oui |
|
issue_date |
string |
oui |
|
due_date |
string |
oui |
|
currency |
string |
oui |
|
notes |
string |
non |
|
terms |
string |
non |
|
items |
array |
oui |
|
Réponses
| Statut |
Description |
| 201 |
For non-paginated data, return as before |
| 422 |
|
| 403 |
|
Exemple de requête
curl -X POST "https://kworia.com/api/v1/invoices" \
-H "Authorization: Bearer {{access_token}}" \
-H "X-Organization-Id: {{organization_id}}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"customer_id": 1,
"issue_date": "string",
"due_date": "string",
"currency": "string",
"notes": "string",
"terms": "string",
"items": []
}'
Display the specified invoice
GET /api/v1/invoices/{id}
Nécessite une authentification (jeton Bearer) et l’en-tête X-Organization-Id.
Paramètres
| Nom |
Emplacement |
Type |
Requis |
Description |
id |
path |
integer |
oui |
|
Réponses
| Statut |
Description |
| 200 |
For non-paginated data, return as before |
Exemple de requête
curl -X GET "https://kworia.com/api/v1/invoices/{id}" \
-H "Authorization: Bearer {{access_token}}" \
-H "X-Organization-Id: {{organization_id}}" \
-H "Accept: application/json"
Update the specified invoice
PUT /api/v1/invoices/{id}
Nécessite une authentification (jeton Bearer) et l’en-tête X-Organization-Id.
Paramètres
| Nom |
Emplacement |
Type |
Requis |
Description |
id |
path |
integer |
oui |
|
Corps de la requête
| Champ |
Type |
Requis |
Description |
customer_id |
integer |
non |
|
issue_date |
string |
non |
|
due_date |
string |
non |
|
currency |
string |
non |
|
notes |
string |
non |
|
terms |
string |
non |
|
items |
array |
non |
|
Réponses
| Statut |
Description |
| 200 |
For non-paginated data, return as before |
| 422 |
|
| 403 |
|
Exemple de requête
curl -X PUT "https://kworia.com/api/v1/invoices/{id}" \
-H "Authorization: Bearer {{access_token}}" \
-H "X-Organization-Id: {{organization_id}}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"customer_id": 1,
"issue_date": "string",
"due_date": "string",
"currency": "string",
"notes": "string",
"terms": "string",
"items": []
}'
Remove the specified invoice
DELETE /api/v1/invoices/{id}
Nécessite une authentification (jeton Bearer) et l’en-tête X-Organization-Id.
Paramètres
| Nom |
Emplacement |
Type |
Requis |
Description |
id |
path |
integer |
oui |
|
Réponses
| Statut |
Description |
| 200 |
For non-paginated data, return as before |
| 422 |
#764 part 2: retention/lock refusal is a domain rule, not a server error. Surface 422 with the message instead of a 500 + stack trace. |
Exemple de requête
curl -X DELETE "https://kworia.com/api/v1/invoices/{id}" \
-H "Authorization: Bearer {{access_token}}" \
-H "X-Organization-Id: {{organization_id}}" \
-H "Accept: application/json"
Duplicate an invoice
POST /api/v1/invoices/{id}/duplicate
Nécessite une authentification (jeton Bearer) et l’en-tête X-Organization-Id.
Paramètres
| Nom |
Emplacement |
Type |
Requis |
Description |
id |
path |
integer |
oui |
|
Réponses
| Statut |
Description |
| 201 |
For non-paginated data, return as before |
Exemple de requête
curl -X POST "https://kworia.com/api/v1/invoices/{id}/duplicate" \
-H "Authorization: Bearer {{access_token}}" \
-H "X-Organization-Id: {{organization_id}}" \
-H "Accept: application/json"
Mark invoice as paid
POST /api/v1/invoices/{id}/mark-paid
Nécessite une authentification (jeton Bearer) et l’en-tête X-Organization-Id.
Paramètres
| Nom |
Emplacement |
Type |
Requis |
Description |
id |
path |
integer |
oui |
|
Corps de la requête
| Champ |
Type |
Requis |
Description |
payment_date |
string |
non |
|
amount |
number |
non |
|
amount_paid |
number |
non |
|
payment_method |
string |
non |
|
reference |
string |
non |
|
payment_reference |
string |
non |
|
notes |
string |
non |
|
Réponses
| Statut |
Description |
| 200 |
For non-paginated data, return as before |
| 422 |
|
Exemple de requête
curl -X POST "https://kworia.com/api/v1/invoices/{id}/mark-paid" \
-H "Authorization: Bearer {{access_token}}" \
-H "X-Organization-Id: {{organization_id}}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"payment_date": "string",
"amount": 1,
"amount_paid": 1,
"payment_method": "string",
"reference": "string",
"payment_reference": "string",
"notes": "string"
}'
Mark invoice as sent
POST /api/v1/invoices/{id}/mark-sent
Nécessite une authentification (jeton Bearer) et l’en-tête X-Organization-Id.
Paramètres
| Nom |
Emplacement |
Type |
Requis |
Description |
id |
path |
integer |
oui |
|
Corps de la requête
| Champ |
Type |
Requis |
Description |
sent_at |
string |
non |
|
sent_method |
string |
non |
|
Réponses
| Statut |
Description |
| 200 |
For non-paginated data, return as before |
| 422 |
|
Exemple de requête
curl -X POST "https://kworia.com/api/v1/invoices/{id}/mark-sent" \
-H "Authorization: Bearer {{access_token}}" \
-H "X-Organization-Id: {{organization_id}}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"sent_at": "string",
"sent_method": "string"
}'
Download invoice PDF
GET /api/v1/invoices/{id}/pdf
Nécessite une authentification (jeton Bearer) et l’en-tête X-Organization-Id.
Uses method injection for the PDF service (only this method needs it).
Paramètres
| Nom |
Emplacement |
Type |
Requis |
Description |
id |
path |
integer |
oui |
|
Réponses
Exemple de requête
curl -X GET "https://kworia.com/api/v1/invoices/{id}/pdf" \
-H "Authorization: Bearer {{access_token}}" \
-H "X-Organization-Id: {{organization_id}}" \
-H "Accept: application/json"
Send invoice via email
POST /api/v1/invoices/{id}/send
Nécessite une authentification (jeton Bearer) et l’en-tête X-Organization-Id.
Paramètres
| Nom |
Emplacement |
Type |
Requis |
Description |
id |
path |
integer |
oui |
|
Corps de la requête
| Champ |
Type |
Requis |
Description |
recipients |
string |
non |
|
message |
string |
non |
|
attach_pdf |
string |
non |
|
Réponses
| Statut |
Description |
| 200 |
For non-paginated data, return as before |
Exemple de requête
curl -X POST "https://kworia.com/api/v1/invoices/{id}/send" \
-H "Authorization: Bearer {{access_token}}" \
-H "X-Organization-Id: {{organization_id}}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"recipients": "string",
"message": "string",
"attach_pdf": "string"
}'