AI chat
Walk the same path as the in-app assistant: create a thread (and its first chat), send a question, list the conversation, then manage extra chats and titles.
Published images, videos, and audio are already analysed for you — identifying tags on photos and video, English visual descriptions on images, and English transcriptions on video soundtracks and standalone audio. Chat can search that text; you do not upload the file again on /v0/ai.
Use your API gateway base URL and a session from Authentication. Concepts: AI.
Allow up to five minutes on send. Inference plus tool rounds can take that long.
1. Create a thread
Section titled “1. Create a thread”POST /v0/ai/threads creates the topic and the first empty chat. Capture both ids.
curl -sS "https://<api-gateway-server-url>/v0/ai/threads" \ -H "Authorization: Bearer $SESSION" \ -H "Content-Type: application/json" \ -d '{"title":"My first thread"}'The response includes thread.id and chat.id. You cannot send a turn without that chat.id.
2. Send a turn
Section titled “2. Send a turn”curl -sS "https://<api-gateway-server-url>/v0/ai/chats/$CHAT_ID/turns" \ -H "Authorization: Bearer $SESSION" \ -H "Content-Type: application/json" \ -d '{"content":"How many spaces am I assigned to?"}'Try questions that lean on analysed media as well — for example “Which published videos mention the inspection?” or “Show photos tagged as a cracked pipe.”
content is the user message (text is accepted as an alias). The response includes userTurn, assistantTurn, and turns. Assistant refs are entities the model cited (space, channel, asset, and so on) for your UI to link.
Subject to ai.chats.send.perDay. This is not channel /tags.
3. List turns
Section titled “3. List turns”curl -sS "https://<api-gateway-server-url>/v0/ai/chats/$CHAT_ID/turns" \ -H "Authorization: Bearer $SESSION"Newest first. offset=0 is the latest page. Default limit is 25 (max 100).
4. List chats on the thread
Section titled “4. List chats on the thread”curl -sS "https://<api-gateway-server-url>/v0/ai/threads/$THREAD_ID/chats" \ -H "Authorization: Bearer $SESSION"5. Create another chat
Section titled “5. Create another chat”A thread can hold multiple conversation chains.
curl -sS "https://<api-gateway-server-url>/v0/ai/threads/$THREAD_ID/chats" \ -H "Authorization: Bearer $SESSION" \ -H "Content-Type: application/json" \ -d '{"title":"Follow-up"}'Send later turns to the new chat.id if you want a separate chain.
6. Rename the thread and a chat
Section titled “6. Rename the thread and a chat”curl -sS -X PATCH "https://<api-gateway-server-url>/v0/ai/threads/$THREAD_ID" \ -H "Authorization: Bearer $SESSION" \ -H "Content-Type: application/json" \ -d '{"title":"Site inspection"}'
curl -sS -X PATCH "https://<api-gateway-server-url>/v0/ai/chats/$CHAT_ID" \ -H "Authorization: Bearer $SESSION" \ -H "Content-Type: application/json" \ -d '{"title":"Counts"}'7. List and fetch threads
Section titled “7. List and fetch threads”curl -sS "https://<api-gateway-server-url>/v0/ai/threads" \ -H "Authorization: Bearer $SESSION"
curl -sS "https://<api-gateway-server-url>/v0/ai/threads/$THREAD_ID" \ -H "Authorization: Bearer $SESSION"List uses skip pagination (offset, limit). Only the caller’s threads are returned.
Schemas: API reference (tag AI). Limits: Errors & limits.