← Back to blog
·9 min read

Parse UCO Bank Statements with AI: A Developer Guide

Extract structured data from UCO Bank statements using AI. Build salary verification, loan eligibility, and cash flow agents for India's major PSU bank.

uco bankbank statement parsingpsu bankfinancial document aifintech apiai agentdocument extractionindia banking

UCO Bank is one of India's oldest public sector banks, with over 3,000 branches serving millions of customers — particularly government employees, agricultural borrowers, and businesses across Eastern and North Eastern India. If you're building a lending platform, HR tool, or financial health app, you will encounter UCO Bank statements frequently.

This guide shows you exactly how to extract structured data from UCO Bank statements using the Lekha API, and how to build agents on top of that data.

What Makes UCO Bank Statements Distinctive

UCO Bank statements come in several formats depending on how they are generated:

  • Net banking PDF — the most common format, generated from UCO mBanking Plus or the web portal. Features a blue-and-white header with the bank logo, account holder details, and a tabular transaction history.
  • Branch-printed statement — issued at a branch, often on pre-printed stationery. Contains the same data but with different spacing and fonts.
  • Passbook scan — physical passbook pages photographed or scanned. Common for rural and semi-urban account holders who may not have net banking access.
  • All three formats present the same parsing challenges: multi-page documents, inconsistent date formats (DD-MM-YYYY and DD/MM/YYYY both appear), and merged debit/credit columns in some older printouts. Lekha handles all three automatically.

    Extracting Data from a UCO Bank Statement

    The API call is identical for every supported bank — you send the PDF, Lekha classifies it and routes it to the right extractor.

    import Lekha from "@lekhadev/sdk";
    import { readFileSync } from "fs";
    

    const client = new Lekha({ apiKey: process.env.LEKHA_API_KEY });

    const file = readFileSync("uco-bank-statement.pdf"); const base64 = file.toString("base64");

    const result = await client.extract({ document: { content: base64, mimeType: "application/pdf", }, documentType: "bank_statement", });

    console.log(result.data);

    The response includes a fully structured object:

    {
      "bank": "UCO Bank",
      "accountNumber": "XXXXXXXX1234",
      "accountHolder": "Rajesh Kumar Sharma",
      "ifscCode": "UCBA0001234",
      "branch": "Salt Lake Sector V, Kolkata",
      "statementPeriod": {
        "from": "2026-04-01",
        "to": "2026-09-30"
      },
      "openingBalance": 42500.0,
      "closingBalance": 87320.5,
      "transactions": [
        {
          "date": "2026-04-03",
          "description": "SALARY CR WBHIDCO",
          "debit": null,
          "credit": 65000.0,
          "balance": 107500.0,
          "transactionType": "credit",
          "category": "salary"
        },
        {
          "date": "2026-04-05",
          "description": "UPI/PHONEPE/9876543210",
          "debit": 1200.0,
          "credit": null,
          "balance": 106300.0,
          "transactionType": "debit",
          "category": "upi_transfer"
        }
      ],
      "summary": {
        "totalCredits": 390000.0,
        "totalDebits": 344679.5,
        "averageMonthlyCredit": 65000.0,
        "averageMonthlyDebit": 57446.58
      }
    }
    

    All amounts are numbers (never strings), and all dates use ISO 8601 format — ready to pass directly to your database or downstream logic.

    Practical Use Cases for UCO Bank Data

    Salary Verification for Lending

    UCO Bank is widely used for government employee salary accounts — state government workers, PSU employees, teachers, and defence personnel in many states receive their salary credits here. A regular monthly credit from a government employer is a strong loan eligibility signal.

    function verifySalaryEligibility(statement: BankStatement) {
      const sixMonthsAgo = new Date();
      sixMonthsAgo.setMonth(sixMonthsAgo.getMonth() - 6);
    

    const salaryCreditsByMonth = statement.transactions .filter( (tx) => tx.category === "salary" && tx.credit !== null && new Date(tx.date) >= sixMonthsAgo, ) .reduce( (acc, tx) => { const month = tx.date.substring(0, 7); // "YYYY-MM" if (!acc[month] || acc[month] < (tx.credit ?? 0)) { acc[month] = tx.credit ?? 0; } return acc; }, {} as Record, );

    const salaryMonths = Object.keys(salaryCreditsByMonth).length; const avgSalary = Object.values(salaryCreditsByMonth).reduce((a, b) => a + b, 0) / salaryMonths;

    return { consistent: salaryMonths >= 5, // at least 5 of 6 months averageMonthlySalary: avgSalary, eligible: salaryMonths >= 5 && avgSalary >= 15000, }; }

    EMI Obligation Detection

    Before approving a new loan, lenders need to know existing obligations. UCO Bank statements typically show EMI debits as NACH mandates or standing instruction debits, which Lekha categorises automatically.

    async function detectExistingEMIs(statementBase64: string) {
      const result = await client.extract({
        document: { content: statementBase64, mimeType: "application/pdf" },
        documentType: "bank_statement",
      });
    

    const emiTransactions = result.data.transactions.filter( (tx) => tx.category === "emi" || tx.category === "loan_repayment" || tx.description.match(/NACH|ECS|EMI|LOAN/i), );

    // Group by description pattern to identify unique EMIs const uniqueEMIs = new Map(); for (const tx of emiTransactions) { const key = tx.description.replace(/\d{6,}/g, "").trim(); // strip account numbers const existing = uniqueEMIs.get(key) ?? 0; uniqueEMIs.set(key, Math.max(existing, tx.debit ?? 0)); }

    const totalMonthlyEMI = Array.from(uniqueEMIs.values()).reduce( (a, b) => a + b, 0, );

    return { emis: Array.from(uniqueEMIs.entries()).map(([name, amount]) => ({ name, amount, })), totalMonthlyEMI, debtBurdenRatio: totalMonthlyEMI / result.data.summary.averageMonthlyCredit, }; }

    Agricultural Loan Assessment

    UCO Bank has a significant agricultural lending portfolio, and many farming businesses use it. When assessing a kisan credit or crop loan application, irregular income patterns are normal — payments often cluster around harvest cycles.

    function assessAgriculturalCashFlow(statement: BankStatement) {
      // Group credits by quarter for seasonal analysis
      const quarterlyCredits: Record = {};
    

    for (const tx of statement.transactions) { if (tx.credit === null) continue; const date = new Date(tx.date); const quarter = Q${Math.ceil((date.getMonth() + 1) / 3)}-${date.getFullYear()}; quarterlyCredits[quarter] = (quarterlyCredits[quarter] ?? 0) + tx.credit; }

    const quarters = Object.entries(quarterlyCredits); const avgQuarterly = quarters.reduce((a, [, v]) => a + v, 0) / quarters.length;

    return { quarterlyBreakdown: quarterlyCredits, averageQuarterlyIncome: avgQuarterly, annualisedIncome: avgQuarterly * 4, isSeasonalIncome: Math.max(...quarters.map(([, v]) => v)) > avgQuarterly * 2, }; }

    Handling Passbook Scans and Low-Quality Images

    For customers in rural or semi-urban areas, the document you receive may be a phone photo of a passbook — blurry, skewed, with shadows. Lekha's vision model handles these gracefully, but you can improve accuracy by preprocessing.

    import Lekha from "@lekhadev/sdk";
    

    async function extractFromPassbookScan(imageBuffer: Buffer) { const base64 = imageBuffer.toString("base64");

    // For image files (JPEG/PNG), use image/jpeg or image/png mimeType const result = await client.extract({ document: { content: base64, mimeType: "image/jpeg", }, documentType: "bank_statement", });

    return result.data; }

    For multi-page passbooks scanned as separate images, convert them to a single PDF first — Lekha processes multi-page PDFs as a unified document, maintaining transaction order across pages.

    Building a Complete Loan Pre-Screening Agent

    Here is a minimal but production-ready agent that takes a UCO Bank statement, extracts it, and returns a structured pre-screening decision:

    import Lekha from "@lekhadev/sdk";
    import { readFileSync } from "fs";
    

    const client = new Lekha({ apiKey: process.env.LEKHA_API_KEY });

    interface LoanDecision { eligible: boolean; maxLoanAmount: number; reasons: string[]; details: { avgMonthlyIncome: number; existingEMI: number; availableSurplus: number; }; }

    async function prescreenLoanApplicant( documentPath: string, ): Promise { const file = readFileSync(documentPath); const result = await client.extract({ document: { content: file.toString("base64"), mimeType: "application/pdf", }, documentType: "bank_statement", });

    const { transactions, summary } = result.data; const reasons: string[] = [];

    // Check salary regularity (last 6 months) const sixMonthsAgo = new Date(); sixMonthsAgo.setMonth(sixMonthsAgo.getMonth() - 6); const recentSalaries = transactions.filter( (tx) => tx.category === "salary" && tx.credit !== null && new Date(tx.date) >= sixMonthsAgo, ); const salaryMonths = new Set(recentSalaries.map((tx) => tx.date.slice(0, 7))) .size;

    if (salaryMonths < 3) { reasons.push("Insufficient salary history (less than 3 months)"); }

    // Estimate existing EMI burden const monthlyEMI = transactions .filter( (tx) => tx.debit !== null && (tx.category === "emi" || tx.category === "loan_repayment" || /NACH|ECS/i.test(tx.description)), ) .reduce((sum, tx) => sum + (tx.debit ?? 0), 0) / 6;

    const avgMonthlyIncome = summary.averageMonthlyCredit; const availableSurplus = avgMonthlyIncome - monthlyEMI; const foir = monthlyEMI / avgMonthlyIncome; // Fixed Obligation to Income Ratio

    if (foir > 0.5) { reasons.push(High debt burden: FOIR is ${(foir * 100).toFixed(1)}%); }

    // Calculate max loan (50% surplus, 60-month tenure, ~12% interest) const maxEMICapacity = availableSurplus * 0.5; const monthlyRate = 0.12 / 12; const tenure = 60; const maxLoan = (maxEMICapacity * (1 - Math.pow(1 + monthlyRate, -tenure))) / monthlyRate;

    const eligible = reasons.length === 0 && maxLoan > 50000;

    return { eligible, maxLoanAmount: Math.floor(maxLoan / 1000) * 1000, reasons, details: { avgMonthlyIncome, existingEMI: monthlyEMI, availableSurplus, }, }; }

    Tips for Production Deployments

    Statement period: Most UCO Bank customers submit 3–6 month statements. Always check statementPeriod in the response — if the period is shorter than requested, ask the applicant for a longer statement before making decisions. Multiple accounts: Some applicants have both a savings account and an overdraft facility at UCO Bank. Treat them as separate documents — Lekha returns them separately — and aggregate the cash flows at the application layer. Dormant accounts: UCO Bank has a relatively high proportion of dormant accounts (fewer than 2 transactions per month). Your agent should flag these and ask for an alternative bank statement rather than treating low activity as income information. IFSC validation: The IFSC codes returned by Lekha can be cross-referenced against the RBI's master list to verify branch authenticity — a useful anti-fraud check.

    FAQ

    Does Lekha support all UCO Bank statement formats? Yes — net banking PDFs, branch-printed statements, and passbook scans are all supported. For passbook scans, make sure the image is at least 300 DPI and the text is legible; heavily blurred or low-contrast images may return partial data. How does Lekha distinguish UCO Bank from other PSU banks with similar statement layouts? The classifier uses a combination of visual features (logo, colour scheme, header layout) and textual signals (IFSC prefix UCBA, branch details format). It is reliable across all three statement types even without the user specifying the bank name. Can I process UCO Bank statements in bulk for portfolio analysis? Yes. The Lekha API is stateless and horizontally scalable. For bulk processing, send documents concurrently up to your plan's rate limit — see the batch processing guide for the recommended concurrency pattern. What is the accuracy for UCO Bank passbook scans vs digital PDFs? Digital PDFs (net banking or branch-printed) achieve near-perfect extraction accuracy. Passbook scans depend on image quality — well-lit, in-focus photos typically achieve 95%+ field-level accuracy. You can test your documents before integrating at the Lekha playground.

    UCO Bank's wide reach in Eastern India and its large government-employee customer base make it an important document format for any Indian lending or financial health product. With Lekha, you get production-ready extraction without building or maintaining bank-specific parsers.

    Ready to integrate? Sign up at lekhadev.com to get your API key and start extracting UCO Bank statements in minutes. The playground lets you test with real documents before writing a single line of integration code.