> 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/liveness/integration/liveness-web-sdk/sdk-initialization.md).

# SDK Initialization

The `init` method initializes the Vida Web SDK and configures its behavior. This method accepts an options object that allows customization of the SDK's functionality, appearance, and localization.&#x20;

<details>

<summary><strong>Example Code for <code>init</code> method</strong></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",
  env: "production", // pass "sandbox" for sandbox env, This param is required only for integration via npm package
  elementId: "sdk-container",
  workflow: "liveness", 
  locale: "EN",
  partnerTransactionId: "088f7c1f-49b4-fde2-4c5d-d61af9cca1f8",
  partner: { /* applicable for user onboarding auth */
    logo: "<URL for Branding Logo>";
    name: "<Your Brand/Org Name>";
  },
  userInfo: {
    id: "user-123"
  },
  workflowConfigs: {
    liveness: {
      maxRetryAttempts: 4,
      detectionTimeOut: 120000,
    },
  },
  themeConfigs: {
    primaryButtonBgColor: "#007bff",
    primaryButtonTextColor: "#ffffff",
    titleTextColor: "#333333",
  },
  onComplete: (data) => {
    console.log("Liveness completed:", data);
  },
  onError: (error) => {
    console.error("Error during liveness:", error);
  },
});
```

{% endcode %}

</details>

Below is a detailed breakdown of all the parameters available in the `InitOptions` interface.

{% hint style="info" %}
**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.&#x20;

See the [**ID Fraud Shield**](/identity-stack/verify/id-fraud-shield-sdk.md) Integration guide for full details.
{% endhint %}

#### Parameters

<table><thead><tr><th width="172.14453125">Parameter</th><th width="162.7109375">Type</th><th width="126.6328125">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td>string</td><td>Yes</td><td>The bearer token obtained from Vida SSO. Used for authentication.</td></tr><tr><td><code>signingKey</code></td><td>string</td><td>Yes</td><td>The signing key shared by Vida. Required for secure SDK initialization.</td></tr><tr><td><code>env</code></td><td>string</td><td>Yes for npm based integration</td><td>This is required only if your integration method is via npm package. Environment values are <code>production</code> / <code>sandbox</code></td></tr><tr><td><code>elementId</code></td><td>string</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>(data: LivenessResponse) => void</td><td>No</td><td>Callback executed when the liveness process is completed successfully. The response data is passed as an argument.</td></tr><tr><td><code>onError</code></td><td>(data: LivenessResponse) => void</td><td>No</td><td>Callback executed if an error occurs during the liveness process either in the client side or in the API. The error data is passed as an argument.</td></tr><tr><td><code>onSelfieCapture</code></td><td>(image: string) => void</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>locale</code></td><td>string</td><td>No</td><td>Language code for localization (e.g., "EN" for English, "ID" 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>"liveness"</td><td>No</td><td>Specifies the workflow. Currently, only "liveness" is supported. (In future, may support “ocr” and “kyc”).</td></tr><tr><td><code>partnerTransactionId</code></td><td>string</td><td>No</td><td>A unique transaction ID provided by the partner for tracking purposes.</td></tr><tr><td><code>userinfo.Id</code></td><td>string</td><td>No</td><td>UserID or hash of the UserID. This will help to configure rules around users.</td></tr><tr><td><code>workflowConfigs</code></td><td>object</td><td>No</td><td>Configuration options specific to the liveness workflow.</td></tr><tr><td><code>localeConfigs</code></td><td>object</td><td>No</td><td>Custom localization configurations.</td></tr><tr><td><code>themeConfigs</code></td><td>object</td><td>No</td><td>Custom styling options to align the SDK with your brand's design.</td></tr></tbody></table>

This table summarizes all the parameters you can use in the `init` method to configure the Vida Web SDK.
