What analytics gives you
GET /books/:id/analytics returns the fully computed BookAnalytics object. This is the same data that powers the Pathway synopsis dashboard: key metrics, debt positions, per-statement breakdowns, transaction-level data with tags, counterparty clusters, and screening results.
Everything here is computed after applying your org’s exclusion config (excluded docs, accounts, positions, and revenue tags).
BookAnalytics — full class
BookAnalytics — full class
Key metrics
The most commonly needed fields are at the top level:total_deposits - true_revenue gives you the excluded amount.
DTI is (total_loan_payments / true_revenue) x 100. It’s null if true_revenue is 0.
Per-statement breakdown
analytics.statements[] gives you per-month, per-account metrics. Each statement covers one PDF document. Multi-account statements include one entry per account plus a account_id=0 combined aggregate.
is_reconciled tells you whether the parser’s transaction sum matches the bank-reported ending balance. When false, check discrepancy for the dollar difference.
average_statement_metrics is a pre-computed average row across all statements with the same shape as an account object:
Debt positions
analytics.positions[] lists each detected loan or MCA as a named position. These are groups of transactions the parser identified as belonging to the same lender.
merchant_cash_advance, bank_loan, factoring, credit, lease, auto, mortgage, buy_now_pay_later, debt_collection
loan_summary[] rolls up positions by loan type for a quick debt composition view:
Transaction-level data
analytics.merged_accounts is an object keyed by account ID. Each account has a flat list of all transactions across the full statement period, with tags and position info attached.
Counterparty clusters
analytics.counterparty_clusters[] groups transactions by counterparty (normalized description). Top credits are revenue sources. Top debits are expense categories.
Tag-based metrics
Every transaction is tagged. Aggregates are pre-computed onBookAnalytics:
Weekday cash flow patterns
Revenue exclusion config
analytics.revenue_exclusion_tags shows which tags were excluded from true_revenue when this analytics was computed. Either book-level (custom) or falls back to org-level default.