Skip to main content
POST
Start a DigiLocker consent session
Step 1 of the DigiLocker flow. Call it from your server with the page you want the user to come back to. It returns a url; open it in the user’s browser. The user signs in to DigiLocker and consents, then their browser is sent to your redirect_url with these query parameters: Then exchange the code with either DigiLocker profile (v2, masked, normalised profile) or Get a reference key (v1, needed to download the e-Aadhaar XML). Each code works once.

Environments

Billing

Charged only when the response status is success, which is every time a url is returned. A charged JSON response also carries "chargeble": "true" and "user_consent": "true" (spelled as the API returns them).
This endpoint has no idempotency support. A retry after a timeout runs the call again and can be charged twice.

Request notes

  • redirect_url must be a full URL you control. It receives the code, so serve it over HTTPS.
  • state comes back unchanged. Use letters, digits, - and _ only; other characters can be cut short on the way back.
  • redirect_to_signup: true opens DigiLocker’s sign-up page instead of sign-in, for users without an account. Check first with Check a DigiLocker account.
  • consent and consent_purpose are required. Record the user’s consent before you call.
  • The returned url carries your brand name, as set on your idto account, in its service_name parameter. Open the url as returned; do not rebuild it.

Errors

Test scenarios

Questions: Aadhaar FAQ. Was this page helpful? Email us at tech@idto.ai with the page link.

Authorizations

X-Client-ID
string
header
default:<client-id>
required

The Client ID shown on the API Credentials page of the idto dashboard. It is not your account or customer ID, which returns 401. Send it on every server-to-server request together with X-API-Key. Staging and production client IDs are different.

X-API-Key
string
header
default:<api-key>
required

Your API key from the idto dashboard (API credentials). Keep it on your server; never ship it in a browser or mobile app. Send it on every server-to-server request together with X-Client-ID.

Body

application/json

The end user has consented to share their DigiLocker data.

Why you are asking, in plain words.

redirect_url
string<uri>
required

Your page that receives code and codeVerifier.

redirect_to_signup
boolean
default:false

true opens DigiLocker sign-up instead of sign-in.

Optional. Passed to DigiLocker as the documents to request consent for.

state
string

Your own value, returned unchanged on the redirect. Use letters, digits, - and _ only.

user_id
string

Response

Session URL created. Charged.

status
enum<string>
Available options:
success
code
enum<integer>
Available options:
1000
url
string

Open this in the end user's browser.

chargeble
enum<string>

"true" on a charged call.

Available options:
true

"true" on a charged call.

Available options:
true
tranx_id
string

idto transaction id. Quote it to support.

timestamp
string
Last modified on December 1, 2026