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

# Chat Over Documents - POST /v1/workspaces/:workspace_id/chat

> Retrieval-augmented Q&A over a workspace's KBs via POST /v1/workspaces/:workspace_id/chat, streamed as SSE. Minimum role viewer.

Run retrieval-augmented Q\&A (RAG) over a workspace's knowledge bases. The response is streamed as **SSE (Server-Sent Events)** with content type `text/event-stream`, returning the answer and citations incrementally.

## Endpoint

```http theme={null}
POST /v1/workspaces/:workspace_id/chat
```

## Authentication

`Authorization: Bearer <jwt>` or `X-API-Key <sk_...>`. Minimum role: **viewer**.

## Path parameters

**workspace\_id** `string` *required*

Workspace id.

## Request body

**query** `string` *required*

The user's question.

**k** `integer`

Number of document chunks to retrieve; server default when omitted.

## Response (stream)

`Content-Type: text/event-stream`. Each `data:` line is an incremental text segment; a trailing "引用 / References" section lists the matched documents and snippets. Read line-by-line as SSE on the client.

## Example

```bash cURL theme={null}
curl -N -X POST https://memo.ariacompute.com/v1/workspaces/ws_01a2b3c4d5e6/chat \
  -H "Authorization: Bearer <jwt>" \
  -H "Content-Type: application/json" \
  -d '{"query":"What conversions does AriaMem support?","k":4}'
```

```text stream theme={null}
data: AriaMem supports
data: knowledge-to-memory
data: as well as memory-to-knowledge
data: bidirectional conversion.

data: 引用 / References： [1] 文档:doc_01a2b3c4d5e6 片段:AriaMem supports bidirectional knowledge memory conversion.
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.