Tutorials
FPT.AI Reader - Vietnamese Passport Recognition
API Usage Guide
Authentication
To authorize, users can use the following code:
import requests
API_ENDPOINT = "https://api.fpt.ai/vision/passport/vnm"
auth = {'api_key': 'generated_API_key'}
r = requests.post(API_ENDPOINT, files=/path/to/image/file, headers=auth)
# Pass api_key into header with cURL command
curl -X POST
https://api.fpt.ai/vision/passport/vnm
-H "api_key: generated_API_key"
The system has been connected to FPT Gateways, therefore, users need to create an account on Console and then generate an API key in order to send requests to the gateway (by default each new API key can only make 50 requests).
The API key needs to be embedded in the header of all API requests as follows:
api_key: generated_API_key
Recognition of Vietnamese Passport from form-data image file
import requests
API_ENDPOINT = "https://api.fpt.ai/vision/passport/vnm"
auth = {'api_key': 'generated_API_key'}
file = {'image': open(/path/to/image/file, 'rb')}
r = requests.post(API_ENDPOINT, files=file, headers=auth)
# Pass api_key into header with cURL command
curl -X POST
https://api.fpt.ai/vision/passport/vnm
-H "api_key: generated_API_key"
-F image=@/path/to/image/file
This is the method of using the system by sending a form-data Vietnamese Passport image to the API endpoint. Users need to set the key image for the image file in the body of the request.
Instructions to send the request using the software POSTMAN:
Header
Body
Recognition of Vietnamese Passport from URL
import requests
API_ENDPOINT = "https://api.fpt.ai/vision/passport/vnm"
payload = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data;
name=\"image_url\"\r\n\r\nlink/to/image\r\n
------WebKitFormBoundary7MA4YWxkTrZu0gW--"
auth = {
'content-type': "multipart/form-data;
boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
'api_key': "generated_API_key"}
response = requests.request("POST", API_ENDPOINT, data=payload, headers=auth)
# Pass api_key into header with cURL command
curl -X POST
https://api.fpt.ai/vision/passport/vnm
-H "api_key: generated_API_key"
-F "image_url=/link/to/image"
This is the method of using the system by sending a link contained Vietnamese Passport image to the API endpoint. Users need to set the key image_url for the link in the body of the request.
Instructions to send the request using the software POSTMAN:
Body