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

# POST /v1/chat

> Send a message to the ARIS AI engine and receive a streamed response.

## Request

```bash theme={null}
curl -X POST \
  "https://dqgynnlsclfbqysauesf.supabase.co/functions/v1/api-router/v1/chat" \
  -H "Content-Type: application/json" \
  -H "X-ARIS-API-Key: aris_yourkey" \
  -d '{
    "messages": [
      {"role": "user", "content": "Show me 3-bedroom homes under $500k in Austin"}
    ],
    "sessionId": "session_abc123"
  }'
```

### Body parameters

<ParamField body="messages" type="array" required>
  Conversation history. Each item has `role` (`user`, `assistant`, `system`) and `content` (string). Most recent message last.
</ParamField>

<ParamField body="sessionId" type="string">
  Reuse across turns to maintain conversation memory (preferences, prior listings). A new one is generated if omitted.
</ParamField>

## Response

**Content-Type:** `text/event-stream`

The response is a Server-Sent Events (SSE) stream in OpenAI-compatible delta format:

```
data: {"choices":[{"delta":{"content":"I found"},"index":0}]}

data: {"choices":[{"delta":{"content":" 3 homes"},"index":0}]}

data: [DONE]
```

### Consuming the stream

```javascript theme={null}
const response = await fetch(url, { method: "POST", headers, body });
const reader = response.body.getReader();
const decoder = new TextDecoder();
let content = "";

while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  const text = decoder.decode(value);
  for (const line of text.split("\n")) {
    if (line.startsWith("data: ")) {
      const payload = line.slice(6).trim();
      if (payload === "[DONE]") break;
      const parsed = JSON.parse(payload);
      const delta = parsed.choices?.[0]?.delta?.content;
      if (delta) content += delta;
    }
  }
}
```

### Listing data in the stream

Property listings are embedded in the stream using HTML comment markers:

```
<!--PROPERTIES: [{"listingId":"a123","address":"123 Main St",...}] -->
```

The ARIS widget parser extracts these automatically. If building a custom client, look for `<!--PROPERTIES:` markers in the accumulated content.

## Intent classification

The AI automatically classifies each message and routes to the appropriate tool:

`property_search` · `property_question` · `general_question` · `correction` · `contact_info` · `scheduling` · `small_talk` · `off_topic` · `follow_up` · `comparison` · `affordability` · `negotiation` · `location_info`
