Chat API & streaming

Conversations

Create one bound to a bot (knowledgebase = bot id):

PATCH /api/chat/conversation/{id}/ renames; DELETE removes it. PATCH …/update-lead/ sets the lead status.

Send (wait for the full answer)

Stream (word by word)

POST /api/chat/conversation/{id}/send-stream/ takes the same body and returns text/event-stream. Each line is data: <json:

| type | Payload | Use it to | |---|---|---| | status | stage, meta | Show "searching…", "thinking…" | | sources | sources[] | Render citations | | token | token / content | Append text as it arrives | | suggestions | items[] | Offer follow-up questions | | websearch | sources[], errors[] | Web results, when web search is on | | error | content | Show and stop | | done | assistantmessageid, coinsspent, balance | Finish and update the wallet |

Files, voice and feedback

- POST …/{id}/upload-file/ — multipart file, then ask about it. - POST /api/chat/conversation/transcribe-voice/ — multipart audio, returns text. - POST …/{id}/send-voice/ — multipart audio; transcribes it and answers. - POST /api/chat/message/{id}/feedback/ — {"userrating": 1-5, "userfeedback": "…"}; low ratings are flagged for review. - POST /api/chat/message/{id}/regenerate/ — try the answer again.

Full list: [reference → chat](/dev-docs/reference/chat).