Manage invoices, billing, payment tracking, and invoice-related operations in the billing system.
/api/invoices
The Invoices API provides comprehensive endpoints for managing invoices including creation, retrieval, status tracking, bulk operations, and export functionality. All invoice endpoints support OData filtering and pagination.
Creates a new invoice with billing details.
{
"customerId": "cust_123",
"orderId": "ord_456",
"invoiceNumber": "INV-2026-001",
"invoiceDate": "2026-06-02T10:30:00Z",
"dueDate": "2026-06-15T23:59:59Z",
"items": [
{
"description": "Cloud Server Premium",
"quantity": 1,
"unitPrice": 299.99,
"amount": 299.99
}
],
"subtotal": 299.99,
"tax": 29.99,
"total": 329.98,
"currency": "USD",
"status": "draft"
}
{
"id": "inv_789",
"invoiceNumber": "INV-2026-001",
"customerId": "cust_123",
"status": "draft",
"total": 329.98,
"createdAt": "2026-06-02T10:30:00Z"
}
Gets invoice details by ID with all line items.
| Parameter | Type |
|---|---|
| id | string |
{
"id": "inv_789",
"invoiceNumber": "INV-2026-001",
"customerId": "cust_123",
"orderId": "ord_456",
"invoiceDate": "2026-06-02T10:30:00Z",
"dueDate": "2026-06-15T23:59:59Z",
"items": [
{
"description": "Cloud Server Premium",
"quantity": 1,
"unitPrice": 299.99,
"amount": 299.99
}
],
"subtotal": 299.99,
"tax": 29.99,
"total": 329.98,
"currency": "USD",
"status": "issued",
"createdAt": "2026-06-02T10:30:00Z"
}
Gets invoices with OData filtering and pagination.
| Parameter | Type | Description |
|---|---|---|
| $filter | string | OData filter expression |
| $orderby | string | Sort by columns |
| $skip | integer | Skip n records |
| $top | integer | Take n records |
{
"value": [
{
"id": "inv_789",
"invoiceNumber": "INV-2026-001",
"customerId": "cust_123",
"status": "issued",
"total": 329.98,
"dueDate": "2026-06-15T23:59:59Z"
}
],
"count": 250
}
Updates invoice details (only draft invoices).
{
"invoiceNumber": "INV-2026-002",
"dueDate": "2026-06-20T23:59:59Z",
"items": [
{
"description": "Cloud Server Premium",
"quantity": 1,
"unitPrice": 349.99,
"amount": 349.99
}
],
"subtotal": 349.99,
"tax": 34.99,
"total": 384.98
}
{
"id": "inv_789",
"invoiceNumber": "INV-2026-002",
"status": "draft",
"total": 384.98,
"updatedAt": "2026-06-02T11:00:00Z"
}
Updates invoice status (draft → issued → paid).
{
"status": "issued",
"reason": "Ready for delivery"
}
{
"id": "inv_789",
"invoiceNumber": "INV-2026-001",
"status": "issued",
"updatedAt": "2026-06-02T11:05:00Z"
}
Bulk cancels multiple invoices.
{
"invoiceIds": ["inv_789", "inv_790", "inv_791"],
"reason": "Customer request"
}
{
"cancelled": 3,
"failed": 0,
"results": [
{
"invoiceId": "inv_789",
"status": "cancelled"
}
]
}
Exports invoice to PDF format.
PDF file download
Soft deletes invoice (only draft invoices).
{
"success": true,
"message": "Invoice deleted"
}
| Code | HTTP Status | Description |
|---|---|---|
| INVOICE_NOT_FOUND | 404 | Invoice does not exist |
| INVALID_STATUS_TRANSITION | 400 | Cannot transition to this status |
| INVOICE_LOCKED | 400 | Cannot modify issued or paid invoices |
| INVALID_AMOUNT | 400 | Invalid invoice amount |