> ## Documentation Index
> Fetch the complete documentation index at: https://idto.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Aadhaar overview

> Verify a person against Aadhaar by OTP, DigiLocker, the card's signed QR code, or OCR of the card.

Aadhaar is India's 12-digit national identity number. idto gives you four ways to verify someone with it. Pick by how much assurance you need and what the person has with them.

| Method | The person needs | You get | Assurance |
| - | - | - | - |
| [OKYC](https://idto.mintlify.site/api-reference/aadhaar/okyc-generate-otp.md) | Their Aadhaar number and the phone linked to it | Name, date of birth, gender, full address, photo | High: data comes from the Aadhaar record after an OTP |
| [DigiLocker](https://idto.mintlify.site/api-reference/aadhaar/digilocker.md) | A DigiLocker sign-in | Profile, and the e-Aadhaar XML on request | High: data comes from DigiLocker after the person consents |
| [Aadhaar QR](https://idto.mintlify.site/api-reference/aadhaar/aadhaar-qr.md) | Their card or e-Aadhaar | Name, date of birth, gender, address, photo, and whether the UIDAI signature matched | High for a signed QR that matches, low for an old unsigned QR |
| [Aadhaar OCR](https://idto.mintlify.site/api-reference/aadhaar/aadhaar-ocr.md) | A photo of their card | Number, name, date of birth, gender, care-of, address, pincode as printed | Low: reads the card, does not check it |

## Endpoints

| Endpoint | What it does | Billing |
| - | - | - |
| [`POST /v2/verify/okyc_generate_otp`](https://idto.mintlify.site/api-reference/aadhaar/okyc-generate-otp) | Sends the OTP, returns `session_id` | Billed on 200, including an invalid Aadhaar (`IDTO_202`) |
| [`POST /v2/verify/okyc_get_result`](https://idto.mintlify.site/api-reference/aadhaar/okyc-get-result) | Checks the OTP, returns the Aadhaar record | Billed only on a correct OTP |
| [`POST /v2/verify/aadhaar_qr`](https://idto.mintlify.site/api-reference/aadhaar/aadhaar-qr) | Reads the QR and checks its signature | Billed for every readable QR; no QR found (`IDTO_204`) is free |
| [`POST /v2/verify/aadhaar_ocr`](https://idto.mintlify.site/api-reference/aadhaar/aadhaar-ocr) | Reads the printed card | Billed on 200, including no number read (`IDTO_202`) |
| [`POST /v2/verify/digilocker`](https://idto.mintlify.site/api-reference/aadhaar/digilocker) | Exchanges the DigiLocker code for a masked profile | Billed only when the profile is returned |
| [`POST /verify/digilocker/initiate_session`](https://idto.mintlify.site/api-reference/aadhaar/digilocker-initiate-session) | v1. Returns the DigiLocker sign-in URL | Charged when `status` is `success` |
| [`POST /verify/digilocker/get_reference`](https://idto.mintlify.site/api-reference/aadhaar/digilocker-get-reference) | v1. Exchanges the code for a one-hour `reference_key` | Charged when `status` is `success` |
| [`POST /verify/digilocker/user_details`](https://idto.mintlify.site/api-reference/aadhaar/digilocker-user-details) | v1. Unmasked DigiLocker profile | Charged when `status` is `success` |
| [`POST /verify/digilocker/fetch_aadhaar`](https://idto.mintlify.site/api-reference/aadhaar/digilocker-fetch-aadhaar) | v1. e-Aadhaar XML file | Charged when the file is returned |
| [`POST /verify/digilocker/verify_account`](https://idto.mintlify.site/api-reference/aadhaar/digilocker-verify-account) | v1. Is this mobile registered with DigiLocker? | Charged for both answers |
| [`POST /verify/okyc_generate_otp`](https://idto.mintlify.site/api-reference/aadhaar/okyc-generate-otp-v1) | v1. Sends the OKYC OTP, returns `sessionId` | Charged when `status` is `success` |
| [`POST /verify/okyc_get_result`](https://idto.mintlify.site/api-reference/aadhaar/okyc-get-result-v1) | v1. Checks the OTP, returns the Aadhaar record | Charged when `status` is `success` |
| [`POST /verify/aadhaar_qr`](https://idto.mintlify.site/api-reference/aadhaar/aadhaar-qr-v1) | v1. Reads the QR and checks its signature | Charged when `status` is `success` |
| [`POST /verify/aadhaar_ocr`](https://idto.mintlify.site/api-reference/aadhaar/aadhaar-ocr-v1) | v1. Reads one side of the printed card | Charged when `status` is `success` |
| [`POST /verify/digilocker`](https://idto.mintlify.site/api-reference/aadhaar/digilocker-v1) | v1. Exchanges the DigiLocker code for the unmasked profile | Charged when `status` is `success` |
| [`POST /verify/digilocker/issued_docs`](https://idto.mintlify.site/api-reference/aadhaar/digilocker-issued-docs) | v1. Lists the holder's issued documents with their `uri` | Charged when `status` is `success` |
| [`POST /verify/digilocker/get_issued_docs`](https://idto.mintlify.site/api-reference/aadhaar/digilocker-get-issued-docs) | v1. One issued document as a file, by `uri` | Charged when the file is returned |
| [`POST /verify/digilocker/fetch_pan`](https://idto.mintlify.site/api-reference/aadhaar/digilocker-fetch-pan) | v1. PAN as a PDF file | Charged when the file is returned |
| [`POST /verify/digilocker/fetch_pan/xml`](https://idto.mintlify.site/api-reference/aadhaar/digilocker-fetch-pan-xml) | v1. PAN as an XML file | Charged when the file is returned |
| [`POST /verify/digilocker/fetch_dl`](https://idto.mintlify.site/api-reference/aadhaar/digilocker-fetch-dl) | v1. Driving licence as a PDF file | Charged when the file is returned |
| [`POST /verify/digilocker/fetch_dl/xml`](https://idto.mintlify.site/api-reference/aadhaar/digilocker-fetch-dl-xml) | v1. Driving licence as an XML file | Charged when the file is returned |
| [`POST /verify/digilocker/fetch_uan`](https://idto.mintlify.site/api-reference/aadhaar/digilocker-fetch-uan) | v1. UAN card as a PDF file | Charged when the file is returned |
| [`POST /verify/digilocker/fetch_degree`](https://idto.mintlify.site/api-reference/aadhaar/digilocker-fetch-degree) | v1. Degree certificate as a PDF file | Charged when the file is returned |
| [`POST /verify/digilocker/fetch_12thmarksheet`](https://idto.mintlify.site/api-reference/aadhaar/digilocker-fetch-12thmarksheet) | v1. Class XII marksheet as a PDF file | Charged when the file is returned |
| [`POST /verify/digilocker/fetch_10thmarksheet`](https://idto.mintlify.site/api-reference/aadhaar/digilocker-fetch-10thmarksheet) | v1. Class X marksheet as a PDF file | Charged when the file is returned |
| [`GET /verify/digilocker/doc_master`](https://idto.mintlify.site/api-reference/aadhaar/digilocker-doc-master) | v1. DigiLocker document type codes and names | Charged on every call |

v2 endpoints return `billed` and support `Idempotency-Key`. v1 endpoints have no idempotency, so a retry can be charged twice.

## OKYC flow

```mermaid theme={null}
sequenceDiagram
    participant User as Your user
    participant App as Your server
    participant idto as idto API
    App->>idto: POST /v2/verify/okyc_generate_otp {aadhaar_number, user_consent}
    idto-->>User: OTP by SMS to the Aadhaar-linked mobile
    idto-->>App: 200, data.session_id, billed true
    User->>App: Types the OTP
    App->>idto: POST /v2/verify/okyc_get_result {session_id, otp}
    alt OTP correct
        idto-->>App: 200, data with name, dob, address, billed true
    else OTP wrong or expired
        idto-->>App: 422 IDTO_205, billed false
    else Attempt limit reached
        idto-->>App: 429 IDTO_206, billed false, start again
    end
```

## DigiLocker flow

```mermaid theme={null}
sequenceDiagram
    participant User as User's browser
    participant App as Your server
    participant idto as idto API
    participant DL as DigiLocker
    App->>idto: POST /verify/digilocker/initiate_session {redirect_url, consent, consent_purpose}
    idto-->>App: url
    App->>User: Open url
    User->>DL: Sign in and consent
    DL-->>User: Redirect to your redirect_url with code, codeVerifier, clientId, state
    User->>App: code, codeVerifier
    alt Profile only
        App->>idto: POST /v2/verify/digilocker {code, code_verifier}
        idto-->>App: Masked profile, billed true
    else e-Aadhaar XML
        App->>idto: POST /verify/digilocker/get_reference {code, code_verifier}
        idto-->>App: reference_key, valid one hour
        App->>idto: POST /verify/digilocker/fetch_aadhaar with reference_key
        idto-->>App: e-Aadhaar XML file
    end
```

Each `code` can be exchanged once, so choose one branch per session. To check first whether the user has a DigiLocker account, call [Check a DigiLocker account](https://idto.mintlify.site/api-reference/aadhaar/digilocker-verify-account.md) and send new users to sign-up with `redirect_to_signup: true`.

## Outcomes

| Outcome | Endpoint | HTTP | `error_code` | Billed | What to do |
| - | - | - | - | - | - |
| OTP sent | okyc\_generate\_otp | 200 | `null` | Yes | Ask for the OTP |
| Aadhaar number rejected | okyc\_generate\_otp | 200 | `IDTO_202` | Yes | Ask the user to check the number |
| OTP generation blocked for now | okyc\_generate\_otp | 503 | `IDTO_103` | No | Offer DigiLocker or QR instead |
| Verified | okyc\_get\_result | 200 | `null` | Yes | Compare name and date of birth with what you hold |
| Wrong or expired OTP | okyc\_get\_result | 422 | `IDTO_205` | No | Let the user retry |
| Too many wrong OTPs | okyc\_get\_result | 429 | `IDTO_206` | No | Start again from step 1 |
| QR signature matched | aadhaar\_qr | 200 | `null`, `authentic: true` | Yes | Accept the card data |
| QR signature did not match | aadhaar\_qr | 200 | `null`, `authentic: false` | Yes | Reject the card |
| No QR in the image | aadhaar\_qr | 422 | `IDTO_204` | No | Ask for a clearer photo of the QR |
| Card read | aadhaar\_ocr | 200 | `null` | Yes | Use as a pre-fill, then verify by OKYC, DigiLocker or QR |
| DigiLocker code expired or reused | digilocker | 400 | `IDTO_001` | No | Start a new DigiLocker session |

Error bodies follow [Error response shapes](https://idto.mintlify.site/concepts/request-response.md#error-response-shapes), and charges follow the [billing rule](https://idto.mintlify.site/concepts/billing-consent.md#billing).

## In the idto verification flow

The Aadhaar step in the idto SDKs lets the user choose DigiLocker, an Aadhaar OTP, or an upload (scan the QR or photograph the front and back), with a consent checkbox before they continue.

<video controls preload="metadata" src="https://idto-sdk-usage-demo-bucket.s3.ap-south-1.amazonaws.com/docs/v1/video/flow-aadhaar-okyc.mp4" poster="https://idto-sdk-usage-demo-bucket.s3.ap-south-1.amazonaws.com/docs/v1/video/flow-aadhaar-okyc.jpg" />

![Aadhaar step offering DigiLocker, Aadhaar OTP and upload, with a consent checkbox](https://idto-sdk-usage-demo-bucket.s3.ap-south-1.amazonaws.com/docs/v1/img/sdk-aadhaar-method.png)

See [SDK modules](https://idto.mintlify.site/sdks/modules.md) to add the Aadhaar step to a workflow.

## Next steps

* [Send an Aadhaar OKYC OTP](https://idto.mintlify.site/recipes/aadhaar-okyc-send-otp.md)
* [DigiLocker consent flow](https://idto.mintlify.site/recipes/digilocker-consent-flow.md)
* [DigiLocker guide](https://idto.mintlify.site/guides/digilocker-integration.md)
* [Aadhaar FAQ](https://idto.mintlify.site/products/aadhaar/faq.md)

Was this page helpful? Email us at [tech@idto.ai](mailto:tech@idto.ai?subject=Docs%20feedback%3A%20Aadhaar%20overview) with the page link.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.