Ask a question about your business data
POST
Answers a plain-English question about the tenant's report data and streams the answer back as server-sent events. An optional history of up to 6 earlier turns gives the conversation context.
How to use it
- Send the question as query (at most 500 characters), with context giving today's date and timezone so relative dates resolve correctly.
- For a follow-up, include up to 6 earlier turns in history, oldest first.
- Read the text/event-stream response: TOKEN events carry answer text to show as it arrives, TOOL_CALL and TOOL_CARD events show which data was looked up, and DONE or ERROR ends the stream. Nothing is saved: the assistant only reads data the caller is allowed to see, and an item it drafts is added only after it is confirmed.
BearerAuthheader
AuthorizationBearer <JWT>application/json- body
query*stringThe question in plain English, e.g. "top 5 items by sales last week". Required, at most 500 characters.
Length
0 <= length <= 500context?Optional date and timezone of the person asking, used to resolve words like "today" or "this month".
history?array<>|Optional earlier turns of the same conversation, oldest first, at most 6. Lets follow-up questions refer to earlier ones. Nothing is stored server-side.
Items
0 <= items <= 6OK
text/event-stream- response
timeout?|Server-side lifetime of the event stream in milliseconds (300000, i.e. 5 minutes). You do not send this; the response body is a text/event-stream of answer events.
Format
int64Example Request
curl -X POST 'https://beta.iotoms.com/api/v1/ai/chat/stream' \ -H 'Content-Type: application/json' \ -d '{ "query": "string"}'Example Response
{ "timeout": 0}