Cashflow Report

GET /api/v1/reports/cashflow

Returns cashflow data grouped by transaction type (income, expense, asset, liability, transfer, unknown) and time period. This endpoint provides the same data as the Cashflow Report in the web UI, allowing you to analyze cash movements by transaction type over time.

Query Parameters

ParameterTypeRequiredDefaultDescription
date_fromstringYes-Start date (YYYY-MM-DD)
date_tostringYes-End date (YYYY-MM-DD)
group_bystringNomonthGrouping period (day/week/month/year)
accountsstringNoallComma-separated account IDs to filter
particularsstringNo-Filter by particulars (partial match)
entitystringNo-Filter by entity (partial match, use 'empty' for null)
categorystringNo-Filter by category (partial match, use 'empty' for null)

Example Request

curl -X GET "https://statements.finopsbricks.com/api/v1/reports/cashflow?date_from=2024-01-01&date_to=2024-12-31&group_by=month" \
  -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"
    },
    "data": [
      {
        "period": "2024-01",
        "income": {
          "inflow": 15000.00,
          "outflow": 0,
          "net": 15000.00,
          "transaction_count": 5
        },
        "expense": {
          "inflow": 0,
          "outflow": 8500.00,
          "net": -8500.00,
          "transaction_count": 12
        },
        "asset": {
          "inflow": 2000.00,
          "outflow": 500.00,
          "net": 1500.00,
          "transaction_count": 3
        },
        "liability": {
          "inflow": 1000.00,
          "outflow": 500.00,
          "net": 500.00,
          "transaction_count": 2
        },
        "transfer": {
          "inflow": 3000.00,
          "outflow": 3000.00,
          "net": 0,
          "transaction_count": 4
        }
      },
      {
        "period": "2024-02",
        "income": {
          "inflow": 18000.00,
          "outflow": 0,
          "net": 18000.00,
          "transaction_count": 6
        },
        "expense": {
          "inflow": 0,
          "outflow": 9200.00,
          "net": -9200.00,
          "transaction_count": 15
        }
      }
    ],
    "accounts": [
      {
        "id": "acc123",
        "name": "Main Business Account",
        "category": "bank"
      },
      {
        "id": "acc456",
        "name": "Business Credit Card",
        "category": "credit_card"
      }
    ]
  }
}

Response Fields

period

FieldTypeDescription
date_fromstringStart date of the report
date_tostringEnd date of the report
group_bystringGrouping period used (day/week/month/year)

data

Array of period objects, each containing:

FieldTypeDescription
periodstringPeriod identifier (format depends on group_by: YYYY-MM-DD for day, YYYY-Www for week, YYYY-MM for month, YYYY for year)
incomeobjectIncome transactions for this period (optional, only present if data exists)
expenseobjectExpense transactions for this period (optional, only present if data exists)
assetobjectAsset transactions for this period (optional, only present if data exists)
liabilityobjectLiability transactions for this period (optional, only present if data exists)
transferobjectTransfer transactions for this period (optional, only present if data exists)
unknownobjectUnknown type transactions for this period (optional, only present if data exists)

Transaction Type Object

Each transaction type (income, expense, etc.) contains:

FieldTypeDescription
inflownumberTotal inflows for this type in the period
outflownumberTotal outflows for this type in the period
netnumberNet amount (inflow - outflow)
transaction_countnumberTotal number of transactions (inflow + outflow)

accounts

Array of account objects available for filtering:

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

Grouping Period Formats

The period field format varies based on the group_by parameter:

  • day: YYYY-MM-DD (e.g., "2024-01-15")
  • week: YYYY-Www (e.g., "2024-W03")
  • month: YYYY-MM (e.g., "2024-01")
  • year: YYYY (e.g., "2024")

Use Cases

  • Cashflow Analysis: Track how different transaction types contribute to overall cashflow
  • Income vs Expense: Compare income and expense patterns over time
  • Budget Tracking: Monitor spending patterns across different periods
  • Financial Planning: Identify seasonal patterns in income and expenses
  • Asset/Liability Management: Track changes in assets and liabilities over time

Filtering

Use the optional filters to narrow down the analysis:

  • accounts: Focus on specific bank accounts or credit cards
  • particulars: Find transactions with specific descriptions
  • entity: Filter by vendor, customer, or entity name
  • category: Analyze specific expense or income categories

Errors

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