AmpleTrails, Gurugram · since 2012 +91 93154 41053 WhatsApp info@ampletrails.com Developer guide · Guides
Products
Identity verificationBusiness verification (KYB)Bank, income & creditFace match & OCRVideo KYC, eSign & flowsCompliance & riskPayouts & messagingAll 52 APIs
Use cases
Customer onboarding (KYC)Merchant & seller onboarding (KYB)Vendor & supplier verificationEmployee background checksGig and field worker onboardingLoan underwritingPayout and refund validationDuplicate and synthetic identity detection
Industries
Fintech & Digital LendingBanks & NBFCsInsuranceBroking, Mutual Funds & WealthCrypto & VDA PlatformsReal-money GamingE-commerce & MarketplacesStaffing, Gig & HRTelecomMobility & LogisticsReal Estate & RentalsB2B & Procurement
Resources
GuidesGlossaryFAQSecurity & data
DevelopersPricingAbout
Theme
Get API keysCall +91 93154 41053

Photo ID OCR API

Reads a photo of an Indian ID and returns the document type, number, name, date of birth, father's name and address where printed, with confidence and quality flags.

ID photo Live selfie 92 score Same person Liveness passed
Source
Our OCR models trained on Indian identity documents
Turnaround
Real time, one to three seconds
Endpoint
POST /v1/ocr/id
Who can use it
Any business with the user's consent to process their ID image.

Overview

Typing details from an ID photo is slow and error-prone, and so is asking users to do it. Send a photo of an Indian ID and we return the document type, number, name, date of birth, father's name and address where printed. A confidence score and quality flags tell you when to ask for a better photo. Aadhaar numbers can be masked in the same call.

Good to know

OCR reads the card, it doesn't validate it. A well-made fake card will read cleanly, so always verify the number against the source.

What you get

  • Auto-detects the documentNo need to ask the user which ID they uploaded. We detect it and pick the right fields.
  • Aadhaar masking includedGet the Aadhaar number masked to the last four digits and a masked image to store.
  • Quality and photocopy flagsBlur, glare, cropping and photocopies are flagged so you don't accept a bad scan.
  • Front and backSend both sides where the address is on the back, as with Aadhaar and some DLs.

Request

POST https://api.ampletrails.com/v1/ocr/id

FieldTypeStatusDescription
image_frontstringRequiredFront of the document as base64 or HTTPS URL
image_backstringOptionalBack of the document, if it carries the address
doc_typestringOptionalExpected type (aadhaar, pan, voter_id, dl, passport); auto-detected if omitted
mask_aadhaarbooleanOptionalReturn a masked Aadhaar image and number

Response

Fields inside data. Every response also carries status, request_id and, on errors, message. See error codes.

FieldMeaningExample
doc_typeDetected document typepan
id_numberDocument numberABCDE1234F
nameName as printedRAVI KUMAR
father_nameFather's name, where printedSURESH KUMAR
dobDate of birth1990-05-14
addressAddress, where printednull
confidenceOverall extraction confidence from 0 to 10097
quality_flagsIssues like blur, glare, cropping or a photocopy[]

Example

curl -X POST https://api.ampletrails.com/v1/ocr/id \
  -H "Authorization: Bearer $AMPLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image_front": "data:image/jpeg;base64,…", "image_back": "data:image/jpeg;base64,…", "doc_type": "pan", "mask_aadhaar": true, "consent": "Y"}'
Response · 200 OK
{
  "status": "success",
  "request_id": "req_7f3a9c21e4",
  "data": {
    "doc_type": "pan",
    "id_number": "ABCDE1234F",
    "name": "RAVI KUMAR",
    "father_name": "SURESH KUMAR",
    "dob": "1990-05-14",
    "address": null,
    "confidence": 97,
    "quality_flags": "[]"
  }
}

Example data. The exact field list for your account comes with your sandbox documentation.

Use cases

Faster onboarding forms

Prefill name, date of birth and ID number from a photo, then let the user correct anything.

Back-office digitisation

Convert stacks of scanned KYC files into structured records.

Agent-assisted KYC

Field agents photograph the ID and the form fills itself.

Questions about this API

Does OCR verify the document?

No. It reads what is printed. Run the extracted number through PAN, DL or Voter ID verification to check it against government records.

Which documents are supported?

Aadhaar, PAN, Voter ID, driving licence and passport. For other countries, see Global ID verification.

What about regional-language text?

We return the English fields. Names printed only in a regional script are transliterated where possible, so check those with the user.

Can it read a photo of a screen?

It will usually read it, but we flag it. Many teams reject screen photos because they're a common sign of a borrowed document.

Try the Photo ID OCR API

Sandbox keys, the full field reference and a Postman collection, usually within a working day.