API referenceSections

Send a message; the answer streams as server-sent events

Generated from the OpenAPI contract. Sessions send the CSRF header on writes; API keys use a Bearer token. Authentication

POST /api/v1/tenants/{tid}/assistant/conversations/{cid}/messages

Send a message; the answer streams as server-sent events. Tools run as the caller through these same routes; changes wait for the user (event action). Errors before the stream starts are ordinary problems (ASSISTANT_RATE_LIMITED, ASSISTANT_BUSY)

Authentication: API key (Authorization: Bearer …) or session cookie __Host-panel_session.

Parameters

NameInTypeRequiredDescription
tidpathstringrequired
cidpathstringrequired
X-CSRF-Tokenheaderstringoptional

Required on unsafe requests authenticated by session cookie; API keys do not use it.

Request body

required

Content type: application/json

object
  • no other properties
  • text string required
    • max length 4000
  • lang string optional
    Allowed values: "vi" "en"
  • context object optional
    • no other properties
    • path string optional
    • site_id string optional
    • server_id string optional
Example
{
  "text": "string",
  "lang": "vi",
  "context": {
    "path": "string",
    "site_id": "string",
    "server_id": "string"
  }
}

Responses

200 Events

Content type: text/event-stream

One server-sent event (data: <json>) of a turn

  • type string required
    Allowed values: "text" "tool" "action" "usage" "waiting" "done" "error"
  • text string optional
  • tool AssistantToolEvent optional
    • id string required
    • name string required
    • state string required
      Allowed values: "running" "done" "error"
    • code string optional
  • action AssistantAction optional
    • id string required
    • tool string required
    • state string required
      Allowed values: "pending" "done" "failed" "denied" "expired"
    • code string optional
    • preview object required
      • tool string required
      • target string required
      • changes array<AssistantChange> required
        • field string required
        • from string required
        • to string required
  • usage object optional
    • input_tokens integer optional
    • output_tokens integer optional
    • cache_read_tokens integer optional
    • cache_write_tokens integer optional
  • code string optional
  • message string optional

default Error

Content type: application/json

  • code string required
  • message string required
  • details_redacted boolean required
  • correlation_id string required
  • retryable boolean required