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_id
      • 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.
    • issuingDate: The issuing date of the document. This will be a structured date.
    • expirationDate: The expiry date of the document. This will be a structured date.
    • documentNumber: The document number.
    • personalNumber: The personal number, if available..
    • additionalDetails: Any additional details extracted from the document. This will be returned as an array of key/value pair objects.
    • 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.
    • birthPlace: The birthplace.
    • nationality: The nationality. This will be the two-letter country ISO code.
    • gender: The gender. Values include:
      • male
      • female
      • other

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_face
  • 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.

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
}
41
},
42
"mrzAnalysis": {
43
"mrzFormat": "clear",
44
"mrzChecksum": "clear"
45
},
46
"consistencyAnalysis": {
47
"lastName": "clear",
48
"firstName": "clear",
49
"dob": "clear",
50
"documentNumber": "clear",
51
"personalNumber": "clear",
52
"expirationDate": "clear",
53
"issuingDate": "clear"
54
},
55
"contentAnalysis": {
56
"issuingCountry": "clear",
57
"issuingDate": "clear",
58
"expirationDate": "clear",
59
"specimenCheck": "clear",
60
"nationality": "clear"
61
},
62
"formatAnalysis": {
63
"modelIdentification": "clear",
64
"countryModelValidity": "clear",
65
"documentModelValidity": "clear",
66
"photocopyDetected": "clear"
67
},
68
"forensicAnalysis": {
69
"daylightAnalysis": "clear",
70
"mrzVisualPlacement": "clear",
71
"securityElements": "clear",
72
"photoLocation": "clear",
73
"mrzClassification": "clear"
74
},
75
"frontAndBackAnalysis": {
76
"formatAnalysis": "clear",
77
"dataConsistency": "clear"
78
},
79
"clientValidation": {
80
"ageVerification": "clear",
81
"clientDataConsistency": "clear"
82
},
83
"extractedImages": [
84
{
85
"type": "front_side",
86
"data": "<BASE64_IMAGE_CONTENT>"
87
}
88
]
89
}
90
},
91
"createdAt": "2020-01-01T14:06:44.756Z",
92
"updatedAt": "2020-01-01T14:06:91.913Z"
93
}
Copied!
Last modified 2mo ago