Credit report
1. Extract credit report information with URL input or pdf URL
API:
| Method | URL |
|---|---|
| GET | https://demo.computervision.com.vn/api/v2/ocr/document/credit_report |
Params:
| Key | Value | Description |
|---|---|---|
img | https://example.com/image.png | URL của ảnh hoặc pdf |
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/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:
| Method | URL | content-type |
|---|---|---|
| POST | https://demo.computervision.com.vn/api/v2/ocr/document/credit_report | 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 | Image file or pdf file of credit report |
Demo Python:
import requestsapi_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:
| Method | URL | content-type |
|---|---|---|
| POST | https://demo.computervision.com.vn/api/v2/ocr/document/credit_report | 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 or pdf to extract}
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/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_timereport_time_boxreport_time_confidencereport_time_idcic_codecic_code_boxcic_code_confidencecic_code_idid_cardid_card_boxid_card_confidenceid_card_idaddressaddress_boxaddress_confidenceaddress_idcredit_scorecredit_score_boxcredit_score_confidencecredit_score_idcredit_rankcredit_rank_boxcredit_rank_confidencecredit_rank_idcredit_ranking_datecredit_ranking_date_boxcredit_ranking_date_confidencecredit_ranking_date_iddebt_sold_to_vamcdebt_sold_to_vamc_boxdebt_sold_to_vamc_confidencedebt_sold_to_vamc_idimgsloan_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_imagecredit_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_imageoutstanding_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_imagebad_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_imagelate_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_imageloan_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_imagecredit_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_imagecustomers_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:
| Code | Message |
|---|---|
| 0 | Success |
| 1 | Incorrect image format |
| 2 | Url is unavailable |
| 3 | Incorrect image format |
| 4 | Incorrect api_key or api_secret |
| 5 | Out of requests |
| 6 | Error when processing the request |