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

```bash
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 | <ul><li>The container appears to be affected by errors and can’t be unpackaged,</li><li>or Oz API (Full) detected a repeat analysis on OzCapsula media after a failed analysis</li></ul> |

## 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="https://2532558063-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5g6dgsxRbyrCvB0uAf8f%2Fuploads%2FJ5Q2cNvuJyoh0C3p6EoG%2Fsession%20token.png?alt=media&amp;token=8579a2cf-ebca-4f1d-8061-094b3c4e5ce7" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://doc.ozforensics.com/oz-knowledge/guides/developer-guide/api/oz-api/ozcapsula-data-container.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
