Expense Report
GET /api/v1/reports/expense
Returns expense transaction data grouped by category or entity over time periods. This endpoint provides the same data as the Expense Reports in the web UI (Expense by Category and Expense by Entity).
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| date_from | string | Yes | - | Start date (YYYY-MM-DD) |
| date_to | string | Yes | - | End date (YYYY-MM-DD) |
| group_by | string | No | month | Grouping period (day|week|month|year) |
| group_by_field | string | No | category | Group by field (category|entity) |
| accounts | string | No | all | Comma-separated account IDs to filter |
| particulars | string | No | - | Filter by particulars (partial match) |
| entity | string | No | - | Filter by entity (partial match, use 'empty' for null/empty) |
| category | string | No | - | Filter by category (partial match, use 'empty' for null/empty) |
Example Requests
Expenses by Category
curl -X GET "https://statements.finopsbricks.com/api/v1/reports/expense?date_from=2024-01-01&date_to=2024-12-31&group_by=month&group_by_field=category" \
-H "api-key: fob_stm_xxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxx"
Expenses by Entity
curl -X GET "https://statements.finopsbricks.com/api/v1/reports/expense?date_from=2024-01-01&date_to=2024-12-31&group_by=month&group_by_field=entity" \
-H "api-key: fob_stm_xxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxx"
With Filters
curl -X GET "https://statements.finopsbricks.com/api/v1/reports/expense?date_from=2024-01-01&date_to=2024-12-31&group_by_field=category&category=Food&accounts=acc123,acc456" \
-H "api-key: fob_stm_xxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxx"
Response
{
"data": {
"period": {
"date_from": "2024-01-01",
"date_to": "2024-12-31",
"group_by": "month",
"group_by_field": "category"
},
"data": [
{
"category": "Food & Dining",
"2024-01": {
"inflow": 0,
"outflow": 1250.50,
"net": -1250.50,
"transaction_count": 15
},
"2024-02": {
"inflow": 0,
"outflow": 1450.75,
"net": -1450.75,
"transaction_count": 18
}
},
{
"category": "Transportation",
"2024-01": {
"inflow": 0,
"outflow": 450.00,
"net": -450.00,
"transaction_count": 8
}
}
],
"accounts": [
{
"id": "acc123",
"name": "Main Business Account",
"category": "bank"
},
{
"id": "acc456",
"name": "Business Credit Card",
"category": "credit_card"
}
]
}
}
Response Fields
period
| Field | Type | Description |
|---|---|---|
| date_from | string | Start date of the report |
| date_to | string | End date of the report |
| group_by | string | Time period grouping (day/week/month/year) |
| group_by_field | string | Data grouping field (category/entity) |
data
Array of expense data grouped by the specified field (category or entity).
When group_by_field=category
Each object has:
| Field | Type | Description |
|---|---|---|
| category | string | Category name (or "empty" for uncategorized) |
{period} | object | Period data (e.g., "2024-01", "2024-W01", "2024-Q1") |
When group_by_field=entity
Each object has:
| Field | Type | Description |
|---|---|---|
| entity | string | Entity name (or "empty" for untagged) |
{period} | object | Period data (e.g., "2024-01", "2024-W01", "2024-Q1") |
Period Object
Each period object contains:
| Field | Type | Description |
|---|---|---|
| inflow | number | Total inflows for the period (typically 0 for expenses) |
| outflow | number | Total outflows for the period |
| net | number | Net amount (inflow - outflow, typically negative) |
| transaction_count | number | Total number of transactions |
accounts
Array of account objects available for filtering.
| Field | Type | Description |
|---|---|---|
| id | string | Account ID |
| name | string | Account name |
| category | string | Account category (bank or credit_card) |
Understanding Expense Data
Expense transactions are typically:
- Outflows from bank accounts or credit cards
- Negative net amounts (money going out)
- May occasionally have small inflows (refunds, corrections)
The net field (inflow - outflow) is typically negative for expense reports, representing money spent.
Filtering
Filter by Category
To view only specific categories:
?category=Food
To view uncategorized expenses:
?category=empty
Filter by Entity
To view expenses for a specific vendor/entity:
?entity=Acme Corp
To view expenses without an entity tag:
?entity=empty
Filter by Particulars
To search transaction descriptions:
?particulars=uber
This performs a partial, case-insensitive match.
Filter by Accounts
To limit to specific accounts:
?accounts=acc123,acc456
Grouping Periods
The group_by parameter determines how time periods are aggregated:
- day: Daily aggregation (e.g., "2024-01-15")
- week: Weekly aggregation (e.g., "2024-W03")
- month: Monthly aggregation (e.g., "2024-01")
- year: Yearly aggregation (e.g., "2024")
Errors
| Code | Description |
|---|---|
| 400 | Missing required parameters (date_from or date_to) |
| 400 | Invalid date format (must be YYYY-MM-DD) |
| 400 | date_from is after date_to |
| 400 | Invalid group_by (must be: day, week, month, year) |
| 400 | Invalid group_by_field (must be: category, entity) |
| 401 | Invalid or missing API credentials |
| 403 | API key lacks reports:read permission |