> 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/api/oz-api/ozcapsula-data-container.md).

# OzCapsula Data Container

## Configuring Oz API

The main change in interaction with API is that you require to send data with another content type, as data container is a binary file: `Content-Type` = `application/octet-stream`. We've added support for this content type along with container functionality.

Also, Instant API now requires client’s private and public keys to function. The paths to these keys should be specified in `OZ_JWT_PRIVATE_KEY_PATH` and `OZ_JWT_PUBLIC_KEY_PATH` in the configuration file.

To generate them, use commands as listed below.

```bash
# Generate private key:
openssl ecparam -name secp384r1 -genkey -noout | openssl pkcs8 -topk8 -nocrypt -out ./jwt.key
# Generate public key:
openssl ec -in ./jwt.key -pubout -out ./jwt.pub
```

#### Configuration parameters

These parameters are mandatory for OzCapsula to work. Add them to your configuration file.

{% code title="" expandable="true" %}

```py
OZ_SESSION_TOKEN_LIFETIME=<your_ttl_for_session_token>
OZ_JWT_PRIVATE_KEY_PATH=<jwt_private_key_path>
OZ_JWT_PUBLIC_KEY_PATH=<jwt_public_key_path>
OZ_MALEWICZ_ANALYSIS_ENABLED=true
```

{% endcode %}

### Examples

{% 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 %}

`POST api/folders`:

```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'
```

`POST api/instant/folders`:

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

### **Exceptions**

| **Error code** | **Error message**    | **Description**                                                         |
| -------------- | -------------------- | ----------------------------------------------------------------------- |
| 3              | Invalid request data | Missing payload.json                                                    |
| 4              | Invalid request data | No media have been added into container                                 |
| 5              | Invalid request data | Container is damaged                                                    |
| 13             | Invalid request data | API didn’t receive the container                                        |
| 14             | Invalid request data | The container appears to be affected by errors and can’t be unpackaged. |

## Obtaining a Session Token

Before you start with SDK, obtain a session token:

1. (Optional, only if you use stateful API) Authorize as any non-OPERATOR role.
2. Call `GET {{host}}/api/authorize/session_token`.

**Example request**

```bash
curl -L 'https://{{host}}/api/authorize/session_token' \
-H 'X-Forensic-Access-Token: <token>' \
-H 'Content-Type: application/json'
```

**Example response**

```bash
{
    "session_token": "<session_token>"
}
```

<figure><img src="/files/GD4lJxmuRF4iGpn8YwOt" alt=""><figcaption></figcaption></figure>


---

# 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/api/oz-api/ozcapsula-data-container.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.
