Skip to content

API: AI Chat

Ask questions of your data (streamed or not), conversations and their history, feedback, and the workspace AI settings, quota and usage. All endpoints require authentication unless noted. 27 endpoints.

AI tool-call audit log for the workspace (admin only)

Query parameters

Name Type Required Description
limit integer no
offset integer no
toolName string no

Responses: 200

AI escalation queue for the workspace (admin only)

Query parameters

Name Type Required Description
status "awaiting_human" | "claimed" | "resolved" no
limit integer no
offset integer no

Responses: 200

Claim an AI escalation ticket (admin only)

Path parameters

Name Type Required Description
id string yes

Responses: 200

Resolve an AI escalation ticket (admin only)

Path parameters

Name Type Required Description
id string yes

Request body (JSON)

Field Type Required Description
notes string | null no

Responses: 200

Thumbs, reasons and corrections on the workspace’s AI answers (admin only)

Query parameters

Name Type Required Description
days integer no

Responses: 200

List AI agent prompt overrides (platform admin only)

Query parameters

Name Type Required Description
agentName string no

Responses: 200

AI quota config for the workspace (admin only)

Responses: 200

Set an AI quota for the workspace (admin only)

Request body (JSON)

Field Type Required Description
period "day" | "month" yes
tokensLimit integer | null no
requestsLimit integer | null no

Responses: 200

The workspace’s AI settings (admin only)

Responses: 200

Set the workspace’s AI level, longest answer and conversation retention (admin only)

Request body (JSON)

Field Type Required Description
level "fast" | "standard" | "advanced" | "max" | null yes
maxOutputTokens integer | null yes
retentionDays integer | null yes

Responses: 200

The AI tools of the workspace, with their switch (admin only)

Responses: 200

Switch an AI tool on or off for the workspace (admin only)

Path parameters

Name Type Required Description
name string yes

Request body (JSON)

Field Type Required Description
enabled boolean yes
notes string no

Responses: 200

AI token-usage summary for the workspace (admin only)

Query parameters

Name Type Required Description
days integer no

Responses: 200

Send a chat message (non-streaming)

Request body (JSON)

Field Type Required Description
message string yes
conversationId string no
pageContext object no
assistantIntent object no
authoringIntent object no
approvalReceiptId string no
suggestion object no
effort "auto" | "quick" | "balanced" | "thorough" | "max" no
suggestionArm "set" | "generic" no

Responses: 200 · 400 · 401 · 404 · 422 · 503

POST /api/chat/approvals/{receiptId}/approve

Section titled “POST /api/chat/approvals/{receiptId}/approve”

Path parameters

Name Type Required Description
receiptId string yes

Responses: 200 · 400 · 401 · 404 · 409

POST /api/chat/approvals/{receiptId}/cancel

Section titled “POST /api/chat/approvals/{receiptId}/cancel”

Path parameters

Name Type Required Description
receiptId string yes

Responses: 200 · 400 · 401 · 404 · 409

List user conversations (paginated)

Query parameters

Name Type Required Description
limit integer no
offset integer no

Responses: 200 · 400 · 401

Get conversation with messages

Path parameters

Name Type Required Description
id string yes

Responses: 200 · 400 · 401 · 404

Rename or pin an owned conversation

Path parameters

Name Type Required Description
id string yes

Request body (JSON)

Field Type Required Description
title string no
pinned boolean no

Responses: 200 · 400 · 401 · 404

Delete a conversation

Path parameters

Name Type Required Description
id string yes

Responses: 204 — No content · 401 · 404

Export a conversation as markdown or JSON

Path parameters

Name Type Required Description
id string yes

Query parameters

Name Type Required Description
format "md" | "json" no

Responses: 200

POST /api/chat/conversations/{id}/feedback/{messageId}

Section titled “POST /api/chat/conversations/{id}/feedback/{messageId}”

Set feedback on a message (thumbs up/down, with a reason and a correction)

Path parameters

Name Type Required Description
id string yes
messageId string yes

Request body (JSON)

Field Type Required Description
feedback "thumbs_up" | "thumbs_down" yes
reason "wrong_number" | "wrong_scope" | "wrong_data" | "incomplete" | "not_what_i_asked" | "too_long" | "other" no
note string no

Responses: 200 · 400 · 401 · 404

Fork a conversation from a pivot message

Path parameters

Name Type Required Description
id string yes

Request body (JSON)

Field Type Required Description
pivotMessageId string yes
title string no

Responses: 200 · 400 · 401 · 404

Full-text search across user’s conversations

Query parameters

Name Type Required Description
q string yes
limit integer no

Responses: 200 · 400 · 401 · 404

Effort choices for a chat message (Auto, Quick, Balanced, Thorough, Max) and which the plan allows

Responses: 200 · 400 · 401 · 404

Send a chat message (SSE streaming)

Request body (JSON)

Field Type Required Description
message string yes
conversationId string no
turnId string no
pageContext object no
assistantIntent object no
authoringIntent object no
approvalReceiptId string no
suggestion object no
effort "auto" | "quick" | "balanced" | "thorough" | "max" no
suggestionArm "set" | "generic" no

Responses: 200 — Server-Sent Events. Each data: line is one AiStreamEvent (@datasquares/contracts AiStreamEventSchema): start, text (delta), tool_start, tool_result, then exactly one terminal done or error, each carrying version, turnId, a monotonic sequence and cursor (\<turnId>:\<sequence>). A terminal frame is followed by event: close; : keepalive comments arrive every 15 s. If the connection ends without a terminal frame, GET /api/chat/turns/{turnId} returns the turn’s durable status and the persisted assistant messageId.

Recover the durable status of an AI turn

Path parameters

Name Type Required Description
turnId string yes

Responses: 200 · 400 · 401 · 404