> ## Documentation Index
> Fetch the complete documentation index at: https://www.cashfree.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# DigiLocker Overview

> Use Cashfree DigiLocker integration to run consent-based KYC for Aadhaar, PAN, and Driving Licence in line with UIDAI guidelines and the DPDP Act in India.

DigiLocker is a government-backed platform that enables users to securely store and share official documents. By integrating DigiLocker with Cashfree, you can offer a consent-based KYC process that supports documents such as Aadhaar, PAN, and Driving License. This solution helps you comply with the latest UIDAI guidelines and the Digital Personal Data Protection (DPDP) Act. You can implement it using a simple API flow with minimal code changes.

## Use cases

Use DigiLocker integration across industries to ensure compliance and streamline customer onboarding:

| Sector                           | Use case                                                                 |
| -------------------------------- | ------------------------------------------------------------------------ |
| Banking and NBFCs                | Verify Aadhaar and PAN during account opening and loan processing.       |
| Micro-lending platforms          | Confirm user identity using Aadhaar and PAN before loan disbursement.    |
| Insurance providers              | Perform identity verification during policy applications and claims.     |
| Payments and fintech services    | Validate Aadhaar and PAN for user registration and wallet onboarding.    |
| Trading and investment platforms | Complete full KYC with Aadhaar and PAN verification for user onboarding. |
| E-commerce marketplaces          | Verify seller identities for compliance and fraud prevention.            |
| Digital lending platforms        | Authenticate borrowers with government-verified documents.               |

## Key benefits

Cashfree's DigiLocker integration provides these key advantages:

* **UIDAI and DPDP compliant**: Fully legal and compliant for all merchants.
* **Consent-based verification**: Users log in to DigiLocker and explicitly approve the sharing of their Aadhaar document.
* **User control and privacy**: Aadhaar data isn't exposed to merchants without user action. Data is retrieved securely via the government infrastructure.
* **Multiple document types supported**: Retrieve Aadhaar, PAN, Driving License, and more.
* **Familiar and trusted interface**: Users are redirected to the DigiLocker portal, increasing trust.
* **Streamlined integration**: Simple API integration for document verification.

## Verification process

You can verify documents through DigiLocker using two primary methods:

* **Merchant dashboard**: Generate DigiLocker consent links for manual document verification
* **REST API**: Integrate verification directly into your applications

<Tabs>
  <Tab title="Dashboard verification">
    Use the merchant dashboard for quick manual DigiLocker verification:

    1. Log in to the [Merchant Dashboard](https://merchant.cashfree.com/auth/login).
    2. Navigate to **Secure ID** > **Aadhaar/PAN** > **DigiLocker–Aadhaar**.
    3. Select **Verify Document** and choose the verification type (Aadhaar, PAN, or Driving License).
    4. Select **Verify Now** to generate the DigiLocker link and share it with the customer.

    **Customer flow**:

    1. Customer opens the DigiLocker link.
    2. Enters Aadhaar-linked mobile number and OTP for authentication.
    3. Reviews consent screen and approves document sharing.
    4. Cashfree retrieves verified document details from DigiLocker.

    All verified documents appear in your dashboard with comprehensive details including document type, verification status, and customer information.
  </Tab>

  <Tab title="API verification">
    Integrate DigiLocker verification programmatically using the REST API flow:

    **Step 1:** Check if the user has a DigiLocker account using the [Verify Account API](/docs/api-reference/vrs/v2/digilocker/verify-digilocker-account).

    Endpoint: `POST /verification/digilocker/verify-account`

    Check if the user's mobile number or Aadhaar is registered with DigiLocker.

    <Accordion title="Request format">
      ```json theme={"dark"}
      {
        "verification_id": "ABC00123",
        "mobile_number": "9988777666",
        "aadhaar_number": "655675523712"
      }
      ```
    </Accordion>

    <Accordion title="Response format">
      ```json theme={"dark"}
      {
        "verification_id": "ABC00123",
        "reference_id": 12345,
        "mobile_number": "1234567899",
        "aadhaar_number": "XXXXXXXX3712",
        "status": "ACCOUNT_EXISTS",
        "digilocker_id": "8aa626bf-34aa-5ffc-a123-f69207e129a7"
      }
      ```
    </Accordion>

    **Step 2:** Create a consent URL for document access using the [Create URL API](/docs/api-reference/vrs/v2/digilocker/create-digilocker-url).

    Endpoint: `POST /verification/digilocker`

    <Accordion title="Request format">
      ```json theme={"dark"}
      {
        "verification_id": "ABC00123",
        "document_requested": [
          "AADHAAR",
          "PAN",
          "DRIVING_LICENSE"
        ],
        "redirect_url": "https://www.cashfree.com",
        "user_flow": "signup"
      }
      ```
    </Accordion>

    <Accordion title="Response format">
      ```json theme={"dark"}
      {
        "verification_id": "ABC00123",
        "reference_id": 12345,
        "url": "https://verification-test.cashfree.com/dgl/h7562ci7us0",
        "status": "PENDING",
        "user_flow": "signup",
        "document_requested": [
          "AADHAAR",
          "PAN",
          "DRIVING_LICENSE"
        ],
        "redirect_url": "https://www.cashfree.com"
      }
      ```
    </Accordion>

    **Step 3:** Monitor user consent and authentication using the [Get Status API](/docs/api-reference/vrs/v2/digilocker/get-digilocker-verification-status).

    Endpoint: `GET /digilocker?verification_id={verification_id}`

    Status values:

    * `PENDING`: User hasn't completed the flow
    * `AUTHENTICATED`: User logged in and consented successfully
    * `EXPIRED`: Link expired before completion
    * `CONSENT_DENIED`: User rejected consent

    **Step 4:** Fetch verified documents from DigiLocker using the [Get Document API](/docs/api-reference/vrs/v2/digilocker/get-document-from-digilocker).

    Endpoint: `GET /digilocker/document/{document_type}?verification_id={verification_id}`

    Available document types: `AADHAAR`, `PAN`, `DRIVING_LICENSE`

    <Accordion title="Response format for Aadhaar">
      ```json theme={"dark"}
      {
        "care_of": "John Snow",
        "dob": "02-02-1995",
        "gender": "M",
        "name": "John Doe",
        "year_of_birth": 1995,
        "address": {
          "house": "123",
          "street": "Main Street",
          "landmark": "Near Park",
          "locality": "Central Area",
          "city": "Mumbai",
          "district": "Mumbai",
          "state": "Maharashtra",
          "pincode": "400001",
          "post_office": "Mumbai GPO"
        },
        "aadhaar_number": "XXXX-XXXX-1234"
      }
      ```
    </Accordion>

    <Accordion title="Error responses">
      ```json theme={"dark"}
      {
        "type": "invalid_request_error",
        "code": "verification_failed",
        "message": "Document retrieval failed",
        "details": [
          {
            "field": "document_type",
            "issue": "Document not available"
          }
        ]
      }
      ```
    </Accordion>

    **Rate limits**: Check your plan limits for DigiLocker API calls
  </Tab>
</Tabs>

<Note>
  Use the [DigiLocker Integration API](/docs/api-reference/vrs/v2/digilocker/digilocker-integration) for programmatic integration into your applications.
</Note>

## Understanding document types

DigiLocker supports verification of multiple government-issued documents through secure, consent-based authentication:

<Tabs>
  <Tab title="Supported Documents">
    **Primary Identity Documents**:

    | Document type   | Use case                             | Key information retrieved               |
    | --------------- | ------------------------------------ | --------------------------------------- |
    | Aadhaar         | Universal identity verification      | Name, DOB, address, Aadhaar number      |
    | PAN             | Tax identification and financial KYC | Name, PAN number, date of issue         |
    | Driving License | Identity and address verification    | Name, license number, address, validity |
    | Voter ID        | Age and address verification         | Name, voter ID, address, DOB            |
    | Passport        | International identity verification  | Name, passport number, validity         |
  </Tab>

  <Tab title="Data Security">
    **Government-grade Security Features**:

    * **End-to-end encryption**: All document transfers use government encryption standards
    * **Consent-based access**: Users explicitly approve each document sharing request
    * **No data retention**: Documents are not stored on Cashfree servers after verification
    * **Audit trails**: Complete verification logs for compliance requirements
    * **UIDAI compliance**: Follows all Aadhaar handling guidelines and DPDP Act requirements
    * **Real-time verification**: Direct integration with government databases ensures authenticity
  </Tab>
</Tabs>

## Best practices

Follow these recommendations to optimise your DigiLocker integration and ensure reliable document verification:

* **User experience**: Provide clear instructions about the DigiLocker process to reduce abandonment rates and improve completion.
* **Link management**: Monitor link expiry times and implement retry mechanisms for expired verification attempts.
* **Consent handling**: Respect user consent decisions and provide alternative verification methods if DigiLocker consent is denied.
* **Data compliance**: Implement proper data retention policies following DPDP Act guidelines for document verification records.
* **Error recovery**: Build robust error handling for network issues, government service downtime, and authentication failures.
* **Security measures**: Store API credentials securely and use HTTPS for all webhook endpoints and redirect URLs.
* **Status monitoring**: Implement real-time status checking to provide users with verification progress updates.
* **Fallback options**: Offer alternative verification methods when DigiLocker is unavailable or users can't complete the flow.
* **Document validation**: Cross-verify retrieved document data with your existing user information for additional security.
* **Performance optimisation**: Cache verification results appropriately while respecting data privacy regulations.

<snippet>snippets/related-topics-loader.mdx</snippet>

<div class="hidden" data-table-of-contents="bottom">
  <p class="mt-4 font-medium flex items-center gap-2 related-docs-heading">
    <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="w-4 h-4">
      <path d="M3 4h7a2 2 0 0 1 2 2v13a2 2 0 0 0-2-2H3z" />

      <path d="M21 4h-7a2 2 0 0 0-2 2v13a2 2 0 0 1 2-2h7z" />
    </svg>

    <span>Related topics</span>
  </p>

  <ul>
    <li><a href="/docs/api-reference/vrs/v2/digilocker/verify-digilocker-account">Verify DigiLocker Account API</a></li>
    <li><a href="/docs/api-reference/vrs/v2/digilocker/create-digilocker-url">Create DigiLocker Link API</a></li>
    <li><a href="/docs/api-reference/vrs/v2/digilocker/get-digilocker-verification-status">Get DigiLocker Status API</a></li>
    <li><a href="/docs/secure-id/digilocker/digilocker-faqs">DigiLocker FAQs</a></li>
  </ul>
</div>
