For the complete documentation index, see llms.txt. This page is also available as Markdown.

Workflow Integration

Integrate KYC workflows in your web app using the ComplyCube Web SDK.

Overview

This guide walks you through integrating the Web SDK with ComplyCube workflows.

For a quick copy-paste example, use our integration assistant.

Integration flow

The Web SDK runs as part of your frontend but relies on your backend to create secure tokens. Here’s how it works:

1

Create a client

Register a new client (i.e. customer) using the ComplyCube API

2

Generate an SDK token

Your backend requests a JWT token tied to that client.

3

Import and mount the SDK

Add the JS and CSS files, then mount the SDK in your web app.

4

Capture documents, videos, and selfies

The SDK guides your customer through the required steps.

5

Perform verification checks

Captured data is securely sent to ComplyCube for verification checks, and results are delivered in real time through the API or webhooks.

Web SDK Integration via Workflows Guide

Integration guide

1

Create a client

Every verification flow starts with a client (i.e. customer). Use the API to create the client.

Example request

Example response

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

See Clients API Reference to learn more.

2

Generate an SDK token

Your backend must create an SDK token for each new flow. This token links the SDK session to the client. Tokens are short-lived and must not be reused.

Example request

Example response

See SDK Token API Reference to learn more.

3

Import the SDK

To import our Web SDK, you need to include it in your target page HTML:

Loading the SDK with Integrity (Optional)

For additional security, you can optionally load the ComplyCube Web SDK using Subresource Integrity (SRI). This allows the browser to verify that the JavaScript and CSS files have not been modified by validating them against cryptographic checksums.

Retrieve the latest SDK integrity values

To ensure you always use the latest supported SDK version and integrity hashes, retrieve the asset metadata from the Web SDK info endpoint.

Example request

Example response

The response includes the URLs and corresponding integrity values for both the JavaScript and CSS assets.

Import the SDK using integrity attributes

Use the returned values to load the SDK in your HTML with integrity and crossorigin attributes:

Notes

  • Using SRI is optional, but recommended for environments with stricter security requirements.

  • The crossorigin="anonymous" attribute is required when using SRI with assets served from a different origin.

  • Integrity values may change when the SDK is updated. Always retrieve the latest values from the endpoint.

The links to complycube.min.js and style.css can be found in your developers portal.

4

Mount the SDK

As part of mounting the Web SDK, you are required to specify a workflow template ID. The SDK will automatically run the active version of the selected workflow.

Once the verification flow is complete, customers are redirected back to the return URL you specify.

With the generated token, the Web SDK can be initialized in your frontend using the following JavaScript code:

The SDK mount parameters are described in the SDK Settings section below.

Referrer policy

To enable successful communication between the SDK and our servers, your web page's Referrer Policy header should be set to strict-origin-when-cross-origin. This ensures that the referrer information is securely transmitted during HTTP requests.

You can either do it programmatically or add it directly to the web page as follows: <meta name="referrer" content="strict-origin-when-cross-origin">

5

Perform verification checks

Once your customer starts the flow, a workflow session is automatically created. This session contains all captured data (documents, images, and videos) as well as progress tracking. You can view all of them through the workflow sessions page on the portal or through the API.

When the flow finishes, the SDK triggers the onComplete callback. The callback provides a data object that includes the workflowSessionId. Your backend should use this ID to notify ComplyCube that the workflow has completed, which in turn runs the verification checks defined in the workflow.

If you have set up webhooks as described in our webhooks guide, you will be notified once a workflow session completes.

You can retrieve the details of a workflow session by calling the retrieve workflow session request.

Example of a complete workflow session request

SDK reference

This section describes all configurable settings, callbacks, lifecycle methods, and branding options available in the ComplyCube Web SDK.

Settings

Option
Description

token

The SDK token generated by your backend. This is required. Type: string

workflowTemplateId

The ID of the workflow template to load for this the session. This is required.

Type: string

containerId

The ID of the container element where the SDK mounts. This must be an empty element.

Type: string Default value: complycube-mount

useModal

This defines whether the UI screens load into a modal instead of inline. Type: boolean Default value: true

useFullScreen

This defines whether the SDK loads in full-screen mode. Type: boolean Default value: false

disableClientAnalytics

This defines whether we track client analytics or not.

Type: boolean Default value: false

Callback

Callbacks let you respond to SDK lifecycle events.

Option
Description

onComplete

Triggered after the customer completes the verification flow. This is used to invoke a workflow session complete request.

onError

Triggered when an error occurs. The error object has two attributes:

  • type: This can be:

    • exception

    • token_expired : indicates the token has expired. When this occurs, a new SDK token must be provided.

  • message: Description of the error.

onExit

This callback is triggered when your client exits before completing the flow. It will return the exit reason, e.g., USER_CONSENT_NOT_GRANTED.

onModalClose

Triggered when the customer tries to close the modal. You can allow or prevent closure by updating the isModalOpen attribute using updateSettings.

Updating settings

A number of settings can be updated at runtime as follows:

Unmounting the SDK

If you are using the SDK in a Single Page Application (SPA), you can call the unmount function to remove the SDK and reset its state.

Branding

You can customise colours, logos, and other branding elements through the branding settings page, if available on your plan.