Skip to main content
POST
Connect a DigiLocker account
DigiLocker is the government document wallet linked to a person’s Aadhaar. With the holder’s consent, this endpoint returns their DigiLocker profile: DigiLocker id, name, date of birth, gender, masked mobile and email, and whether Aadhaar is linked. Nothing is typed by the holder except their DigiLocker sign-in, so there is no OCR error to handle.

Get code and code_verifier

  1. Call Start a DigiLocker session from your server with your redirect_url. It returns a url.
  2. Open the url in the holder’s browser. They sign in to DigiLocker and consent.
  3. The browser lands on your redirect_url with the query parameters code, codeVerifier, clientId and state.
  4. Send code and codeVerifier to this endpoint as code and code_verifier.
A code can be exchanged once. Use it either here or with Get a reference key (to download the e-Aadhaar XML), not both. The DigiLocker consent recipe and the DigiLocker guide walk through the whole flow.

Environments

How to read the result

  • 200 with error_code: null and data: the profile was returned. This is the only billed outcome. There is no IDTO_202 result.
  • data.dob is YYYY-MM-DD. data.gender is as DigiLocker returns it.
  • data.extras.mobile and data.extras.email are masked. data.extras.eaadhaar_linked is true when Aadhaar is linked to the DigiLocker account.
  • An expired, reused or invalid code is a 400 IDTO_001 and is not billed. Start the session again to get a new code.
Send an Idempotency-Key header. A retry with the same key and body returns the first response, which matters here because the code itself cannot be exchanged twice. See Idempotency.

Errors

A missing or wrong X-Client-ID / X-API-Key pair returns 401 with a detail string and is not billed. The full code list is in v2 error codes.

Test scenarios

See the 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.

Headers

Idempotency-Key
string

Make retries of this exact request safe. If the same key is replayed with an identical request body, the original result is returned without re-running the verification or billing again. If the same key is replayed with a different body, the request is rejected with IDTO_010 (422). Omitting this header runs every request as new.

Maximum string length: 255

Body

application/json
code
string
required

The authorization code from the DigiLocker redirect. Single use.

Maximum string length: 512
code_verifier
string
required

The PKCE code verifier used when the authorization URL was built.

Maximum string length: 512
user_id
string

Response

The code was exchanged and the profile returned. There is no IDTO_202 outcome. extras.mobile and extras.email are masked.

status
enum<string>
required
Available options:
success
message
string
required
error_code
string | null
required

null on a full match, an IDTO_2xx code on a definitive no-record result. Both are billed.

data
object | null
required
billed
enum<boolean>
required
Available options:
true
tranx_id
string | null
timestamp
string<date-time> | null
Last modified on December 1, 2026