Skip to main content

HyperKYC WebSDK

Overview

This documentation covers the HyperKYC WebSDK implementation, including SDK initialization, configuration options, response handling, and error management.

Step 1: Include the SDK Script

Add the following script to your HTML page:

<script src="https://hv-camera-web-sg.s3.ap-southeast-1.amazonaws.com/hyperverge-web-sdk@<SDK_VERSION>/src/sdk.min.js"></script>

Step 2: Launch the SDK

You have two ways to initialise and launch the HyperKYC SDK.

Option 1: Passing workflowId and transactionId directly

const hyperKycConfig = new HyperKycConfig(
"<jwtToken>", // JWT token generated from your backend
"<workflowID>", // Workflow identifier
"<transactionId>", // Unique transaction identifier
true // Optional: true to show landing page, default is false
);

await HyperKYCModule.launch(hyperKycConfig, callback);

Option 2: Passing only the authToken

Generate the token from your backend:

curl --location 'https://auth.hyperverge.co/login' \
--header 'Content-Type: application/json' \
--data '{
"appId": "<appId>",
"appKey": "<appKey>",
"expiry": "<token-expiry-time-in-seconds>",
"transactionId": "<transactionId>",
"workflowId": "<workflowId>"
}'

Initialise the SDK using the generated token:

const hyperKycConfig = new HyperKycConfig(
"<jwtToken>", // JWT token with workflowId and transactionId in payload
true // Optional: true to show landing page, default is false
);

await HyperKYCModule.launch(hyperKycConfig, callback);

Understanding the Parameters

  • jwtToken — Secure JWT token generated from your backend to authenticate requests
  • workflowID — Name/ID of the workflow you're launching
  • transactionId — Unique ID for tracking individual transactions
  • Landing Page Flag — If true, shows a landing page before the workflow begins
warning

Always generate JWT tokens securely from your backend to protect your appId and appKey.

Optional Setter Functions

setInputs

Pass additional inputs required by your workflow:

hyperKycConfig.setInputs({
"input_key": "input_value"
});

supportDarkMode

Enable automatic dark mode detection:

hyperKycConfig.supportDarkMode(true);

By default, the SDK always launches in light mode regardless of system settings.

setUniqueId (Deprecated)

For cross-platform resume workflows:

hyperKycConfig.setUniqueId('<unique_id>');

setCustomFontStylesheet

Required only for SDK versions older than 8.11.5. For newer versions, font URLs can be included directly in the workflow's UI config.

hyperKycConfig.setCustomFontStylesheet('https://fonts.googleapis.com/css2?family=Roboto');

setDefaultLangCode

Set the default language when multiple languages are configured:

hyperKycConfig.setDefaultLangCode('en');

If not specified, the SDK defaults to the first language listed in the workflow config.

setInitialLoaderColor

Sets the loader colour displayed immediately when the SDK is launched:

hyperKycConfig.setInitialLoaderColor('#ff5733');

setUseLocation

Enables location consent before workflow execution. If denied, the user cannot proceed.

hyperKycConfig.setUseLocation(true); // default is false

Understanding HyperKycResult

Upon workflow completion, the SDK returns a HyperKycResult object:

FieldDescription
statusStatus of workflow: auto_approved, auto_declined, needs_review, error, user_cancelled
detailsData points from workflow execution (based on sdkResponse in workflow config)
transactionIdTransaction ID provided at start
errorMessageError description (only if status is error or user_cancelled)
errorCodeError code (only if status is error or user_cancelled)
latestModuleLast executed module (only if status is error or user_cancelled)
transactionAlreadyProcessedIndicates end state already reached for the given transactionId

Sample Response Structures

auto_approved / needs_review / auto_declined
{
"transactionId": "123456",
"status": "auto_approved/auto_declined/needs_review",
"details": {
"fullName": "Jose",
"countrySelected": "ind",
"dateOfBirth": "06-01-1993",
"dateOfIssue": "03-01-2003",
"selfieImage": "",
"idFrontImage": "",
"idBackImage": ""
}
}
When exitOnEndStates is enabled

If the user who has already reached an end state resumes again:

{
"transactionId": "ab_14may_test02",
"status": "auto_approved/auto_declined/needs_review",
"details": {},
"transactionAlreadyProcessed": true
}
error
{
"transactionId": "d00890a507",
"status": "error",
"errorMessage": "<error_message>",
"errorCode": "<error_code>",
"latestModule": "<module_id>"
}
user_cancelled
{
"transactionId": "fd6aa8af4a",
"status": "user_cancelled",
"errorCode": 103,
"errorMessage": "Workflow cancelled by user",
"latestModule": "<module_id>"
}

Error Codes

SDK Config Errors (101)

Error MessageDescription
Unable to Fetch workFlow with workflowIdWorkflow ID not found for the provided app ID
Unable to Fetch Text ConfigCustom text config source configured but file not found
accessToken cannot be emptyAccess token not provided during SDK initialization
workflowId cannot be emptyWorkflow ID not provided during SDK initialization
transactionId cannot be emptyTransaction ID not provided during SDK initialization
Invalid Request Headers / Request BodyGet Transaction State API returning 4xx error (for CPR)
uniqueId invalidUnique ID not in standard UUID format
Local data not supported by cross platform resumeWorkflow passing module variables with local file references in CPR mode

Workflow Input Errors (102)

Error MessageDescription
<input> is not found in inputsRequired input missing in setInputs call
value <value> for key <key> is not of the expected typeInput data type mismatch with workflow spec
Unexpected param <key> passed as inputInput not defined in inputsRequired

User Cancelled Errors (103)

Error MessageDescription
Workflow cancelled by userUser clicked close button
Internet is downNo internet connection
Domain is not CORS whitelistedCORS issue
Network error occuredNetwork issues

Workflow Errors (104)

Error MessageDescription
Invalid previous stepModule has previous step configured but it was not executed
Request payload size exceeds maximum limit for finish transaction apiPayload > 12MB
Media stream not presentMediaRecorder API initialization issue
Media recorder not presentMediaRecorder API not supported in browser
Recording not startedMediaRecorder API access issue
Could not start recordingRecording start failure
logVideoStatementUrl not defined in workflowMissing API URL in workflow

Other Error Codes

CodeCategoryDescription
106Camera Permissions DeniedCamera permission not granted
107Hardware ErrorCamera/media recorder initialization failure
111 or 4xx-5xxNetwork errorAPI error
112Signature FailedRequest/response signature validation failure (possible MITM)
126Privacy Consent DeniedUser denied BIPA compliance consent (USA clients only)
151Session ConflictParallel ongoing session validation failure (CPR-related)
500-505WebBundle Module ErrorVarious webBundle module configuration/initialization errors

Complete Sample Implementation

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HyperKYC Integration</title>
<script src="https://hv-web-sdk-cdn.hyperverge.co/hyperverge-web-sdk@<SDK_VERSION>/src/sdk.min.js"></script>
</head>
<body>
<button type="button" onclick="runGlobal();">Launch Workflow</button>
<div class="result" style="width: 40%;"></div>

<script>
async function runGlobal() {
const hyperKycConfig = new HyperKycConfig(
'<jwt_token>',
false,
);

hyperKycConfig.setInputs({
"input_key": "input_value"
});

hyperKycConfig.supportDarkMode(false);
hyperKycConfig.setCustomFontStylesheet('https://fonts.googleapis.com/css2?family=Roboto');
hyperKycConfig.setInitialLoaderColor('<color>');
hyperKycConfig.setDefaultLangCode('<language>');
hyperKycConfig.setUseLocation(false);

await HyperKYCModule.launch(hyperKycConfig, callback);
}

const callback = (HVResponse) => {
console.log(HVResponse);
};
</script>
</body>
</html>
OwnerUnknown
Last reviewed onNever
Last updated onApr 10, 2026
Last updated bySrinija
Was this helpful?
Ask AI

Ask anything about the internal documentation

AI answers are based on internal documentation. Verify critical information.