List Supplier Invoices (v1)
Method & Path
GET /api/v1/workspace/:workspaceId/suppliers/:supplierId/invoices
Actual backend path: GET /v1/workspace/:workspaceId/suppliers/:supplierId/invoices
Description
List all invoices for a supplier (الفاتورة باليوم والتاريخ). Each invoice includes totalAmount, paidAmount, remainingAmount, and status.
Authentication
Required: Workspace JWT.
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <workspace_token> |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string | Yes | Workspace identifier |
supplierId | string | Yes | Supplier identifier |
Response 200 OK
{
"invoices": [
{
"id": "507f1f77bcf86cd799439021",
"workspaceId": "507f1f77bcf86cd799439012",
"supplierId": "507f1f77bcf86cd799439011",
"invoiceNumber": "INV-001",
"totalAmount": 5000,
"paidAmount": 2000,
"remainingAmount": 3000,
"status": "partially-paid",
"issueDate": "2024-01-15T00:00:00.000Z",
"dueDate": "2024-02-15T00:00:00.000Z",
"description": "وصف اختياري",
"notes": "ملاحظات",
"createdAt": "2024-01-15T10:00:00.000Z",
"updatedAt": "2024-01-15T10:00:00.000Z"
}
]
}
status can be: pending, partially-paid, paid, cancelled.
Common Errors
- 401 Unauthorized: Missing or invalid token
- 403 Forbidden: Workspace access denied
- 404 Not Found: Workspace or supplier not found
- 500 Internal Server Error: Server error