Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
179 changes: 179 additions & 0 deletions content/data/digilocker/pulldrivinglicense.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
---
sidebar_title: Pull Driving Licence via Digilocker
page_title: Digilocker quickstart
order: 1
visible_in_sidebar: true
---


## Pull Driving Licence via Digilocker

Use this flow to fetch a user's Driving Licence from Digilocker via Setu APIs. This involves two steps:

1. Redirect the user to complete the consent journey.
2. Fetch the Driving Licence document after consent is granted.

<hr class="primary" />

### 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.


<Row>
<Portion desktopSpan="whole">
<Tabs
tabs={[
{
key: "1",
label: "200",
content: (
<>
<p>
<Badge type="success">SUCCESS</Badge> Setu has processed your
request successfully.
</p>
<hr className="tertiary" />
<h5>Request</h5>
<CodeBlockWithCopy language="json">
{`POST /api/digilocker/

{
"redirectUrl": "https://setu.co",
"docType": "DRVLC"
} `}
</CodeBlockWithCopy>
<hr className="tertiary" />
<h5>Response</h5>

<CodeBlockWithCopy language="json">
{`{
"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"
} `}
</CodeBlockWithCopy>

<p>You will get the following details—</p>
<ul>
<li>
Unique DigiLocker request <code>id</code> which can be used to
manage this request.
</li>
<li>
The status will be <code>unauthenticated</code> for requests
that do not have user consent yet and will change to{" "}
<code>authenticated</code> once the user has provided their
consent. You can check the status of a request at any point of
time, using the <strong>Get DigiLocker request status</strong>{" "}
API.
</li>
<li>
The <code>url</code> from the response should be used to
redirect your user to Sign in / Sign up and provide consent to
access their DigiLocker.
</li>
<li>
Validity of this request in <code>ISO 8601 format</code>{" "}
timestamp, after which the request is expired and deleted.
</li>
</ul>
</>
),
},
]}
></Tabs>
</Portion>
</Row>

### 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.

<hr class="primary" />

## 2. Fetch the Driving Licence document

After the user grants consent, use the following API to fetch their Driving Licence.

<Row>
<Portion desktopSpan="whole">
<Tabs
tabs={[
{
key: "1",
label: "200",
content: (
<>
<p>
<Badge type="success">SUCCESS</Badge> Setu has processed your
request successfully.
</p>
<hr className="tertiary" />
<h5>Request</h5>
<CodeBlockWithCopy language="json">
{`POST /api/digilocker/:requestId/document

{
"docType": "DRVLC",
"orgId": "002202",
"format": "pdf",
"consent": "Y",
"parameters": [
{
"name": "dlno",
"value": "MH4820240007455"
}
] `}
</CodeBlockWithCopy>
<hr className="tertiary" />
<p>Request parameter details—</p>
<ul>
<li>
docType : Document type. Always use "DRVLC" for Driving Licence.
</li>
<li>
orgId : Organisation ID provided by Setu.
</li>
<li>
format : Format of the returned document. Use "pdf" or "xml".
</li>
<li>
consent : Must be "Y" (yes). Indicates user has granted consent.
</li>
<li>
parameters : Required inputs to identify the document. For DL, use the "dlno" param.
</li>
</ul>
<h5>Response</h5>

<CodeBlockWithCopy language="json">
{`{
"fileUrl": "https://dg-prod.s3.amazonaws.com/f7d7c996-a36d-4442-b1,
"validUpto": "2025-04-30T13:21:16+05:30"
} `}
</CodeBlockWithCopy>
<p>You will get the following details—</p>
<ul>
<li>
fileUrl : URL to download the Driving Licence document.
</li>
<li>
validUpto : Timestamp until the document URL is valid.
</li>
</ul>
</>
),
},
]}
></Tabs>
</Portion>
</Row>
Loading