Initialize Session

For a user to go through ZeroKYC 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, not 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', {
        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);
}

Last updated