Docs
API referenceComplianceSupportHomeLog inSign up
  • Introduction
  • Guides
    • API Quick Guide
      • Perform AML Screening
      • Perform Document Check
      • Perform Identity Check
      • Perform Proof of Address Check
      • Perform Multi-Bureau Check
    • Web Portal Quick Guide
      • Perform AML Screening
      • Perform Document Check
      • Perform Multi-Bureau Check
      • Send verification link to client
    • Web SDK Guide
      • Web SDK integration guide
      • Web SDK customizations
    • Mobile SDK Guide
      • Mobile SDK integration guide
      • Mobile SDK stages
      • Mobile SDK tracked events
      • Mobile SDK error codes
    • Hosted Solution Guide
      • Integration guide
    • Postman Guide
    • Webhooks Guide
    • Integration Checklist
  • Check Types
    • AML Screening Check
      • Lists coverage
    • Document Check
      • ID coverage
      • RFID authentication
      • Redaction
      • Expected sides per type
    • Identity Check
    • Enhanced Identity Check
    • Proof of Address Check
    • Multi-Bureau Check
      • Service coverage
    • Face Authentication Check
    • Age Estimation Check
    • Automation
  • Other Services
    • AML Risk Profile
    • Bulk Processing
    • Autofill
    • Company Search
    • Address Search
    • Custom Lists
    • Advanced Case Management
  • Access Management
    • Teams and User Roles
    • Single Sign On (SSO)
      • SSO with Okta
      • SSO with Microsoft Entra ID
  • Useful Resources
    • Testing Data
  • API Reference
Powered by GitBook
On this page
  • Overview of flow
  • 1. Create a client
  • 2. Create a document
  • 3. Upload front side image of an ID
  • 4. Create a check
  • 5. Retrieve outcome

Was this helpful?

  1. Guides
  2. API Quick Guide

Perform Document Check

PreviousPerform AML ScreeningNextPerform Identity Check

Last updated 1 year ago

Was this helpful?

You can run this check immediately via our . It's publicly available and doesn't require an account.

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 -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"
          }
        }'
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"
  }
});
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)
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'
    ]
]);
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.doe@example.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.

{
    "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 document

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

Example request for creating a document

curl -X POST https://api.complycube.com/v1/documents \
     -H 'Authorization: <YOUR_API_KEY>' \
     -H 'Content-Type: application/json' \
     -d '{
          "clientId":"5eb04fcd0f3e360008035eb1",
          "type": "passport",
          "issuingCountry": "GB"
        }'
const document = await complycube.document.create("5eb04fcd0f3e360008035eb1", {
  type: "passport",
  issuingCountry: "GB"
});
document = cc_api.documents.create(
    "5eb04fcd0f3e360008035eb1",
    type="passport",
    issuingCountry="GB"
)
$doc = $ccapi->documents()->create(
    '5eb04fcd0f3e360008035eb1',
    [
        'type' => 'passport',
        'issuingCountry' => 'GB'
    ]
);
var docRequest = new DocumentRequest {
  clientId = "5eb04fcd0f3e360008035eb1",
  type = "passport",
  issuingCountry = "GB"
};

var document = await docApi.CreateAsync(docRequest);

Example response

The response will contain an id (the Document ID). It is required for the next step.

{
    "id": "5ebd40714f23960008c81527",
    "type": "passport",
    "issuingCountry": "GB",
    "createdAt": "2020-01-04T17:25:21.116Z",
    "updatedAt": "2020-01-04T17:25:21.116Z"
}

3. Upload front side image of an ID

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.

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

 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>"
        }'
const frontImage = await complycube.document.upload("5ebd40714f23960008c81527", {
    fileName: "front-test.jpg",
    data: "<BASE64_DATA_CONTENT>"
}, "front");
front_image = cc_api.documents.upload(
    "5ebd40714f23960008c81527",
    "front",
    fileName="front-test.jpg",
    data="<BASE64_DATA_CONTENT>",
)
$up = $ccapi->documents()->upload(
    '5ebd40714f23960008c81527', 
    'front', 
    [
        'fileName' => 'front-test.jpg',
        'data' => '<BASE64_DATA_CONTENT>'
    ]
);
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 Check ID). It is required for the next step.

{
    "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"
}

4. Create a check

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

Example request for creating a check

curl -X POST https://api.complycube.com/v1/checks \
     -H 'Authorization: <YOUR_API_KEY>' \
     -H 'Content-Type: application/json' \
     -d '{
          "clientId":"5eb04fcd0f3e360008035eb1",
          "documentId":"5ebd40714f23960008c81527",
          "type": "document_check"
        }'
const check = await complycube.check.create("5eb1276d96be4a0008713af5", {
    documentId: "5ebd40714f23960008c81527",
    type: "document_check"
});
check = cc_api.checks.create(
    "5eb1276d96be4a0008713af5", 
    "document_check", 
    documentId="5ebd40714f23960008c81527"
)
$result = $ccapi->checks()->create(
    '5eb1276d96be4a0008713af5',
    [
        'type' => 'document_check',
        'documentId' => '5ebd40714f23960008c81527'
    ]
);
var checkRequest = new CheckRequest {
  clientId = "5eb04fcd0f3e360008035eb1",
  documentId = "5ebd40714f23960008c81527",
  type = "document_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.

{
    "id": "65c12a6426d2ab000814037e",
    "entityName": "John Doe",
    "type": "document_check",
    "clientId": "5eb04fcd0f3e360008035eb1",
    "documentId": "5ebd40714f23960008c81527",
    "status": "pending",
    "createdAt": "2020-01-04T17:25:21.116Z",
    "updatedAt": "2020-01-04T17:25:21.116Z"
}

5. 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 -X GET https://api.complycube.com/v1/checks/5ebd40714f23960008c81527 \
     -H 'Authorization: <YOUR_API_KEY>'
const check = await complycube.check.get("5ebd40714f23960008c81527");
check = cc_api.checks.get('5ebd40714f23960008c81527')
$check = $ccapi->checks()->get('5ebd40714f23960008c81527');
var check = await checkApi.GetAsync("5ebd40714f23960008c81527");

Example response

{
  "id": "65c12a6426d2ab000814037e",
  "clientId": "5eb04fcd0f3e360008035eb1",
  "documentId": "5ebd40714f23960008c81527",
  "entityName": "John Doe",
  "type": "document_check",
  "status": "complete",
  "result": {
    "outcome": "clear",
    "breakdown": {
      "extractedData": {
        "documentDetails": {
          "documentType": "driving_license",
          "hasTwoSides": true,
          "issuingCountry": "GB",
          "issuingDate": {
            "day": 1,
            "month": 1,
            "year": 2015
          },
          "expirationDate": {
            "day": 1,
            "month": 1,
            "year": 2025
          },
          "documentNumber": "123456790",
          "personalNumber": "123456790"
        },
        "holderDetails": {
          "lastName": [
            "DOE"
          ],
          "firstName": [
            "JOHN"
          ],
          "dob": {
            "day": 3,
            "month": 9,
            "year": 1995
          },
          "address": {
            "addressText": "110 MAPLE ROAD, SAMPLE CITY, NC 10000-0008",
            "line": "110 MAPLE ROAD",
            "city": "SAMPLE CITY",
            "state": "North Carolina",
            "postalCode": "10000-0008",
            "country": "US"
          }
        }
      },
      "allExtractedData": {
        "visual": {
          "lastName": [
            "DOE"
          ],
          "firstName": [
            "JOHN"
          ],
          "dob": {
            "day": 3,
            "month": 9,
            "year": 1995
          },
          "age": 26,
          "gender": "male",
          "documentNumber": "123456790",
          "documentDiscriminator": "123456790",
          "issuingDate": {
            "day": 1,
            "month": 1,
            "year": 2015
          },
          "expirationDate": {
            "day": 1,
            "month": 1,
            "year": 2025
          },
          "addressText": "110 MAPLE ROAD, SAMPLE CITY, NC 10000-0008",
          "addressLine": "110 MAPLE ROAD",
          "addressCity": "SAMPLE CITY",
          "addressPostalCode": "10000-0008",
          "height": "175 cm"
        },
        "barcode": {
          "lastName": [
            "DOE"
          ],
          "firstName": [
            "JOHN"
          ],
          "dob": {
            "day": 3,
            "month": 9,
            "year": 1995
          },
          "gender": "male",
          "documentNumber": "123456790",
          "documentDiscriminator": "123456790",
          "issuingCountry": "US",
          "issuingDate": {
            "day": 15,
            "month": 11,
            "year": 2018
          },
          "expirationDate": {
            "day": 29,
            "month": 9,
            "year": 2026
          },
          "addressText": "110 MAPLE ROAD, SAMPLE CITY, NC 10000-0008",
          "addressLine": "110 MAPLE ROAD",
          "addressCity": "SAMPLE CITY",
          "addressPostalCode": "10000-0008",
          "addressState": "North Carolina",
          "addressCountry": "US",
          "height": "175 cm"
        }
      }
    },
    "mrzAnalysis": {
      "mrzFormat": "clear",
      "mrzChecksum": "clear"
    },
    "consistencyAnalysis": {
      "lastName": "clear",
      "firstName": "clear",
      "dob": "clear",
      "documentNumber": "clear",
      "personalNumber": "clear",
      "expirationDate": "clear",
      "issuingDate": "clear"
    },
    "contentAnalysis": {
      "dataIntegrity": "clear",
      "issuingDate": "clear",
      "expirationDate": "clear",
      "specimenCheck": "clear",
      "blackListCheck": "clear"
    },
    "formatAnalysis": {
      "modelIdentification": "clear",
      "countryModelValidity": "clear",
      "documentModelValidity": "clear",
      "photocopyDetected": "clear"
    },
    "forensicAnalysis": {
      "documentLivenessCheck": "clear",
      "tamperingDetected": "clear",
      "mrzVisualPlacement": "clear",
      "securityElements": "clear",
      "photoLocation": "clear",
      "mrzClassification": "clear",
      "breakdown": {
        "documentFrontLivenessScore": 100,
        "documentBackLivenessScore": 100
      }
    },
    "frontAndBackAnalysis": {
      "formatAnalysis": "clear",
      "dataConsistency": "clear"
    },
    "clientValidation": {
      "ageVerification": "clear",
      "clientDataConsistency": "clear"
    },
    "extractedImages": [{
      "type": "front_side",
      "data": "<BASE64_IMAGE_CONTENT>"
    }],
    "securityAndPatternAnalysis": [{
      "similarity": 100,
      "outcome": "clear",
      "narrative": "Clear",
      "actualImageData": "<BASE64_IMAGE_CONTENT>",
      "expectedImageData": "<BASE64_IMAGE_CONTENT>"
    }]
  },
  "createdAt": "2020-01-01T14:06:44.756Z",
  "updatedAt": "2020-01-01T14:06:91.913Z"
}

Upload a BASE64 encoded image of the front-side of the ID document. Depending on the type and country combination, may be required.

If you have a notification is sent upon completion of the check.

both sides of the ID
set up webhooks,
Learn more about result outcome and breakdown ➔
Demo Postman collection
95KB
base64-encoded-id-sample.txt
Sample - BASE64 encoded front-side of passport
Document check API flow