/ocr/indian_passport
1.API Specification
2.Request Params
3.Response Params
4.Error Codes
5.Sample
1.API Specification
This API is used to recognize Indian passport, and extract the key information.
Passport (2 calls) - Front and back
Image spec
1. Format: JPG(JPEG), PNG
2. Between 128*128 and 6000*6000 (pixels),Recommended resolution: 1280*1280
3. File size: no larger than 5 MB
Request Method
POST
Request URL
https://cloudapi.accuauth.in/ocr/indian_passport
Debugging Tool
2.Request Params
2.1 Request Header
| Parameter | Type | Required | Description |
|---|---|---|---|
| X-DF-API-ID | string | Yes | For API credentials,Please visit API Request |
| X-DF-API-SECRET | string | Yes | For API credentials,Please visit API Request |
2.2 Request Body
| Fields | Type | Description | |
|---|---|---|---|
| optional | file | file | Binary data of the image |
| optional | image_base64 | string | Base64 encoded data of image |
| optional | detect_image_quality | int | Image quality detection option, 1: enable, 0: disable. API will return the detect_image_quality field if the above mentioned value is enabled. |
Either parameter
fileorimage_base64must be provided as a request parameter.You MUST add image stream to multipart/form-data section of POST message when using
fileparameter.
3.Response Params
| Fields | Type | Description |
|---|---|---|
| request_id | string | Unique id of each request |
| status | string | Response status, OK for success request, Error Codes for failed request |
| image_quality | float | Image quality score [0.0-1.0], the greater of the value the higher image quality |
| results | array | The array of ocr results; See results |
Elements in results:
| Fields | Type | Description |
|---|---|---|
| card_side | string | The side: front,back |
| card_info | object | The key infomation of passport; See card_info |
Elements in the card_info
- Front side of passport info:
| Fields | Type | Description |
|---|---|---|
| type | string | Type |
| country_code | string | Country code |
| passport_no | string | Passport No |
| surname | string | Surname |
| given_name | string | Given name |
| nationality | string | Nationality |
| sex | string | Sex |
| dob | string | Date of birth |
| place_of_birth | string | Place of birth |
| place_of_issue | string | Place of issue |
| date_of_issue | string | Date of issue |
| date_of_expiry | string | Date of expiry |
- Back side of passport info:
| Fields | Type | Description |
|---|---|---|
| father_name | string | Name of father |
| mother_name | string | Name of mother |
| spouse_name | string | Name of spouse |
| address | string | Address |
| file_number | string | File number |
| pin | string | Postcode |
Response Syntax
{
"request_id": "TID8bf47ab6eda64476973cc5f5b6ebf57e",
"status": "OK",
"image_quality": 0.771,
"results": [{
"card_side": "back",
"card_info":{
"father_name": "*** JAISWAL",
"mother_name": "*** JAISWAL",
"spouse_name": "",
"address": "ROOM NO 3-1 NEH NET PCNA",
"file_number": "PA10609627091316",
"pin": "604200"
}
}]
}
4.Error Codes
Common error codes of this API:
| Http Status Code | Status Field |
Description |
|---|---|---|
400 |
INVALID_ARGUMENT | Request parameter is invalid |
400 |
DETECTION_FAILED | Detect image failed |
401 |
UNAUTHORIZED | Unauthorized or access is denied |
401 |
KEY_EXPIRED | Your API ID has expired |
403 |
NO_PERMISSION | You are not authorized to use this API |
403 |
OUT_OF_QUOTA | API calls quota exceeded |
403 |
RATE_LIMIT_EXCEEDED | API request frequency exceeds the limit |
404 |
NOT_FOUND | Requested API cannot be found |
500 |
INTERNAL_ERROR | Internal server error |
Comment: Please see the reason field for details when the above 40X error occurred
Response Syntax
{
"status": "INVALID_ARGUMENT",
"reason": "must specify 'file' or 'image_base64' argument",
"request_id": "TID8bf47ab6eda64476973cc5f5b6ebf57e"
}