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/digilockerwithcodeandcode_verifier, as in the callback route above. - Documents:
POST /verify/digilocker/get_referencewithcodeandcode_verifier, thenPOST /verify/digilocker/user_detailsorPOST /verify/digilocker/fetch_aadhaarwith the returnedreference_key.
200
Good to know
- Starting a session is charged.
chargeble: "true"in the response confirms it. - Use a
redirect_urlon your own HTTPS domain, and checkstateon the callback if you set one.