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

# Atualizar contexto do agente

`PUT /api/management/ai/agents/{agentId}/contexts/{contextId}`

Atualiza um contexto do agente; o tipo não pode ser trocado. Em um contexto de texto, `content` é obrigatório. Em um contexto de arquivo, envie a requisição como `multipart/form-data` com um novo `file`, e o arquivo anterior é apagado.

## Request body

- object — Campos do contexto a alterar; o tipo não pode ser trocado.
  - `content` string — Novo texto do contexto. Obrigatório em contextos do tipo `text` e ignorado em contextos do tipo `file`.
  - `file` string, binary — Novo arquivo do contexto, de até 10 MB. Aceito apenas em contextos do tipo `file` e apenas em requisição multipart/form-data; substitui e apaga o arquivo anterior.
  - `order` integer — Nova posição do contexto na sequência aplicada ao prompt.
  - `is_active` boolean — Define se o contexto é aplicado ao prompt.

## Response `200`

Sucesso

- object — Contexto já com as alterações aplicadas.
  - `id` string, uuid — ID (UUID) do contexto.
  - `ai_agent_id` string, uuid — ID (UUID) do agente dono do contexto.
  - `type` 'text' | 'file' — Tipo do contexto: `text` para texto escrito à mão, `file` para arquivo enviado.
  - `content` string, nullable — Texto do contexto quando o tipo é `text`; endereço temporário para baixar o arquivo quando o tipo é `file`.
  - `mime_type` string, nullable — Tipo do arquivo enviado; nulo em contextos de texto.
  - `order` integer — Posição do contexto na sequência aplicada ao prompt, começando em zero.
  - `is_active` boolean — Indica se o contexto é aplicado ao prompt do agente.
  - `created_at` string, date-time — Data e hora de criação do contexto.
  - `updated_at` string, date-time — Data e hora da última alteração do contexto.
  - `deleted_at` string, date-time, nullable — Data e hora da exclusão lógica; nulo enquanto o contexto está ativo.

## Other responses

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

## Changes

- **2026-09-22** `d71b18b1685d` — 1 breaking, 3 warning, 4 info
  - the response property `content` became nullable for the status `200`
  - removed the optional property `validation/content` from the response with the `422` status
  - added the new `file` enum value to the `type` response property for the response status `200`
  - added the new `text` enum value to the `type` response property for the response status `200`
  - …4 more
- **2026-09-22** `b43a04f35145` — 2 warning
  - removed the optional property `deleted_at` from the response with the `200` status
  - removed the optional property `mime_type` from the response with the `200` status
- **2026-09-18** `468063611950` — 4 info
  - added optional request body
  - added the media type `application/json` for the response with the status `200`
  - added the non-success response with the status `404`
  - added the non-success response with the status `422`

[Change history](https://skmtc.dev/olie-ai/apis/olie-api/changes/api/management/ai/agents/:agentId/contexts/:contextId/put.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/d71b18b1685d?raw)
