---
title: "Send a chat message to the agent"
method: POST
path: "/agents/{agentId}/messages"
tags: ["Messages"]
---

# Send a chat message to the agent

`POST /agents/{agentId}/messages`

## Request

- Base URL: `https://api.atako.ai`
- URL: `https://api.atako.ai/agents/{agentId}/messages`
- Auth: HTTP bearer

Fire-and-forget: the reply arrives later over the WS bridge → SSE/DB. `role` is ignored — always inserted as `user`.

## Path parameters

- `agentId` string, required

## Request body

- object
  - `content` string: Required unless `attachments` is non-empty.
  - `conversationId` string, uuid: Session to read/write. Omitted = the caller's most recently active session (created on demand) — what every client written before sessions existed gets. A session that is not the caller's own on this agent answers 404.
  - `attachments` string[]: Ids of files you uploaded (`/client/files`) that this agent can read — its dedicated folder, or granted. Stored in `meta.attachments` and forwarded to the agent.

## Response `201`

- Message
  - `id` string, uuid, required
  - `agentId` string, uuid, required
  - `conversationId` string, uuid: Session this message belongs to.
  - `role` 'user' | 'agent', required
  - `content` string, required
  - `meta` object
  - `flaggedAsError` boolean: Deprecated — see `feedback`.
  - `deliveryState` string
  - `feedback` 'up' | 'down': The caller's thumbs up/down on this agent reply, if any.
  - `timestamp` string, date-time, required

## Other responses

- `400`: content required · INVALID_ATTACHMENTS (not an array of ≤ 10 uuids) · ATTACHMENT_NOT_FOUND (not an uploaded file of yours this agent can read)
- `401`: Missing, malformed, or invalid bearer token / API key, or revoked session (SESSION_REVOKED).
- `404`: Not found, or the caller is not authorized to access this resource.
- `409`: AGENT_NOT_MESSAGEABLE — the agent is ended, failed or paused (resume it first); `status` carries its current status. A provisioning or unresponsive agent accepts messages and gets them once connected.

---

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