Overview of 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
Copy curl -X POST https://api.complycube.com/v1/clients \
-H 'Authorization: <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"type": "person",
"email": "john.doe@example.com",
"personDetails":{
"firstName": "John",
"lastName" :"Doe"
}
}'
Copy const { ComplyCube } = require("@complycube/api");
const complycube = new ComplyCube({ apiKey: "<YOUR_API_KEY>" });
const client = await complycube.client.create({
type: "person",
email: "john.doe@example.com",
personDetails: {
firstName: "John",
lastName: "Doe"
}
});
Copy from complycube import ComplyCubeClient
cc_api = ComplyCubeClient(api_key='<YOUR API KEY>')
new_client = {
'type':'person',
'email':'john.doe@example.com',
'personDetails': {
'firstName':'John',
'lastName':'Doe'
}
}
client = cc_api.clients.create(**new_client)
Copy use ComplyCube\ComplyCubeClient;
$ccapi = new ComplyCubeClient('<YOUR_API_KEY>');
$result = $ccapi->clients()->create(['type' => 'person',
'email' => 'john.doe@example.com',
'personDetails' => ['firstName' => 'John',
'lastName' => 'Doe']]);
Copy using ComplyCube.Net;
using ComplyCube.Net.Resources.Clients;
var clientApi = new ClientApi(new ComplyCubeClient("<YOUR_API_KEY>"));
var newClient = new ClientRequest {
type = "person",
email = "john@smith.com",
personDetails = new PersonDetails {
firstName = "John",
lastName = "Doe"
}
}
var client = await clientApi.CreateAsync(newclient);
Example response
The response will contain an id
(the Client ID). It is required for the next step.
Copy {
"id": "5eb04fcd0f3e360008035eb1",
"type": "person",
"email": "john.doe@example.com",
"personDetails": {
"firstName": "John",
"lastName": "Doe"
},
"createdAt": "2020-01-04T17:24:29.146Z",
"updatedAt": "2020-01-04T17:24:29.146Z"
}
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.
cURL Node.js Python PHP .NET
Copy curl -X POST https://api.complycube.com/v1/livePhotos \
-H 'Authorization: <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"clientId":"5eb04fcd0f3e360008035eb1",
"data": "<BASE64_DATA_CONTENT>"
}'
Copy const livePhoto = await complycube.livePhoto.upload("5eb04fcd0f3e360008035eb1", {
data: "<BASE64_DATA_CONTENT>"
}
Copy livePhoto = cc_api.livephotos.upload('5eb04fcd0f3e360008035eb1',
data='<BASE64_DATA_CONTENT>')
Copy $img = $ccapi->livephotos()->upload('5eb04fcd0f3e360008035eb1',
['data' => '<BASE64_DATA_CONTENT>']);
Copy var livePhotoRequest = new LivePhotoRequest
{
clientId = "5eb04fcd0f3e360008035eb1",
data= "<BASE64_DATA_CONTENT>"
};
var livePhoto = await livePhotoApi.UploadAsync(livePhotoRequest);
Example response
The response will contain an id
(the Document ID). It is required for the next step.
Copy {
"id": "5eb1b5f231778a0008d1c3f6",
"clientId": "5eb04fcd0f3e360008035eb1",
"downloadLink": "/livePhotos/5eb1b5f231778a0008d1c3f6/download",
"contentType": "images/jpg",
"size": 44896,
"createdAt": "2020-01-01T14:06:44.756Z",
"updatedAt": "2020-01-01T14:06:44.756Z"
}
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
Copy curl -X POST https://api.complycube.com/v1/documents \
-H 'Authorization: <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"clientId":"5eb04fcd0f3e360008035eb1",
"type": "passport"
}'
Copy const document = await complycube.document.create("5eb04fcd0f3e360008035eb1", {
type: "passport"
});
Copy document = cc_api.documents.create('5eb04fcd0f3e360008035eb1', type='passport')
Copy $doc = $ccapi->documents()->create('5eb04fcd0f3e360008035eb1',
['type' => 'passport']);
Copy var docRequest = new DocumentRequest
{
clientId = "5eb04fcd0f3e360008035eb1",
type = "passport"
};
var document = await docApi.CreateAsync(docRequest);
Example response
The response will contain an id
(the Document ID). It is required for the next step.
Copy {
"id": "5ebd40714f23960008c81527",
"type": "passport",
"createdAt": "2020-01-04T17:25:21.116Z",
"updatedAt": "2020-01-04T17:25:21.116Z"
}
4. Upload front side image of an ID
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.
cURL Node.js Python PHP .NET
Copy curl -X POST https://api.complycube.com/v1/documents/5ebd40714f23960008c81527/upload/front \
-H 'Authorization: <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"fileName": "front-test.jpg",
"data": "<BASE64_DATA_CONTENT>"
}'
Copy const frontImage = await complycube.document.upload("5ebd40714f23960008c81527", {
fileName: "front-test.jpg",
data: "<BASE64_DATA_CONTENT>"
}, "front");
Copy image = {
'fileName': 'front-test.jpg',
'data' : '<BASE64_DATA_CONTENT>'
}
front_img = cc_api.documents.upload('5ebd40714f23960008c81527', 'front', **image)
Copy $up = $ccapi->documents()->upload('5ebd40714f23960008c81527',
'front',
['fileName' => 'front-test.jpg',
'data' => '<BASE64_DATA_CONTENT>']);
Copy var docFront = new ImageRequest
{
fileName = "front-test.jpg",
data= "<BASE64_DATA_CONTENT>"
};
var img = await docApi.UploadImageAsync("5ebd40714f23960008c81527",
"front",
docFront);
Example response
The response will contain an id
(the Live Photo ID). It is required for the next step.
Copy {
"id": "5eb169302d868c0008828591",
"fileName": "front-test.jpg",
"documentSide": "front",
"downloadLink": "/documents/5ebd40714f23960008c81527/images/5eb169302d868c0008828591/download",
"contentType": "image/jpg",
"size": 72716,
"createdAt": "2020-01-04T17:25:21.116Z",
"updatedAt": "2020-01-04T17:25:21.116Z"
}
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
Copy curl -X POST https://api.complycube.com/v1/checks \
-H 'Authorization: <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"clientId":"5eb04fcd0f3e360008035eb1",
"livePhotoId":"5eb1b5f231778a0008d1c3f6",
"documentId":"5ebd40714f23960008c81527",
"type": "identity_check"
}'
Copy const check = await complycube.check.create("5eb04fcd0f3e360008035eb1", {
livePhotoId: "5eb1b5f231778a0008d1c3f6",
documentId: "5ebd40714f23960008c81527",
type: "identity_check"
});
Copy check = cc_api.check.create('5ebd40714f23960008c81527',
'identity_check',
livePhotoId='5eb169302d868c0008828591'
documentId='5ebd40714f23960008c81527')
Copy $result = $ccapi->checks()->create('5eb1276d96be4a0008713af5',
['type' => 'identity_check',
'livePhotoId' => '5eb169302d868c0008828591',
'documentId' => '5ebd40714f23960008c81527']);
Copy var checkRequest = new CheckRequest
{
clientId = "5eb04fcd0f3e360008035eb1",
documentId = "5ebd40714f23960008c81527",
livePhotoId = "5eb169302d868c0008828591",
type = "identity_check"
};
var check = await checkApi.CreateAsync(checkRequest);
Example response
The response will contain an id
(the Check ID). It is required for the next step.
Copy {
"id": "65c12a6426d2ab000814037e",
"entityName": "John Doe",
"type": "identity_check",
"clientId": "5eb04fcd0f3e360008035eb1",
"livePhotoId": "5eb1b5f231778a0008d1c3f6",
"documentId": "5ebd40714f23960008c81527",
"status": "pending",
"createdAt": "2020-01-04T17:25:21.116Z",
"updatedAt": "2020-01-04T17:25:21.116Z"
}
6. Retrieve outcome
ComplyCube will perform the check. You can retrieve a check's outcome and breakdown via the API.
Example request for retrieving the check outcome
cURL Node.js Python PHP .NET
Copy curl -X GET https://api.complycube.com/v1/checks/5ebd40714f23960008c81527 \
-H 'Authorization: <YOUR_API_KEY>'
Copy const check = await complycube.check.get("5ebd40714f23960008c81527");
Copy check = cc_api.checks.get('5ebd40714f23960008c81527')
Copy $check = $ccapi->checks()->get('5ebd40714f23960008c81527');
Copy var check = await checkApi.GetAsync("5ebd40714f23960008c81527");
Example response
Copy {
"id": "5e94b88a01bce00008c86f06",
"entityName": "John Doe",
"type": "identity_check",
"clientId": "5e94b75d01bce00008c86f02",
"documentId": "5e94b87b01bce00008c86f03",
"livePhotoId": "5e94b88901bce00008c86f05",
"status": "complete",
"result": {
"outcome": "clear",
"breakdown": {
"faceAnalysis": {
"faceDetection": "clear",
"facialSimilarity": "clear",
"breakdown": {
"facialSimilarityScore": 100
}
},
"authenticityAnalysis": {
"spoofedImageAnalysis": "clear",
"livenessCheck": "clear",
"breakdown": {
"livenessCheckScore": 100
}
},
"integrityAnalysis": {
"faceDetection": "clear"
}
}
},
"createdAt": "2020-01-04T17:25:21.116Z",
"updatedAt": "2020-01-04T17:25:21.116Z"
}