IDBI Bank Statement Parser: Extract Structured Data with AI
Parse any IDBI Bank statement into structured JSON with AI. Handles savings, current, and NRI accounts across all PDF layouts and net banking exports.
IDBI Bank is one of India's largest government-owned banks with over 40 million customers and a legacy that spans decades of infrastructure lending and retail banking. If you are building a credit underwriting, personal finance, or KYC platform, IDBI Bank statements will regularly appear in your document pipeline.
The challenge: IDBI Bank generates PDF statements in multiple formats — net banking exports, printed account statements from branches, NRI account summaries, and corporate current account reports — each with its own column layout, header style, and metadata positioning. A generic OCR approach falls apart the moment IDBI refreshes a template or a user uploads a scanned branch printout.
This guide shows you how to reliably extract structured JSON from any IDBI Bank statement using Lekha — a financial document intelligence API purpose-built for Indian bank formats.
What Makes IDBI Bank Statements Difficult to Parse
Understanding the failure modes of naive parsers helps you appreciate why a specialized API matters:
Multiple account categories. IDBI Bank serves savings, current, NRI (NRE/NRO), Pradhan Mantri Jan Dhan Yojana (PMJDY), and corporate accounts. Each has a distinct PDF structure. Savings account statements use a clean five-column table; corporate statements add reference numbers, instrument IDs, and branch codes. Scanned branch printouts. Many IDBI customers receive physical statements from branches and scan them. These introduce noise: slight rotations, variable contrast, broken table borders. Regex-based parsers produce garbage on scanned inputs; vision-based extraction handles them cleanly. Inconsistent balance columns. Some IDBI statement variants show a running balance column; others only show debit and credit totals per row without the running balance. A parser that assumes running balance presence will miscompute net position. Non-standard date formats. IDBI statements intermix formats —04-OCT-2025, 04/10/2025, and 04 Oct 2025 can appear in the same export depending on the template version. Lekha normalizes all dates to ISO 8601 (YYYY-MM-DD), so your code never needs to handle date parsing.
Multi-page continuations. Long date ranges split across multiple pages without repeating column headers. Page-naïve parsers lose column alignment after the first page break.
Extracting IDBI Bank Statements with Lekha
Lekha's API accepts a PDF or image and returns a structured JSON object with normalized fields. You need one endpoint and one API key.
Installation
npm install @lekha/client
or
bun add @lekha/client
Basic Extraction
import { LekhaClient } from "@lekha/client";
import { readFileSync } from "fs";
const lekha = new LekhaClient({ apiKey: process.env.LEKHA_API_KEY });
async function extractIdbiStatement(filePath: string) {
const file = readFileSync(filePath);
const result = await lekha.extract({
document: file,
filename: "idbi-statement.pdf",
documentType: "bank_statement",
});
if (!result.success) {
throw new Error(result.error.message);
}
return result.data;
}
const statement = await extractIdbiStatement("./idbi-2025-q3.pdf");
console.log(statement.bankName); // "IDBI Bank"
console.log(statement.accountNumber); // "0651104000XXXXXX"
console.log(statement.transactions.length); // 84
The API auto-detects IDBI Bank formatting — you do not need to specify the bank name or layout variant.
Parsed Output Structure
Lekha returns a typed object matching the BankStatement schema:
interface BankStatement {
bankName: string; // "IDBI Bank"
accountNumber: string; // masked last 4 digits
accountHolderName: string;
accountType: string; // "savings" | "current" | "nre" | "nro"
ifscCode: string;
branchName: string;
statementPeriod: {
from: string; // ISO 8601
to: string;
};
openingBalance: number; // always a number, never a string
closingBalance: number;
currency: string; // "INR"
transactions: Transaction[];
}
interface Transaction {
date: string; // "2025-10-04" — always ISO 8601
description: string;
amount: number; // always positive
type: "credit" | "debit";
balance: number | null; // null if not present in source
referenceNumber: string | null;
transactionMode: string | null; // "UPI", "NEFT", "ATM", "IMPS", etc.
}
Amounts are always numbers (never "Rs. 12,500"), dates are always ISO 8601, and debit/credit is captured as a type field — no ambiguity in downstream logic.
Handling Scanned IDBI Statements
Scanned statements from IDBI Bank branches are common, especially for customers submitting documents for loan applications or VISA processing. Lekha handles them without any extra configuration:
import sharp from "sharp";
async function extractScannedStatement(imagePath: string) {
// Lekha accepts JPEG, PNG, WebP — pre-processing optional
const imageBuffer = await sharp(imagePath)
.resize({ width: 2480 }) // upscale to A4 300dpi equivalent
.grayscale()
.sharpen()
.toBuffer();
const result = await lekha.extract({
document: imageBuffer,
filename: "idbi-scanned.jpg",
documentType: "bank_statement",
mimeType: "image/jpeg",
});
return result.success ? result.data : null;
}
The sharp pre-processing step is optional. Lekha's vision model handles moderate-quality scans directly. Upscaling and sharpening helps when the source image is below 150 DPI.
Building an IDBI Statement Processing Pipeline
Here is a complete pipeline for a loan underwriting use case: ingest multiple IDBI statements, extract them in parallel, and compute a 12-month cash flow summary.
import { LekhaClient, BankStatement } from "@lekha/client";
const lekha = new LekhaClient({ apiKey: process.env.LEKHA_API_KEY });
interface CashFlowSummary {
month: string;
totalCredits: number;
totalDebits: number;
netCashFlow: number;
closingBalance: number | null;
}
async function processIdbiBatch(
files: Array<{ buffer: Buffer; filename: string }>,
): Promise<{
statements: BankStatement[];
summary: CashFlowSummary[];
averageMonthlyInflow: number;
}> {
// Extract all statements in parallel
const results = await Promise.all(
files.map((f) =>
lekha.extract({
document: f.buffer,
filename: f.filename,
documentType: "bank_statement",
}),
),
);
const statements = results
.filter((r) => r.success)
.map((r) => r.data as BankStatement);
// Aggregate transactions by month
const monthlyMap = new Map();
for (const statement of statements) {
for (const tx of statement.transactions) {
const month = tx.date.slice(0, 7); // "YYYY-MM"
if (!monthlyMap.has(month)) {
monthlyMap.set(month, {
month,
totalCredits: 0,
totalDebits: 0,
netCashFlow: 0,
closingBalance: null,
});
}
const entry = monthlyMap.get(month)!;
if (tx.type === "credit") {
entry.totalCredits += tx.amount;
} else {
entry.totalDebits += tx.amount;
}
entry.netCashFlow = entry.totalCredits - entry.totalDebits;
}
}
const summary = Array.from(monthlyMap.values()).sort((a, b) =>
a.month.localeCompare(b.month),
);
const averageMonthlyInflow =
summary.reduce((sum, m) => sum + m.totalCredits, 0) / summary.length;
return { statements, summary, averageMonthlyInflow };
}
// Usage
const pipeline = await processIdbiBatch([
{ buffer: q1Buffer, filename: "idbi-q1-2025.pdf" },
{ buffer: q2Buffer, filename: "idbi-q2-2025.pdf" },
{ buffer: q3Buffer, filename: "idbi-q3-2025.pdf" },
]);
console.log(
Average monthly inflow: ₹${pipeline.averageMonthlyInflow.toLocaleString("en-IN")},
);
Transaction Mode Detection
IDBI Bank statements often include payment mode indicators in the narration field. Lekha's extraction normalizes these into the transactionMode field:
| Narration pattern | Normalized transactionMode |
| -------------------------- | ---------------------------- |
| UPI/... | UPI |
| NEFT/..., NEFT-INB-... | NEFT |
| IMPS/... | IMPS |
| ATW/..., ATM WDL | ATM |
| CLG/..., CLNC/... | CHEQUE |
| RTGS/... | RTGS |
| INB/..., IB/... | INTERNET_BANKING |
This normalization lets you run payment-mode analytics — for example, filtering salary credits by NEFT/IMPS or identifying ATM withdrawal patterns — without writing narration-parsing regex yourself.
NRI Account Statements
IDBI Bank has a strong NRI banking franchise. NRE and NRO account statements follow slightly different structures, often including foreign currency conversion lines and remittance reference numbers. Lekha handles them with the same API call:
const nriResult = await lekha.extract({
document: nreStatementBuffer,
filename: "idbi-nre-2025.pdf",
documentType: "bank_statement",
});
if (nriResult.success) {
const { accountType } = nriResult.data;
// accountType === "nre" or "nro"
// Repatriation-eligible credits are tagged in transactionMode as "SWIFT" or "REMITTANCE"
}
You can try extraction immediately in Lekha Playground — upload an IDBI NRE statement and inspect the JSON output before writing a line of code.
Error Handling
Lekha returns structured errors so you can handle edge cases gracefully:
const result = await lekha.extract({
document: fileBuffer,
filename: "statement.pdf",
documentType: "bank_statement",
});
if (!result.success) {
switch (result.error.code) {
case "DOCUMENT_UNREADABLE":
// Low-quality scan or corrupted PDF
await notifyUser("Please re-upload a clearer scan.");
break;
case "WRONG_DOCUMENT_TYPE":
// User uploaded ITR instead of bank statement
await notifyUser(
"This appears to be a tax document, not a bank statement.",
);
break;
case "UNSUPPORTED_BANK":
// Unlikely for IDBI but handle defensively
await escalateToManualReview(fileBuffer);
break;
default:
logger.error({ code: result.error.code, message: result.error.message });
}
}
Frequently Asked Questions
Does Lekha support all IDBI Bank account types? Yes. Lekha handles savings, current, NRE, NRO, corporate, and PMJDY accounts. TheaccountType field in the response indicates which was detected.
Can Lekha extract IDBI Bank statements downloaded from net banking vs branch-printed?
Both are supported. Net banking PDFs are machine-readable and extract with very high accuracy. Branch-printed and subsequently scanned statements use vision-based extraction, which handles moderate scan quality without pre-processing.
How does Lekha handle multi-page IDBI statements?
Lekha processes all pages of a single PDF as one document. Transactions are returned in chronological order across all pages, and column alignment is maintained even when headers don't repeat on continuation pages.
Is IDBI Bank statement data stored after extraction?
No. Lekha processes documents in memory only and does not persist financial document data to disk or any database. This design supports DPDP Act compliance for Indian financial data processors.
Next Steps
Lekha supports 30+ Indian bank formats including SBI, HDFC, ICICI, Axis, Kotak, IndusInd, Yes Bank, PNB, and more. If your pipeline handles multiple banks, one integration covers all of them.