---
title: "Send a message to a Chat"
method: POST
path: "/agents/{agentId}/chat/{chatId}"
tags: ["Agents Streams"]
---

# Send a message to a Chat

`POST /agents/{agentId}/chat/{chatId}`

Send a chat message to the existing chat with the agent

## Path parameters

- `agentId` string, required
- `chatId` string, required

## Request body

- IChatPayload
  - `messages` Message[], required — List of messages for Chat
    - `role` 'system' | 'user' | 'assistant', required
    - `content` string, required
    - `created_at` string, required
  - `streamId` string — Id of Stream (a new WebRTC connection to a browser peer) For more details go to Stream documents
  - `sessionId` string — Id of session for Stream Required to organize requests to one thread of messages
  - `chatMode` 'Functional' | 'TextOnly' | 'Maintenance' | 'Playground'

## Response `200`

OK

- ChatResponse
  - `matches` IRetrivalMetadata[], required
    - `id` string, required
    - `data` string, required
    - `title` string, required
    - `document_id` string, required
    - `knowledge_id` string, required
    - `source_url` string, required
  - `documentIds` string[], required
  - `result` string
  - `chatMode` 'Functional' | 'TextOnly' | 'Maintenance' | 'Playground'
  - `videoId` string

## Other responses

- `401` — AuthorizationError

---

[API](https://skmtc.net/d-id/apis/realtime-endpoints.md) · [All operations](https://skmtc.net/d-id/apis/realtime-endpoints/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/d-id/realtime-endpoints/revisions/2f2425e1b6b6/schema)
