Skip to main content

DigiLocker Fetch Document API

The following document highlights the details of the DigiLocker Fetch Document API.

API Description

Objective

The DigiLocker Fetch Document API retrieves documents from DigiLocker. For the documents that are non-issued, the API issues them before returning the document data.

InputOutput
Document parameters required for retrieving documents from DigiLocker. These parameters are retrieved from the DigiLocker Pull Parameters API responses.The requested documents with their associated data from DigiLocker

API URL

https://ind-verify.hyperverge.co/api/digilocker/fetchDocuments

API Endpoint

fetchDocuments

Overview

The DigiLocker Fetch Document API is RESTful and uses standard HTTP verbs and status codes. The responses are in JSON format and you should upload all images and files as form-data through a POST request.

Method - POST

Authentication

You need a unique pair of application ID ( appId ) and application key ( appKey ) from HyperVerge to verify your identity for accessing the API.

Headers

HeaderMandatory / OptionalDescriptionInput Format
content-type MandatoryThis parameter defines the media type for the request payloadapplication/json
appId MandatoryThe application identifier shared by HyperVerge. You can find the details in the dashboard's credentials tabThis should be a unique value
appKey MandatoryThe application key shared by HyperVerge. You can find the details in the dashboard's credentials tabThis should be a unique value
transactionIdOptionalA unique identifier for tracking a user journeyThis should be both unique and easily associated with the user's journey in your application(s)

Inputs

The following tables provide the details of the parameters required for the DigiLocker Fetch Document API's request body. Depending on the type of document being retrieved, the parameters are categorised into the following two groups:

ParameterMandatory / OptionalTypeDescriptionInput FormatDefault Value
referenceIdMandatorystringThe parameter that represents the unique reference identifier generated in the initial requestNot ApplicableNot Applicable
docsMandatoryarrayThe parameter that contains the collection of document parametersNot ApplicableNot Applicable
docs.uriMandatorystringThe parameter that specifies the unique URI for every document. This can be received from the fetch issued document APINot ApplicableNot Applicable
docs.fileOptionalstringThe parameter that indicates if the document is needed in file format. When set to yes, an s3 url with a validity of 15 minutes will be returnedyes / noNot Applicable
useUpstreamStatusOptionalstringThe parameter that controls whether the API returns a failure response (with status code 504) when it fails to retrieve all the documents specified in the request. When set to "yes", the API returns a failure responseyes / noNot Applicable
returnAllFieldsFromDigilockerOptionalstringThe parameter that controls whether the API retrieves all the fields for PAN and DL from the DigiLocker accountyes / noNot Applicable
useV2StorageLocationOptionalstringThe parameter that enables dashboard visibility. When set to "yes", you can view the data in the dashboardyes / nono

Request

The following code snippet demonstrates standard curl requests for the DigiLocker Fetch Document API:

curl --location --request POST 'https://ind-verify.hyperverge.co/api/digilocker/fetchDocuments' \
--header 'appid: <appId-shared-by-HyperVerge>' \
--header 'appKey: <appKey-shared-by-HyperVerge>' \
--header 'Content-Type: application/json' \
--data-raw '{
"referenceId": "test-fetch-id",
"docs": [
{
"uri": "in.gov.cbse-SSCER-1234",
"file": "no"
}
]
}'

Success Response

The following code snippet demonstrates success responses from the DigiLocker Fetch Document API:

{
"status": "success",
"statusCode": "200",
"result": [
{
"uri": "in.gov.cbse-SSCER-53969032016",
"data": {
"number": "123456",
"name": "John Doe",
"dob": "01-02-93",
"address": "permanent, IN",
"photo": "",
"file": "https://example.com"
}
}
]
}

Success Response Details

The following table outlines the details of the success response from the DigiLocker Fetch Document API:

ParameterTypeDescription
statusstringThe status of the request
statusCodestringThe HTTP status code for the response
resultarrayAn array of objects, each containing document data
result[].uristringThe unique URI for issued documents (present for issued documents only)
result[].docIdstringThe document ID for non-issued documents (present for non-issued documents only)
result[].dataobjectAn object containing the document data including number, name, dob, address, photo, and file URL
result[].data.numberstringThe document number
result[].data.namestringThe name associated with the document
result[].data.dobstringThe date of birth associated with the document
result[].data.addressstringThe address associated with the document
result[].data.photostringThe photo URL or data associated with the document
result[].data.filestringThe file URL for the document

Error Responses

The following are some error responses from the DigiLocker Fetch Document API:

{
"status": "success",
"statusCode": "200",
"result": [
{
"docId": "000027_SSCER",
"error": {
"error": "repository_service_configerror",
"error_description": "No Record Found! Try Again.."
}
}
]
}
{
"status": "failure",
"statusCode": "504",
"error": {
"code": "ER_DIGILOCKER_REPO_SERVICE_UNPUBLISHED",
"message": "Error Connecting to digilocker. Please try again after sometime."
}
}

Error Response Details

A failure or error response contains an error object within the result array for the specific document ID or URI that failed, or returns a failure status with an error code.
The following table lists all error responses:

Status CodeError MessageError DescriptionError Resolution
200No Record Found! Try Again..The requested document could not be found in the repository. Please verify the document ID and try again.Verify that the document ID or URI is correct and that the document exists in DigiLocker. Ensure the user has granted proper consent and the document is available in their DigiLocker account.
200PAN DOB not matched with Aadhaar dataThe date of birth associated with the PAN provided does not match the data in the Aadhaar database. Please ensure that the date of birth provided matches the records linked with the Aadhaar number.Verify that the date of birth matches between PAN and Aadhaar records. Ensure the user's DigiLocker account has the correct Aadhaar-linked information.
400Please try verifying the refIdYou have provided an invalid reference ID. Please verify the reference ID and retry the request.Verify that the referenceId matches the one used in the DigiLocker Consent Start API request and that it is valid.
400referenceId is requiredThe reference ID is a mandatory parameter for this request. Please ensure that you provide a valid reference ID in the request.Provide a valid referenceId in the request body. The referenceId should be the same one used in the initial DigiLocker consent flow.
400docId is requiredThe document ID is a mandatory parameter for this request. Please ensure that you provide a valid document ID in the request.Provide a valid docId in the request body for non-issued documents. The docId should be in the format orgId_docType.
504No file found for given URIThe API failed to find the requested document associated with the given URI(s) in the repository. Please verify the URI and retry the request.Verify that the URI is correct and that the document exists in DigiLocker. Ensure the URI was obtained from a valid issued document fetch operation.
504Error Connecting to digilocker. Please try again after sometime.An error occurred while attempting to connect to the Digilocker repository service. Please retry the operation after some time. If the issue persists, please contact the HyperVerge team for further assistance.Retry the request after some time. If the issue persists, contact the HyperVerge team for resolution. This error may occur due to DigiLocker service unavailability or configuration issues.
Was this helpful?
Ask AIBeta
Hi! How can I help?
Ask me anything about HyperVerge products, APIs, and SDKs.
Try asking: