Skip to Content
TorBox API
Assistant

Chat With Assistant

POST /v1/api/assistant/chat

Try it in the playground

POST https://api.torbox.app/v1/api/assistant/chat

  • Operation ID: chat_with_assistant
  • Group: Assistant
  • Auth: API key, Authorization: Bearer <api key> (Sign in with TorBox gives the same key)

Overview

Send a message to the AI Assistant. Optionally include a session_id to resume a previous conversation. If no session_id is given, the AI will have no previous context and will create a new conversation.

Also included is a way to upload files in base64 allowing you to attach a file that the AI Assistant can use.

We also allow you to send blocks which is a list of strings that state what additional features your chat interface includes. If no blocks are sent, responses are sent in plain text and markdown (for things like tables or bolding text).

The answer is streamed as plain text while it is written. Send the header Accept: text/event-stream to get it as server-sent events instead: tool with the name of each tool the assistant uses, text with each piece of the answer, support with the id of the support conversation when the chat is handed to the support team, usage with the share of the day's allowance that is used and when it resets_at, error with the error if the answer fails, and done at the end.

event: tool
data: {"name": "get_torrent_list"}

event: text
data: {"text": "You have 2 torrents, "}

event: text
data: {"text": "and both have finished downloading."}

event: usage
data: {"used": 0.0123, "resets_at": "2026-01-01T00:00:00Z"}

event: done
data: {}

The X-Session-ID response header holds the session_id to send with the next message.

Authorization

Requires an API key using the Authorization Bearer Header.

Request body (application/json)

FieldTypeRequiredDescription
messagestringyes
session_idstringno
filesobject[]no
blocksstring[]no

Responses

  • 200 Successful Response
  • 401 Unauthorized
  • 403 Forbidden
  • 404 Not Found
  • 422 Validation Error
  • 429 Too Many Requests
  • 500 Internal Server Error
  • 503 Service Unavailable