Initialize SDK and Session


Install the frontend SDK and add Verisoul's script onto your site with a valid project_id and env {prod, sandbox}.

<script async src="{env}/bundle.js" verisoul-project-id="{project_id}"></script>

It is recommended to use async or defer script attributes, or put the tag in the body to decrease page load times. If you choose these methods make sure the Verisoul object is initialized on the window before using.

To integrate into a mobile app see our webview integration

If you have a Content Security Policy the network calls to Verisoul's CDN and servers could be blocked. Add the policies below to unblock the network calls.

<meta http-equiv="Content-Security-Policy" content="
script-src 'self';
connect-src 'self';


Once installed, you can use the SDK to get the current session_id when you need to make a prediction or reinitialize a session when once an account logs out.


Verisoul generates a session_id to uniquely identify each user session. The session_id is required when you need to get a risk prediction from the backend API and so it must be passed from your client to the server.

You can get the current session_id at any time by calling Verisoul.session(). The function returns a promise that resolves once Verisoul collects a minimum amount of session information to make a prediction.

For example:

const login = async () => {
    try {
        const {session_id} = await window.Verisoul.session();

        // pass session_id to backend
    } catch (e) {
        console.log("Verisoul failed get session_id");


It is recommended that each session_id only be tied to one account. To avoid problems joining a session to an account, reinitialize the session once an account logs out.

Calling Verisoul.reinitialize() generates a new session_id, which ensures that if a user logs out of one account and into a different account, Verisoul will be able to delineate each account's data cleanly.

For example:

const logout = async () => {
    try {
        await window.Verisoul.reinitialize();
    } catch (e) {
        console.log("Verisoul failed to reinitialize");