Income Endpoints¶
This page provides detailed documentation for the income management endpoints in CurioPay API.
Get All Income Records¶
Retrieves a list of income records with pagination and filters.
URL: /api/v1/income
Method: GET
Auth required: Yes (via Authorization header)
Request Headers¶
Query Parameters¶
| Parameter | Type | Description | Required |
|---|---|---|---|
| startDate | string | Start date (YYYY-MM-DD) | No |
| endDate | string | End date (YYYY-MM-DD) | No |
| categoryId | string | Filter by category ID | No |
| paymentMethodId | string | Filter by payment method ID | No |
| searchTerm | string | Search term for description | No |
| minAmount | number | Minimum amount in cents | No |
| maxAmount | number | Maximum amount in cents | No |
| page | number | Page number | No |
| limit | number | Items per page | No |
Success Response¶
Code: 200 OK
{
"items": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"amount": 500000,
"description": "Monthly Salary",
"date": "2024-05-01T00:00:00.000Z",
"categoryId": "456e4567-e89b-12d3-a456-426614174000",
"userId": "789e4567-e89b-12d3-a456-426614174000",
"createdAt": "2024-05-01T12:00:00.000Z",
"updatedAt": "2024-05-01T12:00:00.000Z"
}
],
"meta": {
"total": 1,
"page": 1,
"limit": 20,
"totalPages": 1
}
}
Error Responses¶
Code: 401 UNAUTHORIZED - Invalid or missing token
Create an Income Record¶
Creates a new income record.
URL: /api/v1/income
Method: POST
Auth required: Yes (via Authorization header)
Request Headers¶
Request Body¶
{
"date": "2024-05-01",
"description": "Monthly Salary",
"amount": 500000,
"categoryId": "456e4567-e89b-12d3-a456-426614174000",
"paymentMethodId": "789e4567-e89b-12d3-a456-426614174000",
"notes": "Includes end of month bonus"
}
| Field | Type | Description | Required |
|---|---|---|---|
| date | string | Date when the income was received | Yes |
| description | string | Description of the income | Yes |
| amount | number | Income amount in cents | Yes |
| categoryId | string | Category ID for the income | Yes |
| paymentMethodId | string | Payment method ID | Yes |
| notes | string | Additional notes about the income | No |
Success Response¶
Code: 201 CREATED
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"amount": 500000,
"description": "Monthly Salary",
"date": "2024-05-01T00:00:00.000Z",
"categoryId": "456e4567-e89b-12d3-a456-426614174000",
"userId": "789e4567-e89b-12d3-a456-426614174000",
"createdAt": "2024-05-01T12:00:00.000Z",
"updatedAt": "2024-05-01T12:00:00.000Z"
}
Error Responses¶
Code: 400 BAD REQUEST - Invalid input
Code: 401 UNAUTHORIZED - Invalid or missing token
Update an Income Record¶
Updates an existing income record.
URL: /api/v1/income
Method: PUT
Auth required: Yes (via Authorization header)
Request Headers¶
Request Body¶
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"date": "2024-05-01",
"description": "Updated Monthly Salary",
"amount": 525000,
"categoryId": "456e4567-e89b-12d3-a456-426614174000",
"paymentMethodId": "789e4567-e89b-12d3-a456-426614174000",
"notes": "Updated notes with additional bonus"
}
| Field | Type | Description | Required |
|---|---|---|---|
| id | string | Income record ID | Yes |
| date | string | Date when the income was received | No |
| description | string | Description of the income | No |
| amount | number | Income amount in cents | No |
| categoryId | string | Category ID for the income | No |
| paymentMethodId | string | Payment method ID | No |
| notes | string | Additional notes about the income | No |
Success Response¶
Code: 200 OK
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"amount": 525000,
"description": "Updated Monthly Salary",
"date": "2024-05-01T00:00:00.000Z",
"categoryId": "456e4567-e89b-12d3-a456-426614174000",
"userId": "789e4567-e89b-12d3-a456-426614174000",
"updatedAt": "2024-05-01T14:00:00.000Z"
}
Error Responses¶
Code: 401 UNAUTHORIZED - Invalid or missing token
Code: 404 NOT FOUND - Income record not found
Void an Income Record¶
Voids (soft deletes) an income record.
URL: /api/v1/income
Method: DELETE
Auth required: Yes (via Authorization header)
Request Headers¶
Query Parameters¶
| Parameter | Type | Description | Required |
|---|---|---|---|
| id | string | Income record ID to void | Yes |
Success Response¶
Code: 200 OK
Error Responses¶
Code: 401 UNAUTHORIZED - Invalid or missing token
Code: 404 NOT FOUND - Income record not found
Get Income Record by ID¶
Retrieves a specific income record by ID.
URL: /api/v1/income/{id}
Method: GET
Auth required: Yes (via Authorization header)
Request Headers¶
Path Parameters¶
| Parameter | Description | Required |
|---|---|---|
| id | Income record ID | Yes |
Success Response¶
Code: 200 OK
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"amount": 500000,
"description": "Monthly Salary",
"date": "2024-05-01T00:00:00.000Z",
"categoryId": "456e4567-e89b-12d3-a456-426614174000",
"userId": "789e4567-e89b-12d3-a456-426614174000",
"createdAt": "2024-05-01T12:00:00.000Z",
"updatedAt": "2024-05-01T12:00:00.000Z"
}
Error Responses¶
Code: 401 UNAUTHORIZED - Invalid or missing token
Code: 404 NOT FOUND - Income record not found
Get Income Totals by Category¶
Retrieves income totals grouped by category within a specified date range.
URL: /api/v1/income/stats/by-category
Method: GET
Auth required: Yes (via Authorization header)
Request Headers¶
Query Parameters¶
| Parameter | Type | Description | Required |
|---|---|---|---|
| startDate | string | Start date (YYYY-MM-DD) | Yes |
| endDate | string | End date (YYYY-MM-DD) | Yes |
| categoryId | string | Filter by category ID | No |
| paymentMethodId | string | Filter by payment method ID | No |
| searchTerm | string | Search term for description | No |
| minAmount | number | Minimum amount in cents | No |
| maxAmount | number | Maximum amount in cents | No |
Success Response¶
Code: 200 OK
[
{
"categoryId": "456e4567-e89b-12d3-a456-426614174000",
"categoryName": "Salary",
"total": 1000000,
"count": 2
},
{
"categoryId": "567e4567-e89b-12d3-a456-426614174000",
"categoryName": "Investments",
"total": 25000,
"count": 1
}
]
Error Responses¶
Code: 400 BAD REQUEST - Missing date range
Code: 401 UNAUTHORIZED - Invalid or missing token