Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/astrxnomo/financial-analytics-agent/llms.txt

Use this file to discover all available pages before exploring further.

The /api/finance/category-breakdown endpoint returns monthly aggregated totals split by category, giving you the composition of either income or expense over time. It answers questions like “what share of our spending is Payroll versus SaaS versus Advertising?” and “how has our Cloud Infrastructure spend trended month over month?” You can scope it to a single department to see that department’s category mix in isolation, or filter to a single category to get its complete month-by-month series without the noise of the other categories.

Request

from
string
required
Start of the date range in YYYY-MM-DD format. Inclusive.
to
string
required
End of the date range in YYYY-MM-DD format. Inclusive.
metric
string
default:"expense"
Which transaction type to aggregate. Either income or expense. Defaults to expense if omitted.
department
string
Optional. Filter results to a single department by its exact name (e.g. Engineering). When omitted, all departments are aggregated together.
category
string
Optional. Filter to a single category by its exact name (e.g. Cloud Infrastructure). Useful when you want the month-over-month series for one category in isolation.

Response

The response is an array of CategorySlice objects. Each object represents the total value for one category in one calendar month. The array is not sorted in any particular order by default — the chart components sort by total descending to determine ranking.
period
string
The first day of the calendar month, in YYYY-MM-DD format.
category
string
The category name (e.g. Payroll, SaaS, Advertising, Product Revenue).
value
number
The summed income or expense for this category in this period.
The category-breakdown chart component displays only the top 8 categories by total value across the selected period; all remaining categories are folded into a single “Other” band. This grouping is performed client-side in category-breakdown-chart.tsx using the CATEGORY_BREAKDOWN_TOP_N = 8 constant from finance.types.ts. The API itself always returns all categories — you can use the full response to build your own ranking or grouping logic.

Example

Request

curl "http://localhost:3000/api/finance/category-breakdown?from=2025-01-01&to=2025-12-31&metric=expense"

Response (excerpt)

[
  { "period": "2025-01-01", "category": "Payroll", "value": 62000.00 },
  { "period": "2025-01-01", "category": "SaaS", "value": 8400.00 },
  { "period": "2025-01-01", "category": "Advertising", "value": 12500.00 },
  { "period": "2025-02-01", "category": "Payroll", "value": 63200.00 },
  { "period": "2025-02-01", "category": "SaaS", "value": 8100.00 }
]

Filter to one department

curl "http://localhost:3000/api/finance/category-breakdown?from=2025-01-01&to=2025-12-31&metric=expense&department=Engineering"

Single-category time series

curl "http://localhost:3000/api/finance/category-breakdown?from=2024-01-01&to=2025-12-31&metric=expense&category=Cloud+Infrastructure"

Build docs developers (and LLMs) love