Books by finzkoDevelopers

Bank Statements

Upload a CSV or Excel bank statement, read back the parsed statements and their lines, and run reconciliation matching against entries already posted to the ledger. This is the same import and matching the app does after a statement upload.

Resource shape

{
  "id":              "st_…",
  "bank_account_id": "acc_icici",
  "file_name":       "icici-may-2026.csv",
  "statement_date":  "2026-05-31T00:00:00",
  "opening_balance": 120000.0,
  "closing_balance": 95500.5,
  "total_debits":    40000.0,
  "total_credits":   15500.5,
  "row_count":       42,
  "status":          "…"
}

statusis the statement's processing state as stored by the app. Treat it as an opaque string. A single-statement read (GET /bank_statements/{statement_id}) adds a transactions array:

{
  "id":          "bt_…",
  "date":        "2026-05-03T00:00:00",
  "description": "NEFT-ACME CORP",
  "reference":   "UTR12345",
  "debit":       0.0,
  "credit":      11800.0,
  "balance":     131800.0,
  "status":      "…"            // match state of the line
}
POST/bank_statements/uploadUpload a statement (CSV / XLSX)AIBooks.bank_statements.CREATE

Idempotency-Key is required (400 idempotency.key_required without it). Send multipart/form-data:

FieldTypeNotes
filefileRequired. CSV or Excel statement.
bank_account_idstringRequired. Account id of the bank ledger (from /bank_accounts).
opening_balancefloat?Optional. Passed to the parser for files that have no opening balance row.
curl -X POST "$BASE/bank_statements/upload" \
  -H "Authorization: Bearer $PAT" \
  -H "Idempotency-Key: $(uuidgen)" \
  -F "file=@icici-may-2026.csv" \
  -F "bank_account_id=acc_icici"

200 OK
{
  "code": 0,
  "message": "Bank statement uploaded.",
  "bank_statement": {
    "id": "st_…",
    "bank_account_id": "acc_icici",
    "file_name": "icici-may-2026.csv",
    "row_count": 42,
    "skipped_duplicates": 0,
    …
  }
}

skipped_duplicates counts rows that were already imported earlier and were left out. After the import the server matches the new lines against posted entries and queues the Bank Clerk pass, as the in-app upload does.

Notable errors

  • 400 validation.invalid_value— empty file; the file could not be parsed; or no transactions were found (“check the file/columns”).
GET/bank_statementsList statementsAIBooks.bank_statements.READ
ParamNotes
per_page1 – 200, default 50. Returns the newest N statements.
bank_account_idKeep only statements for this bank account.

Not cursor-paginated: page_context.has_more_page is always false and there is no next_cursor. The bank_account_id filter is applied after the per_page cap, so a filtered call can return fewer rows than exist. See Pagination.

GET/bank_statements/{statement_id}Get a statement with its linesAIBooks.bank_statements.READ
200 OK
{
  "code": 0,
  "message": "success",
  "bank_statement": { "id": "st_…", …, "transactions": [ { "id": "bt_…", "date": "…", "credit": 11800.0, … } ] }
}

Lines are sorted by date, oldest first, and are not paginated. Unknown id: 404 not_found.resource.

POST/bank_statements/account/{account_id}/matchReconcile: match a bank account's lines to posted entriesAIBooks.bank_statements.CREATE

No body. Scans every line still in PENDING state across all statements of that bank account and matches it against the account's posted ledger entries (7-day window). Matching is suggest-only: a person confirms in the app. Returns counts under match:

200 OK
{
  "code": 0,
  "message": "Matching complete.",
  "match": { "matched": 12, "suggested": 7, "unmatched": 3, "scanned": 22 }
}

This endpoint does not require an Idempotency-Key. Running it again only looks at lines that are still PENDING.