> For the complete documentation index, see [llms.txt](https://doc.ozforensics.com/oz-knowledge/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.ozforensics.com/oz-knowledge/guides/developer-guide/sdk/oz-liveness-websdk/using-ozcapsula-data-container-in-web-sdk.md).

# Using OzCapsula Data Container in Web SDK

In this mode, the SDK captures media from the user, packs all biometric and technical data into a **container** (`application/octet-stream`), and then either:

* uploads it directly to Oz API (architecture: **normal** for stateful API or **lite** for Instant), or
* returns it to your backend for forwarding (**capture** architecture).

OzCapsula in Web SDK requires API 6.6.1 and newer.

## **Configuration overview**

When enabling container mode, the key parameters are:

| **Parameter**            | **Value**                    | **Description**                                                |
| ------------------------ | ---------------------------- | -------------------------------------------------------------- |
| use\_wasm\_container     | true                         | Enables data container generation                              |
| architecture             | `normal` / `lite`/ `capture` | Defines who sends the data to Oz API (Web SDK or your backend) |
| api\_use\_session\_token | `client`                     | Defines the retrieval of session token via your backend        |

## Session token

In configuration file, `set api_use_session_token: "client"` for your **backend** to obtain the session token before opening the Web SDK.

**Steps:**

1. Request a session token from Oz API:

```bash
curl --location '{{host}}/api/authorize/session_token' \
  -H 'X-Forensic-Access-Token: <YOUR_TOKEN>'
```

2. The response will contain a short-term `session_token`:

```bash
{
  "session_token": "eyJh..."
}
```

3. Pass this token to the Web SDK Plugin:

```php
OzLiveness.open({
  session_token,
  // other open options
});
```

{% hint style="info" %}
The session token is valid only for a few minutes and must be requested before each capture session.
{% endhint %}

## Flow for different architectures

The flow is different depending on your architecture type.

#### `architecture: "normal"`

In this mode, the Web SDK **automatically uploads** the generated container to Oz API.\
You do **not** need to handle any upload manually.

#### `architecture: "lite"`

In this mode, the Web SDK **automatically uploads** the generated container to Oz API.\
You do **not** need to handle any upload manually.

#### `architecture: "capture"`

In this mode, **Web SDK only captures and packs data**, but **does not send it** to the Oz API.

Your backend is responsible for receiving the container and forwarding it to Oz API.

**Flow:**

1. Web SDK performs video capture and calls the `on_capture_complete(result, container)` callback, where the second argument (`container`) is a **Blob** object (`application/octet-stream`).
2. You send this blob to your backend.
3. Your backend sends it to Oz API using an HTTPS POST request.

{% hint style="info" %}
Please note: currently, the container works with [single request mode](/oz-knowledge/guides/developer-guide/api/oz-api/single-request.md) only.
{% endhint %}

**Example request:**

```bash
curl -X POST \
  '{{host}}/api/folders' \
  -H 'Content-Type: application/octet-stream' \
  -H 'X-Forensic-Access-Token: <YOUR_TOKEN>' \
  --data-binary '@/path/to/container.dat'
```

The response will be similar to the one from the non-container flow.

## Possible errors

| **Error**                                                                                                                               | **Description**                                  |
| --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
| error\_wasm\_internal\_failure\_1                                                                                                       | The device or browser used doesn’t support WASM  |
| error\_wasm\_internal\_failure\_2                                                                                                       | The device doesn’t have enough memory to proceed |
| <ul><li>error\_wasm\_internal\_failure\_3</li><li>error\_wasm\_internal\_failure\_4</li><li>error\_wasm\_internal\_failure\_5</li></ul> | SDK couldn’t generate the container. Try again   |
| error\_wasm\_internal\_failure\_1000                                                                                                    | Any other error not from the list above          |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://doc.ozforensics.com/oz-knowledge/guides/developer-guide/sdk/oz-liveness-websdk/using-ozcapsula-data-container-in-web-sdk.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
