ID card - Citizen ID - Passport - Driving license - Military ID card - Officer ID card

1. Extract double-sided information of identity card, citizen identity with photo URL input

API:

MethodURL
GEThttps://cloud.computervision.com.vn/api/v2/ekyc/cards

Params:

KeyValueDescription
img1https://example.com/front.pngFront side image URL to extract information
img2https://example.com/back.pngBack side image URL to extract information
format_typeurlType of data to pass in, receive value: url, file, base64
get_thumbtrue/falseReturns a aligned image

Demo Python:

import requests
api_key = "YOUR_API_KEY"
api_secret = "YOUR_API_SECRET"
front_url = 'sample front url'
back_url = 'sample back url'
response = requests.get(
"https://cloud.computervision.com.vn/api/v2/ekyc/cards?img1=%s&img2=%s&format_type=%s&get_thumb=%s"
% (front_url, back_url, 'url', 'false'),
auth=(api_key, api_secret))
print(response.json())

2. Extract double-sided information of identity card, citizen identity with image file input

API:

MethodURLcontent-type
POSThttps://cloud.computervision.com.vn/api/v2/ekyc/cardsmultipart/form-data

Params:

KeyValueDescription
format_typefileType of data to pass in, receive value: url, file, base64
get_thumbtrue/falseReturns a aligned image

Body:

KeyTypeValueDescription
img1fileexample_front.jpgFront image file needs to extract information
img2fileexample_back.jpgBack image file needs to extract information

Demo Python:

import requests
api_key = "YOUR_API_KEY"
api_secret = "YOUR_API_SECRET"
front_path = '/path/to/your/example_front.jpg'
back_path = '/path/to/your/example_back.jpg'
response = requests.post(
"https://cloud.computervision.com.vn/api/v2/ekyc/cards?format_type=file&get_thumb=false",
auth=(api_key, api_secret),
files={'img1': open(front_path, 'rb'), 'img2' : open(back_path, 'rb')})
print(response.json())

3. Extract double-sided information of identity card, citizen identity with JSON input

API:

MethodURLcontent-type
POSThttps://cloud.computervision.com.vn/api/v2/ekyc/cardsapplication/json

Params:

KeyValueDescription
format_typebase64Type of data to pass in, receive value: url, file, base64
get_thumbtrue/falseReturns a aligned image

Body:

{
"img1": "iVBORw0KGgoAAAANSU...", // string base64 of the front image
"img2": "iVBORw0KGgoAAAANSU..." // string base64 of the back image
}

Demo Python:

import base64
import io
import requests
from PIL import Image
def get_byte_img(img):
img_byte_arr = io.BytesIO()
img.save(img_byte_arr, format='PNG')
encoded_img = base64.encodebytes(img_byte_arr.getvalue()).decode('ascii')
return encoded_img
api_key = "YOUR_API_KEY"
api_secret = "YOUR_API_SECRET"
img_front_path = "/path/to/your/img_front.jpg"
img_back_path = "/path/to/your/img_back.jpg"
encode_front = get_byte_img(Image.open(img_front_path))
encode_back = get_byte_img(Image.open(img_back_path))
response = requests.post(
"https://cloud.computervision.com.vn/api/v2/ekyc/cards?format_type=base64&get_thumb=false",
auth=(api_key, api_secret),
json={'img1' : encode_front, "img2" : encode_back})
print(response.json())

4. Extract photo information containing 1 or more sides of ID card, Citizen ID, Passport, photo URL input

API:

MethodURL
GEThttps://cloud.computervision.com.vn/api/v2/ocr/card

Params:

KeyValueDescription
imghttps://example.com/image.pngPhoto URL of any ID card front/back, Citizen ID front/back, Passport
format_typeurlType of data to pass in, receive value: url, file, base64
get_thumbtrue/falseReturns a aligned image

Demo Python:

import requests
api_key = "YOUR_API_KEY"
api_secret = "YOUR_API_SECRET"
image_url = 'https://example.com/image.png'
response = requests.get(
"https://cloud.computervision.com.vn/api/v2/ocr/card?img=%s&format_type=%s&get_thumb=%s"
% (image_url, 'url', 'false'),
auth=(api_key, api_secret))
print(response.json())

5. Extract photo information containing 1 or more sides of ID card, Citizen ID, Passport, image file input

API:

MethodURLcontent-type
POSThttps://cloud.computervision.com.vn/api/v2/ocr/cardmultipart/form-data

Params:

KeyValueDescription
format_typefileType of data to pass in, receive value: url, file, base64
get_thumbtrue/falseReturns a aligned image

Body:

KeyTypeValueDescription
imgfileexample.jpgPhoto file of any ID card front/back, Citizen ID card front/back, Passport

Demo Python:

import requests
api_key = "YOUR_API_KEY"
api_secret = "YOUR_API_SECRET"
image_path = '/path/to/your/example.jpg'
response = requests.post(
"https://cloud.computervision.com.vn/api/v2/ocr/card?format_type=file&get_thumb=false",
auth=(api_key, api_secret),
files={'img': open(image_path, 'rb')})
print(response.json())

6. Extract photo information containing 1 or more sides of ID card, Citizen ID, Passport, JSON input

API:

MethodURLcontent-type
POSThttps://cloud.computervision.com.vn/api/v2/ocr/cardapplication/json

Params:

KeyValueDescription
format_typebase64Type of data to pass in, receive value: url, file, base64
get_thumbtrue/falseReturns a aligned image

Body:

{
"img": "iVBORw0KGgoAAAANSU..." // string base64 of the image to be extracted
}

Demo Python:

import base64
import io
import requests
from PIL import Image
def get_byte_img(img):
img_byte_arr = io.BytesIO()
img.save(img_byte_arr, format='PNG')
encoded_img = base64.encodebytes(img_byte_arr.getvalue()).decode('ascii')
return encoded_img
api_key = "YOUR_API_KEY"
api_secret = "YOUR_API_SECRET"
img_path = "/path/to/your/image.jpg"
encode_img = get_byte_img(Image.open(img_path))
response = requests.post(
"https://cloud.computervision.com.vn/api/v2/ocr/card?format_type=base64&get_thumb=false",
auth=(api_key, api_secret),
json={'img' : encode_img})
print(response.json())

7. Extract information from any type of ID card front/back, Citizen ID front/back, Passport, photo URL input

API:

MethodURL
GEThttps://cloud.computervision.com.vn/api/v2/ekyc/card

Params:

KeyValueDescription
imghttps://example.com/image.pngPhoto URL of any ID card front/back, Citizen ID front/back, Passport
format_typeurlType of data to pass in, receive value: url, file, base64
get_thumbtrue/falseReturns a aligned image

Demo Python:

import requests
api_key = "YOUR_API_KEY"
api_secret = "YOUR_API_SECRET"
image_url = 'https://example.com/image.png'
response = requests.get(
"https://cloud.computervision.com.vn/api/v2/ekyc/card?img=%s&format_type=%s&get_thumb=%s"
% (image_url, 'url', 'false'),
auth=(api_key, api_secret))
print(response.json())

8. Extract information from any type of ID card front/back, Citizen ID front/back, Passport, input image file or PDF file

API:

MethodURLcontent-type
POSThttps://cloud.computervision.com.vn/api/v2/ekyc/cardmultipart/form-data

Params:

KeyValueDescription
format_typefileType of data to pass in, receive value: url, file, base64
get_thumbtrue/falseReturns a aligned image

Body:

KeyTypeValueDescription
imgfileexample.jpgPhoto file of any ID card front/back, Citizen ID front/back, Passport

Demo Python:

import requests
api_key = "YOUR_API_KEY"
api_secret = "YOUR_API_SECRET"
image_path = '/path/to/your/example.jpg'
response = requests.post(
"https://cloud.computervision.com.vn/api/v2/ekyc/card?format_type=file&get_thumb=false",
auth=(api_key, api_secret),
files={'img': open(image_path, 'rb')})
print(response.json())

9. Extract information from any type of ID card front/back, Citizen ID front/back, Passport, JSON input

API:

MethodURLcontent-type
POSThttps://cloud.computervision.com.vn/api/v2/ekyc/cardapplication/json

Params:

KeyValueDescription
format_typebase64Type of data to pass in, receive value: url, file, base64
get_thumbtrue/falseReturns a aligned image

Body:

{
"img": "iVBORw0KGgoAAAANSU..." // string base64 of the image to be extracted
}

Demo Python:

import base64
import io
import requests
from PIL import Image
def get_byte_img(img):
img_byte_arr = io.BytesIO()
img.save(img_byte_arr, format='PNG')
encoded_img = base64.encodebytes(img_byte_arr.getvalue()).decode('ascii')
return encoded_img
api_key = "YOUR_API_KEY"
api_secret = "YOUR_API_SECRET"
img_name = "path_img"
encode_cmt = get_byte_img(Image.open(img_name))
response = requests.post(
"https://cloud.computervision.com.vn/api/v2/ekyc/card?format_type=base64&get_thumb=false",
auth=(api_key, api_secret),
json={'img' : encode_cmt})
print(response.json())

10. Response

The generic response will be a JSON with the following format:

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

In the case of identification use /ekyc, the data field will contain the following information:

{
"info": [xxxx],
"valid": [xxxx],
"invalidMessage": [xxxx],
"invalidCode": [xxxx],
"type": [xxxx]
}

Note: In case of extracting information from a PDF file, many types of identification in one image, there is no valid, invalidCode, invalidMessage fields.

type: Type of identity document to which information is extracted.

  • 9_id_card_front
  • 12_id_card_front
  • chip_id_card_front
  • 9_id_card_back
  • 12_id_card_back
  • chip_id_card_back
  • driving_license
  • passport
  • military_id_card_front
  • military_id_card_back
  • officer_id_card_front
  • officer_id_card_back

info: Including information extracted from input images with identification documents, for each type of identification document, there will be different returned information.

The front of the ID card - 9_id_card_front

  • id
  • name
  • dob
  • hometown
  • address
  • address_town_code
  • address_district_code
  • address_ward_code
  • hometown_town_code
  • hometown_district_code
  • hometown_ward_code
  • address_town
  • address_district
  • address_ward
  • hometown_town
  • hometown_district
  • hometown_ward
  • id_confidence
  • name_confidence
  • dob_confidence
  • hometown_confidence
  • address_confidence
  • id_box
  • name_box
  • dob_box
  • hometown_box
  • address_box
  • image

The front of the citizen's identity card - 12_id_card_front

  • id
  • name
  • dob
  • hometown
  • gender
  • due_date
  • nationality
  • ethnicity
  • address
  • address_town_code
  • address_district_code
  • address_ward_code
  • hometown_town_code
  • hometown_district_code
  • hometown_ward_code
  • address_town
  • address_district
  • address_ward
  • hometown_town
  • hometown_district
  • hometown_ward
  • image
  • id_confidence
  • name_confidence
  • dob_confidence
  • hometown_confidence
  • gender_confidence
  • due_date_confidence
  • nationality_confidence
  • ethnicity_confidence
  • address_confidence
  • id_box
  • name_box
  • dob_box
  • hometown_box
  • gender_box
  • due_date_box
  • nationality_box
  • ethnicity_box
  • address_box

The front of the citizen's identity card is assigned a chip - chip_id_card_front

  • id
  • name
  • dob
  • hometown
  • gender
  • due_date
  • nationality
  • address
  • address_town_code
  • address_district_code
  • address_ward_code
  • hometown_town_code
  • hometown_district_code
  • hometown_ward_code
  • address_town
  • address_district
  • address_ward
  • hometown_town
  • hometown_district
  • hometown_ward
  • id_confidence
  • name_confidence
  • dob_confidence
  • hometown_confidence
  • gender_confidence
  • due_date_confidence
  • nationality_confidence
  • address_confidence
  • id_box
  • name_box
  • dob_box
  • hometown_box
  • gender_box
  • due_date_box
  • nationality_box
  • address_box
  • image

Back side of ID card - 9_id_card_back

  • ethnicity
  • issue_date
  • religious
  • issued_at
  • issued_at_town
  • issued_at_code
  • identification_sign
  • image
  • issue_date_confidence
  • issued_at_confidence
  • religious_confidence
  • ethnicity_confidence
  • identification_sign_confidence
  • issue_date_box
  • issued_at_box
  • religious_box
  • ethnicity_box
  • identification_sign_confidence

The back of the citizen's identity card - 12_id_card_back

  • issue_date
  • issued_at
  • identification_sign
  • image
  • issue_date_confidence
  • issued_at_confidence
  • identification_sign_confidence
  • issue_date_box
  • issued_at_box
  • identification_sign_box

The back of the citizen's identity card is assigned a chip - chip_id_card_back

  • issue_date
  • issued_at
  • country
  • document_number
  • person_number
  • dob
  • gender
  • due_date
  • nationality
  • sur_name
  • given_name
  • identification_sign
  • identification_sign_confidence
  • issue_date_confidence
  • issue_date_box
  • identification_sign_box
  • mrz_confidence
  • image

Driving license - driving_license

  • id
  • name
  • dob
  • class
  • nationality
  • issue_date
  • due_date
  • address
  • address_town
  • address_district
  • address_ward
  • address_town_code
  • address_district_code
  • address_ward_code
  • id_confidence
  • name_confidence
  • dob_confidence
  • class_confidence
  • nationality_confidence
  • issue_date_confidence
  • due_date_confidence
  • address_confidence
  • id_box
  • name_box
  • dob_box
  • class_box
  • nationality_box
  • issue_date_box
  • due_date_box
  • address_box
  • image

Passport - passport

  • id
  • id_confidence
  • id_box
  • sur_name
  • given_name
  • full_name
  • full_name_confidence
  • full_name_box
  • dob
  • dob_confidence
  • dob_box
  • gender
  • gender_confidence
  • gender_box
  • country
  • nationality
  • nationality_confidence
  • nationality_box
  • due_date
  • due_date_confidence
  • due_date_box
  • person_number
  • person_number_confidence
  • person_number_box
  • issue_date
  • issue_date_confidence
  • issue_date_box
  • issued_at
  • issued_at_confidence
  • issued_at_box
  • place_of_birth
  • place_of_birth_confidence
  • place_of_birth_box
  • image
  • confidence

Front side Military ID card - military_id_card_front

  • id
  • id_box
  • id_confidence
  • name
  • name_box
  • name_confidence
  • dob
  • dob_box
  • dob_confidence
  • unit
  • unit_box
  • unit_confidence
  • issue_date
  • issue_date_box
  • issue_date_confidence
  • due_date
  • due_date_box
  • due_date_confidence
  • image

Back of Military ID card - military_id_card_back

  • dob
  • dob_box
  • dob_confidence
  • hometown
  • hometown_box
  • hometown_confidence
  • address
  • address_box
  • address_confidence
  • identification_sign
  • identification_sign_box
  • identification_sign_confidence
  • blood_type
  • blood_type_box
  • blood_type_confidence
  • image

Front of Officer ID card - officer_id_card_front

  • id
  • id_box
  • id_confidence
  • name
  • name_box
  • name_confidence
  • rank
  • rank_box
  • rank_confidence
  • unit
  • unit_box
  • unit_confidence
  • issue_date
  • issue_date_box
  • issue_date_confidence
  • due_date
  • due_date_box
  • due_date_confidence
  • image

Back of Officer ID card - officer_id_card_back

  • dob
  • dob_box
  • dob_confidence
  • hometown
  • hometown_box
  • hometown_confidence
  • address
  • address_box
  • address_confidence
  • identification_sign
  • identification_sign_box
  • identification_sign_confidence
  • blood_type
  • blood_type_box
  • blood_type_confidence
  • image

Error code table:

CodeMessage
0Success
1The photo does not contain content
2Url is unavailable
3Incorrect image format
4Out of requests
5Incorrect api_key or api_secret
6Incorrect format type

Warning error code table:

CodeMessage
0Successful
1Photo contains sign of being taken through an electronic screen
2The picture is a photocopy version of the id card
3The id field on the document is incorrectly formatted
5The id card's corner has been clipped
6The id card's corner has been missing