Get XML (PAN/Aadhaar/etc)
Download XML for one DigiLocker document by URI. Server-side POST with Bearer, AccessToken, and DocumentURI from Get issued files.
API reference
JWT Bearer token authentication. Obtain a token from the KwikID dashboard.
In: header
Header Parameters
DigiLocker session token for this user after the hosted Init flow completed (same header as Get issued files). Not your API Bearer token.
stringThe document uri from issued_files.items[] returned by Get issued files for the file you want (PAN, Aadhaar, etc.).
stringOptional. Send {} when you have no extra fields (typical for this route).
Empty Object
Response Body
curl -X POST "https://__mock__/verification/v2/digilocker/get_document_xml" \ -H "AccessToken: string" \ -H "DocumentURI: string" \ -H "Content-Type: application/json" \ -d '{}'{
"document_xml": "string"
}{
"detail": {},
"message": "string"
}{
"detail": {},
"message": "string"
}{
"error": "string"
}Overview
Call POST /verification/v2/digilocker/get_document_xml from your backend after DigiLocker OAuth has completed and you know which document you need. You send:
Authorization: Bearer <token>- your KwikID Verification API credential (same model as Init).AccessTokenheader - the DigiLocker session token for this user after the hosted flow completes (same value as Get issued files).DocumentURIheader - theurifrom the row you chose inissued_files.itemsfrom Get issued files.
On success, the JSON body includes document_xml: an XML string for many issuers (PAN, Aadhaar, and others). Parse it with your XML stack; certificate-level field notes are in DigiLocker API. Treat the body as sensitive.
Key features
- Three headers: API Bearer, DigiLocker
AccessToken, andDocumentURI(the issued-fileuri). All are required for this route as documented in OpenAPI. - Server-side only: Do not put your API Bearer token in a browser or mobile client.
- Per-document fetch: Unlike Get Aadhaar XML, this call targets one URI you select from the issued list.
Implementation
Prerequisites
- Completed DigiLocker flow for this user (after Init and user consent).
- Valid
AccessTokenfor that DigiLocker session. - A
urifromissued_files.itemsfor the document you want.
Step 1: Call from your backend
| Header | Required | Purpose |
|---|---|---|
Authorization | Yes | Bearer <token> for the Verification API. |
AccessToken | Yes | DigiLocker access token for this user session after OAuth. |
DocumentURI | Yes | The uri value for the chosen row in issued_files.items. |
POST /verification/v2/digilocker/get_document_xml HTTP/1.1
Host: <verification-api-base-url>
Authorization: Bearer <token>
AccessToken: <digilocker-access-token>
DocumentURI: <uri-from-issued-files-item>
Content-Type: application/json
{}Use your real base URL (production or sandbox from KwikID). Send {} in the body when you have no extra fields.
Step 2: Use the response
On 200 OK, read document_xml (string). Map certificate paths for PAN or other types using DigiLocker API.
Do: Log correlation IDs only; do not log full XML or tokens in plain text.
Do not: Expose AccessToken, DocumentURI, or document_xml to untrusted clients or analytics.
End-to-end placement
Error handling
| HTTP status | When |
|---|---|
| 400 | Bad or missing headers, malformed request, or validation failure. See OpenAPI ValidationError. |
| 401 | Invalid or expired Bearer token. See AuthenticationError. |
| 500 | Server error on KwikID side. Retry with backoff; verify tokens and DigiLocker session with support if it persists. |
Security notes
Warning: document_xml can contain strong identifiers and personal data. Store and transmit it only under your compliance and vault policies. Use HTTPS for all calls.
- Keep Bearer,
AccessToken, andDocumentURIon servers you control.
Benefits
- Fetches one issued document by URI without embedding DigiLocker protocol details in your client app.
- Reuses the same Init then issued files then XML pattern as the rest of the DigiLocker suite.
Next steps
Get Issued Files POST
List documents issued to DigiLocker for the user after OAuth. Server-side POST with Bearer plus AccessToken. Use URIs with Get XML for file content.
Authenticate POST
Verify PAN with holder demographics and explicit consent. Server-side POST with Bearer. Returns message plus transaction ids for reconciliation.