Credit report

1. Extract credit report information with URL input or pdf URL

API:

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

Params:

KeyValueDescription
imghttps://example.com/image.pngURL của ảnh hoặc 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/credit_report?img=%s&format_type=url&get_thumb=false"
% image_url,
auth=(api_key, api_secret))
print(response.json())

2. Extract credit report information with image file or pdf file input

API:

MethodURLcontent-type
POSThttps://demo.computervision.com.vn/api/v2/ocr/document/credit_reportmultipart/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 of credit report

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/credit_report?format_type=file&get_thumb=false",
auth=(api_key, api_secret),
files={'img': open(image_path, 'rb')})
print(response.json())

3. Extract credit report information with JSON input

API:

MethodURLcontent-type
POSThttps://demo.computervision.com.vn/api/v2/ocr/document/credit_reportapplication/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/credit_report?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": "credit_report"
},
"errorCode": string,
"errorMessage": string
}

info:

  • report_time
  • report_time_box
  • report_time_confidence
  • report_time_id
  • cic_code
  • cic_code_box
  • cic_code_confidence
  • cic_code_id
  • id_card
  • id_card_box
  • id_card_confidence
  • id_card_id
  • address
  • address_box
  • address_confidence
  • address_id
  • credit_score
  • credit_score_box
  • credit_score_confidence
  • credit_score_id
  • credit_rank
  • credit_rank_box
  • credit_rank_confidence
  • credit_rank_id
  • credit_ranking_date
  • credit_ranking_date_box
  • credit_ranking_date_confidence
  • credit_ranking_date_id
  • debt_sold_to_vamc
  • debt_sold_to_vamc_box
  • debt_sold_to_vamc_confidence
  • debt_sold_to_vamc_id
  • imgs
  • loan_details: As a list, each element in the list corresponds to the information of a row with the format: [json0, json1, json2, json3, json4]

json0,json1,json2,json4 all have the format:

{
"value": string,
"box": array,
"score": float
}

json3 have the format:

{
"value": [
{
"debt_name": string, // Name of outstanding balance
"debt": string // The corresponding outstanding balance
},
...
],
"box": [array, ...],
"score": [float, ...]
}
  • loan_details_image
  • credit_card_info: As a list, each element in the list corresponds to the information of a row with the format: [json0, json1, json2, json3]

json0,json1,json2 all have the format:

{
"value": string,
"box": array,
"score": float
}
  • credit_card_info_image
  • outstanding_loans: As a list, each element in the list corresponds to the information of a row with the format: [json0, json1, json2]

json0,json1,json2 all have the format:

{
"value": string,
"box": array,
"score": float
}
  • outstanding_loans_image
  • bad_debt: As a list, each element in the list corresponds to the information of a row with the format: [json0, json1, json2]

json0,json1,json2,json3,json4 all have the format:

{
"value": string,
"box": array,
"score": float
}
  • bad_debt_image
  • late_payments: As a list, each element in the list corresponds to the information of a row with the format: [json0, json1, json2]

json0,json1,json2 all have the format:

{
"value": string,
"box": array,
"score": float
}
  • late_payments_image
  • loan_guarantee: As a list, each element in the list corresponds to the information of a row with the format: [json0, json1]

json0,json1 all have the format:

{
"value": string,
"box": array,
"score": float
}
  • loan_guarantee_image
  • credit_contract: As a list, each element in the list corresponds to the information of a row with the format: [json0, json1]

json0,json1 all have the format:

{
"value": string,
"box": array,
"score": float
}
  • credit_contract_image
  • customers_look_up: As a list, each element in the list corresponds to the information of a row with the format: [json0, json1, json2]

json0,json1,json2 all have the format:

{
"value": string,
"box": array,
"score": float
}
  • customers_look_up_image

Error code table:

CodeMessage
0Success
1Incorrect image format
2Url is unavailable
3Incorrect image format
4Incorrect api_key or api_secret
5Out of requests
6Error when processing the request