Financial Reporting

Generate and retrieve financial reports with Open Ledger.

Open Ledger provides comprehensive financial reporting capabilities that allow businesses to generate essential financial statements and download them in PDF format. Our reporting system leverages the underlying ledger data structure to produce accurate and consistent financial insights.

Available Financial Reports

Balance Sheet

Snapshot of financial position at a specific date showing Assets = Liabilities + Equity.

Income Statement

Details revenues, costs, and expenses over a period to show net profit/loss.

Cash Flow Statement

Analyzes cash movements across operating, investing, and financing activities.

API Reference

Generating Financial Reports

To generate financial reports for an entity, use the following endpoint:

1GET /v1/reports/generate
2Authorization: Bearer {access_token}

Query Parameters

ParameterTypeDescription
entityIdstringRequired. The entity ID for report generation
monthintegerOptional. Month number (1-12)
yearintegerOptional. Year (e.g., 2024)
typestringOptional. Specific report type: INCOME, BALANCE, CASHFLOW
ledgerIdstringOptional. Ledger ID (if not provided, will use entityId)
statusstringOptional. Status filter for transactions

Response

1{
2 "reportPeriod": {
3 "month": 3,
4 "year": 2024,
5 "startDate": "2024-03-01T00:00:00Z",
6 "endDate": "2024-03-31T00:00:00Z"
7 },
8 "balanceSheet": {
9 "hierarchical": {
10 "assets": [
11 {
12 "id": "ASSET-CASH",
13 "name": "Cash and Cash Equivalents",
14 "type": "ASSET",
15 "financialType": "CASH",
16 "balance": 15000.0,
17 "children": [
18 {
19 "id": "Cash-ASSET",
20 "name": "Cash",
21 "type": "ASSET",
22 "financialType": "CASH",
23 "balance": 10500.0,
24 "parentId": "ASSET-CASH",
25 "level": 1
26 }
27 ],
28 "parentId": null,
29 "level": 0,
30 "isCategory": true
31 }
32 ],
33 "liabilities": [
34 {
35 "id": "LIABILITY-PAYABLE",
36 "name": "Accounts Payable",
37 "type": "LIABILITY",
38 "financialType": "ACCOUNTS_PAYABLE",
39 "balance": 8000.0,
40 "children": [],
41 "parentId": null,
42 "level": 0
43 }
44 ],
45 "equity": [
46 {
47 "id": "EQUITY-CAPITAL",
48 "name": "Owner's Capital",
49 "type": "EQUITY",
50 "financialType": "OWNERS_EQUITY",
51 "balance": 50000.0,
52 "children": [],
53 "parentId": null,
54 "level": 0
55 }
56 ],
57 "totals": {
58 "totalAssets": 150000.0,
59 "totalLiabilities": 75000.0,
60 "totalEquity": 75000.0,
61 "liabilitiesAndEquity": 150000.0
62 }
63 },
64 "totalCurrentAssets": 35000.0,
65 "totalNonCurrentAssets": 115000.0,
66 "totalAssets": 150000.0,
67 "totalCurrentLiabilities": 25000.0,
68 "totalNonCurrentLiabilities": 50000.0,
69 "totalLiabilities": 75000.0,
70 "totalEquity": 75000.0,
71 "liabilitiesAndEquity": 150000.0
72 },
73 "incomeStatement": {
74 "hierarchical": {
75 "revenue": [
76 {
77 "id": "REVENUE-SALES",
78 "name": "Sales Revenue",
79 "type": "REVENUE",
80 "financialType": "SALES_REVENUE",
81 "balance": 120000.0,
82 "children": [],
83 "parentId": null,
84 "level": 0
85 }
86 ],
87 "expenses": [
88 {
89 "id": "EXPENSE-OPERATING",
90 "name": "Operating Expenses",
91 "type": "EXPENSE",
92 "financialType": "OPERATING_EXPENSES",
93 "balance": 70000.0,
94 "children": [],
95 "parentId": null,
96 "level": 0
97 }
98 ],
99 "totals": {
100 "totalRevenue": 120000.0,
101 "totalExpenses": 70000.0,
102 "netIncome": 50000.0
103 }
104 },
105 "revenue": 120000.0,
106 "expenses": 70000.0,
107 "grossProfit": 120000.0,
108 "operatingIncome": 50000.0,
109 "incomeBeforeTax": 50000.0,
110 "netIncome": 50000.0
111 },
112 "cashFlowStatement": {
113 "hierarchical": {
114 "operatingActivities": {
115 "netIncome": 50000.0,
116 "adjustments": {
117 "depreciation": 5000.0,
118 "changeInAccountsReceivable": -2000.0,
119 "changeInInventory": 1000.0,
120 "changeInAccountsPayable": 3000.0,
121 "changeInAccruedLiabilities": 500.0
122 }
123 },
124 "investingActivities": {
125 "purchaseOfFixedAssets": -15000.0,
126 "purchaseOfInvestments": 0.0,
127 "saleOfInvestments": 0.0
128 },
129 "financingActivities": {
130 "proceedsFromDebt": 10000.0,
131 "repaymentOfDebt": -5000.0,
132 "issuanceOfStock": 0.0,
133 "dividendsPaid": 0.0
134 },
135 "totals": {
136 "totalOperatingActivities": 57500.0,
137 "totalInvestingActivities": -15000.0,
138 "totalFinancingActivities": 5000.0,
139 "netChangeInCash": 47500.0
140 }
141 },
142 "netCashFromOperatingActivities": 57500.0,
143 "netCashFromInvestingActivities": -15000.0,
144 "netCashFromFinancingActivities": 5000.0,
145 "netChangeInCash": 47500.0
146 },
147 "reconciliation": {
148 "plaidAccountsTotal": 10750.0,
149 "ledgerCashBalance": 10500.0,
150 "difference": -250.0,
151 "plaidAccounts": [
152 {
153 "accountName": "Checking Account",
154 "balance": 8500.0,
155 "accountMask": "1234"
156 },
157 {
158 "accountName": "Savings Account",
159 "balance": 2250.0,
160 "accountMask": "5678"
161 }
162 ]
163 },
164 "accountHierarchy": [
165 {
166 "id": "ASSET-CASH",
167 "name": "Cash and Cash Equivalents",
168 "type": "ASSET",
169 "balance": 15000.0,
170 "children": [],
171 "level": 0
172 }
173 ],
174 "pdf_urls": {
175 "profit_loss": "https://storage.openledger.com/reports/pl-123456.pdf",
176 "balance_sheet": "https://storage.openledger.com/reports/bs-789012.pdf",
177 "cash_flow": "https://storage.openledger.com/reports/cf-345678.pdf"
178 }
179}

Generating General Ledger Report

To generate a general ledger report, which includes a detailed view of all accounts and their transactions:

1GET /v1/reports/general-ledger
2Authorization: Bearer {access_token}

Query Parameters

ParameterTypeDescription
entityIdstringRequired. The entity ID for report generation
monthintegerOptional. Month number (1-12)
yearintegerOptional. Year (e.g., 2024)

Response

1{
2 "accounts": [
3 {
4 "name": "Cash",
5 "type": "ASSET",
6 "financialType": "CASH",
7 "accountCode": 1010,
8 "subTypeCode": 1010,
9 "balance": {
10 "debits_pending": "1000.00",
11 "debits_posted": "11000.00",
12 "credits_pending": "0.00",
13 "credits_posted": "500.00",
14 "timestamp": "2024-01-15T00:00:00Z"
15 }
16 }
17 ],
18 "entries": [
19 {
20 "id": "entry_123456",
21 "ledger_id": "ldgr_789012",
22 "debit_account_id": "acc_cash",
23 "credit_account_id": "acc_revenue",
24 "amount": 1000.0,
25 "description": "Service payment received",
26 "status": "POSTED",
27 "created_at": "2024-01-15T14:30:00Z"
28 }
29 ],
30 "pdf_url": "https://storage.openledger.com/reports/gl-123456.pdf",
31 "hierarchy": {
32 "assets": [
33 {
34 "id": "ASSET-CASH",
35 "name": "Cash",
36 "type": "ASSET",
37 "financialType": "CASH",
38 "balance": 11500.0,
39 "children": [
40 {
41 "id": "Cash-ASSET",
42 "name": "Cash",
43 "type": "ASSET",
44 "financialType": "CASH",
45 "balance": 11500.0,
46 "parentId": "ASSET-CASH",
47 "level": 1
48 }
49 ],
50 "parentId": null,
51 "level": 0,
52 "isCategory": true
53 }
54 ],
55 "liabilities": [],
56 "equity": [],
57 "revenue": [],
58 "expenses": []
59 }
60}

PDF Reports

All financial reports can be generated as beautifully formatted PDFs. These PDFs include:

  • Company header with logo and legal information
  • Professional formatting with account hierarchies
  • Clearly marked totals and subtotals
  • Proper accounting sign conventions (debits and credits)
  • Page numbers and timestamps

The PDF generation is handled automatically when you request financial reports, and download URLs are included in the response.

How to Use Financial Reports

1

Generate Reports via API

1// Example using fetch API
2const getFinancialReports = async (entityId, month, year, type) => {
3 const response = await fetch(
4 `https://api.openledger.com/v1/reports/generate?entityId=${entityId}&month=${month}&year=${year}&type=${type}`,
5 {
6 method: 'GET',
7 headers: {
8 'Authorization': `Bearer ${token}`,
9 'Content-Type': 'application/json'
10 }
11 }
12 );
13
14 const data = await response.json();
15
16 // Access the financial data and PDF links
17 console.log(data.incomeStatement.hierarchical.totals.netIncome);
18 console.log(data.pdf_urls.profit_loss); // URL to download PDF
19
20 // Access hierarchical data for detailed breakdown
21 console.log(data.balanceSheet.hierarchical.assets);
22 console.log(data.reconciliation); // Plaid account reconciliation
23};
24
25// Example usage - generate income statement for March 2024
26getFinancialReports('entity_123abc', 3, 2024, 'INCOME');
3

Customize Report Parameters

When generating reports, you can customize various aspects:

  • Specify entityId to select the entity for reporting

  • Include month and year for periodic reports

  • Use type parameter: INCOME, BALANCE, or CASHFLOW for specific report types

  • Add status filter to include only posted transactions or all transactions

  • Optionally specify ledgerId if different from entityId

4

Access the General Ledger

For detailed transaction-level reporting:

1const getGeneralLedger = async (entityId, month, year) => {
2 const response = await fetch(
3 `https://api.openledger.com/v1/reports/general-ledger?entityId=${entityId}&month=${month}&year=${year}`,
4 {
5 method: 'GET',
6 headers: {
7 'Authorization': `Bearer ${token}`,
8 'Content-Type': 'application/json'
9 }
10 }
11 );
12
13 const data = await response.json();
14
15 // Access account details, entries, and PDF link
16 console.log(data.accounts.length);
17 console.log(data.entries.length);
18 console.log(data.pdf_url); // URL to download PDF
19 console.log(data.hierarchy); // Hierarchical account structure
20};
5

Working with Hierarchical Data

The API returns hierarchical account structures for better organization:

1// Access hierarchical balance sheet data
2const processBalanceSheet = (balanceSheet) => {
3 // Assets with hierarchical structure
4 balanceSheet.hierarchical.assets.forEach(assetCategory => {
5 console.log(`${assetCategory.name}: $${assetCategory.balance}`);
6
7 // Process child accounts
8 assetCategory.children?.forEach(childAccount => {
9 console.log(` ${childAccount.name}: $${childAccount.balance}`);
10 });
11 });
12
13 // Access totals
14 const totals = balanceSheet.hierarchical.totals;
15 console.log(`Total Assets: $${totals.totalAssets}`);
16 console.log(`Total Liabilities: $${totals.totalLiabilities}`);
17 console.log(`Total Equity: $${totals.totalEquity}`);
18};
6

Download & Use PDFs

Access the PDF URLs returned in the response to download beautifully formatted reports for sharing or archiving.

Best Practices

  1. Use Type Parameters: Specify the type parameter (INCOME, BALANCE, CASHFLOW) for focused reporting
  2. Leverage Hierarchical Data: Use the hierarchical structures for detailed breakdowns in your UI
  3. Monitor Reconciliation: Check the reconciliation data to ensure Plaid account balances align with ledger balances
  4. Filter by Status: Use the status parameter to control whether to include pending transactions
  5. Generate reports at consistent intervals (monthly, quarterly, annually)
  6. Download and archive PDF reports for record-keeping
  7. Use report data to identify trends and inform business decisions
  8. Ensure all transactions are properly categorized before generating reports