Perform Document Check
You can run this check immediately via our Demo Postman collection. It's publicly available and doesn't require an account.

Overview of flow

Document check API flow

1. Create a client

The first step in creating any check is to create a client from your backend server. A client can be a person or a company. For a person, you must provide their first name and last name. Only the name is required for a company.

Example request for creating a client

cURL
Node.js
Python
PHP
.NET
1
curl -X POST https://api.complycube.com/v1/clients \
2
-H 'Authorization: <YOUR_API_KEY>' \
3
-H 'Content-Type: application/json' \
4
-d '{
5
"type": "person",
6
"email": "[email protected]",
7
"personDetails":{
8
"firstName": "John",
9
"lastName" :"Doe"
10
}
11
}'
Copied!
1
const { ComplyCube } = require("@complycube/api");
2
3
const complycube = new ComplyCube({ apiKey: "<YOUR_API_KEY>" });
4
5
const client = await complycube.client.create({
6
type: "person",
7
8
personDetails: {
9
firstName: "John",
10
lastName: "Doe"
11
}
12
});
Copied!
1
from complycube import ComplyCubeClient
2
cc_api = ComplyCubeClient(api_key='<YOUR_API_KEY>')
3
4
new_client = {
5
'type':'person',
6
'email':'[email protected]',
7
'personDetails': {
8
'firstName':'John',
9
'lastName':'Doe'
10
}
11
}
12
13
client = cc_api.clients.create(**new_client)
Copied!
1
use ComplyCube\ComplyCubeClient;
2
3
$ccapi = new ComplyCubeClient('<YOUR_API_KEY>');
4
5
$result = $ccapi->clients()->create(['type' => 'person',
6
'email' => '[email protected]',
7
'personDetails' => ['firstName' => 'John',
8
'lastName' => 'Doe']]);
Copied!
1
using ComplyCube.Net;
2
using ComplyCube.Net.Resources.Clients;
3
4
var clientApi = new ClientApi(new ComplyCubeClient("<YOUR_API_KEY>"));
5
6
var newClient = new ClientRequest {
7
type = "person",
8
email = "[email protected]",
9
personDetails = new PersonDetails {
10
firstName = "John",
11
lastName = "Doe"
12
}
13
}
14
15
var client = await clientApi.CreateAsync(newclient);
Copied!

Example response

The response will contain an id (the Client ID). It is required for the next step.
1
{
2
"id": "5eb04fcd0f3e360008035eb1",
3
"type": "person",
4
"email": "[email protected]",
5
"personDetails": {
6
"firstName": "John",
7
"lastName": "Doe"
8
},
9
"createdAt": "2020-01-04T17:24:29.146Z",
10
"updatedAt": "2020-01-04T17:24:29.146Z"
11
}
Copied!

2. Create a document

Create a document by providing the Client ID and document type (e.g. passport, national ID).

Example request for creating a document

cURL
Node.js
Python
PHP
.NET
1
curl -X POST https://api.complycube.com/v1/documents \
2
-H 'Authorization: <YOUR_API_KEY>' \
3
-H 'Content-Type: application/json' \
4
-d '{
5
"clientId":"5eb04fcd0f3e360008035eb1",
6
"type": "passport",
7
"issuingCountry": "GB"
8
}'
Copied!
1
const document = await complycube.document.create("5eb04fcd0f3e360008035eb1", {
2
type: "passport",
3
issuingCountry: "GB"
4
});
Copied!
1
document = cc_api.documents.create(
2
'5eb04fcd0f3e360008035eb1',
3
type='passport',
4
issuingCountry='GB')
Copied!
1
$doc = $ccapi->documents()->create('5eb04fcd0f3e360008035eb1',
2
['type'=>'passport','issuingCountry'=>'GB']);
Copied!
1
var docRequest = new DocumentRequest
2
{
3
clientId = "5eb04fcd0f3e360008035eb1",
4
type = "passport",
5
issuingCountry = "GB"
6
};
7
8
var document = await docApi.CreateAsync(docRequest);
Copied!

Example response

The response will contain an id (the Document ID). It is required for the next step.
1
{
2
"id": "5ebd40714f23960008c81527",
3
"type": "passport",
4
"issuingCountry": "GB",
5
"createdAt": "2020-01-04T17:25:21.116Z",
6
"updatedAt": "2020-01-04T17:25:21.116Z"
7
}
Copied!

3. Upload front side image of an ID

Upload a BASE64 encoded image of the front-side of the ID document. Depending on the type and country combination, both sides of the ID may be required.
Images should be JPG, PNG, or PDF and between 34 KB and 4 MB in size.
Below is a sample BASE64encoded file. Download it, and copy its content. Then paste into the data attribute when making the request.
base64-encoded-id-sample.txt
95KB
Text
Sample - BASE64 encoded front-side of passport

Example request for uploading the front-side image of a document

cURL
Node.js
Python
PHP
.NET
1
curl -X POST https://api.complycube.com/v1/documents/5ebd40714f23960008c81527/upload/front \
2
-H 'Authorization: <YOUR_API_KEY>' \
3
-H 'Content-Type: application/json' \
4
-d '{
5
"fileName": "front-test.jpg",
6
"data": "<BASE64_DATA_CONTENT>"
7
}'
Copied!
1
const frontImage = await complycube.document.upload("5ebd40714f23960008c81527", {
2
fileName: "front-test.jpg",
3
data: "<BASE64_DATA_CONTENT>"
4
}, "front");
Copied!
1
front_image = cc_api.documents.upload(
2
'5ebd40714f23960008c81527',
3
'front',
4
fileName='front-test.jpg',
5
data='<BASE64_DATA_CONTENT>')
Copied!
1
$up = $ccapi->documents()->upload('5ebd40714f23960008c81527',
2
'front',
3
['fileName' => 'front-test.jpg',
4
'data' => '<BASE64_DATA_CONTENT>']);
Copied!
1
var docFront = new ImageRequest
2
{
3
fileName = "front-test.jpg",
4
data= "<BASE64_DATA_CONTENT>"
5
};
6
7
var img = await docApi.UploadImageAsync("5ebd40714f23960008c81527",
8
"front",
9
docFront);
Copied!

Example response

The response will contain an id (the Check ID). It is required for the next step.
1
{
2
"id": "5eb169302d868c0008828591",
3
"fileName": "front-test.jpg",
4
"documentSide": "front",
5
"downloadLink": "/documents/5ebd40714f23960008c81527/images/5eb169302d868c0008828591/download",
6
"contentType": "image/jpg",
7
"size": 72716,
8
"createdAt": "2020-01-04T17:25:21.116Z",
9
"updatedAt": "2020-01-04T17:25:21.116Z"
10
}
Copied!

4. Create a check

Create a check by providing the Client ID, Document ID and check type.

Example request for creating a check

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":"5eb04fcd0f3e360008035eb1",
6
"documentId":"5ebd40714f23960008c81527",
7
"type": "document_check"
8
}'
Copied!
1
const check = await complycube.check.create("5eb1276d96be4a0008713af5", {
2
documentId: "5ebd40714f23960008c81527",
3
type: "document_check"
4
});
Copied!
1
check = cc_api.checks.create( '5eb1276d96be4a0008713af5',
2
'document_check',
3
documentId='5ebd40714f23960008c81527' )
Copied!
1
$result = $ccapi->checks()->create('5eb1276d96be4a0008713af5',
2
['type' => 'document_check',
3
'documentId' => '5ebd40714f23960008c81527']);
Copied!
1
var checkRequest = new CheckRequest
2
{
3
clientId = "5eb04fcd0f3e360008035eb1",
4
documentId = "5ebd40714f23960008c81527",
5
type = "document_check"
6
};
7
8
var check = await checkApi.CreateAsync(checkRequest);
Copied!

Example response

The response will contain an id (the Check ID). It is required for the next step.
1
{
2
"id": "5ebd40714f23960008c81527",
3
"entityName": "John Doe",
4
"type": "document_check",
5
"clientId": "5eb04fcd0f3e360008035eb1",
6
"documentId": "5ebd40714f23960008c81527",
7
"status": "pending",
8
"createdAt": "2020-01-04T17:25:21.116Z",
9
"updatedAt": "2020-01-04T17:25:21.116Z"
10
}
Copied!

Perform check

ComplyCube will perform the check. You can retrieve a check's outcome and breakdown via the API.
If you have set up webhooks, a notification is sent upon completion of the check.

Example request for retrieving the check outcome

cURL
Node.js
Python
PHP
.NET
1
curl -X GET https://api.complycube.com/v1/checks/5ebd40714f23960008c81527 \
2
-H 'Authorization: <YOUR_API_KEY>'
Copied!
1
const check = await complycube.check.get("5ebd40714f23960008c81527");
Copied!
1
check = cc_api.checks.get('5ebd40714f23960008c81527')
Copied!
1
$check = $ccapi->checks()->get('5ebd40714f23960008c81527');
Copied!
1
var check = await checkApi.GetAsync("5ebd40714f23960008c81527");
Copied!

Example response

1
{
2
"id": "5ebd40714f23960008c81527",
3
"entityName": "John Doe",
4
"type": "document_check",
5
"clientId": "5eb04fcd0f3e360008035eb1",
6
"documentId": "5ebd40714f23960008c81527",
7
"status": "complete",
8
"result": {
9
"outcome": "clear",
10
"breakdown": {
11
"extractedData": {
12
"documentDetails": {
13
"documentType": "driving_license",
14
"hasTwoSides": true,
15
"issuingCountry": "GB",
16
"issuingDate": {
17
"day": 1,
18
"month": 1,
19
"year": 2015
20
},
21
"expirationDate": {
22
"day": 1,
23
"month": 1,
24
"year": 2025
25
},
26
"documentNumber": "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
},
67
"forensicAnalysis": {
68
"daylightAnalysis": "clear",
69
"mrzVisualPlacement": "clear",
70
"securityElements": "clear",
71
"photoLocation": "clear",
72
"mrzClassification": "clear"
73
},
74
"frontAndBackAnalysis": {
75
"formatAnalysis": "clear",
76
"dataConsistency": "clear"
77
},
78
"clientValidation": {
79
"ageVerification": "clear",
80
"clientDataConsistency": "clear"
81
},
82
"extractedImages": [
83
{
84
"type": "front_side",
85
"data": "<BASE64 image content>"
86
}
87
]
88
}
89
},
90
"createdAt": "2020-01-04T17:25:21.116Z",
91
"updatedAt": "2020-01-04T17:25:21.116Z"
92
}
Copied!