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:
PENDING
when the user has not finished the session.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.
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 appendsid
to the query parameter. Use thissid
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
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",
}
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
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"
}
}
}