Background supergraphic

Singapore NRIC

Singapore NRIC is the legal identity document for all Singapore permanent residents and citizens.

Singapore NRIC Object

  • Name
    status
    Type
    string
    Description

    Enum code indicating the status of the reading result.

    1. SUCCESS
    2. NO_FILE
    3. FILE_INVALID_FORMAT
    4. FAILED
  • Name
    reason
    Type
    string
    Description

    A human-readable message providing more details about the reading result.

  • Name
    read
    Type
    object
    Description

    Contains the reading for each Singapore NRIC fields. Each field contains:

    • confidence_text (number): Text recognition confidence in percentage (except photo field)
    • confidence (number): Overall confidence score in percentage
    • polygon (array): Array of coordinate pairs [x, y] representing the bounding box of the field
    • value_original (string): The original text as read from the document (except photo field)
    • value (string): The processed/extracted value
    • page_index (number): Page number where the field was found (0-indexed)
    • Name
      photo
      Type
      object
      Description

      Face in base64 format.

    • Name
      address
      Type
      object
      Description

      Address.

    • Name
      blood_type
      Type
      object
      Description

      Blood type.

    • Name
      card_number
      Type
      object
      Description

      Card number.

    • Name
      country_of_birth
      Type
      object
      Description

      Country of birth.

    • Name
      date_of_birth
      Type
      object
      Description

      Date of birth.

    • Name
      issue_date
      Type
      object
      Description

      Document issue date.

    • Name
      name
      Type
      object
      Description

      Name.

    • Name
      nationality
      Type
      object
      Description

      Nationality.

    • Name
      nric_no
      Type
      object
      Description

      NRIC number.

    • Name
      race
      Type
      object
      Description

      Race.

    • Name
      sex
      Type
      object
      Description

      Sex.


POST/ocr/v1/singapore-nric

Read Singapore NRIC

Detects a valid Singapore NRIC image and returns the information as text.

Required parameter

  • Name
    image
    Type
    file (.png, .jpg, .jpeg)
    Description

    The image file for the Singapore NRIC.

Sample Request

POST
/ocr/v1/singapore-nric
1
2
3
4
5
import ApiClient from '@glair/vision'; const vision = new Vision({ apiKey: 'api-key', username: 'username', password: 'password' }); await vision.ocr.singaporeNRIC({ image: '/path/to/image/NRIC.jpg' });

Sample Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
{ "status": "SUCCESS", "reason": "File Successfully Read", "read": { "photo": { "value": "iVBO..", "confidence": 0.9673, "polygon": [ [31, 158], [153, 159], [153, 308], [31, 308] ], "page_index": 0 }, "race": { "value": "CHINESE", "value_original": "CHINESE", "confidence": 0.9777, "confidence_text": 0.9997, "polygon": [ [169, 296], [169, 281], [230, 281], [230, 296] ], "page_index": 0 }, "name": { "value": "SNG WEIBIN, VENETIA (SUN WEIBIN)", "value_original": "SNG WEIBIN, VENETIA (SUN WEIBIN)", "confidence": 0.8946, "confidence_text": 0.9964, "polygon": [ [168, 238], [168, 197], [367, 197], [367, 238] ], "page_index": 0 }, "date_of_birth": { "value": "20-10-1988", "value_original": "20-10-1988", "confidence": 0.9504, "confidence_text": 0.9972, "polygon": [ [171, 316], [255, 316], [255, 331], [171, 331] ], "page_index": 0 }, "sex": { "value": "F", "value_original": "F", "confidence": 0.9374, "confidence_text": 0.9907, "polygon": [ [271, 316], [285, 316], [285, 331], [271, 331] ], "page_index": 0 }, "country_of_birth": { "value": "SINGAPORE", "value_original": "SINGAPORE", "confidence": 0.9643, "confidence_text": 1.0, "polygon": [ [172, 350], [251, 350], [251, 365], [172, 365] ], "page_index": 0 }, "nric_no": { "value": "", "value_original": "", "confidence": 0.0, "confidence_text": 0.0, "polygon": [], "page_index": 0 }, "nationality": { "value": "", "value_original": "", "confidence": 0.0, "confidence_text": 0.0, "polygon": [], "page_index": 0 }, "issue_date": { "value": "", "value_original": "", "confidence": 0.0, "confidence_text": 0.0, "polygon": [], "page_index": 0 }, "address": { "value": "", "value_original": "", "confidence": 0.0, "confidence_text": 0.0, "polygon": [], "page_index": 0 }, "card_number": { "value": "", "value_original": "", "confidence": 0.0, "confidence_text": 0.0, "polygon": [], "page_index": 0 }, "blood_type": { "value": "", "value_original": "", "confidence": 0.0, "confidence_text": 0.0, "polygon": [], "page_index": 0 } } }

Request ID

An associated request identifier is generated for every request made to this endpoint. This value can be found in the response headers under Request-Id


Responses

Various responses for this endpoint, in addition to general responses specified in Errors.

200 - OK

Request with readable Singapore NRIC image

Response

1
2
3
4
5
{ "status": "SUCCESS", "reason": "File successfully read.", //..., }

400 - Bad Request

Request without form-data image

Response

1
2
3
4
5
{ "status": "NO_FILE", "reason": "No file in request body. Some fields are invalid.", //..., }

415 - Unsupported Media Type

Request with non-image file format

Response

1
2
3
4
5
{ "status": "FILE_INVALID_FORMAT", "reason": "Failed to process invalid file format. Please upload the correct file format. Some fields are invalid.", //..., }