# 2. Chat with the Chatbot

## Chat with the Chatbot

```
POST /api/v1/backend/chatbot/{bot_uid}/chat
```

The Chat API enables programmatic interaction with chatbots through a POST request. This API is accessible to users with a paid subscription and facilitates communication with chatbots.

### Path Parameters

* **bot\_uid** (string, required): The unique ID of the chatbot with which you intend to engage in conversation.

### Body Parameters

Content-Type of the request should be set to <mark style="color:red;">`application/json`</mark>

* **q** (string, required): The question you want to pose to the chatbot.
* **conversation\_uid** (string, optional): The session ID for the chat. Note that you should not manually construct a session ID. After conversing with the chatbot, a session ID will be returned. If you wish to continue the same session, you can pass this session ID in subsequent interactions.
* **language** (string, optional, default is auto): The desired language for chatting with the chatbot. Currently supports English, French, Spanish, Russian, Simplified Chinese, and more. Refer to the table below for language codes.
* **stream** (boolean, optional, default is False): Indicates whether to enable streaming output.

### Returns

**Normal**

```json
{
  "code": 0,
  "data": {
    "answer": "answer",
    "conversation_uid": "f05f1800-a728-4e23-adb8-69abd55b5dcb",
    "is_qa_mode": true,
    "question": "Ut minim ex",
    "system_message": ""
  },
  "msg": "Success.",
  "request_id": "25a40914-d8d9-4b0f-a92d-b8844bfc9852"
}
```

**Stream**

```
{"answer": "", "question": "Ut minim ex", "related_docs": [], "conversation_uid": "9628808a-dbb6-42c3-aba6-9fe5b772c724", "is_qa_mode": true, "system_message": ""}
645130146e8d07b175fd8b1d5682d520answer
```

**Data**

* **answer** (string): The chatbot's response to the question.
* **conversation\_uid** (string): The session ID for the current conversation.
* **is\_qa\_mode** (boolean): Indicates whether it's in QA mode (QA mode provides references to answers).
* **question** (string): The user's posed question.
* **system\_message** (string): System-generated message for displaying system notifications.

**Note:** In streaming mode, the response data is separated by the magic number "645130146e8d07b175fd8b1d5682d520" Before this magic number is a JSON string, and after the magic number is the actual answer.

### Language Codes

<table><thead><tr><th>Code</th><th>Name</th><th width="102">Native Name</th><th>Remark</th></tr></thead><tbody><tr><td>auto</td><td>Auto</td><td>Auto</td><td>Automatically determines language based on input</td></tr><tr><td>en</td><td>English</td><td>English</td><td></td></tr><tr><td>fr</td><td>French</td><td>Français</td><td></td></tr><tr><td>es</td><td>Spanish</td><td>Español</td><td></td></tr><tr><td>ru</td><td>Russian</td><td>Русский</td><td></td></tr><tr><td>zh-Hans</td><td>Simplified Chinese</td><td>中文 (简体)</td><td></td></tr><tr><td>zh-Hant</td><td>Traditional Chinese</td><td>中文 (繁體)</td><td></td></tr><tr><td>ar</td><td>Arabic</td><td>العربية</td><td></td></tr><tr><td>de</td><td>German</td><td>Deutsch</td><td></td></tr><tr><td>jp</td><td>Japanese</td><td>日本語</td><td></td></tr><tr><td>pt</td><td>Portuguese</td><td>Português</td><td></td></tr><tr><td>hi</td><td>Hindi</td><td>हिंदी</td><td></td></tr><tr><td>ko</td><td>Korean</td><td>한국어</td><td></td></tr><tr><td>it</td><td>Italian</td><td>Italiano</td><td></td></tr><tr><td>uk</td><td>Ukrainian</td><td>Українська</td><td></td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.chatof.ai/api-reference/endpoints/2.-chat-with-the-chatbot.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
