Skip to main content

Mask Aadhaar API

API Description

Objective

The Mask Aadhaar API hides the valid Aadhaar numbers and the associated QR (quick response) code in any document by blurring them for privacy and security reasons.

InputOutput
Images or files with user's AadhaarThe masked Aadhaar

API URL

https://ind-ckyc.hyperverge.co/api/v1/maskAadhaar

API Endpoint

maskAadhaar

Overview

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

Authentication

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

API Request Details

Method - POST

Headers

ParameterMandatory or OptionalDescriptionValid Values
content-type MandatoryThe media type for the request payload.multipart/form-data
appId MandatoryThe Application ID provided by HyperVergeThis should be a unique value provided by HyperVerge.
appKey MandatoryThe Application Key provided by HyperVergeThis should be a unique value provided by HyperVerge.
transactionIdMandatoryA custom unique identifier for a user journey or transaction.This should be a unique value configured by you.

Input

The following table provides the complete information on the parameters used in the request body for the API call.

ParameterDescriptionMandatory or OptionalAccepted ValuesDefault Value
fileImages or files to be maskedMandatoryNot applicableNot applicable
maskStandardAadhaarOnlyIf set to "yes", masks only the first 8 digits of the user's Aadhaar numberOptional"yes" or "no""no"
maskFullAadhaarIf set to "yes", masks all 12 digits of the user's Aadhaar numberOptional"yes" or "no""no"
maskQRIf set to "yes", masks the QR code associated with the user's AadhaarOptional"yes" or "no""yes"
returnMaskingInfoIf set to "yes", the API returns the maskingInfo.masked field with the details of the masking resultOptional"yes" or "no""no"
returnInputImageIf set to "yes", the API returns the input image as a URL that expires after 15 minutesOptional"yes" or "no""no"
maskAllAadhaarNumbersIf set to "yes", the API uses a more generic OCR to mask all Aadhaar numbers in the documentOptional"yes" or "no""no"
flagNonAadhaarCardsParameter to enhance Non-Aadhaar document classification; this works only when maskAllAadhaarNumbers is set to "yes".Optional"yes" or "no""no"
checkPreMasked

If set to "yes", the API checks if the Aadhaar is already masked.

Note
Ensure that you enable the returnMaskingInfo parameter to retrieve the pre-masked information under the returnMaskingInfo field of the response, if applicable.

Optional"yes" or "no""no"

Request

The following code snippets demonstrate standard curl requests for the API:

curl --location --request POST 'https://ind-ckyc.hyperverge.co/api/v1/maskAadhaar' \
--header 'appId: <Enter_the_HyperVerge_appId>' \
--header 'appKey: <Enter_the_HyperVerge_appKey>' \
--header 'transactionId: <Enter_the_HyperVerge_transactionID>' \
--form 'file=@"<Path_to_the_File(s)>"'

Success Response

The following code snippet demonstrates a success responses from the API. It includes information about the document type, input file name, masked file name, occurrences of standard and non-standard Aadhaar numbers, masked file URL, total pages, and page-wise masked occurrences.

{
"status": "success",
"statusCode": "200",
"result": {
"docType": "<STANDARD_AADHAAR or NON_STANDARD_AADHAAR or NOT_AADHAAR or NOT_SURE>",
"inputFile": "fileName",
"maskedFile": "fileName_Masked",
"maskedOccurrences": {
"standardAadhaar": 0,
"nonStandardAadhaar": 2
},
"maskedFileUrl": "<masked_url>",
"totalPages": 1,
"pageDetails": [
{
"page": 1,
"maskedOccurrences": {
"standardAadhaar": 0,
"nonStandardAadhaar": 2
}
}
]
}
}

Output Sample

Masked Aadhaar Sample

caution

To ensure user privacy, the name and photograph in the preceding image have been intentionally blurred. In the final output, only the Aadhaar number and the QR code will be masked.

Success Response Details

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

ParameterValueDescription
docTypeSTANDARD_AADHAARDetected a basic or standard Aadhaar
NON_STANDARD_AADHAARDetected a non-standard or alternative format of Aadhaar
NOT_AADHAARDetected a document that is not an Aadhaar
NOT_SUREDetected a document that is not identified as any of the aforementioned typess
maskingInfo.masked"yes"The document was masked successfully
"pre_masked"The document is already masked
"not_sure"The masking was unsuccessful and the API failed to determine if the card was pre-masked

Error Responses

The following are some error responses from the API:

{
"status": "failure",
"statusCode": "400",
"error": {
"code": "ER_FILE_NOT_FOUND",
"message": "No file attached"
}
}

Error Response Details

A failure or error response contains a failure status with a relevant status code and error message. The following table lists all error responses:

Status CodeError MessageError Description
400No file attachedThe request is missing the file that should have the user's Aadhaar.
400Pages exceeded the supported length of 5The API supports input files up to five pages in length.
401Missing/Invalid credentialsMissing or invalid credentials in the request.
413File too largeThe API does not support the input file size.
500Internal Server ErrorKindly check the request headers or contact the HyperVerge team for resolution.
Was this helpful?
Ask AIBeta
Hi! How can I help?
Ask me anything about HyperVerge products, APIs, and SDKs.
Try asking: