This section explains how to integrate DigiLocker workflows on the client side using the provided API endpoints.
1. Account Verification (Optional, for Dynamic Orchestration)
- Step 1: Call
/digilocker/verify_accountwith the user's mobile number. - Step 2: Based on the response:
- If the account exists, set
redirect_to_signuptofalsein the next step. - If the account does not exist, set
redirect_to_signuptotrue.
- If the account exists, set
- This step is optional and only required if you want to orchestrate dynamic user journeys.
2. Initiate DigiLocker Session
- Call
/digilocker/initiate_sessionwith required parameters. - Pass
redirect_urlwhere the user will be redirected after completing DigiLocker authentication. - If you want the user to sign up for DigiLocker, set
redirect_to_signuptotrue; otherwise, set it tofalse. - For document consent, use the
documents_for_consentarray. Document codes can be fetched from/digilocker/doc_master. - To maintain state pass
statewith a valid string. This state will be returned as query parameter in theredirect_url.
3. Handle Redirect and Obtain Reference Key
- After the user completes the DigiLocker flow, they will be redirected to your specified
redirect_urlwithcodeandcode_verifieras query parameters. - Pass these values to
/digilocker/get_referenceto obtain areference_key(valid for 1 hour).
4. Fetch User Documents
- Use the
reference_keyto fetch documents the user has consented to. - For issued documents, call
/digilocker/issued_docsto get a list of available documents. - To fetch a specific document, use
/digilocker/get_issued_docs(for binary files) or/digilocker/get_issued_docs_xml(for XML files). Both require thereference_keyand an additionaluriparameter, which you can obtain from/digilocker/issued_docs.
Notes
- Document codes for consent can be retrieved from
/digilocker/doc_master. - The
reference_keyexpires in 1 hour; ensure document fetch operations are completed within this window. - All endpoints require API key and client ID authentication.
This workflow enables seamless DigiLocker integration for document verification and consent management.
