Skip to main content
POST
Exchange the DigiLocker code for a reference key
Step 2 of the DigiLocker flow. Send the code and codeVerifier your redirect_url received. You get back a reference_key, valid for one hour, to use with DigiLocker user details and Download the e-Aadhaar XML. Call it as soon as the redirect arrives: the code is short-lived and works once.

Environments

Billing

Charged only when the response status is success, which is every time a reference_key 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.
If you only need the holder’s profile, use DigiLocker profile instead: it exchanges the same code in one call, returns a masked profile and supports Idempotency-Key.

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
code
string
required

The code query parameter on your redirect_url.

code_verifier
string
required

The codeVerifier query parameter on your redirect_url.

user_id
string

Response

Reference key issued. Charged.

status
enum<string>
Available options:
success
reference_key
string
expires_at
string

UTC, ISO 8601 without a zone suffix. One hour after issue.

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 October 4, 2026