> ## Documentation Index
> Fetch the complete documentation index at: https://docs.skortorent.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SDK guide

> Embed the SKOR profile session with the JavaScript SDK

SKOR currently provides a JavaScript SDK. More SDKs will be available soon.

Use the SDK when you want an iframe-based integration where SKOR manages the tenant workflow and your application launches the profile session.

## Installation

The JavaScript SDK is available by URL. Include it in your HTML page:

```html theme={null}
<script src="https://api.skortorent.com/sdk/skor.js"></script>
```

## Initialize

After including the SDK, initialize it with your public key.

```js theme={null}
const sdk = Skor({
  publicKey: "YOUR_PUBLIC_KEY",
});
```

## Start a profile session

To start a profile session, call `startProfileSession` with a unique user token generated by the API.

First, create a tenant using the tenant creation API. Then generate an onboarding token for that tenant. Use that token when starting the SDK profile session.

```js theme={null}
const profileSessionInstance = sdk.startProfileSession({
  token,
  containerId: "skor-container",
});
```

## Callbacks

You can provide callback functions to handle events during the profile session.

### `onLoad`

Triggered when the profile session loads successfully.

```js theme={null}
onLoad: () => {
  console.log("Profile Session loaded");
};
```

### `onSkorAnalysisRunning`

Triggered when profile registration is complete and SKOR analysis is running. During this time, you may want to show a loader because the profile session UI cannot be shown until analysis is complete.

```js theme={null}
onSkorAnalysisRunning: () => {
  console.log("Skor Analysis is currently running");
};
```

### `onCancel`

Triggered when the user cancels the profile session or when the cancel method is called.

```js theme={null}
onCancel: () => {
  console.log("Profile Session Cancelled");
};
```

### `onError`

Triggered when an error occurs during the profile session.

```js theme={null}
onError: (error) => {
  console.log("Profile Session error", error);
};
```

### `onProfileReady`

Triggered when the profile session is ready to be used.

```js theme={null}
onProfileReady: () => {
  console.log("Profile Session ready");
};
```

<Tip>
  Review [SDK authentication](/sdk-auth) before using the SDK in production.
</Tip>
