For the complete documentation index, see llms.txt. This page is also available as Markdown.

How to Integrate Oz Liveness into Your Mobile Application

Oz Liveness Mobile SDK implements the ready-to-use face capture user interface that is essential for seamless customer experience and accurate liveness results.

This guide walks you through your first liveness check using Mobile SDK (iOS or Android) and Oz API.

The described flow combines:

  • Capture mode – the Mobile SDK captures the Liveness video in the app and the Client backend forwards it to Oz API. Capture results are not sent from the SDK straight to Oz API; the Client backend acts as an intermediary.

  • OzCapsula – a proprietary encrypted binary container. The SDK packages the captured media into it; only Oz API can decrypt and process it. On the device it is an opaque blob – you cannot decode or inspect it, only forward it as-is.

Each step is marked:

  • [Oz SDK] – call our SDK API.

  • [Your code] – call your own backend or your own code.

{{host}} in the examples below is the base URL of your Oz API deployment, provided to you during deployment setup.

Requirements

Component
Minimum version

Oz API

6.6.1

iOS SDK

10.0.0

Android SDK

10.0.0

Flutter

10.0.0

Use Content-Type: application/octet-stream for any container uploaded to Oz API.

Before you begin, make sure you have Oz API credentials. When using SaaS API, you get them from us:

For the on-premise Oz API, you need to create a user yourself or ask your team that manages the API. See the guide on user creation via Web Console. Consider the proper user role (CLIENT in most cases or CLIENT ADMIN, if you are going to make SDK work with the pre-created folders from other API users). In the end, you need to obtain a similar set of credentials as you would get for the SaaS scenario.

These parameters are mandatory for OzCapsula to work. Define them in your API configuration file.

We also recommend that you use our logging service called telemetry, as it helps a lot in investigating attacks' details. For Oz API users, the service is enabled by default. For on-premise installations, we'll provide you with credentials.

Oz Liveness Mobile SDK requires a license. License is bound to the bundle_id of your application, e.g., com.yourcompany.yourapp.

Instructions

1

(your code) Add SDK to your project

Android

In the build.gradle of your project, add:

In the build.gradle of the module, add:

iOS

CocoaPods

To integrate OZLivenessSDK into an Xcode project, add to Podfile:

SPM

Add the following package dependencies via SPM: https://gitlab.com/oz-forensics/oz-mobile-ios-sdk (if you need a guide on adding the package dependencies, please refer to the Apple documentation). OzLivenessSDK is mandatory. Skip the OzLivenessSDKOnDevice file.

Flutter

Add to pubspec.yaml:

2

(Oz SDK) Initialize the SDK with a license

Call once per app launch.

Android

Connect the telemetry receiver

After the license is loaded, point the SDK at the Oz telemetry receiver so it can send telemetry. Pass the event host along with a service token.

The event host and service token are provided by Oz Forensics. They are distinct from the session_token used for capture in Step 2.

iOS

Optional language setup:

Connect the telemetry receiver

After the license is loaded, point the SDK at the Oz telemetry receiver so it can send telemetry. Pass the event host along with a service token.

The event host and service token are provided by Oz Forensics. They are distinct from the session_token used for capture in Step 2.

Flutter

Connect the telemetry receiver

After the license is loaded, point the SDK at the Oz telemetry receiver so it can send telemetry. Pass the event host along with a service token.

The event host and service token are provided by Oz Forensics. They are distinct from the session_token used for capture in Step 2.

3

(your code) Get a session_token from your backend

OzCapsula uses a session token. The token is mandatory for OzCapsula.

Your backend requests a session token from Oz API. Request it before each capture session, as close to the moment the user starts capture as possible.

Endpoint:

Request:

The authorization mechanism for calls to Oz API (access_token) depends on your installation settings: when using Instant API, you can integrate it under your own authorization scheme. If access token is required in your case, please check Authentication. Also, please note that access and session token are different tokens issued for different purposes.

Response:

This token is short-lived (default lifetime: 900 seconds for API Full, 120 seconds for Instant API). Request one per capture session and pass it to the SDK immediately – do not cache or reuse tokens across sessions.

4

(Oz SDK) Launch the capture screen with the session_token

Pass the session_token from Step 3.

Android
iOS
Flutter
5

(Oz SDK) Get the OzCapsula container

The container is an opaque encrypted blob. You cannot decode it, inspect it, or extract individual images / frames / metadata from it on the device. It must be forwarded as-is to your backend. If you need access to captured images (e.g., the best shot), retrieve them from the Oz API analysis response on the server side.

Android

Extract the DataContainer from the result intent.

iOS

Implement the delegate. On success you receive a DataContainer.

Flutter

Subscribe to livenessResult; the container arrives as a DataContainer.

6

(your code) Send the container to Oz API

Send the encrypted container to your own backend as raw bytes (application/octet-stream). Your backend forwards it to Oz API and returns the analysis response.

Android

The code below is illustrative – YourBackend.uploadOzContainer(...) is not part of Oz SDK. You implement this method yourself in your own backend client; Oz SDK does not provide an upload helper for this integration path.

iOS

The code below is illustrative – YourBackend.uploadOzContainer is not part of Oz SDK. You implement this method yourself in your own backend client; Oz SDK does not provide an upload helper for this integration path.

Flutter

The code below is illustrative – YourBackend.uploadOzContainer is not part of Oz SDK. You implement this method yourself in your own backend client; Oz SDK does not provide an upload helper for this integration path.

Your backend submits the container to Oz API in a single synchronous POST request.

Endpoint (Instant API):

Endpoint (Full API):

Headers:

  • Content-Type: application/octet-stream (mandatory).

  • X-Forensic-Access-Token: {{access_token}}. (optional, depends on installation settings).

Request body: the raw container bytes – no JSON envelope, no multipart, no base64 wrapping.

Request (Instant API):

Request (Full API):

On success: HTTP 201 with a JSON folder object describing the result. Check Step 7.

On container-level error: HTTP 400 – see Exceptions.

This guide covers the Liveness analysis. To perform a Face Matching analysis within the OzCapsula flow, see How to Perform a Face Matching Analysis within OzCapsula Flow.

7

(your code) Handle the response

Your backend now has the response – a JSON folder object describing the result.

Make the accept/reject decision using only these two top-level fields:

Interpret system_resolution:

  • SUCCESS – all checks passed; accept the user.

  • DECLINED – one or more checks failed; reject the user.

  • FAILED – a system error prevented at least one analysis from completing; do not treat as accept or reject.

For per-analysis verdicts (for example, to know whether liveness passed but biometry failed), read $.analyses[*].resolution_status with the values described above.

Checklist


With these steps, you are done with basic integration of Mobile SDKs. You will be able to access recorded media and analysis results in Web Console via browser or programmatically via API.

In developer guides, you can also find instructions for customizing the SDK look-and-feel and access the full list of our Mobile SDK methods. Check out the table below:

Android sample app source code

iOS sample app source code

Flutter sample app source code

Android SDK Developer Guide

Flutter SDK Developer Guide

Demo app in PlayMarket

Demo app in TestFlight

Last updated

Was this helpful?