Certificates of land use rights

1. Extract information from the land use right certificate with image URL or pdf URL input

API:

MethodURL
GEThttps://demo.computervision.com.vn/api/v2/ocr/document/land_certificate

Params:

KeyValueDescription
imghttps://example.com/image.pngURL of photo or pdf
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://demo.computervision.com.vn/api/v2/ocr/document/land_certificate?img=%s&format_type=url&get_thumb=false"
% image_url,
auth=(api_key, api_secret))
print(response.json())

2. Extract information from the land use right certificate with image file or pdf file input

API:

MethodURLcontent-type
POSThttps://demo.computervision.com.vn/api/v2/ocr/document/land_certificatemultipart/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.jpgImage file or pdf file

Demo Python:

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

3. Extract information from the land use right certificate with JSON input

API:

MethodURLcontent-type
POSThttps://demo.computervision.com.vn/api/v2/ocr/document/land_certificateapplication/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 or pdf to extract
}

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://demo.computervision.com.vn/api/v2/ocr/document/land_certificate?format_type=base64&get_thumb=false",
auth=(api_key, api_secret),
json={'img' : encode_cmt})
print(response.json())

4. Response

The response will be a JSON with the following format:

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

Type 1:

type: giay_cnqshdd_mau_1. Certificate of land use right, ownership of houses and other land-attached assets.

info: Includes the following information:

  • so_so
  • noi_cap
  • ngay_cap
  • so_vao_so
  • thong_tin_thua_dat
  • thong_tin_nha_o
  • thong_tin_ghi_chu
  • list_img
  • noi_dung_chu_dat
    • ten
    • nam_sinh
    • so_cmt
    • dia_chi

Type 2:

type: giay_cnqshdd_mau_2. Certificates of land use rights.

info: Includes the following information:

  • so_so
  • noi_cap
  • ngay_cap
  • so_vao_so
  • dia_chi_thua_dat
  • thong_tin_thua_dat
  • list_img
  • noi_dung_chu_dat
    • ten
    • nam_sinh
    • so_cmt
    • dia_chi

Type 3:

type: giay_cnqshdd_mau_3. Certificate of house ownership and residential land use right.

info: Includes the following information:

  • so_so
  • noi_cap
  • ngay_cap
  • so_vao_so
  • thong_tin_thua_dat
  • list_img
  • noi_dung_chu_dat
    • ten
    • nam_sinh
    • so_cmt
    • dia_chi

Lưu ý : Information fields (except for list_img and noi_dung_chu_dat) will have additional _box, _confidence, _id fields. In there:

  • _id: Information is retrieved on how many pages in the image list of the field list_img, the index starts at 0.
  • _box: Coordinates included [left, top, right, bottom].
  • _confidence: Confidence.

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