> ## Documentation Index
> Fetch the complete documentation index at: https://docs.doctly.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Send Message

> Send a message in a session and receive an answer with citations.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.doctly.ai/api/v1/chat/sessions/{session_id}/messages \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"content": "What is the warranty period?"}'
  ```
</RequestExample>

**POST** `/api/v1/chat/sessions/{session_id}/messages`

Sends a user message and returns the assistant's answer. The session's previous turns are used as conversation context.

## Path Parameters

<ParamField path="session_id" type="string" required>
  The session ID returned by [Create Session](/api-reference/chat/create-session).
</ParamField>

## Request

<ParamField body="content" type="string" required>
  The user message. Maximum 32,000 characters.
</ParamField>

<ParamField body="file_ids" type="string[]">
  Restrict retrieval to these file IDs for this message.
</ParamField>

<ParamField body="collection_ids" type="string[]">
  Switch the session to these collections; the change persists on the session.
</ParamField>

<ParamField body="stream" type="boolean" default="false">
  Stream the response as [Server-Sent Events](/api-reference/chat/streaming).
</ParamField>

## Response

<ResponseField name="id" type="integer">
  ID of the stored assistant message.
</ResponseField>

<ResponseField name="session_id" type="string">
  The session ID.
</ResponseField>

<ResponseField name="answer" type="string">
  The generated answer, in Markdown, possibly containing `[citation:{id}]` markers.
</ResponseField>

<ResponseField name="citations" type="array">
  [Citation objects](/api-reference/chat/query#the-citation-object) backing the answer.
</ResponseField>
