Document API

Call this API to do a Document Verification without AAI's Frontend.

Request Example:

curl -X POST \
  https://sg-api.advance.ai/intl/openapi/identity-risk/idvs-h5/ekyc/v1/api/document \
  -H 'Content-Type: application/json' \
  -H 'X-ACCESS-TOKEN:{Your Access Token}' \
  -d '{
"callbackUrl": "https://www.example.com/callback",
"bizId": "7ac66c0f148de9519b8bd264312c4d64", 
"userId":"8e44f0089b076e18a718eb9ca3d94674",
"region":"THA",
"language": "en-US",
"docType": "TH-ID-N",
"productLevel": "ADVANCED",
"frontImageBase64":"YWJjZGVmZw==", // use real image base64 string
"bizCode":"WhiteCard"
}'

Request Url

https://api.advance.ai/intl/openapi/identity-risk/idvs-h5/ekyc/v1/api/document
POST (application/json)
https://sg-api.advance.ai/intl/openapi/identity-risk/idvs-h5/ekyc/v1/api/document
POST (application/json)
https://ph-api.advance.ai/intl/openapi/identity-risk/idvs-h5/ekyc/v1/api/document
POST (application/json)
https://th-api.advance.ai/intl/openapi/identity-risk/idvs-h5/ekyc/v1/api/document
POST (application/json)
https://my-api.advance.ai/intl/openapi/identity-risk/idvs-h5/ekyc/v1/api/document
POST (application/json)
https://vn-api.advance.ai/intl/openapi/identity-risk/idvs-h5/ekyc/v1/api/document
POST (application/json)

Request Header Parameters

ParameterDescription
X-ACCESS-TOKENstring Please use Token Authentication API to get your access token

Request Parameters

Parameter

Description

callbackUrl

Deprecated, please use Webhook instead. string [Optional] The target URL to notify the caller after the Verification finished. Max Length 2048 characters. Refer to Callback Notification

bizId

string The unique business id to identify the business transaction that triggered this Verification processing, such as order id.

userId

string [Optional] The unique userId to identify the user who is performing the Verification.

region

string The region of the service support. Refer to ISO ALPHA-3 Country Code

docType

string [optional] Suggests the document type that user should use. Refer to Supported Regions & DocTypes

bizCode

string [Optional] The business type of the user. max size of the length is 32. only support characters a-zA-z0-9.

productLevel

string Refer to ProductLevel

frontImageBase64

string The front image of the document. Please provide either frontImageBase64 or frontImageUrl. Refer to Image Requirements

frontImageUrl

string The front image of the document. Should not expire in 1 hour. Please provide either frontImageBase64 or frontImageUrl. Refer to Image Requirements .

backImageBase64

string The back image of the document. [Required] when the docType is two-sides. Please provide either backImageBase64 or backImageBase64. Refer to Image Requirements .

backImageUrl

string The back image of the document. Should be valid for at least 1 hour. Please provide either backImageBase64 or backImageBase64. Refer to Image Requirements .

returnImageType

enum [Optional] default to URL. Refer to ReturnImageType

ProductLevel

The productLevel defines the tier of the Identity Verification(..DV, LD, FA) service. Please consult with our sales representative to determine the tier that best aligns with your business requirements and use the granted product level for your API request submission.

Supported ValuesDescription
STANDARDBasic compliance / High coverage rate / Acceptable accuracy
ADVANCEDMedium compliance / High pass rate / High accuracy
PROStrong compliance / Enhanced accuracy

ReturnImageType

Supported ValuesDescription
URLthe value of the image fields in the response will be image urls , so the caller can download images.
BASE64the value of image fields in the repsone will be base64 encoded string of image bytes.

Response Description

the response data structure is similar with Get Result API's Response.

ParameterDescription
codeResponse's Status Code
transactionIdThe request id, the max length is 64
pricingStrategyDeprecated, Always return FREE
messageStatus Code Explanation
dataobject : the business result of Verification
extraExtra response info (Exception Message)

Response.code

Status CodeMessage
SUCCESSOK
PARAMETER_ERRORParameter error, please check you input.
Parameter should not be empty
Region is wrong
Invalid image format, image format should be one of jpeg/jpg/png, and request content type should be image/jpeg or image/png
Invalid image size, max image size should be less than 2M, and image dimension should be between 256 * 256 and 4096 * 4096
The image download has exceeded 3 seconds. Please check the network and operate again.
No image found
SIGNATURE_NOT_EXISTThis signatureId is not exist.
ERRORServer error.

Response.data

FieldDescription
signatureIdstring, the signatureId of this verification transaction.
overallResultstring, The result code of this verification transaction.
idvResultstring, The result code of this verification transaction. (will be deprecated, use overallResult instead)
errorCodestring, The fail reason when overallResult is fail
docDetailobject, The detail of the doc results. Refer to DocDetail.
countryCodeIso3string, the region in the Request Parameters.

overallResult

overallResult is the result code of the Verification, the value is same with DocDetail.ocrResult.

ValueDescription
PASSthe user passed the verification check.
FAILthe user failed the verification check.
nullthe overallResult is still in processing, please wait and use Get Result API to get final overallResult.

errorCode

Response.data.overallResultValueDescription
PASSSUCCESSThe user passed the verification.
FAILNO_FACE_DETECTEDNo face detected on the front image of the document.
CARD_INFO_MISMATCHThe front part and the back part of the two-side document do not match with each other.
ID_FORGERY_DETECTEDThe document (only the front part if the document is two-side) is forgery.
NO_SUPPORTED_CARDThe card type detected from the document image is not supported.
CARD_TYPE_MISMATCHThe card type detected from the document image doesn't match with the docType from the Generate URL API or submitted the wrong side of the card.
CARD_LOW_QUALITY_IMAGEThe document images are too poor to do verification.
INCOMPLETED_CARDThe card is not completed in the document images.
TOO_MANY_CARDSMore than one cards were detected.
CARD_NOT_FOUNDCan't detect card from the document image.
OCR_NO_RESULTCan't extract OCR result from the document images.
PARAMETER_ERRORThe data submitted by our frontend is not valid. This may indicate a frontend bug.
USER_TIMEOUTUser did not complete the operation within the specified time (1 hour).
ERRORError during processing in our backend. This may indicate a backend bug.
OCR_FIELD_INVALIDOne or more required fields extracted from the document are invalid, incomplete, or do not conform to the expected format/standards

Response Examples

SUCCESS

{
  "code": "SUCCESS",
  "message": "OK",
  "data": {
    "signatureId": "f302f5d2454a85c2",
    "overallResult": "PASS",
    "idvResult": "PASS",
    "errorCode": "SUCCESS",
    "docDetail": {
      "ocrResult": "PASS",
      "docFrontImage": "https://abc.com/idFrontImage.jpg",
      "docBackImage": "https://abc.com/idBackImage.jpg",
      "docType": {
        "front": "MY-ID-MYKAD",
        "back": "MY-ID-MYKAD"
      },
      "subDocType": {
        "front": "MY-ID-MYKAD",
        "back": "MY-ID-MYKAD"
      },
      "ocrInfo": {
        "front": {
          "gender": "PEREMPUAN",
          "name": "****** ******",
          "address": "****** ****** ****** ******",
          "idNumber": "************",
          "religion": "",
          "birthday": "1977/10/28",
          "citizen": "MYS"
        },
        "back": {
          "idNumber": "************"
        }
      },
      "qualityLabels": {
        "front": {
          "isBlur": false,
          "isDim": false,
          "isExposure": true
        },
        "back": null
      },
      "forgeryLabels": [
        "photocopy"
      ],
      "eventDetails": [
        {
          "event": "FE_DOCUMENT_SCAN",
          "result": "PASS",
          "createTimestmap": 1665993522952
        }
      ]
    },
    "countryCodeIso3": "MYS"
  },
  "extra": null,
  "transactionId": "d3fde1547eeaf226",
  "pricingStrategy": "FREE"
}
{
    "code": "SUCCESS",
    "message": "OK",
    "data": {
      "signatureId":"f302f5d2454a85c2",
      "overallResult":"FAIL",
      "idvResult":"FAIL",
      "errorCode":"NOT_SUPPORTED_CARD",
      "faceDetail": {
         "faceResult": null,
        "faceImageFar": null,
        "faceImageNear": null,
				"auditImageUrl": null,
				"faceLivenessScore": null,
        "faceSimilarityScore": null
       
      },
      "docDetail":  {
        "docResult": null,
        "docFrontImage": null,
        "docBackImage": null,
				"ocrInfo": null,
        "qualityLabels": null,
        "forgeryLabels": null
      },
     "feeDetail": [
  				{
    				"name": "SOLUTION",
    				"type": "SOLUTION"
				}
		  ],
    "countryCodeIso3":"MYS"
    },
    "extra": null,
    "transactionId": "d3fde1547eeaf226",
    "pricingStrategy": "FREE"
}
{
  "code": "SUCCESS",
  "message": "OK",
  "data": {
    "overallResult": null, // still in processing
    "idvResult": null, // still in processing
    "errorCode": null,
    "docDetail": {
      "ocrResult": "PASS",
      "docFrontImage": "https://abc.com/idFrontImage.jpg",
      "docBackImage": "https://abc.com/idBackImage.jpg",
      "ocrInfo": {
        "front": {
          "birthday": "OCTOBER 28,1977",
          "name": "**************",
          "birthdayParsed": "1977/10/28",
          "idNumber": "09-*******-*"
        },
        "back": null
      },
      "qualityLabels": {
        "front": [],
        "back": []
      },
      "forgeryLabels": null, // in processing
      "eventDetails": [
          {
              "event": "BE_DOCUMENT",
              "result": "PASS",
              "createTimestmap": 1665993522952
          }
      ]
    },
     "feeDetail": [
  				{
    				"name": "SOLUTION",
    				"type": "SOLUTION"
				}
		],
    "countryCodeIso3":"MYS"
  },
  "extra": null,
  "transactionId": "d3fde1547eeaf226",
  "pricingStrategy": "FREE"
}

SIGNATURE_NOT_EXIST

{
    "code":"SIGNATURE_NOT_EXIST",
    "message":"This signatureId is not exist",
    "data":null,
    "extra":null,
    "transactionId":"b6d722f7e9f553ae",
    "pricingStrategy":"FREE"
}