Aadhaar Masking API

Redact Aadhaar numbers in one API call

An Aadhaar masking API and an Aadhaar redaction API are the same thing: this one. Both terms describe covering the first eight digits so the document can be shared safely.

Send a JPG, PNG or PDF. Get the same document back with the first eight digits of the Aadhaar number blacked out and the last four left readable. Built for KYC and document pipelines at banks, NBFCs, housing finance companies and fintechs.

Talk to our technical team → — for integration questions, security review or a volume estimate.

Access is issued per organisation. Email contact@maskaadhaar.com with your expected monthly volume and peak throughput, and we will provision a key with a test quota.

Plug and play in three steps

Synchronous and stateless — no job IDs, no polling, no webhook to configure, no SDK to install.

📄
Step 1

Post the document

One multipart request carrying a JPG, PNG or PDF of the Aadhaar card.

→
🔍
Step 2

Detect and validate

Server-side OCR scans every orientation, and each candidate is checked against the Aadhaar checksum.

→
🔐
Step 3

Get it back redacted

The masked document is the response body, with a header telling you how many regions were covered.

📤
Your KYC systemPOST /api/v1/mask-aadhaar
↓
📄
Aadhaar documentJPG, PNG or PDF, multipart
↓
🔍
Detect the Aadhaar numberevery orientation, checksum-validated
↓
Mask the first eight digitslast four left readable
↓
📑
Masked documentreturned in the response body
↓
📥
Your KYC systemX-Masked-Count tells you what happened

One synchronous call. Nothing is queued, and nothing is kept.

Three lines to integrate

The masked file is returned directly in the response body, so there is nothing to poll and no second call to fetch a result.

curl -X POST \
  https://api.maskaadhaar.com/api/v1/mask-aadhaar \
  -H "X-API-Key: $MASKAADHAAR_KEY" \
  -F "file=@aadhaar.jpg" \
  --output aadhaar_masked.jpg

Full reference with Python and Node.js examples, error codes and rate limits is in the API documentation.

Response headers

Every response reports what actually happened, so your pipeline can branch on it rather than assuming.

HeaderMeaning
X-Masked-CountRegions redacted. Zero means nothing was found — treat that as a failure.
X-Quota-UsedDocuments consumed this month
X-Quota-RemainingDocuments left this month

If the number cannot be read — glare on a laminated card, a fold through the digits — the original document is returned with a count of zero rather than the request failing outright. That keeps a customer's onboarding from breaking on a shaky photograph, but it means a 200 status is not by itself proof of masking.

What makes the detection trustworthy

Masking is easy to get almost right. These are the specific cases that separate a working implementation from one that quietly leaks.

🔄

Both sides, any orientation

UIDAI printouts carry both sides of the card on one page, often with one card rotated ninety degrees. Every orientation is scanned rather than stopping at the first number found — the shortcut that leaves a rotated card fully readable while still reporting success.

✓

Checksum validation, not pattern matching

Aadhaar numbers carry a Verhoeff check digit. Validating it means the sixteen-digit Virtual ID printed below the number, dates of birth and enrolment numbers are not mistaken for Aadhaar numbers and are left readable.

📷

Built for photographs, not just clean scans

Field officers submit phone photographs at angles, under tube lights, of folded printouts. Detection tolerates skew and glare, and where digits are physically unreadable the mask is extrapolated from the readable side of the card.

🇮

Processed in Mumbai

Requests are served from AWS ap-south-1. For an Indian lender answering a data-residency question, processing stays in-country.

🗑

No document retention

Documents are processed in memory and streamed back in the response. No copy is written to a database or object store. The OCR engine writes a short-lived temporary file during processing, removed when the request completes — so the accurate claim is not persisted, rather than never touches disk.

🔑

Keys rotatable, revocable

Keys are stored securely and can be rotated or revoked from your dashboard at any time, with revocation taking effect immediately. Each key carries its own quota and rate limit, enforced per key rather than per IP, so one integration cannot exhaust another.

Built for organisations that process identity documents

The problem is the same everywhere — an Aadhaar number reaching storage unredacted — but where it happens in the workflow differs.

NBFCs

Mask before storage

Redact at the point of upload, so a full Aadhaar number never lands in your document store or your backups in the first place. More on Aadhaar masking for NBFCs.

HFCs

Loan-document workflows

Home-loan files carry Aadhaar copies through sanction, disbursal and post-disbursal audit. Masking once at intake covers every downstream hop. More on KYC for housing finance.

Fintechs

The whole pipeline

Identity documents move between services, vendors and analytics. Redaction at the edge means the copies that spread are already safe. More on KYC document APIs for fintech.

KYC platforms

Offer it to your own customers

Add Aadhaar redaction to your document-processing stack as a feature of your product, without building detection yourself.

Lending SaaS

Skip the OCR problem

Orientation handling, checksum validation, laminated-card glare and true redaction rather than a drawn rectangle — none of it is your roadmap.

Why teams integrate this instead of building it

Aadhaar detection looks like a weekend problem until you meet the second orientation, the sixteen-digit Virtual ID and the PDF whose text layer survives the black box drawn over it.

Doing it yourselfWith the API
×Someone remembers to mask each file ✓Runs on every document, automatically
×A missed file is found at audit ✓X-Masked-Count tells the pipeline what happened
×OCR, orientation and checksum work to own ✓One REST call, no SDK to install
×Regex on twelve digits also hits the Virtual ID ✓Verhoeff checksum, not pattern matching
×A rectangle over recoverable PDF text ✓Pixels removed, so pdftotext finds nothing
×Copies accumulate wherever they were uploaded ✓Nothing retained; processed in Mumbai and discarded
×Capacity planning is your problem ✓Throughput provisioned to your peak

The five tests worth running against any masking tool, including this one, are set out in how to choose Aadhaar masking software.

Also available: PAN masking

The same interface, for Permanent Account Numbers. ABCDE1234F becomes ABxxxxxxxF, keeping the first two and last character visible for reference.

curl -X POST https://api.maskaadhaar.com/api/v1/mask-pan \
  -H "X-API-Key: $MASKAADHAAR_KEY" \
  -F "file=@pan.jpg" \
  --output pan_masked.jpg

Try it before you integrate

The browser-based Aadhaar tool runs the same detection logic entirely on your own machine, with no upload at all. It is the fastest way to see how masking behaves on your own difficult documents — a folded printout, a two-sided scan, a photograph with glare — before writing any integration code.

When you are ready, the API documentation has the endpoint reference and examples, and the integration guide covers the parts that cause incidents in production.

You are only billed for documents we process

Quota is consumed when a document is successfully processed and returned. A rejected request costs nothing:

OutcomeCounts against quota?
401 invalid or missing API keyNo
413 file larger than 50 MBNo
422 unsupported file typeNo
429 rate limited or quota exhaustedNo
500 processing failed on our sideNo
200 document processed and returnedYes

One case deserves stating plainly rather than hiding in the small print: if the document is processed but no number could be read — heavy glare, a fold through the digits — it returns 200 with X-Masked-Count: 0 and costs you nothing — you are charged for documents that come back redacted, and for nothing else. It is rare on legible documents. What matters is that the response body is the original, unchanged: check the header and route those to review rather than storing them as masked.

Every request is also recorded with its status code and processing time, so a disputed month can be reconciled line by line.

Get API access

Tell us your expected monthly document volume and peak throughput. We will size a plan, issue a key and give your team a test quota to validate output against your own documents before any commitment.

Frequently asked questions

What formats does the API accept?

JPG, JPEG, PNG and PDF. Multi-page PDFs are scanned page by page. The masked document is returned in the input format by default; pass output_format as pdf or jpg to override.

How does the API avoid masking the Virtual ID or date of birth?

Candidate numbers are validated against the Verhoeff checksum that Aadhaar uses. A sixteen-digit VID contains five overlapping twelve-digit windows and almost all of them fail the checksum, so the VID, date of birth and enrolment number stay readable. If a masking tool blacks those out, it is pattern-matching without validating.

Are documents stored?

No. Documents are processed in memory and streamed back in the response, with no copy written to a database or object store. The OCR engine writes a short-lived temporary file to local disk during processing which is removed when the request completes. Processing runs in AWS Mumbai (ap-south-1).

How do I know whether a document was actually masked?

Read the X-Masked-Count response header. If the Aadhaar number could not be read, the original document is returned unchanged with a count of zero and a 200 status — so a successful status code alone is not proof of masking. Route those documents to manual review.

Does it handle both sides of the card on one page?

Yes, including the common layout where one card is rotated ninety degrees relative to the other. Every orientation is scanned rather than stopping at the first number found, which is the failure mode that leaves a rotated card unmasked.

What throughput can you sustain?

Masking is CPU-bound OCR work, so sustained throughput depends on provisioned capacity rather than a fixed ceiling. Tell us your peak requests per minute and we will size for it and confirm during the technical evaluation.

Is there a free trial?

We provision a test quota with every evaluation so your team can validate output quality against your own documents before committing. The browser tools are free and unlimited to try, with no account required.

Start integrating

Working clients, batch patterns and the document formats that need special handling.

Who uses the masking API