> 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/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;

**Example Code for `init` method**

```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",
  locale: "EN",
  partnerTransactionId: "088f7c1f-49b4-fde2-4c5d-d61af9cca1f8",
  workflowConfigs: {
    liveness: {
      maxRetryAttempts: 4,
      detectionTimeOut: 120000,
    },
  },
  themeConfigs: {
    primaryButtonBgColor: "#007bff",
    primaryButtonTextColor: "#ffffff",
    titleTextColor: "#333333",
  },
  onComplete: (data) => {
    console.log("Liveness process completed:", data);
  },
  onError: (error) => {
    console.error("Error during liveness process:", error);
  },
});
```

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

#### Parameters

| **Parameter**          | **Type**                         | **Required** | **Description**                                                                                                                                                                                |
| ---------------------- | -------------------------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `token`                | string                           | Yes          | The bearer token obtained from Vida SSO. Used for authentication.                                                                                                                              |
| `signingKey`           | string                           | Yes          | The signing key shared by Vida. Required for secure SDK initialization.                                                                                                                        |
| `elementId`            | string                           | No           | 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.                                                                 |
| `onComplete`           | (data: LivenessResponse) => void | No           | Callback executed when the liveness process is completed successfully. The response data is passed as an argument.                                                                             |
| `onError`              | (data: LivenessResponse) => void | No           | 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.                                             |
| `onSelfieCapture`      | (image: string) => void          | No           | Callback executed when a selfie is captured. The captured image (Base64 string) is passed as an argument.                                                                                      |
| `locale`               | string                           | No           | 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. |
| `workflow`             | "liveness"                       | No           | Specifies the workflow. Currently, only "liveness" is supported. (In future, may support “ocr” and “kyc”).                                                                                     |
| `partnerTransactionId` | string                           | No           | A unique transaction ID provided by the partner for tracking purposes.                                                                                                                         |
| `workflowConfigs`      | object                           | No           | Configuration options specific to the liveness workflow.                                                                                                                                       |
| `localeConfigs`        | object                           | No           | Custom localization configurations.                                                                                                                                                            |
| `themeConfigs`         | object                           | No           | Custom styling options to align the SDK with your brand's design.                                                                                                                              |

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