> For the complete documentation index, see [llms.txt](https://docs.vida.id/identity-stack/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vida.id/identity-stack/verify/kyc-web-sdk/integration/frontend-integration/sdk-initialization.md).

# SDK Initialization

The `init` method initializes the Vida Web SDK and configures its behaviour. This method accepts an options object that allows customization of the SDK's functionality, appearance, and localization. Below is a detailed breakdown of all the parameters available in the `InitOptions` interface.

<details>

<summary>Example Code for <strong><code>init</code></strong> method</summary>

{% code expandable="true" %}

```javascript
import { VidaSDK } from "vida-web-sdk";
/* If using script tag, directly use - window.VidaSDK.init() */
VidaSDK.init({
  token: "your-bearer-token",
  signingKey: "your-signing-key",
  elementId: "sdk-container",
  workflow: "identity-verification", /* Mandatory to pass this */
  countryCode: "MYS", /* Supported values - 'MYS' | 'PHL' | 'IDN' | 'SGP' | 'THA' | 'THL' */
  locale: "EN",
  partnerTransactionId: "088f7c1f-49b4-fde2-4c5d-d61af9cca1f8",
  userInfo: { /* Optional, max 100 chars */
    id: "your-user-id", /* Optional, mac 100 chars */
  },
  workflowConfigs: {
    identityVerification: {
      userConsent: { /* Optional */
        obtained: true,
        obtainedAt: Date.now(),
      },
      documentType: string, /* Optional */
      docVerification: {
        skipDocBackSideCapture: true,  /* Optional */
        skipIntroductionScreen: false, /* Optional */
        skipDocSelectionScreen: false, /* Optional */
        skipTutorialScreen: false,     /* Optional */
        maxRetryAttempts: 4,           /* Optional */
        captureTimeOut: 120000,        /* Optional */
      },
      faceMatch: {
        skipTutorialScreen: false,  /* Optional */
        maxRetryAttempts: 4,        /* Optional */
        detectionTimeOut: 120000,   /* Optional */
      },
    },
  },
  themeConfigs: {
    primaryButtonBgColor: "#007bff",
    primaryButtonTextColor: "#ffffff",
    titleTextColor: "#333333",
  },
  onComplete: (data) => {
    console.log("Identity verification process completed:", data);
  },
  onError: (error) => {
    console.error("Error during Identity verification process:", error);
  },
});
```

{% endcode %}

</details>

{% hint style="info" %}
Document Back Side Capture & Verification is only supported for following cards - **MyKad, MyKas, MyPR & MyTentera.**<br>

**Using ID Fraud Shield?**

When ID Fraud Shield is enabled for your account, it runs alongside this liveness flow to strengthen verification with additional fraud-risk signals. Provide `userInfo.id` so fraud rules can be applied per user.

`userInfo.id` is **optional** — if you do not provide it, the SDK uses a default value — but we recommend setting your own. See the [ID Fraud Shield](/identity-stack/verify/id-fraud-shield-sdk.md) Integration guide for full details.\
\
**Character limits**\
`partnerTransactionId` and `userInfo.id` both accept a maximum of 100 characters. Sending a longer value will cause SDK initialization to fail.
{% endhint %}

### Parameters

<table><thead><tr><th>Parameter</th><th width="224.0234375">Type</th><th width="117.12890625">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td><code>string</code></td><td>Yes</td><td>The bearer token obtained from Vida SSO. Used for authentication.</td></tr><tr><td><code>signingKey</code></td><td><code>string</code></td><td>Yes</td><td>The signing key shared by Vida. Required for secure SDK initialization.</td></tr><tr><td><code>elementId</code></td><td><code>string</code></td><td>No</td><td>The ID of the HTML element where the SDK will be rendered. If not provided, the SDK will create an element and render the SDK.</td></tr><tr><td><code>onComplete</code></td><td><code>(data: IdentityVerificationResponse) => void</code></td><td>Yes</td><td>Callback executed when the liveness/ Onboarding process is completed successfully. The response data is passed as an argument.</td></tr><tr><td><code>onError</code></td><td><p><code>(data: IdentityVerificationResponse) => void</code></p><p> </p></td><td>No</td><td>Callback executed if an error occurs during the identity verification process either in the client side or in the API. The error data is passed as an argument.</td></tr><tr><td><code>onDocVerificationSuccess</code></td><td><code>(data: IdentityVerificationResponse) => void</code></td><td>No</td><td>Callback executed when doc verification is successful.</td></tr><tr><td><code>onDocVerificationError</code></td><td><code>(data: IdentityVerificationResponse) => void</code></td><td>No</td><td>Callback executed when doc verification is api is errored out.</td></tr><tr><td><code>onSelfieCapture</code></td><td><code>(image: string) => void</code></td><td>No</td><td>Callback executed when a selfie is captured. The captured image (Base64 string) is passed as an argument.</td></tr><tr><td><code>onDocFaceMatchError</code></td><td><code>(data: IdentityVerificationResponse) => void</code></td><td>No</td><td>Callback executed when document face match api is errored out.</td></tr><tr><td><code>hideNetworkStatusAlert</code></td><td><code>boolean</code></td><td>No</td><td>Passing this true will hide network status (internet connectivity / offline ) alert.</td></tr><tr><td><code>locale</code></td><td><code>string</code></td><td>No</td><td>Language code for localization (e.g., <code>"EN"</code> for English, <code>"ID"</code> for Indonesian). Defaults to browser language if not specified. Falls back to EN if browser language is not available/applicable.</td></tr><tr><td><code>workflow</code></td><td><code>"identity-verification"</code></td><td>Yes</td><td>Specifies the workflow. use “identity-verification” for identity verification ( KYC ) flow.</td></tr><tr><td><code>countryCode</code></td><td><code>'MYS' | 'PHL' | 'IDN' | 'SGP' | 'THA' | 'VNM'</code></td><td>No</td><td>ISO3 country code for the Identity Verification flow. Defaults to MYS ( Malaysia )</td></tr><tr><td><code>partnerTransactionId</code></td><td><code>string</code></td><td>No</td><td>A unique transaction ID provided by the partner for tracking purposes.<br><br><em>Note: <strong>Maximum 100 characters.</strong> Values longer than this will cause the request to fail.</em></td></tr><tr><td><code>userInfo.id</code></td><td><code>string</code></td><td>No</td><td>UserID or hash of the UserID. This will help to configure rules around users.<br><br><em>Note: <strong>Maximum 100 characters.</strong> If not provided, the SDK uses a default value.</em></td></tr><tr><td><code>workflowConfigs</code></td><td><code>object</code></td><td>No</td><td>Configuration options specific to the identity verification workflow.</td></tr><tr><td><code>localeConfigs</code></td><td><code>object</code></td><td>No</td><td>Custom localization configurations.</td></tr><tr><td><code>themeConfigs</code></td><td><code>object</code></td><td>No</td><td>Custom styling options to align the SDK with your brand's design.</td></tr></tbody></table>
