Appearance
User - Expenses
Base URL:
https://your-domain.com
Admin endpoints for managing expenses. All endpoints require admin/staff authentication.
Fetch All Expenses
Retrieve all expense records with optional filters.
| Property | Value |
|---|---|
| Endpoint | Fetch All Expenses |
| Method | GET |
| URL | /api/v1/expenses |
| Authentication | Bearer Token |
Request Headers:
| Header | Value | Required |
|---|---|---|
Accept | application/json | Yes |
Authorization | Bearer your-auth-token | Yes |
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
from_date | date | No | Start date filter |
to_date | date | No | End date filter |
category_id | integer | No | Filter by category |
Success Response (200 OK):
json
{
"success": true,
"data": [
{
"id": 1,
"category_id": 1,
"category_name": "Office Supplies",
"amount": 5000,
"description": "Printer paper and ink",
"created_by": "Admin",
"created_at": "2024-01-15 10:30:00"
}
],
"total": 25000
}Fetch Expense Categories
Retrieve all expense categories.
| Property | Value |
|---|---|
| Endpoint | Fetch Expense Categories |
| Method | GET |
| URL | /api/v1/expenses/categories |
| Authentication | Bearer Token |
Success Response (200 OK):
json
{
"success": true,
"data": [
{"id": 1, "name": "Office Supplies"},
{"id": 2, "name": "Utilities"},
{"id": 3, "name": "Equipment"}
]
}Fetch Expense
Retrieve details of a specific expense.
| Property | Value |
|---|---|
| Endpoint | Fetch Expense |
| Method | GET |
| URL | /api/v1/expenses/{id} |
| Authentication | Bearer Token |
Success Response (200 OK):
json
{
"success": true,
"data": {
"id": 1,
"category_id": 1,
"category_name": "Office Supplies",
"amount": 5000,
"description": "Printer paper and ink",
"receipt_url": null,
"created_by": "Admin",
"created_at": "2024-01-15 10:30:00"
}
}Create Expense
Record a new expense.
| Property | Value |
|---|---|
| Endpoint | Create Expense |
| Method | POST |
| URL | /api/v1/expenses |
| Authentication | Bearer Token |
Request Body:
json
{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"category_id": 1,
"amount": 5000,
"description": "Office supplies"
}| Parameter | Type | Required | Description |
|---|---|---|---|
category_id | integer | Yes | Expense category ID |
amount | decimal | Yes | Expense amount |
description | string | No | Expense description |
Success Response (201 Created):
json
{
"success": true,
"message": "Expense recorded successfully",
"data": {
"id": 1
}
}Update Expense
Update an existing expense record.
| Property | Value |
|---|---|
| Endpoint | Update Expense |
| Method | PUT |
| URL | /api/v1/expenses/{id} |
| Authentication | Bearer Token |
Request Body:
json
{
"amount": 6000,
"description": "Updated description"
}Success Response (200 OK):
json
{
"success": true,
"message": "Expense updated successfully"
}Delete Expense
Delete an expense record.
| Property | Value |
|---|---|
| Endpoint | Delete Expense |
| Method | DELETE |
| URL | /api/v1/expenses/{id} |
| Authentication | Bearer Token |
Success Response (200 OK):
json
{
"success": true,
"message": "Expense deleted successfully"
}