OCR KTP Api Sample and Description

Here are the OCR KTP Sample and Description detail:

 

Request API:

curl -X POST \
-H "X-ADVAI-KEY: {Your Access Key}" \
-H "Content-Type: multipart/form-data" \
-F "ocrImage=@/Users/lby/Desktop/ocrImage.jpg"\
"https://api.advance.ai/openapi/face-recognition/v1/ocr-ktp-check"

 

Request Parameter:

Parameter Description
ocrImage file picture of a person’s id card

 

Note

Image Quality requirements:

The services check and extract the necessary information from the uploaded images, hence please ensure the uploaded images satisfy the following criteria:

    • Is in one of the following image formats: PNG / JPG / JPEG
    • Below 2 MB file size
    • Minimum resolution of 256 x 256
    • Maximum resolution of 4096 x 4096
  • For OCR services please also ensure that the uploaded images satisfy the following criteria:
    • ID Card’s ratio in the uploaded photo is not so small that the words in the ID Card are unreadable
    • ID Card’s orientation is in Vertical or Horizontal position and NOT heavily tilted (around 45 degree)
    • Nothing is covering up the words in the ID Card (ex: Light Spot, Dirt, Ink, Shadow, etc)
    • Have a clean background (No words or other picture in the background)

 

Response Description:

Parameter Description
code OCR Status Code
transactionId the request id, the max length is 64
pricingStrategy whether the request will be charged, enum type: FREEPAY
message Status Code Explanation
data idNumber : ID Number (NIK) of the Person in the KTP
  name : Name of the person in the KTP
  bloodType: Blood type of the person
  religion: Religion of the person
  gender: Gender of the person
  birthPlaceBirthday: Place and date of birth of the person
  province: Province of the person’s residence
  city: City of the person’s residence
  district: District of the person’s residence
  village: Village of the person’s residence
  rtrw: RT/RW of the person’ residence
  address: Detailed Address of the person’s residence
  occupation: Occupation of the person
  expiryDate: Expiry Date of the person’s KTP
  nationality: Nationality of the person
  maritalStatus: Marital status of the person
extra Extra response info (Exception Message)

 

Response Code:

Status Code Message
IMAGE_INVALID_FORMAT free Invalid image format, image format should be one of jpeg/jpg/png, and request content type should be image/jpeg or image/png
IMAGE_INVALID_SIZE free Invalid image size, max image size should be less than 2M, and image dimension should be between 256 * 256 and 4096 * 4096
OCR_NO_RESULT pay OCR check failed, unable to find any ktp field in the uploaded picture

 

Status Code:

  • Our API responses will contain a Status Code indicating the result of the API call, whether it was successful, or an error occurred during the process
  • Each API will also have its own unique Status Codes that can only be found in the responses of the API
  • Your API usage will be charged based on the response Status Code, each Status Code listed in our API document will have either a free or pay tag with it
  • free means you will not be charged and paymeans that you will be charged
  • pay means you will be charged if the API response contains the said status code
  • Below are the commonly used Status Codes, these status codes could appear in all our API responses, so please remember to add a handler for these Status Codes
Status Code Message
SUCCESS pay OK
ERROR free Server error
EMPTY_PARAMETER_ERROR free Parameter should not be empty
INSUFFICIENT_BALANCE free Insufficient balance, please top up or contact your sales manager for help
SERVICE_BUSY free Messages may look like:
Rate limit is exceeded, please retry after the suggested time in HTTP Header.
Retry-After :10s
p.s. Please also note that this code may migrate to HTTP 429 Too Many Requests in the future.

Quota exceeded: You have exceeded the daily quota for free queries, please contact out tech support for help
IAM_FAILED free Access denied. Messages may look like:
You are not authorized by the Identity and Access Management system
Access Key not found
Token not found or expired
Access Key not found or expired
Account not authorized for this country
Account not authorized for this domain
Account is expired. Please contact your sales manager for help
Account is disabled. Please contact your sales manager for help
PARAMETER_ERROR free The message is detailed error description, may includes:
Parameter should not be empty
Invalid phone number, please check your phone number format
etc.
p.s. Mobile number format should be country code + phone number(without leading 0 or dash or space e.g. +xx12345678); fixed-line number should be country code + area code + number(without leading 0)
OVER_QUERY_LIMIT free Messages may look like:
Quota exceeded. you have exceeded free query quota, please contact your sales manager for help
Quota exceeded: You have exceeded free query quota for test account, please contact your sales manager for help
CLIENT_ERROR free HTTP client error. Messages may look like:
HTTP 400 - Bad Request
HTTP 404 - Not Found
HTTP 405 - Method Not Allowed
etc.
If you get this error, please check the API document or contact our tech support for help.
RETRY_LATER free Query failed, please retry after the suggested time in HTTP Header.
Retry-After :10s

 

Notes:

If the Status Code is SUCCESS, it may not be charged. Please check the code returned by each interface

 

 

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.