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:
| Method | URL |
|---|---|
| GET | https://demo.computervision.com.vn/api/v3/ekyc/cards |
Params:
| Key | Value | Description |
|---|---|---|
img1 | https://example.com/front.png | Front side image URL to extract information thông tin |
img2 | https://example.com/back.png | Back side image URL to extract information thông tin |
format_type | url | Type of data to pass in, receive value: url, file, base64 |
get_thumb | true/false | Returns a aligned image |
Demo Python:
import requestsapi_key = "YOUR_API_KEY"api_secret = "YOUR_API_SECRET"front_url = 'sample front url'back_url = 'sample back url'response = requests.get("https://demo.computervision.com.vn/api/v3/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:
| Method | URL | content-type |
|---|---|---|
| POST | https://demo.computervision.com.vn/api/v3/ekyc/cards | multipart/form-data |
Params:
| Key | Value | Description |
|---|---|---|
format_type | file | Type of data to pass in, receive value: url, file, base64 |
get_thumb | true/false | Returns a aligned image |
Body:
| Key | Type | Value | Description |
|---|---|---|---|
img1 | file | example_front.jpg | Front image file needs to extract information |
img2 | file | example_back.jpg | Back image file needs to extract information |
Demo Python:
import requestsapi_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://demo.computervision.com.vn/api/v3/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:
| Method | URL | content-type |
|---|---|---|
| POST | https://demo.computervision.com.vn/api/v3/ekyc/cards | application/json |
Params:
| Key | Value | Description |
|---|---|---|
format_type | base64 | Type of data to pass in, receive value: url, file, base64 |
get_thumb | true/false | Returns a aligned image |
Body:
{"img1": "iVBORw0KGgoAAAANSU...", // string base64 of the front image"img2": "iVBORw0KGgoAAAANSU..." // string base64 of the back image}
Demo Python:
import base64import ioimport requestsfrom PIL import Imagedef 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_imgapi_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://demo.computervision.com.vn/api/v3/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 information from any type of ID card front/back, Citizen ID front/back, Passport, photo URL input
API:
| Method | URL |
|---|---|
| GET | https://demo.computervision.com.vn/api/v3/ekyc/card |
Params:
| Key | Value | Description |
|---|---|---|
img | https://example.com/image.png | Photo URL of any ID card front/back, Citizen ID front/back, Passport |
format_type | url | Type of data to pass in, receive value: url, file, base64 |
get_thumb | true/false | Returns a aligned image |
Demo Python:
import requestsapi_key = "YOUR_API_KEY"api_secret = "YOUR_API_SECRET"image_url = 'https://example.com/image.png'response = requests.get("https://demo.computervision.com.vn/api/v3/ekyc/card?img=%s&format_type=%s&get_thumb=%s"% (image_url, 'url', 'false'),auth=(api_key, api_secret))print(response.json())
5. Extract information from any type of ID card front/back, Citizen ID front/back, Passport, input image file or PDF file
API:
| Method | URL | content-type |
|---|---|---|
| POST | https://demo.computervision.com.vn/api/v3/ekyc/card | multipart/form-data |
Params:
| Key | Value | Description |
|---|---|---|
format_type | file | Type of data to pass in, receive value: url, file, base64 |
get_thumb | true/false | Returns a aligned image |
Body:
| Key | Type | Value | Description |
|---|---|---|---|
img | file | example.jpg | Photo file of any ID card front/back, Citizen ID front/back, Passport |
Demo Python:
import requestsapi_key = "YOUR_API_KEY"api_secret = "YOUR_API_SECRET"image_path = '/path/to/your/example.jpg'response = requests.post("https://demo.computervision.com.vn/api/v3/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:
| Method | URL | content-type |
|---|---|---|
| POST | https://demo.computervision.com.vn/api/v3/ekyc/card | application/json |
Params:
| Key | Value | Description |
|---|---|---|
format_type | base64 | Type of data to pass in, receive value: url, file, base64 |
get_thumb | true/false | Returns a aligned image |
Body:
{"img": "iVBORw0KGgoAAAANSU..." // string base64 of the image to be extracted}
Demo Python:
import base64import ioimport requestsfrom PIL import Imagedef 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_imgapi_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://demo.computervision.com.vn/api/v3/ekyc/card?format_type=base64&get_thumb=false",auth=(api_key, api_secret),json={'img' : encode_cmt})print(response.json())
7. 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_front12_id_card_frontchip_id_card_front9_id_card_back12_id_card_backchip_id_card_backdriving_licensepassportmilitary_id_card_frontmilitary_id_card_backofficer_id_card_frontofficer_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
idnamedobhometownaddressaddress_town_codeaddress_district_codeaddress_ward_codehometown_town_codehometown_district_codehometown_ward_codeaddress_townaddress_districtaddress_wardhometown_townhometown_districthometown_wardid_confidencename_confidencedob_confidencehometown_confidenceaddress_confidenceid_boxname_boxdob_boxhometown_boxaddress_boximage
The front of the citizen's identity card - 12_id_card_front
idnamedobhometowngenderdue_datenationalityethnicityaddressaddress_town_codeaddress_district_codeaddress_ward_codehometown_town_codehometown_district_codehometown_ward_codeaddress_townaddress_districtaddress_wardhometown_townhometown_districthometown_wardimageid_confidencename_confidencedob_confidencehometown_confidencegender_confidencedue_date_confidencenationality_confidenceethnicity_confidenceaddress_confidenceid_boxname_boxdob_boxhometown_boxgender_boxdue_date_boxnationality_boxethnicity_boxaddress_box
The front of the citizen's identity card is assigned a chip - chip_id_card_front
idnamedobhometowngenderdue_datenationalityaddressaddress_town_codeaddress_district_codeaddress_ward_codehometown_town_codehometown_district_codehometown_ward_codeaddress_townaddress_districtaddress_wardhometown_townhometown_districthometown_wardid_confidencename_confidencedob_confidencehometown_confidencegender_confidencedue_date_confidencenationality_confidenceaddress_confidenceid_boxname_boxdob_boxhometown_boxgender_boxdue_date_boxnationality_boxaddress_boximage
Back side of ID card - 9_id_card_back
ethnicityissue_datereligiousissued_atissued_at_townissued_at_codeidentification_signimageissue_date_confidenceissued_at_confidencereligious_confidenceethnicity_confidenceidentification_sign_confidenceissue_date_boxissued_at_boxreligious_boxethnicity_boxidentification_sign_confidence
The back of the citizen's identity card - 12_id_card_back
issue_dateissued_atidentification_signimageissue_date_confidenceissued_at_confidenceidentification_sign_confidenceissue_date_boxissued_at_boxidentification_sign_box
The back of the citizen's identity card is assigned a chip - chip_id_card_back
issue_dateissued_atcountrydocument_numberperson_numberdobgenderdue_datenationalitysur_namegiven_nameidentification_signidentification_sign_confidenceissue_date_confidenceissue_date_boxidentification_sign_boxmrz_confidenceimage
Driving license - driving_license
idnamedobclassnationalityissue_datedue_dateaddressaddress_townaddress_districtaddress_wardaddress_town_codeaddress_district_codeaddress_ward_codeid_confidencename_confidencedob_confidenceclass_confidencenationality_confidenceissue_date_confidencedue_date_confidenceaddress_confidenceid_boxname_boxdob_boxclass_boxnationality_boxissue_date_boxdue_date_boxaddress_boximage
Passport - passport
idid_confidenceid_boxsur_namegiven_namefull_namefull_name_confidencefull_name_boxdobdob_confidencedob_boxgendergender_confidencegender_boxcountrynationalitynationality_confidencenationality_boxdue_datedue_date_confidencedue_date_boxperson_numberperson_number_confidenceperson_number_boxissue_dateissue_date_confidenceissue_date_boxissued_atissued_at_confidenceissued_at_boxplace_of_birthplace_of_birth_confidenceplace_of_birth_boximageconfidence
Front side Military ID card - military_id_card_front
idid_boxid_confidencenamename_boxname_confidencedobdob_boxdob_confidenceunitunit_boxunit_confidenceissue_dateissue_date_boxissue_date_confidencedue_datedue_date_boxdue_date_confidenceimage
Back of Military ID card - military_id_card_back
dobdob_boxdob_confidencehometownhometown_boxhometown_confidenceaddressaddress_boxaddress_confidenceidentification_signidentification_sign_boxidentification_sign_confidenceblood_typeblood_type_boxblood_type_confidenceimage
Front of Officer ID card - officer_id_card_front
idid_boxid_confidencenamename_boxname_confidencerankrank_boxrank_confidenceunitunit_boxunit_confidenceissue_dateissue_date_boxissue_date_confidencedue_datedue_date_boxdue_date_confidenceimage
Back of Officer ID card - officer_id_card_back
dob_boxdobdob_confidencehometownhometown_boxhometown_confidenceaddressaddress_boxaddress_confidenceidentification_signidentification_sign_boxidentification_sign_confidenceblood_typeblood_type_boxblood_type_confidenceimage
Error code table:
| Code | Message |
|---|---|
| 0 | Success |
| 1 | The photo does not contain content |
| 2 | Url is unavailable |
| 3 | Incorrect image format |
| 4 | Out of requests |
| 5 | Incorrect api_key or api_secret |
| 6 | Incorrect format type |
Warning error code table:
| Mã lỗi | Message |
|---|---|
| 0 | Successful |
| 1 | Photo contains sign of being taken through an electronic screen |
| 2 | The picture is a photocopy version of the id card |
| 3 | The id field on the document is incorrectly formatted |
| 5 | The id card's corner has been clipped |
| 6 | The id card's corner has been missing |
| 7 | Some information fields of the id card are covered |
| 8 | The fingerprint area is missing |
| 9 | Photo is blurred |
| 10 | Photo contains light glare |
| 11 | Information on the photo has signs of editing or modifying |
| 12 | The portrait photo on the id card is replaced |
| 13 | Expired personal documents |
| 14 | The dob field on the document is incorrectly formatted |