> 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/oz-knowledge/pt-br/guias/developer-guide/api/oz-api/conteiner-de-dados-ozcapsula.md).

# Contêiner de dados OzCapsula

## Configurando Oz API

A principal mudança na interação com a API é que é necessário enviar dados com outro tipo de conteúdo, pois o contêiner de dados é um arquivo binário: `Content-Type` = `application/octet-stream`. Foi adicionada compatibilidade com esse tipo de conteúdo, juntamente com a funcionalidade de contêiner.

Além disso, Instant API agora requer as chaves privada e pública do cliente para funcionar. Os caminhos para essas chaves devem ser especificados em `OZ_JWT_PRIVATE_KEY_PATH` e `OZ_JWT_PUBLIC_KEY_PATH` no arquivo de configuração.

Para gerá-las, use os comandos listados abaixo.

```bash
# Gerar chave privada:
openssl ecparam -name secp384r1 -genkey -noout | openssl pkcs8 -topk8 -nocrypt -out ./jwt.key
# Gerar chave pública:
openssl ec -in ./jwt.key -pubout -out ./jwt.pub
```

#### Parâmetros de configuração

Esses parâmetros são obrigatórios para o funcionamento do OzCapsula. Adicione-os ao arquivo de configuração.

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

### Exemplos

{% hint style="info" %}
Observe: atualmente, o contêiner funciona com [modo de solicitação única](https://doc.ozforensics.com/oz-knowledge/oz-knowledge/pt-br/guias/developer-guide/api/oz-api/single-request.md) apenas.
{% 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'
```

### **Exceções**

| **Código de erro** | **Mensagem de erro**           | **Descrição**                                                                                                                                                                                   |
| ------------------ | ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 3                  | Dados da solicitação inválidos | payload.json ausente                                                                                                                                                                            |
| 4                  | Dados da solicitação inválidos | Nenhuma mídia foi adicionada ao contêiner                                                                                                                                                       |
| 5                  | Dados da solicitação inválidos | O contêiner está danificado                                                                                                                                                                     |
| 13                 | Dados da solicitação inválidos | A API não recebeu o contêiner                                                                                                                                                                   |
| 14                 | Dados da solicitação inválidos | <ul><li>O contêiner parece estar afetado por erros e não pode ser descompactado,</li><li>ou Oz API (Full) detectou uma análise repetida em mídia OzCapsula após uma análise com falha</li></ul> |

## Obtendo um token de sessão

Antes de começar com o SDK, obtenha um token de sessão:

1. (Opcional, somente se usar a API stateful) Autorize-se como qualquer função diferente de OPERATOR.
2. Chame `GET {{host}}/api/authorize/session_token`.

**Exemplo de solicitação**

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

**Exemplo de resposta**

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

<figure><img src="https://2275968150-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/oz-knowledge/pt-br/guias/developer-guide/api/oz-api/conteiner-de-dados-ozcapsula.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.
