Background supergraphic

Passive Liveness Sessions

A session is required when you want integrate our Prebuilt Web Pages into your product/platform. It contains the unique URL for your user to access the prebuilt web pages.

Passive Liveness Sessions Object

  • Name
    status
    Type
    string
    Description

    The status of the session. Possible values are:

    1. PENDING when the user has not finished the session.
    2. FINISHED when the user has finished the session.
  • Name
    expired
    Type
    number
    Description

    Number (in milliseconds since epoch) indicating the session expiration.

  • Name
    url
    Type
    string
    Description

    The URL to access the session.

  • Name
    success_url
    Type
    string
    Description

    The URL the user will be directed to after the session is successful.

  • Name
    cancel_url
    Type
    string
    Description

    If set, the prebuilt web pages will show a back button and users will be directed to this URL if they decide to cancel.

  • Name
    result
    Type
    string
    Description

    Contains the result. When the session has not been finished. The result will be null.


POST/face/v1/passive-liveness-sessions

Create a Passive Liveness Session

Create a passive liveness session. By default, a session will automatically expire after 24 hours.

Required parameter

  • Name
    success_url
    Type
    string
    Description

    When the session is successful, GLAIR will redirect to this URL. When GLAIR redirects your user to success_url, GLAIR will append sid to the query parameter. Use this sid to retrieve the result if necessary.

Optional parameter

  • Name
    cancel_url
    Type
    string
    Description

    If set, GLAIR will show a back button on the prebuilt-UI and your user will be directed to this URL when the button is clicked.

Sample Request

POST
/face/v1/passive-liveness-sessions
1
2
3
4
5
6
7
8
import { Vision } from '@glair/vision'; const vision = new Vision({ apiKey: 'api-key', username: 'username', password: 'password' }); await vision.faceBio.passiveLivenessSessions.create({ success_url: `SUCCESS_URL`, cancel_url: `CANCEL_URL` });

Sample Response

1
2
3
4
5
6
{ "status": "PENDING", "success_url": "https://yourdomain.com?success=true", "cancel_url": "https://yourdomain.com?cancel=true", "url": "https://vision.glair.ai/passive-liveness/eyJhbgc9asdalkja", }

GET/face/v1/passive-liveness-sessions/:sid

Retrieve a Passive Liveness Session

Create a passive liveness session. By default, a session will automatically expire after 24 hours.

Required parameter

  • Name
    sid
    Type
    string
    Description

    The session ID you want to retrieve.

Sample Request

GET
/face/v1/passive-liveness-sessions/:sid
1
2
3
4
5
import { Vision } from '@glair/vision'; const vision = new Vision({ apiKey: 'api-key', username: 'username', password: 'password' }); await vision.faceBio.passiveLivenessSessions.retrieve({ sid: 'SID' });

Sample Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
{ "status": "FINISHED", "expired": 1678247333160, "url": "https://vision.glair.ai/passive-liveness/eyJhbgc9asdalkja", "success_url": "https://yourdomain.com?success=true", "cancel_url": "https://yourdomain.com?cancel=true", "result": { "status": "success", "result": { "spoof_percentage": 0.99768, "status": "HIGH" } } }