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

# Chat Endpoint

> POST /api/chat

## Send a chat message

`POST /api/chat`

Send a message to the AI assistant and receive a response.

### Request

```json theme={null}
{
  "message": "What is Olis?",
  "sessionId": "uuid-string",
  "context": []
}
```

### Parameters

<ParamField body="message" type="string" required>
  The user's message or query
</ParamField>

<ParamField body="sessionId" type="string" required>
  Unique session identifier for conversation continuity
</ParamField>

<ParamField body="context" type="array">
  Optional array of previous messages for context
</ParamField>

### Response

```json theme={null}
{
  "response": "Olis is an AI-powered assistant...",
  "sources": ["doc1.pdf", "doc2.md"],
  "confidence": 0.95,
  "sessionId": "uuid-string"
}
```

### Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST http://localhost:8000/api/chat \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -d '{
      "message": "What is Olis?",
      "sessionId": "test-session"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('http://localhost:8000/api/chat', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer YOUR_TOKEN'
    },
    body: JSON.stringify({
      message: 'What is Olis?',
      sessionId: 'test-session'
    })
  })

  const data = await response.json()
  console.log(data.response)
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'http://localhost:8000/api/chat',
      headers={'Authorization': 'Bearer YOUR_TOKEN'},
      json={
          'message': 'What is Olis?',
          'sessionId': 'test-session'
      }
  )

  print(response.json()['response'])
  ```
</CodeGroup>
