Automate Indian Financial Document Processing with n8n and Lekha
Step-by-step guide to building n8n workflows that parse Indian bank statements, salary slips, and ITRs using the Lekha API for fintech automation.
n8n is one of the most popular open-source workflow automation platforms — and it pairs exceptionally well with Lekha for building no-code or low-code financial document pipelines. Whether you are processing loan applications, automating KYC, or routing salary verification requests, this guide shows you exactly how to wire Lekha into n8n in under an hour.
Why n8n + Lekha?
n8n gives you a visual canvas for orchestrating HTTP calls, conditional logic, database writes, and notifications without managing servers or queues. Lekha gives you a single API endpoint that turns any Indian financial document — bank statement, salary slip, ITR, Form 16, CAS, CIBIL — into clean structured JSON.
Together they let a small fintech team automate document-heavy workflows that would otherwise require a dedicated engineering sprint:
| Use case | Documents | n8n trigger | | ----------------------- | ---------------------------- | ----------------------- | | Loan pre-screening | Bank statement + salary slip | Form submission webhook | | KYC enrichment | ITR + CIBIL report | Typeform / Google Form | | Mutual fund onboarding | CAS statement | Email attachment | | GST refund verification | Bank statement + GST invoice | Scheduled batch |
Prerequisites
Step 1: Store Your Lekha API Key in n8n
Never hard-code credentials in workflow nodes. Use n8n's built-in credential store instead.
x-api-key, Value = lk_live_YOUR_KEY_HERELekha APIYou will reference this credential in every HTTP Request node that calls Lekha.
Step 2: Build a Loan Pre-Screening Workflow
This is the most common pattern: a borrower uploads documents via a form, n8n picks them up, Lekha extracts the financials, and the result goes to your CRM or Slack.
Node 1 — Webhook Trigger
Add a Webhook node as the trigger. Set:
Your form (Tally, Typeform, or a custom React form) should POST a multipart body containing:
bank_statement — PDF filesalary_slip — PDF fileapplicant_id — stringNode 2 — Extract Bank Statement
Add an HTTP Request node named Parse Bank Statement:
Method: POST
URL: https://api.lekhadev.com/v1/extract
Authentication: Predefined Credential Type → Header Auth → Lekha API
In the Body tab, choose Form Data and add:
file → {{ $binary.bank_statement }} (expression, set to Binary)document_type → bank_statement (fixed string)The response will look like:
{
"success": true,
"data": {
"account_holder": "Priya Sharma",
"bank": "HDFC Bank",
"period": { "from": "2026-01-01", "to": "2026-03-31" },
"summary": {
"opening_balance": 45200,
"closing_balance": 62800,
"total_credits": 285000,
"total_debits": 267400,
"average_monthly_balance": 54600
},
"transactions": [ ... ]
}
}
Node 3 — Extract Salary Slip
Duplicate Node 2, rename it Parse Salary Slip, and change the document_type to salary_slip. Lekha auto-classifies most documents, but passing the type explicitly saves a round-trip and avoids ambiguity when multiple formats are in scope.
Node 4 — Merge Results
Add a Merge node (Combine mode: Merge by Index) to join the outputs of both HTTP Request nodes into a single item. Then add a Set node to build your screening object:
// Expression in the Set node
{
"applicant_id": "{{ $('Webhook').item.json.applicant_id }}",
"monthly_income": "{{ $('Parse Salary Slip').item.json.data.net_pay }}",
"avg_balance": "{{ $('Parse Bank Statement').item.json.data.summary.average_monthly_balance }}",
"total_credits_3m": "{{ $('Parse Bank Statement').item.json.data.summary.total_credits }}",
"bank_name": "{{ $('Parse Bank Statement').item.json.data.bank }}"
}
Node 5 — Decision Gate
Add an IF node to apply your pre-screening rules:
Condition 1: monthly_income >= 30000
Condition 2: avg_balance >= 10000
Operator: AND
Route True to a Slack notification or CRM update, False to an automatic rejection email.
Step 3: Handle Email-Triggered Document Intake
If your borrowers email documents rather than uploading through a form, n8n's Gmail / Outlook nodes make this equally simple.
Add a Gmail Trigger node set to poll every 5 minutes for emails with the subject tag [LOAN-APPLICATION]. Then:
$binary.attachment_0 directly$json.data.bank contains a supported bank nameNo Lambda functions, no S3 buckets, no custom parsers per bank.
Step 4: Scheduled Batch Processing
For high-volume operations (NBFCs processing hundreds of applications per day), trigger the workflow on a schedule rather than per-event.
Add a Schedule Trigger node set to run every hour. Pair it with a Postgres node that queries for pending applications:
SELECT id, file_url FROM applications
WHERE status = 'pending' AND created_at > NOW() - INTERVAL '1 hour';
Then use a Split in Batches node (batch size 10) → HTTP Request to Lekha → Postgres to update each row. This keeps you well within rate limits while processing large queues efficiently.
Lekha supports documents up to 50 MB and multi-page PDFs up to 200 pages — so you do not need to pre-split statements before sending them. See the Lekha docs for rate limit tiers.
Step 5: Error Handling and Retries
Financial document workflows must handle errors gracefully. Add an Error Trigger node connected to every HTTP Request node:
On Error: Continue (return error data)
Then check the response:
// IF node condition
{
{
$json.success === false;
}
}
If extraction fails, route to a Wait node (retry after 30 s) with a counter. After three failures, write the document to a manual review queue and notify via Slack. Lekha returns structured error codes like UNSUPPORTED_FORMAT, LOW_QUALITY_SCAN, and EXTRACTION_FAILED that you can use to build intelligent retry logic.
Calling Lekha from Code Nodes (Advanced)
If you need programmatic control — for example, selecting document_type based on an ML classifier output — use n8n's Code node:
// n8n Code node (JavaScript)
const formData = new FormData();
formData.append("file", items[0].binary.attachment);
formData.append("document_type", items[0].json.predicted_type);
const response = await this.helpers.httpRequest({
method: "POST",
url: "https://api.lekhadev.com/v1/extract",
headers: { "x-api-key": "lk_live_YOUR_KEY" },
body: formData,
returnFullResponse: true,
});
return [{ json: response.body }];
The Code node gives you the full flexibility of a developer-facing SDK while staying inside n8n's visual canvas for the rest of the flow.
Real-World Example: NBFC Loan Pipeline
Here is a complete n8n workflow used by a mid-size NBFC built on this pattern:
Gmail Trigger (subject: LOAN)
→ Extract Attachments
→ Parse Bank Statement (Lekha)
→ Parse Salary Slip (Lekha)
→ Calculate DSR (Code Node)
→ IF DSR < 0.45
→ True: Create CRM Lead (Salesforce)
→ False: Send Rejection Email (Gmail)
→ Log to Postgres
→ Slack Notification (#credit-team)
Total setup time: 2 hours. Documents processed automatically: ~150/day. Manual review queue reduced from 100% to 12%.
Try It in the Playground
Before wiring up n8n, experiment with your actual documents at lekhadev.com/playground. Paste the JSON output directly into n8n's Mock node to prototype your decision logic without making live API calls.
FAQ
Does Lekha store the documents I send? No. Lekha processes documents entirely in-memory and never persists them to disk. This makes the API compliant with India's DPDP Act and suitable for sensitive financial data. Which Indian banks does Lekha support? Lekha supports 50+ Indian banks including HDFC, ICICI, SBI, Axis, Kotak, PNB, Canara, Bank of Baroda, IndusInd, Federal Bank, Yes Bank, IDFC First, Union Bank, and more. Check the supported formats list for the complete registry. Can I use the free tier for a production n8n workflow? The free tier is generous enough for development and low-volume testing. For production workloads (100+ documents/day), upgrade to a paid plan at lekhadev.com for higher rate limits and priority processing. What if n8n sends a scanned PDF instead of a digital one? Lekha handles both. Digital PDFs are parsed directly; scanned images go through a vision AI pipeline that accurately extracts transaction data even from low-quality scans. You do not need separate logic for each case.Ready to automate your document workflows? Sign up for a free Lekha API key at lekhadev.com and have your first n8n workflow processing bank statements in under an hour.