/ocr/idcard

1.API Specification
2.Request Params
3.Response Params
4.Error Codes
5.Sample

1.API Specification

This API is used to recognize ID card of Egypt, and extract the key information.

Image spec

1. Format: JPG(JPEG), PNG, e-aadhaar(PDF)
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.egypt.accuauth.com/ocr/idcard

Debugging Tool

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

Either parameter file or image_base64 must be provided as a request parameter.

You MUST add image stream to multipart/form-data section of POST message when using file parameter.

3.Response Params

Fields Type Description
request_id string Unique id of each request
status string Response status, OK if request success, other if failed; See Error Codes for details
results array The array of card ocr results,See results belowed for details
Elements in results:
Fields Type Description
card_side string The side of card: front or back
card_info object The key infomation of card
Elements in the card_info
  • Front side of card info:
Fields Type Description
id_number string ID card number(Digit)
certificate_number string Certificate number
first_name string First name
last_name string Last name
birthday string Date of birth
birthday_arabic string Date of birth in Arabic
address string Address
region string Region
  • Back side of card info:
Fields Type Description
id_number string ID card number(Digit)
issue_date string Issue date of the card: yyyy/mm
issue_date_arabic string Issue date of the card in Arabic
expiry_date string Expiry date of the card: yyyy/mm/dd
expiry_date_arabic string expiry date of the card in Arabic
gender string Gender
gender_en string Gender in english, M for male and F for female
degree string Degree
religion string Religion of the person
religion_en string The religion in English, which can be one of the following values: Muslim, Christian, Judaism, if no religion is extracted, an empty string will be returned
husband_name string Husband name
jobs string Jobs of the person
marriage string Marriage
marriage_en string Marriage in english, married, unmarried, widow, divorced, if no marital status is extracted, an empty string will be returned

Response Syntax
  • Front side of card
{
  "request_id": "TID8bf47ab6eda64476973cc5f5b6ebf57e",
  "status": "OK",
  "results": [{
     "card_side": "front",
     "card_info":{
                "address": "**** البولاقية",
                "birthday": "1988/06/26",
                "birthday_arabic": "١٩٨٨/٠٦/٢٦",
                "certificate_number": "HR297****",
                "first_name": "يوس***",
                "id_number": "***** 1234",
                "last_name": "***** اسكندر",
                "region": "****  القاهره"
      }
  }]
}
  • Back side of card
{
  "request_id": "TID8bf47ab6eda64476973cc5f5b6ebf57e",
  "status": "OK",
  "results": [{
     "card_side": "back",
     "card_info":{
                "degree": "طالب",
                "expiry_date": "2025/10/10",
                "expiry_date_arabic": "٢٠٢٥/١٠/١٠",
                "gender": "ذكر",
                "gender_en": "M",
                "husband_name": "***",
                "id_number": "2451xxxxxx",
                "issue_date": "2018/10",
                "issue_date_arabic": "٢٠١٨/١٠",
                "jobs": "",
                "marriage": "أعزب",
                "marriage_en": "unmarried",
                "religion": "مسيحى",
                "religion_en": "Christian",
      }
  }]
}

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"
}

5.Sample

results matching ""

    No results matching ""