API Reference
Search…
Document Check
Check your clients documents to extracts details and confirm their authenticity.

Run a document check

To run a Document Check, you must create a check with the type set to document_check
The provided document must have an issuingCountry and associated image attachments that adhere to our image specifications.
The front side of the document will always be required. For certain document types, you should also provide the back side.
If the back side is not provided, our engine will conduct the check based on the front side alone. It is highly recommended to provide both sides of documents for more robust checks to take place.

Image specifications

Image attachments must comply with the following:
  • The images must be of good quality, with a minimum of 150 DPI.
  • The images must be either in JPG, PNG, or PDF format.
  • The images must be provided without blur or glare.
  • You must not take the image at an angle.
  • Each side of the document must be between 34 KB and 4 MB.

Document check request

Attribute
Type
Description
clientId
string
The ID of the client associated with this check. (Required)
type
string
This must be set to document_check. (Required)
documentId
string
The ID of the document. (Required)
options
object
The advanced optional configuration associated with the check. Also, see the options object below. (Optional)

The options object

Attribute
Type
Description
analysisCoverage
array[string]
The types of analysis to conduct as part of a document check. Valid values include:
  1. 1.
    consistency_analysis
  2. 2.
    forensic_analysis
  3. 3.
    content_analysis
  4. 4.
    format_analysis
  5. 5.
    front_back_analysis
  6. 6.
    mrz_analysis
When this attribute is not provided, we will conduct all analysis types.
minimumPermittedAge
number
The minimum acceptable age before your client ID is flagged. When this attribute is not provided, we will default the minimum age to 18.
clientDataValidation
boolean
Adds an additional check that compares the client record data (first and last names) with data extracted from an ID document. When this attribute is not provided, it will default to false.

Example requests

Simple request

cURL
Node.js
Python
PHP
.NET
1
curl -X POST https://api.complycube.com/v1/checks \
2
-H 'Authorization: <YOUR_API_KEY>' \
3
-H 'Content-Type: application/json' \
4
-d '{
5
"clientId": "CLIENT_ID",
6
"type": "document_check",
7
"documentId": "DOCUMENT_ID"
8
}'
Copied!
1
const { ComplyCube } = require("@complycube/api");
2
3
const complycube = new ComplyCube({ apiKey: "<YOUR_API_KEY>" });
4
5
const check = await complycube.check.create("CLIENT_ID", {
6
type: "document_check",
7
documentId: "DOCUMENT_ID"
8
});
Copied!
1
from complycube import ComplyCubeClient
2
3
cc_api = ComplyCubeClient(api_key='<YOUR_API_KEY>')
4
5
check = cc_api.checks.create('CLIENT_ID',
6
'document_check',
7
documentId='DOCUMENT_ID')
Copied!
1
use ComplyCube\ComplyCubeClient;
2
3
$ccapi = new ComplyCubeClient('<YOUR_API_KEY>');
4
5
$result = $ccapi->checks()->create('CLIENT_ID',
6
['type' => 'document_check',
7
'documentId' => 'DOCUMENT_ID']);
Copied!
1
using ComplyCube.Net;
2
using ComplyCube.Net.Resources.Checks;
3
4
var checkApi = new CheckApi(new ComplyCubeClient("<YOUR_API_KEY>"));
5
6
var checkRequest = new CheckRequest
7
{
8
clientId = "CLIENT_ID",
9
type = "document_check",
10
documentId = "DOCUMENT_ID"
11
};
12
13
var check = await checkApi.CreateAsync(checkRequest);
Copied!

Request with optional attributes

cURL
Node.js
Python
PHP
.NET
1
curl -X POST https://api.complycube.com/v1/checks \
2
-H 'Authorization: <YOUR_API_KEY>' \
3
-H 'Content-Type: application/json' \
4
-d '{
5
"clientId": "CLIENT_ID",
6
"type": "document_check",
7
"documentId": "DOCUMENT_ID",
8
"options": {
9
"analysisCoverage": ["consistency_analysis", "content_analysis"],
10
"clientDataValidation": false
11
}
12
}'
Copied!
1
const { ComplyCube } = require("@complycube/api");
2
3
const complycube = new ComplyCube({ apiKey: "<YOUR_API_KEY>" });
4
5
const check = await complycube.check.create("CLIENT_ID", {
6
type: "document_check",
7
documentId: "DOCUMENT_ID",
8
options: {
9
analysisCoverage: ["consistency_analysis", "content_analysis"],
10
clientDataValidation: false
11
}
12
});
Copied!
1
from complycube import ComplyCubeClient
2
3
cc_api = ComplyCubeClient(api_key='<YOUR_API_KEY>')
4
5
request = {
6
'documentId': 'DOCUMENT_ID',
7
'options' : {
8
'analysisCoverage' : [
9
'consistency_analysis',
10
'content_analysis'
11
],
12
'clientDataValidation' : False
13
}
14
}
15
16
check = cc_api.checks.create('CLIENT_ID', 'document_check', **request)
Copied!
1
use ComplyCube\ComplyCubeClient;
2
3
$ccapi = new ComplyCubeClient('<YOUR_API_KEY>');
4
$check = ['type' => 'document_check',
5
'documentId' => 'DOCUMENT_ID',
6
'options' => [
7
'analysisCoverage' => ['consistency_analysis', 'content_analysis'],
8
'clientDataValidation' => false
9
]
10
];
11
$result = $ccapi->checks()->create('CLIENT_ID', $check);
Copied!
1
using ComplyCube.Net;
2
using ComplyCube.Net.Resources.Checks;
3
4
var checkApi = new CheckApi(new ComplyCubeClient("<YOUR_API_KEY>"));
5
6
var checkRequest = new CheckRequest
7
{
8
clientId = "CLIENT_ID",
9
type = "document_check",
10
documentId = "DOCUMENT_ID"
11
};
12
checkRequest.options = new CheckRequestOptions {
13
clientDataValidation = false,
14
analysisCoverage = new string[] {
15
"consistency_analysis",
16
"content_analysis" }};
17
18
var check = await checkApi.CreateAsync(checkRequest);
Copied!

Result object

The result object is only returned when the status of the check is complete . It has two components - outcome and breakdown.

Outcome

The outcome attribute represents the overall check result. Returned values include:
  1. 1.
    clear: Indicates every analysis type conducted returned a successful result, and hence the document is authentic.
  2. 2.
    attention: Indicates at least one of the analysis results requires attention.
  3. 3.
    not_processed: Indicates that ComplyCube was not able to process the images. Reasons include:
    • The image is of low quality.
    • The image is blurred or glared.
    • The image is at an angle.
    • The ID type and country provided do not correspond with the actual document provided uploaded.

Breakdown

The breakdown comprises the following objects:

extractedData object

The data extracted using Optical Character Recognition (OCR). It has the following constituents:
  • documentDetails: Data relating to the document.
    • documentType: The detected document type. Values include:
      • passport
      • driving_license
      • national_identity_card
      • residence_permit
      • visa
      • unidentified
    • hasTwoSides: A boolean indicating if both sides of the document were used for the analysis.
    • issuingCountry: The issuing country of the document. This will be the two-letter country ISO code.
    • expirationDate: The expiry date of the document. This will be a structured date.
    • documentNumber: The document number.
    • personalNumber: The personal number, if available.
    • issuingDate: The issuing date of the document. This will be a structured date.
    • issuingPlace: The issuing place of the document.
    • issuingAuthority: The issuing authority of the document.
    • additionalDetails: Any additional details extracted from the document. This will be returned as an array of key/value pair objects.
    • documentDiscriminator: The document discriminator.
    • cardAccessNumber: The card access number.
    • mrz : The Machine Readable Zone (MRZ), which is usually at the bottom of the identity page of a passport or the back of an identity card, can be up to 3 lines depending on the document type:
      • line1
      • line2
      • line3
  • holderDetails : Data relating to the document holder.
    • firstName: The list of first/given names as an array.
    • lastName: The list of last names as an array.
    • dob: The date of birth. This will be a structured date.
    • age: The age of the document holder. This will be a number.
    • birthPlace: The birthplace.
    • nationality: The nationality. This will be the two-letter country ISO code.
    • taxIdentificationNumber: The Tax Identification Number (TIN).
    • healthInsuranceNumber: The health insurance number.
    • gender: The gender. Values include:
      • male
      • female
      • other
  • allExtractedData: All the data extracted from the document, including data in native scripts, organized by source (e.g. Visual, MRZ, and barcode)
    • visual: All data extracted through the Visual Inspection Zone (VIZ).
    • mrz: All data extracted through the MRZ.
    • barcode: All data extracted through the barcode or QR code.

extractedImages array

The images extracted from the document. It's an array of type/data objects:
  • type: The extracted image type. Values include:
    • front_side
    • back_side
    • extracted_face
    • extracted_signature
    • extracted_security_element
    • extracted_code
    • extracted_fingerprint
  • data: The BASE64 encoded data content.

Analysis

For each conducted analysis, the returned values include:
  1. 1.
    clear: Indicates the analysis returned a successful result.
  2. 2.
    attention: Indicates a potential falsified or fraudulent document.
  3. 3.
    not_processed: Returned when the analysis does not apply to a document type, e.g. MRZ Analysis on a document without an MRZ. It will also be returned if ComplyCube does not support a given country's particular analysis for a document type.

mrzAnalysis object

The MRZ analysis results. It has the following constituents:
  • mrzChecksum: Indicates whether the MRZ checksum test is valid.
  • mrzFormat: Indicates whether the MRZ format is valid.

consistencyAnalysis object

The consistency analysis results. It has the following constituents:
  • firstName: Indicates whether the first name on the document and MRZ are consistent.
  • lastName: Indicates whether the last name on the document and MRZ are consistent.
  • dob: Indicates whether the birth date on the document and MRZ are consistent.
  • documentNumber: Indicates whether the document number on the document and MRZ are consistent.
  • personalNumber: Indicates whether the personal number on the document and MRZ are consistent.
  • issuingDate: Indicates whether issuing date on the document and MRZ are consistent.
  • expirationDate: Indicates whether the expiry date on the document and MRZ are consistent.

contentAnalysis object

The content analysis results. It has the following constituents:
  • issuingCountry: Indicates whether the issuing country has valid content.
  • issuingDate: Indicates whether issuing date has valid content.
  • expirationDate: Indicates whether the expiration date has valid content.
  • nationality: Indicates whether nationality has valid content.
  • specimenCheck: Indicates whether the content has been copied from the internet.
  • blackListCheck: Indicates a competent authority blacklisted the ID document.

formatAnalysis object

The format analysis results. It has the following constituents:
  • modelIdentification: Indicates whether the document model has been identified.
  • countryModelValidity: Indicates whether the document model adheres to the issuing country specifications.
  • documentModelValidity: Indicates whether the document model adheres to the document type specifications.
  • photocopyDetected: Indicates whether the document is a black and white photocopy.

forensicAnalysis object

The forensic analysis results. It has the following constituents:
  • daylightAnalysis: Indicates whether the document daylight colours are valid.
  • mrzVisualPlacement: Indicates whether the MRZ is in the right location and not tampered with.
  • securityElements: Indicates whether the document security elements are valid.
  • photoLocation: Indicates whether the photo is in the correct location for a given document type.
  • mrzClassification: Indicates whether the MRZ is consistent with the document type.

frontAndBackAnalysis object

The front and back of the image analysis results. It has the following constituents:
  • formatAnalysis: Indicates that both sides of the document are following the document type and country specifications.
  • dataConsistency: Indicates whether data on both sides of the document are consistent.

securityAndPatternAnalysis array

The security and pattern analysis results. It constitutes of an array of objects taking the following form:
  • expectedImageData: The BASE64 encoded data of the expected security element's pattern.
  • actualImageData: The BASE64 encoded data of the actual extracted security element pattern.
  • similarity: The similarity score between the expected and actual image patterns. The higher the score, the more likely the document is authentic.
  • outcome: The outcome of the analysis. This can be clear or attention.
  • narrative: A description of the analysis performed.

clientValidation object

The client validation results. It has the following constituents:
  • ageVerification: Indicates whether the extracted age is greater than or equal to a predefined minimum accepted age.
  • clientDataConsistency: Indicates whether the client data (e.g. first and last names) corresponds with data extracted from the ID.

Sample Response

1
{
2
"id": "5eb2b61e02df0a0008f1cf23",
3
"clientId": "5eb1276d96be4a0008713af5",
4
"entityName": "John Doe",
5
"type": "document_check",
6
"status": "complete",
7
"result": {
8
"outcome": "clear",
9
"breakdown": {
10
"extractedData": {
11
"documentDetails": {
12
"documentType": "driving_license",
13
"hasTwoSides": true,
14
"issuingCountry": "GB",
15
"issuingDate": {
16
"day": 1,
17
"month": 1,
18
"year": 2015
19
},
20
"expirationDate": {
21
"day": 1,
22
"month": 1,
23
"year": 2025
24
},
25
"documentNumber": "123456790",
26
"personalNumber": "123456790"
27
},
28
"holderDetails": {
29
"lastName": [
30
"DOE"
31
],
32
"firstName": [
33
"JOHN"
34
],
35
"dob": {
36
"day": 3,
37
"month": 9,
38
"year": 1995
39
},
40
"address": {
41
"addressText": "110 MAPLE ROAD, SAMPLE CITY, NC 10000-0008",
42
"line": "110 MAPLE ROAD",
43
"city": "SAMPLE CITY",
44
"state": "North Carolina",
45
"postalCode": "10000-0008",
46
"country": "US"
47
}
48
}
49
},
50
"allExtractedData": {
51
"visual": {
52
"lastName": [
53
"DOE"
54
],
55
"firstName": [
56
"JOHN"
57
],
58
"dob": {
59
"day": 3,
60
"month": 9,
61
"year": 1995
62
},
63
"age": 26,
64
"gender": "male",
65
"documentNumber": "123456790",
66
"documentDiscriminator": "123456790",
67
"issuingDate": {
68
"day": 1,
69
"month": 1,
70
"year": 2015
71
},
72
"expirationDate": {
73
"day": 1,
74
"month": 1,
75
"year": 2025
76
},
77
"addressText": "110 MAPLE ROAD, SAMPLE CITY, NC 10000-0008",
78
"addressLine": "110 MAPLE ROAD",
79
"addressCity": "SAMPLE CITY",
80
"addressPostalCode": "10000-0008",
81
"height": "175 cm"
82
},
83
"barcode": {
84
"lastName": [
85
"DOE"
86
],
87
"firstName": [
88
"JOHN"
89
],
90
"dob": {
91
"day": 3,
92
"month": 9,
93
"year": 1995
94
},
95
"gender": "male",
96
"documentNumber": "123456790",
97
"documentDiscriminator": "123456790",
98
"issuingCountry": "US",
99
"issuingDate": {
100
"day": 15,
101
"month": 11,
102
"year": 2018
103
},
104
"expirationDate": {
105
"day": 29,
106
"month": 9,
107
"year": 2026
108
},
109
"addressText": "110 MAPLE ROAD, SAMPLE CITY, NC 10000-0008",
110
"addressLine": "110 MAPLE ROAD",
111
"addressCity": "SAMPLE CITY",
112
"addressPostalCode": "10000-0008",
113
"addressState": "North Carolina",
114
"addressCountry": "US",
115
"height": "175 cm"
116
}
117
}
118
},
119
"mrzAnalysis": {
120
"mrzFormat": "clear",
121
"mrzChecksum": "clear"
122
},
123
"consistencyAnalysis": {
124
"lastName": "clear",
125
"firstName": "clear",
126
"dob": "clear",
127
"documentNumber": "clear",
128
"personalNumber": "clear",
129
"expirationDate": "clear",
130
"issuingDate": "clear"
131
},
132
"contentAnalysis": {
133
"issuingCountry": "clear",
134
"issuingDate": "clear",
135
"expirationDate": "clear",
136
"specimenCheck": "clear",
137
"nationality": "clear"
138
},
139
"formatAnalysis": {
140
"modelIdentification": "clear",
141
"countryModelValidity": "clear",
142
"documentModelValidity": "clear",
143
"photocopyDetected": "clear"
144
},
145
"forensicAnalysis": {
146
"daylightAnalysis": "clear",
147
"mrzVisualPlacement": "clear",
148
"securityElements": "clear",
149
"photoLocation": "clear",
150
"mrzClassification": "clear"
151
},
152
"frontAndBackAnalysis": {
153
"formatAnalysis": "clear",
154
"dataConsistency": "clear"
155
},
156
"clientValidation": {
157
"ageVerification": "clear",
158
"clientDataConsistency": "clear"
159
},
160
"extractedImages": [{
161
"type": "front_side",
162
"data": "<BASE64_IMAGE_CONTENT>"
163
}],
164
"securityAndPatternAnalysis": [{
165
"similarity": 100,
166
"outcome": "clear",
167
"narrative": "Clear",
168
"actualImageData": "<BASE64_IMAGE_CONTENT>",
169
"expectedImageData": "<BASE64_IMAGE_CONTENT>"
170
}]
171
},
172
"createdAt": "2020-01-01T14:06:44.756Z",
173
"updatedAt": "2020-01-01T14:06:91.913Z"
174
}
Copied!