List Categories

GET /api/v1/categories

Returns transactions grouped by category and type, with a count and inflow/outflow sum per group, over a date range. This provides the same data as the Categories page in the web UI, as flat rows (the UI additionally nests these into a type-grouped tree client-side).

Query Parameters

ParameterTypeRequiredDefaultDescription
date_fromstringYes-Start date (YYYY-MM-DD)
date_tostringYes-End date (YYYY-MM-DD)
accountsstringNoallComma-separated account IDs to filter
typestringNoallFilter by transaction type (income, expense, asset, liability, transfer, unknown)

Example Requests

curl -X GET "https://statements.finopsbricks.com/api/v1/categories?date_from=2024-01-01&date_to=2024-12-31" \
  -H "api-key: fob_stm_xxxxxxxxxxxx" \
  -H "api-secret: xxxxxxxxxxxxxxxx"
curl -X GET "https://statements.finopsbricks.com/api/v1/categories?date_from=2024-01-01&date_to=2024-12-31&type=expense&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"
    },
    "data": [
      {
        "category": "Food & Dining",
        "type": "expense",
        "count": 42,
        "inflow": 0,
        "outflow": 12500.50
      },
      {
        "category": null,
        "type": "income",
        "count": 3,
        "inflow": 250000.00,
        "outflow": 0
      }
    ],
    "totals": {
      "count": 45,
      "inflow": 250000.00,
      "outflow": 12500.50
    },
    "accounts": [
      {
        "id": "acc123",
        "name": "Main Business Account",
        "category": "bank"
      }
    ]
  }
}

Response Fields

period

FieldTypeDescription
date_fromstringStart date of the range
date_tostringEnd date of the range

data

Array of category aggregates. One row per distinct category + type pair found in the range.

FieldTypeDescription
categorystring | nullCategory name, or null for uncategorized transactions
typestringTransaction type of this group
countnumberNumber of transactions in this category+type
inflownumberSum of inflow for this group
outflownumberSum of outflow for this group

totals

Aggregate across all matching transactions in the range (all categories, all types).

FieldTypeDescription
countnumberTotal matching transactions
inflownumberTotal inflow
outflownumberTotal outflow

accounts

Array of non-archived accounts available for filtering.

FieldTypeDescription
idstringAccount ID
namestringAccount name
categorystringAccount category (bank or credit_card)

Errors

CodeDescription
400Missing required parameters (date_from or date_to)
400Invalid date format (must be YYYY-MM-DD)
400date_from is after date_to
400Invalid type
401Invalid or missing API credentials
403API key lacks reports:read permission