Skip to main content
DigiLocker returns documents the user already holds, after they sign in and consent. Your server starts the session, the user consents on a hosted page, and your callback exchanges the one-time code.
1

Set your credentials

Use https://dev.idto.ai (staging) while you build and https://prod.idto.ai (production) when you go live. Keep the client ID and API key on your server only. Never ship them to a browser or a mobile app.
.env
2

Start a session

POST /verify/digilocker/initiate_session with consent: true, a consent_purpose, and the redirect_url of your own callback. The response carries the hosted url.
200
3

Send the user to the URL

Redirect the browser to url. The user signs in to DigiLocker and approves sharing.
4

Exchange the code on your callback

The hosted page redirects to your redirect_url with code and codeVerifier (plus clientId and state). A code works once, so pick one exchange:
  • Identity: POST /v2/verify/digilocker with code and code_verifier, as in the callback route above.
  • Documents: POST /verify/digilocker/get_reference with code and code_verifier, then POST /verify/digilocker/user_details or POST /verify/digilocker/fetch_aadhaar with the returned reference_key.
With the identity exchange, your callback route returns the verified profile:
200

Good to know

  • Starting a session is charged. chargeble: "true" in the response confirms it.
  • Use a redirect_url on your own HTTPS domain, and check state on the callback if you set one.
Was this page helpful? Email us at tech@idto.ai with the page link.
Last modified on October 4, 2026