Working with Documents

The application container allows you to access individual documents in various ways. Each document contains metadata on aspects of the document, including the following:

  • Document Status – the overall result of the document.

  • Document Fields – the data read from the document.

  • Machine-Readable Zone (MRZ) – the machine-friendly data found at the bottom of many documents.

  • Document Feedback Properties – properties which summarise the various checks that have been carried out.

  • External Services Data – the system will sometimes send data to external services for additional checks, for example Amberhill.

  • Image Data - information about images submitted for the document.

Document Fields

A document stores a number of internal data fields and most fields can be accessed as shown below:

Request

POST {{server}}/VPE/dataAccess/retrieveDocumentContainer/
Content-Type: application/json

{
    "DeviceId": "device-id",
    "SessionId": "...",
    "ContainerId": "..."
}

Response

{
    "AccessDenied": false,
    "Message": "Operation executed successfully.",
    "SessionExpired": false,
    "Success": true,
    "Container":
    {
         "Documents": [
                {
                      "CreatedAt": "/Date(...)/",
                      "CustomFieldDictionary": [],
                      "CustomFieldKeys": [],
                      "DocumentFields": [
                                 {
                                   "DataType": 0,
                                   "DisplayName": "Document Number",
                                   "DocumentId": "...",
                                   "FieldValueDate": null,
                                   "FieldValueString": "XN5007316",
                                   "Name": "VI Document Number",
                                   "SourceId": 2
                             },
                             {
                                   "DataType": 0,
                                   "DisplayName": "Firstname",
                                   "DocumentId": "...",
                                   "FieldValueDate": null,
                                   "FieldValueString": "Lauren",
                                   "Name": "VI Firstname",
                                   "SourceId": 2
                             },
                      ],
                      "DocumentId": "...",
                      "DocumentName": "Passport"
                }
          ]
    }
}

There may be multiple instances of certain fields, when comparing the DocumentField.DisplayName property. This is because the given data can be in multiple places within a document, or may have been manually input. The DocumentField.SourceId property specifies the source of the data. The API gives higher values for DocumentFieldSource for the more trusted sources. For example, Manual = 5, whereas Human-Readable Zone (Hrz) = 1.

The DocumentField.Name field always begins with a two or three letter code for the source of the field. Examples include “VI Firstname” for the first name read from the MRZ and “VIZ Firstname” for the first name read from the HRZ.

The most useful Display Names are those listed below:

Actual Display Name

Description

Document Number

Number of document.

Firstname

User first name.

Middlename

User middle name.

Surname

User surname.

Birth Date

Date of birth.

Sex

Gender.

Expiration Date

Document expiry date.

Document Properties

A number of additional data elements are encoded as separate property fields on the object itself, such as DocumentType, IssuingCountry or Nationality.

In the following sections, a number of these property fields are described for various aspects of a document.

The following gender information is supported by the TrustID Cloud:

Display Name

Internal Encoding

Attribute

Male

M

Gender.Male

Female

F

Gender.Female

Transgender

X

Gender.Transgender

Unspecified

<

Gender.Unspecified

Unknown

*

Gender.Unknown

Document Type

The TrustID Cloud distinguishes different document types including passport, national identity card or driving licence.

Request
POST {{server}}/VPE/dataAccess/retrieveDocumentContainer/
Content-Type: application/json

{
    "DeviceId": "device-id",
    "SessionId": "...",
    "ContainerId": "..."
}

Response

{
    "AccessDenied": false,
    "Message": "Operation executed successfully.",
    "SessionExpired": false,
    "Success": true,
    "Container":
    {
        "Documents": [
               {
                     "CreatedAt": "/Date(...)/",
                     "CustomFieldDictionary": [],
                     "CustomFieldKeys": [],
                     "DocumentFields": [],
                     "DocumentId": "...",
                     "DocumentName": "Passport",
                     "DocumentType": 0
               }
        ]
    }
}

To find the underlying type of the document, examine the Document.DocumentType property.

Document Name

A more specific way to distinguish the type of document is by examining the “DocumentName” property. This allows you, for example, to distinguish between an “ID Card” and a “Biometric Residence Permit”.

**Request**

POST {{server}}/VPE/dataAccess/retrieveDocumentContainer/
Content-Type: application/json

{
    "DeviceId": "device-id",
    "SessionId": "...",
    "ContainerId": "..."
}

Response

{
    "AccessDenied": false,
    "Message": "Operation executed successfully.",
    "SessionExpired": false,
    "Success": true,
    "Container":
    {
           "Documents": [
                  {
                        "CreatedAt": "/Date(...)/",
                        "CustomFieldDictionary": [],
                        "CustomFieldKeys": [],
                        "DocumentFields": [],
                        "DocumentId": "...",
                        "DocumentName": "Passport",
                        "DocumentType": 0
                  }
           ]
    }
}

To find the specific type of the document, examine the Document.DocumentName property.

Issuing Country and Nationality

The issuing country of the document and the nationality of the document holder are both encoded by additional data which provides information about the country.

The following example shows a data structure for a country:

{
    Name: "Germany",   // display name
    Mrz: "DEU",        // MRZ encoding
    AltMrz: "D",       // alternative MRZ encoding
    EU: true,          // EU membership
    UK: false,         // UK membership
}

Request

POST {{server}}/VPE/dataAccess/retrieveDocumentContainer/
Content-Type: application/json

{
    "DeviceId": "device-id",
    "SessionId": "...",
    "ContainerId": "..."
}

Response

{
    "AccessDenied": false,
    "Message": "Operation executed successfully.",
    "SessionExpired": false,
    "Success": true,
    "Container":
    {
          "Documents": [
                 {
                       "CreatedAt": "/Date(...)/",
                       "CustomFieldDictionary": [],
                       "CustomFieldKeys": [],
                       "DocumentFields": [],
                       "DocumentId": "...",
                       "DocumentName": "Passport",
                       "DocumentType": 0,
                       "IssuingCountry": {
                            "AltMrz": null,
                            "EU": true,
                            "Mrz": "IRL",
                            "Name": "Ireland",
                            "UK": false
                     },
                       "Nationality": {
                            "AltMrz": null,
                            "EU": true,
                            "Mrz": "IRL",
                            "Name": "Ireland",
                            "UK": false
                     }
                 }
           ]
    }
}

To find the country that issued the document, use Document.IssuingCountry and for the nationality of the holder use Document.Nationality.

Machine-Readable Zone (MRZ)

Some documents may have an MRZ and a number of document properties are related to this type of information:

Request

POST {{server}}/VPE/dataAccess/retrieveDocumentContainer/
Content-Type: application/json

{
    "DeviceId": "device-id",
    "SessionId": "...",
    "ContainerId": "..."
}

Response

{
    "AccessDenied": false,
    "Message": "Operation executed successfully.",
    "SessionExpired": false,
    "Success": true,
    "Container":
    {
           "Documents": [
                  {
                        "CreatedAt": "/Date(...)/",
                        "CustomFieldDictionary": [],
                        "CustomFieldKeys": [],
                        "DocumentFields": [],
                        "DocumentId": "...",
            "Mrz": "P<IRLOSULLIVAN<<LAUREN<<<<<<<<<<<<<<<<<<<<<<\nXN50073162IRL8805049F2309154<<<<<<<<<<<<<<<6",
                        "MrzCharacterCount": 44,
                        "MrzImageType": 3,
                        "MrzLineCount": 2,
                        "MrzSameLength": true
                  }
           ]
    }
}

While the Document.Mrz property contains the entire MRZ string that was read from the document, other properties provide additional information about properties of the MRZ. For example, Document.MrzCharacterCount provides the number of characters per line and Document.MrzLineCount gives the number of lines.

See also

The TrustID Cloud performs a number of validation checks on document data related to all document data in general and to the MRZ in particular. The following section gives more information on so-called feedback properties.

Document Feedback Properties

The TrustID Cloud provides a number of feedback properties for various aspects of a document. A feedback property usually represents a fact or an outcome of a validation process on the document data itself. A good example is whether the document is in date or has expired.

Feedback properties are designed to be presentable to users of the system as a list of established fact or outcome of the validation process that the TrustID Cloud carries out based on the information presented by the document.

A number of different sets of feedback properties are available; all represent a list of feedback properties and work in the same way but they contain different sets of feedback properties, grouped by different aspects.

The following example demonstrates how feedback properties can be enumerated and presented:

Request

POST {{server}}/VPE/dataAccess/retrieveDocumentContainer/
Content-Type: application/json

{
    "DeviceId": "device-id",
    "SessionId": "...",
    "ContainerId": "..."
}

Response

{
    "AccessDenied": false,
    "Message": "Operation executed successfully.",
    "SessionExpired": false,
    "Success": true,
    "Container":
    {
           "Documents": [
                  {
                        "CreatedAt": "/Date(...)/",
                        "CustomFieldDictionary": [],
                        "CustomFieldKeys": [],
                        "DocumentFields": [],
                        "DocumentId": "...",
                        "GeneralDocumentProperties": [
                              {
                                  "ErrorMessage": null,
                                  "Name": "Photo matches applicant (User)",
                                  "Value": true,
                                  "ValueUndefined": false
                              },
                              {
                                  "ErrorMessage": null,
                                  "Name": "Document in date",
                                  "Value": true,
                                  "ValueUndefined": false
                              },
                              {
                                  "ErrorMessage": null,
                                  "Name": "Document details complete",
                                  "Value": true,
                                  "ValueUndefined": false
                              },
                              {
                                  "ErrorMessage": null,
                                  "Name": "Amberhill Check",
                                  "Value": true,
                                  "ValueUndefined": false
                              }
                        ]
                  }
            ]
    }
}

Notable properties are:

  • DocumentFeedback.Name - the name or description of the fact or outcome that each feedback property represents, for example, whether the document has expired or not.

  • DocumentFeedback.Value - true if the corresponding outcome or fact that the feedback property represents, holds true; otherwise, it does not hold true.

  • DocumentFeedback.ValueUndefined - “true” if the outcome of the test is a warning. This could be if the test could not be carried out for some reason, for example the “Amberhill Check” could not be carried out as a connection the Amberhill service could not be made. It could also be because the test is not considered a failure, but also did not pass. For example, “Expiration Date” was not valid as the document is out of date, but it is also not a fail, as an expired document of the particular type is valid.

See also

See the FeedbackProperty() class reference for more information about feedback properties.

Document-level Custom Fields

A number of custom fields can be configured on document-level. Custom fields must be declared through the TrustID Cloud configuration first in order to use them.

All custom fields related to a document can be accessed via the Document.CustomFields property and a number of helper methods are available related to custom document fields:

Request

POST {{server}}/VPE/dataAccess/retrieveDocumentContainer/
Content-Type: application/json

{
    "DeviceId": "device-id",
    "SessionId": "...",
    "ContainerId": "..."
}

Response

{
    "AccessDenied": false,
    "Message": "Operation executed successfully.",
    "SessionExpired": false,
    "Success": true,
    "Container":
    {
           "Documents": [
                   {
                        "CreatedAt": "/Date(...)/",
                        "CustomFieldDictionary": [],
                        "CustomFieldKeys": [],
                        "DocumentFields": [],
                        "DocumentId": "...",
                        "CustomFieldDictionary": [
                            {
                                "Key": "OptionalReference",
                                "Value": {
                                    "DataType": 0,
                                    "DisplayName": "Reference",
                                    "Help": null,
                                    "Index": 0,
                                    "PropertyName": "OptionalReference",
                                    "Required": false,
                                    "Value": null,
                                    "Values": ""
                                }
                            }
                        ],
                        "CustomFieldKeys": [
                            "OptionalReference"
                        ],
                   }
                    ]
    }
}

To access all custom fields for a given document, examine the Document.CustomFieldDictionary.