Skip to main content

ComplyCube Python Library

The official python library for integrating with the ComplyCube API.

Check out the API integration docs.

Check out the API reference.

Installation

pip install complycube

Requirements

  • Python 3.6+

Getting Started

import the client

from complycube import ComplyCubeClient

Initialise the ComplyCubeClient with the api key from your developer dashboard.

cc_api = ComplyCubeClient(api_key='test_....')

Create a new client and complete a standard check

input_client_dict = {
    'type':'person',
    'email':'a@b.com',
    'personDetails': {
        'firstName':'John',
        'lastName':'Smith'
    }
}
cc_client = cc_api.clients.create(**input_client_dict)
check = cc_api.checks.create(cc_client.id,'standard_screening_check')
print(check)

Search for clients with the first name "John"

for client in cc_api.clients.list(personDetails={'firstName': 'John'}):
    print(client.email)

The auto_list function will handle api paging automatically via a generator and return a native object.

for client in cc_api.clients.auto_list(personDetails={'firstName': 'John'}):
    print(client.email)

Available resources

Property Operations
clients create, get, update, delete, list, auto_list
addresses create, get, update, delete, list
documents create, get, update, delete, list, auto_list, upload, download, deleteImage, redact
livephotos upload, get, list, download, deleteImage, redact
livevideos get, list, delete, redact
checks create, get, update, list, validate, redact
notes create, get, update, delete, list, auto_list
riskprofiles get
workflow_sessions get, list, complete, cancel
flow create
tokens create
reports generate_client_report, generate_check_report, generate_workflow_session_report
webhooks create, get, update, delete, list
teammembers get, list
auditlogs get, list
custom_lists get, list, add_entity
lookup search_companies, get_company, search_addresses
autofill perform
static screening_lists, supported_documents
account_info get

Add a note to a client

note = cc_api.notes.create(cc_client.id, 'internal', 'Reviewed by compliance')

Search a company registry and fetch the full company record

companies = cc_api.lookup.search_companies('Stripe Payments Europe Limited', 'IE')
for company in companies:
    details = cc_api.lookup.get_company(company.id)
    print(details.name, details.registration_number)

Redact a document check outcome

cc_api.checks.redact(check.id, attributes=['documentNumber'], images=['face'])

Handling errors

All API errors raise ComplyCubeAPIError, which exposes the HTTP status code, the ComplyCube error type and, for validation errors, the offending param.

from complycube import ComplyCubeAPIError

try:
    cc_api.clients.create(type='person', email='invalid')
except ComplyCubeAPIError as e:
    print(e.code, e.type, e.param, e.message)

Verifying webhooks

ComplyCube signs each webhook with HMAC-SHA256 in the ComplyCube-Signature header. Pass the raw request body, exactly as received, to the verifier.

from complycube.eventverifier import EventVerifier, VerificationError

verifier = EventVerifier('<WEBHOOK_SECRET>')
try:
    event = verifier.construct_event(request.body, request.headers['ComplyCube-Signature'])
except VerificationError:
    ...  # reject the request

Client Configuration

cc_api = ComplyCubeClient(api_key='test_...', timeout=30, retries=5)

timeout sets the default request timeout in seconds (60 if not set). retries enables retries with exponential backoff for GET requests that fail with 429 or 5xx responses.

Per-request Configuration

You can set the following per-request options on any call: timeout, verify, proxies, cert, headers and api_key. They configure the HTTP request and are never sent to the API.

Setting the timeout for client creation to 5 seconds

cc_api.clients.create(**input_client_dict, timeout=5)

Avoiding certification verification

cc_api.clients.create(**input_client_dict, verify=False)

Passing a specific api key for a single request

cc_api.clients.create(**input_client_dict, api_key='test_...')

Configuring a Proxy

A proxy can be configured for all requests when creating the client:

proxies = {
  'https': 'http://10.10.1.10:1080',
}
cc_api = ComplyCubeClient(api_key='test_...', proxy=proxies)

or for a single request:

cc_api.clients.create(**input_client_dict, proxies=proxies)

For additional information, news and our latest blogs visit us at https://www.complycube.com/

Metadata

Release files for complycube 1.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for complycube 1.1.9
File Size Uploaded Provenance Actions
complycube-1.1.9.tar.gz 25.1 kB Without provenance Details for complycube-1.1.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for complycube 1.1.9
File Interpreter ABI Platform Actions
complycube-1.1.9-py3-none-any.whl Python 3 none any Details for complycube-1.1.9-py3-none-any.whl

Total release size: 66.5 kB

Release files / complycube-1.1.9.tar.gz

Download URL complycube-1.1.9.tar.gz
Size 25.1 kB
Tags Source
SHA-256 checksum
How to use checksums
65cb6d28351bd871337f16e31e2da06f5d9424271b64261496921fe0a39b401f
BLAKE2b-256 checksum
How to use checksums
5b9d08a23e79c655f64debe6b06126938357ec9a2cd2387acf3560ef69d3d2ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Release files / complycube-1.1.9-py3-none-any.whl

Download URL complycube-1.1.9-py3-none-any.whl
Size 41.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
277e46b57d720ebdf863e6b43db432a4c7e43706da546014595c075ccb1e2e4a
BLAKE2b-256 checksum
How to use checksums
5e54b864582f196f645d60c75b1521c3420ff1c3bb758357d15856ce48ae62c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Security for complycube 1.1.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page