---
title: "Criar contexto do agente"
method: POST
path: "/api/management/ai/agents/{agentId}/contexts"
tags: ["ai-agents", "agents", "contexts"]
---

# Criar contexto do agente

`POST /api/management/ai/agents/{agentId}/contexts`

Cria um contexto do agente. Sem `order`, ele entra no fim da lista. Para `type: "text"` envie o texto em `content`; para `type: "file"` envie a requisição como `multipart/form-data` com o arquivo no campo `file` (imagem ou PDF, até 10 MB) — nesse caso o `content` passa a apontar para o arquivo armazenado.

## Request body

- object
  - `type` string
  - `content` string
  - `is_active` boolean

## Response `201`

Sucesso

- object
  - `type` string
  - `content` string
  - `is_active` boolean
  - `order` integer
  - `ai_agent_id` string
  - `updated_at` string, date-time
  - `created_at` string, date-time
  - `id` string

## Other responses

- `404` — Agente não encontrado
- `422` — Erro de validação

## Changes

- **2026-09-18** `468063611950` — 1 breaking, 4 info
  - removed the success response with the status `200`
  - added optional request body
  - added the non-success response with the status `404`
  - added the non-success response with the status `422`
  - …1 more

[Change history](https://skmtc.dev/olie-ai/apis/olie-api/changes/api/management/ai/agents/:agentId/contexts/post.md)

---

[API](https://skmtc.dev/olie-ai/apis/olie-api.md) · [All operations](https://skmtc.dev/olie-ai/apis/olie-api/llms.txt) · [OpenAPI document](https://skmtc.dev/olie-ai/apis/olie-api/revisions/b43a04f35145?raw)
