Initialize Session

For a user to go through ID Check you must first fetch a valid session token.

Note: Each session token is short-lived and used to establish the authenticity throughout the session

Get Session Token

To get a session token, your application's server can make an API request to Verisoul like below. Note, for security, best practice is to fetch the session token from a protected server, never on the client.

/*BACKEND SERVER*/

try {
    // Create a session token via Verisoul's API
    let response = await fetch('https://api.prod.verisoul.ai/liveness/session?id=true', {
        method: 'GET',
        x-api-key: {VERISOUL_API_KEY}
    });

    if (!response.ok) {
        throw new Error(`failed to create Verisoul session: ${response.status}`);
    }

    let {session_id} = await response.json();
} catch (err) {
    console.error(err);
}

Referring Session ID

If you have also integrated the Verisoul Platform you can tie a platform session_id to a ID Check session_id by passing an additional query parameter. This will allow Verisoul to better check for common fraud vectors like ID selling or link sharing. See the additional referring_session_id parameter in the Get Session Token API Reference.

Last updated