Perform Identity 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

Identity 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 live photo

Upload a live photo by providing the Client ID and document type (e.g. passport, national ID).
Upload a BASE64 encoded selfie image of the customer. The image should be JPG or PNG and between 34 KB and 4 MB in size.

Example request for uploading the live photo

Below is a sample BASE64 encoded file. Download it, and copy its content. Then paste into the data attribute when making the request.
base64-encoded-livephoto-sample.txt
58KB
Text
Sample - BASE64 encoded selfie
cURL
Node.js
Python
PHP
.NET
1
curl -X POST https://api.complycube.com/v1/livePhotos \
2
-H 'Authorization: <YOUR_API_KEY>' \
3
-H 'Content-Type: application/json' \
4
-d '{
5
"clientId":"5eb04fcd0f3e360008035eb1",
6
"data": "<BASE64_DATA_CONTENT>"
7
}'
Copied!
1
const livePhoto = await complycube.livePhoto.upload("5eb04fcd0f3e360008035eb1", {
2
data: "<BASE64_DATA_CONTENT>"
3
}
Copied!
1
livePhoto = cc_api.livephotos.upload('5eb04fcd0f3e360008035eb1',
2
data='<BASE64_DATA_CONTENT>')
Copied!
1
$img = $ccapi->livephotos()->upload('5eb04fcd0f3e360008035eb1',
2
['data' => '<BASE64_DATA_CONTENT>']);
Copied!
1
var livePhotoRequest = new LivePhotoRequest
2
{
3
clientId = "5eb04fcd0f3e360008035eb1",
4
data= "<BASE64_DATA_CONTENT>"
5
};
6
7
var livePhoto = await livePhotoApi.UploadAsync(livePhotoRequest);
Copied!

Example response

The response will contain an id (the Document ID). It is required for the next step.
1
{
2
"id": "5eb1b5f231778a0008d1c3f6",
3
"clientId": "5eb04fcd0f3e360008035eb1",
4
"downloadLink": "/livePhotos/5eb1b5f231778a0008d1c3f6/download",
5
"contentType": "images/jpg",
6
"size": 44896,
7
"createdAt": "2020-01-01T14:06:44.756Z",
8
"updatedAt": "2020-01-01T14:06:44.756Z"
9
}
Copied!

3. Create a document

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

Example request for creating a client

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
}'
Copied!
1
const document = await complycube.document.create("5eb04fcd0f3e360008035eb1", {
2
type: "passport"
3
});
Copied!
1
document = cc_api.documents.create('5eb04fcd0f3e360008035eb1', type='passport')
Copied!
1
$doc = $ccapi->documents()->create('5eb04fcd0f3e360008035eb1',
2
['type' => 'passport']);
Copied!
1
var docRequest = new DocumentRequest
2
{
3
clientId = "5eb04fcd0f3e360008035eb1",
4
type = "passport"
5
};
6
7
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
"createdAt": "2020-01-04T17:25:21.116Z",
5
"updatedAt": "2020-01-04T17:25:21.116Z"
6
}
Copied!

4. 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 or PNG and between 34 KB and 4 MB in size.

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

Below is a sample BASE64 encoded 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
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
image = {
2
'fileName': 'front-test.jpg',
3
'data' : '<BASE64_DATA_CONTENT>'
4
}
5
6
front_img = cc_api.documents.upload('5ebd40714f23960008c81527', 'front', **image)
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 Live Photo 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!

5. Create a check

Create a check by providing the Client ID, Live Photo 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
"livePhotoId":"5eb1b5f231778a0008d1c3f6",
7
"documentId":"5ebd40714f23960008c81527",
8
"type": "identity_check"
9
}'
Copied!
1
const check = await complycube.check.create("5eb04fcd0f3e360008035eb1", {
2
livePhotoId: "5eb1b5f231778a0008d1c3f6",
3
documentId: "5ebd40714f23960008c81527",
4
type: "identity_check"
5
});
Copied!
1
check = cc_api.check.create('5ebd40714f23960008c81527',
2
'identity_check',
3
livePhotoId='5eb169302d868c0008828591'
4
documentId='5ebd40714f23960008c81527')
Copied!
1
$result = $ccapi->checks()->create('5eb1276d96be4a0008713af5',
2
['type' => 'identity_check',
3
'livePhotoId' => '5eb169302d868c0008828591',
4
'documentId' => '5ebd40714f23960008c81527']);
Copied!
1
var checkRequest = new CheckRequest
2
{
3
clientId = "5eb04fcd0f3e360008035eb1",
4
documentId = "5ebd40714f23960008c81527",
5
livePhotoId = "5eb169302d868c0008828591",
6
type = "identity_check"
7
};
8
9
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": "identity_check",
5
"clientId": "5eb04fcd0f3e360008035eb1",
6
"livePhotoId": "5eb1b5f231778a0008d1c3f6",
7
"documentId": "5ebd40714f23960008c81527",
8
"status": "pending",
9
"createdAt": "2020-01-04T17:25:21.116Z",
10
"updatedAt": "2020-01-04T17:25:21.116Z"
11
}
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": "5e94b88a01bce00008c86f06",
3
"entityName": "John Doe",
4
"type": "identity_check",
5
"clientId": "5e94b75d01bce00008c86f02",
6
"documentId": "5e94b87b01bce00008c86f03",
7
"livePhotoId": "5e94b88901bce00008c86f05",
8
"status": "complete",
9
"result": {
10
"outcome": "clear",
11
"breakdown": {
12
"faceAnalysis": {
13
"faceDetection": "clear",
14
"facialSimilarity": "clear",
15
"breakdown": {
16
"facialSimilarityScore": 100
17
}
18
},
19
"authenticityAnalysis": {
20
"spoofedImageAnalysis": "clear",
21
"livenessCheck": "clear",
22
"breakdown": {
23
"livenessCheckScore": 100
24
}
25
},
26
"integrityAnalysis": {
27
"faceDetection": "clear"
28
}
29
}
30
},
31
"createdAt": "2020-01-04T17:25:21.116Z",
32
"updatedAt": "2020-01-04T17:25:21.116Z"
33
}
Copied!