Get All Invoices
The GET endpoint retrieves a list of all invoices with optional filtering and pagination.
Endpoint
- URL:
/invoices - Method:
GET
Authentication
- Header:
accessToken - Type: Bearer Token
- Value:
<ACCESS-TOKEN>
Request Headers
| Header | Type | Description |
|---|---|---|
accessToken | string | Access token for authentication. (required) |
Query Parameters
| Parameter | Type | Description |
|---|---|---|
page | number | Page number for pagination (default: 1). |
limit | number | Number of invoices per page (default: 10). |
orderId | string | Filter invoices by order ID. |
entityId | string | Filter invoice by entity ID. |
Request Body
- None
Response
- Status Code: 200 OK
Success Response Fields
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates whether the request was successful. |
data | array | Array of invoice objects. |
total | number | Total number of invoices. |
page | number | Current page number. |
limit | number | Number of invoices per page. |
Invoice Object Fields
| Field | Type | Description |
|---|---|---|
_id | string | Unique identifier of the invoice. |
order | string | Reference to the associated order ID. |
entityId | string | Unique entity identifier for the invoice. |
lineItems | array | Array of line items included in the invoice. |
total | number | Total amount of the invoice. |
mailsSent | array | Array of mail objects tracking sent notifications. |
createdBy | object | Information about who created the invoice. |
metaFields | array | Array of custom metadata fields. |
createdAt | string | Timestamp when the invoice was created. |
updatedAt | string | Timestamp when the invoice was last updated. |
Line Item Object
| Field | Type | Description |
|---|---|---|
lineItemId | string | Reference to the order line item ID. |
quantity | number | Quantity of the item in the invoice. |
Mails Sent Object
| Field | Type | Description |
|---|---|---|
sentTo | string | Email address where the invoice was sent. |
sentAt | string | Timestamp when the email was sent. |
Created By Object
| Field | Type | Description |
|---|---|---|
id | string | ID of the creator. |
name | string | Name of the creator. |
type | string | Type of creator ("api" or "admin"). |
Sample Response Body
{
"success": true,
"data": [
{
"order": "6932f96b8cd64c28a4fb5873",
"entityId": "1",
"lineItems": [
{
"lineItemId": "6932f96b8cd64c28a4fb5876",
"quantity": 30,
"id": "693738682fa9114d9af87d2a"
},
{
"lineItemId": "6932f96b8cd64c28a4fb5877",
"quantity": 20,
"id": "693738682fa9114d9af87d2b"
}
],
"total": 3684.78,
"createdBy": {
"id": "6852dc137d290c8e310f258e",
"name": "Sam Nabahani",
"type": "admin"
},
"metaFields": [],
"createdAt": "2025-12-08T20:43:20.608Z",
"updatedAt": "2025-12-08T20:43:20.608Z",
"id": "693738682fa9114d9af87d29"
}
],
"total": 1,
"page": 1,
"limit": 10
}
Example Request
curl --location --request GET '<BASE-URL>/invoices?page=1&limit=10' \
--header 'accessToken: <ACCESS-TOKEN>'
Error Responses
401 Unauthorized
{
"success": false,
"message": "Invalid or missing access token"
}
500 Internal Server Error
{
"success": false,
"message": "An error occurred while fetching invoices"
}