Documentation

Documentation

  • Conversation
  • Reader
  • Speech
  • Console
  • AI Agents
  • Languages iconEnglish
    • Tiếng Việt
    • Janpanese

›API

Overview

  • Driving License Recognition
  • ID Recognition
  • Passport Recognition
  • Facematch
  • Face Search
  • Reader
  • SDK eKYC
  • Liveness Detection

API

  • Driving Licence Recognition
  • ID Recognition
  • Passport Recognition
  • Face Search
  • Facematch
  • Liveness Detection

Tutorials

  • Driving License Recognition
  • ID Recognition
  • Passport Recognition
  • Face Search
  • Facematch
  • SDK eKYC
  • Liveness Detection

API

FPT.AI Reader - Vietnamese ID Card Recognition

Requirements

  • The input image must have 4 clear angles or all main components of a Vietnamese ID card such as photocard, National emblem, document title.
  • All information fields must be visible, readable, unmodified, not blurred.
  • The input image size does not exceed 5 MB and the minimum resolution is approximately 640x480 to ensure the confident rate.
  • The ratio of Vietnamese ID card area must be at least ¼ of the total image area.

Standard image

alt-text

alt-text

Bad image

  • Image with low quality and lack of corner

alt-text

  • Image with low quality and lack of information

alt-text

Request

Request Url

POST https://api.fpt.ai/vision/idr/vnm/

Request Headers

Parameter Required Default Description
api_key Yes Your api key ( get from console.fpt.ai )

Request Body

FormData contain a single image to recognize

Parameter Required Description
image Yes

Sample Request

curl -X POST https://api.fpt.ai/vision/idr/vnm/ -H "api-key: xxxxxx" -F "image=@path/to/image"

Response

JSON

{
    "errorCode" : x,
    "errorMessage" : "xxxx",
    "data" : [xxxx]
}

The system is able to extract all information found on old or new types of Vietnamese ID card (the identification information on the back is only returned if required). The system divides the results into 4 categories:

  • old Vietnamese ID card front side
  • old Vietnamese ID card back side
  • new Vietnamese ID card front side.
  • new Vietnamese ID card back side.

After successfully sending the request, the system will return a json file that includes text information on the Vietnamese ID card using the format below.

  • errorCode: value is 0 if the request was successful with no error occurred
  • errorMessage: value is equal to empty string if the request was successful with no error occurred
  • data: include all information on the Vietnamese ID card image if the request succeeds without errors, return empty list [] if an error occurs (All fields that the system can not extract, will have value "N/A"). Also included with the information extracted is the probability that indicates the reliability of the returned results.

(The detail of the errors that might occure include both errorCode and errorMessage is described on Errors)

Old type - front side

{
  "errorCode" : 0,
  "errorMessage" : "",
  "data": [
    {
      "id": "xxxx",
      "id_prob": "xxxx",
      "name": "xxxx",
      "name_prob": "xxxx",
      "dob": "xxxx",
      "dob_prob": "xxxx",
      "sex": "N/A",
      "sex_prob": "N/A",
      "nationality": "N/A",
      "nationality_prob": "N/A",
      "home": "xxxx",
      "home_prob": "xxxx",
      "address": "xxxx",
      "address_prob": "xxxx",
      "address_entities": {
            "province": "xxxx",
            "district": "xxxx",
            "ward": "xxxx",
            "street": "xxxx"
      },
      "doe": "N/A",
      "doe_prob": "N/A",
      "type": "xxxx"
    }
  ]
}

The old type Vietnamese ID card front side composes of 5 data fields:

FieldDescription
idID number
nameName
dobDate of birth
homeOriginal place
addressAddress

Besides, there are 3 additional data fields, including:

Field Description
type includes 4 types:
  • old: front side of old 9-digit ID card
  • old_back: back side of old 9-digit ID card
  • new: front side of new 12-digit ID card
  • new_back: back side of new 12-digit ID card
type_new ID cards are separated into smaller classes which differentiate 2 types of new ID card; including 5 types:
  • cmnd_09_front: front side of old 9-digit ID card
  • old_back: back side of old 9-digit ID card
  • cmnd_12_front: front side of type-1 12-digit ID card
  • cccd_12_front: front side of type-2 12-digit ID card
  • new_back: back side of new 12-digit ID card
address_entities the raw address address will be standardized and separated into 4 parts:
  • province
  • district
  • ward
  • street

Old type - back side

{
  "errorCode" : 0,
  "errorMessage" : "",
  "data": [
    {
      "religion_prob": "xxxx",
      "religion": "xxxx",
      "ethnicity_prob": "xxxx",
      "ethnicity": "xxxx",
      "features": "xxxx",
      "features_prob": "xxxx",
      "issue_date": "xxxx",
      "issue_date_prob": "xxxx",
      "issue_loc_prob": "xxxx",
      "issue_loc": "xxxx",
      "type": "xxxx"
    }
  ]
}

The old type Vietnamese ID card back side composes of 5 data fields:

FieldDescription
ethnicityEthnicity
religionReligion
featuresPersonal mark and disfigurement
issue_dateIssue date
issue_locIssue location

New type - front side

{
  "errorCode" : 0,
  "errorMessage" : "",
  "data": [
    {
      "id": "xxxx",
      "id_prob": "xxxx",
      "name": "xxxx",
      "name_prob": "xxxx",
      "dob": "xxxx",
      "dob_prob": "xxxx",
      "sex": "xxxx",
      "sex_prob": "xxxx",
      "nationality": "xxxx",
      "nationality_prob": "xxxx",
      "home": "xxxx",
      "home_prob": "xxxx",
      "address": "xxxx",
      "address_prob": "xxxx",
      "address_entities": {
            "province": "xxxx",
            "district": "xxxx",
            "ward": "xxxx",
            "street": "xxxx"
      },
      "doe": "xxxx",
      "doe_prob": "xxxx",
      "type": "xxxx"
    }
  ]
}

The new type Vietnamese ID card front side composes of 8 data fields:

FieldDescription
idID number
nameName
dobDate of birth
homeOriginal place
addressAddress
sexGender
nationality/ethnicityNationality/ Ethnicity
doeExpiry date

Besides, there are 3 additional data fields, including:

Field Description
type includes 4 types:
  • old: front side of old 9-digit ID card
  • old_back: back side of old 9-digit ID card
  • new: front side of new 12-digit ID card
  • new_back: back side of new 12-digit ID card
type_new ID cards are separated into smaller classes which differentiate 2 types of new ID card; including 5 types:
  • cmnd_09_front: front side of old 9-digit ID card
  • old_back: back side of old 9-digit ID card
  • cmnd_12_front: front side of type-1 12-digit ID card
  • cccd_12_front: front side of type-2 12-digit ID card
  • new_back: back side of new 12-digit ID card/li>
address_entities the raw address address will be standardized and separated into 4 parts:
  • province
  • district
  • ward
  • street

New type - back side

Response for the new type Vietnamese ID card back side

{
  "errorCode" : 0,
  "errorMessage" : "",
  "data": [
    {
      "religion_prob": "N/A",
      "religion": "N/A",
      "ethnicity_prob": "N/A",
      "ethnicity": "N/A",
      "features": "xxxx",
      "features_prob": "xxxx",
      "issue_date": "xxxx",
      "issue_date_prob": "xxxx",
      "issue_loc_prob": "N/A",
      "issue_loc": "N/A",
      "type": "xxxx"
    }
  ]
}

The new type Vietnamese ID card back side composes of 2 data fields:

FieldDescription
featuresPersonal mark and disfigurement
issue_dateIssue date

Errors

This section covers common errors and can be handled by the system, messages are returned clearly and specifically for the purpose of instructing users to use the API accurately.

The system uses the error codes as follows:

Error CodeMeaning
0No error -- This is a successful call, no error
1Invalid Parameters or Values! -- Wrong parameter in the request (e.g. no key or image in the request body).
2Failed in cropping -- The Vietnamese ID card in the image is missing of corners so it cannot be cropped to the standard format.
3Unable to find ID card in the image -- The system cannot find the Vietnamese ID card in the image or the image is of poor quality (too blur, too dark/bright).
5No URL in the request -- The request uses the image_url key but the value is left blank.
6Failed to open the URL! -- The request uses the image_url key but the system cannot open this URL.
7Invalid image file -- The uploaded file is not an image file.
8Bad data -- The uploaded image file is corrupted or the format is not supported.
9No string base64 in the request -- The request uses image_base64 key but the value is left blank.
10String base64 is not valid -- The request uses image_base64 key but the provided string is invalid.
← Driving Licence RecognitionPassport Recognition →
  • Requirements
    • Standard image
    • Bad image
  • Request
    • Request Url
    • Request Headers
    • Request Body
    • Sample Request
  • Response
    • JSON
    • Old type - front side
    • Old type - back side
    • New type - front side
    • New type - back side
    • Errors
Conversation
DocumentationAPI ReferenceTutorials (Video)
Reader
DocumentationAPI ReferenceTutorials
Speech
DocumentationAPI ReferenceTutorials
Copyright © 2025 FPT Corporation