#Pull Driving Licence
Use this flow to fetch a user's Driving Licence from Digilocker via Setu APIs. This involves two steps:
- Redirect the user to complete the consent journey.
- Fetch the Driving Licence document after consent is granted.
#1. Redirect user to Digilocker
Initiate the consent flow by creating a Digilocker session. This will return a URL where the user can log in and share their Driving Licence.
Setu has processed your request successfully.
Request
POST /api/digilocker/{"redirectUrl": "https://setu.co","docType": "DRVLC"}
Response
{"id": "ea31e1e6-96eb-4e56-a355-7bc51de94d24","status": "unauthenticated", //ENUM values—unauthenticated | authenticated | revoked"url": "User login url","validUpto": "2021-10-05T19:06:28+05:30"}
You will get the following details—
- Unique DigiLocker request
id
which can be used to manage this request. - The status will be
unauthenticated
for requests that do not have user consent yet and will change toauthenticated
once the user has provided their consent. You can check the status of a request at any point of time, using the Get DigiLocker request status API. - The
url
from the response should be used to redirect your user to Sign in / Sign up and provide consent to access their DigiLocker. - Validity of this request in
ISO 8601 format
timestamp, after which the request is expired and deleted.
#What happens during the consent journey?
The user will be redirected to Digilocker to:
- Verify their Aadhaar using OTP
- Enter their 6-digit security PIN
- Select documents (e.g. Driving Licence) to share
- Grant consent to share the document
Once completed, you can fetch the document using the request ID from Step 1.
#2. Fetch the Driving Licence document
After the user grants consent, use the following API to fetch their Driving Licence.
Setu has processed your request successfully.
Request
POST /api/digilocker/:requestId/document{"docType": "DRVLC","orgId": "002202","format": "pdf","consent": "Y","parameters": [{"name": "dlno","value": "MH4820240007455"}]
Request parameter details—
- docType : Document type. Always use "DRVLC" for Driving Licence.
- orgId : Organisation ID provided by Setu.
- format : Format of the returned document. Use "pdf" or "xml".
- consent : Must be "Y" (yes). Indicates user has granted consent.
- parameters : Required inputs to identify the document. For DL, use the "dlno" param.
Response
{"fileUrl": "https://dg-prod.s3.amazonaws.com/f7d7c996-a36d-4442-b1,"validUpto": "2025-04-30T13:21:16+05:30"}
You will get the following details—
- fileUrl : URL to download the Driving Licence document.
- validUpto : Timestamp until the document URL is valid.