Expenses
The Expense object represents a financial expense record in the EstatePrime system. This object is returned in JSON format, containing all available values for an expense entry.
Object
The Expense object represents an individual expense record. Below are the fields included in an Expense object:
Example
json
{
"id": 18,
"category_id": 1,
"category_name": "Partner Commission",
"partner_id": 8,
"linked_income_id": 42,
"linked_income_commission_id": 5,
"auto_generated": true,
"amount": "1000.00",
"date": "2025-03-10",
"title": null,
"notes": null,
"status": "pending",
"created_by": 3,
"date_created": "2025-03-10 14:22:05",
"date_updated": null,
"contacts": [23]
}- id (int): The system id of the expense.
- category_id (int): The ID of the expense category.
- category_name (string): The name of the expense category.
- partner_id (int, nullable): The user ID of the partner associated with this expense, or
nullif not applicable. - linked_income_id (int, nullable): The ID of the linked income record, or
nullif this expense is standalone. - linked_income_commission_id (int, nullable): The ID of the specific commission entry within the linked income that generated this expense, or
nullif not applicable. - auto_generated (boolean): Indicates if this expense was automatically generated from an income commission split.
- amount (decimal): The expense amount.
- date (string): The expense date in
YYYY-MM-DDformat. - title (string, nullable): An optional title for the expense record.
- notes (string, nullable): Optional notes.
- status (string): The expense status. Possible values:
pending,confirmed. - created_by (int): The user ID of the user who created the record.
- date_created (string): The date and time the record was created in
YYYY-MM-DD HH:MM:SSformat. - date_updated (string, nullable): The date and time the record was last updated, or
nullif never updated. - contacts (array of integers): A list of contact IDs associated with the expense.
Get expenses
/api/expenses (GET)
Fetch a paginated list of expenses.
Request
- Method:
GET - Headers: Include authentication headers as described in the Authentication section.
- Body: JSON object with the following optional parameters:
page(int): The page number to fetch. Defaults to1.category_id(int): Filter by expense category ID.status(string): Filter by status. Possible values:pending,confirmed.partner_id(int): Filter by partner user ID.linked_income_id(int): Filter by linked income ID.auto_generated(boolean): Filter by whether the expense was auto-generated (trueorfalse).contact_id(int): Filter by associated contact ID.date(object): Filter by expense date range. Must include:min(string): The minimum date inYYYY-MM-DDformat, ornullfor no lower limit.max(string): The maximum date inYYYY-MM-DDformat, ornullfor no upper limit.
date_created(object): Filter by creation date range. Must include:min(string): The minimum date inYYYY-MM-DD HH:MM:SSformat, ornullfor no lower limit.max(string): The maximum date inYYYY-MM-DD HH:MM:SSformat, ornullfor no upper limit.
amount(object): Filter by amount range. Must include:min(decimal): The minimum amount, ornullfor no lower limit.max(decimal): The maximum amount, ornullfor no upper limit.
Example Body
json
{
"page": 1,
"category_id": 1,
"status": "pending",
"auto_generated": true,
"date": {
"min": "2025-01-01",
"max": null
}
}Response
- 200 OK: Returns a JSON array of expense objects.
Example Response
json
{
"status": 200,
"page": 1,
"total_pages": 2,
"results_per_page": 50,
"total_results": 74,
"data": [
{
"id": 18,
"category_id": 1,
"category_name": "Partner Commission",
"partner_id": 8,
"linked_income_id": 42,
"linked_income_commission_id": 5,
"auto_generated": true,
"amount": "1000.00",
"date": "2025-03-10",
"title": null,
"status": "pending",
"created_by": 3,
"date_created": "2025-03-10 14:22:05",
"date_updated": null,
"contacts": [23]
}
//Rest of the data...
]
}Get single expense
/api/expenses/{id} (GET)
Get a single expense record by its id.
Request
- Method:
GET - Headers: Include authentication headers.
- Path Params: The expense id to be fetched.
Example Response
json
{
"status": 200,
"data": {
"id": 18,
"category_id": 1,
"category_name": "Partner Commission",
"partner_id": 8,
"linked_income_id": 42,
"linked_income_commission_id": 5,
"auto_generated": true,
"amount": "1000.00",
"date": "2025-03-10",
"title": null,
"notes": null,
"status": "pending",
"created_by": 3,
"date_created": "2025-03-10 14:22:05",
"date_updated": null,
"contacts": [23]
}
}Response
- 200 OK: Returns the JSON object of the expense.
Get expense statuses
/api/expenses/statuses (GET)
Fetch the available expense statuses.
Request
- Method:
GET - Headers: Include authentication headers.
Response
- 200 OK: Returns a JSON array of available expense statuses.
Example Response
json
{
"status": 200,
"data": [
{
"id": "pending",
"name": "Pending"
},
{
"id": "confirmed",
"name": "Confirmed"
}
]
}Get expense categories
/api/expenses/categories (GET)
Fetch the available expense categories.
Request
- Method:
GET - Headers: Include authentication headers.
Response
- 200 OK: Returns a JSON array of available expense categories.
Example Response
json
{
"status": 200,
"data": [
{
"id": 1,
"name": "Partner Commission"
}
]
}
