Chat Streaming V2
curl --request POST \
--url https://document-assistant.us.aodocs.app/assistant/api/v2/tenants/{tenant}/chat:streamingResponse \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>",
"agent_id": "<string>",
"conversation_id": "<string>",
"library_ids": [
"<string>"
],
"document_ids": [
"<string>"
],
"view_id": "<string>",
"timezone": 0,
"read_only": false,
"locale": "<string>",
"search": {
"filters": [
{
"column": "<string>",
"value": "<string>",
"operator": "<string>"
}
],
"query": "",
"in_attachments": true
}
}
'import requests
url = "https://document-assistant.us.aodocs.app/assistant/api/v2/tenants/{tenant}/chat:streamingResponse"
payload = {
"message": "<string>",
"agent_id": "<string>",
"conversation_id": "<string>",
"library_ids": ["<string>"],
"document_ids": ["<string>"],
"view_id": "<string>",
"timezone": 0,
"read_only": False,
"locale": "<string>",
"search": {
"filters": [
{
"column": "<string>",
"value": "<string>",
"operator": "<string>"
}
],
"query": "",
"in_attachments": True
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
message: '<string>',
agent_id: '<string>',
conversation_id: '<string>',
library_ids: ['<string>'],
document_ids: ['<string>'],
view_id: '<string>',
timezone: 0,
read_only: false,
locale: '<string>',
search: {
filters: [{column: '<string>', value: '<string>', operator: '<string>'}],
query: '',
in_attachments: true
}
})
};
fetch('https://document-assistant.us.aodocs.app/assistant/api/v2/tenants/{tenant}/chat:streamingResponse', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://document-assistant.us.aodocs.app/assistant/api/v2/tenants/{tenant}/chat:streamingResponse",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'message' => '<string>',
'agent_id' => '<string>',
'conversation_id' => '<string>',
'library_ids' => [
'<string>'
],
'document_ids' => [
'<string>'
],
'view_id' => '<string>',
'timezone' => 0,
'read_only' => false,
'locale' => '<string>',
'search' => [
'filters' => [
[
'column' => '<string>',
'value' => '<string>',
'operator' => '<string>'
]
],
'query' => '',
'in_attachments' => true
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://document-assistant.us.aodocs.app/assistant/api/v2/tenants/{tenant}/chat:streamingResponse"
payload := strings.NewReader("{\n \"message\": \"<string>\",\n \"agent_id\": \"<string>\",\n \"conversation_id\": \"<string>\",\n \"library_ids\": [\n \"<string>\"\n ],\n \"document_ids\": [\n \"<string>\"\n ],\n \"view_id\": \"<string>\",\n \"timezone\": 0,\n \"read_only\": false,\n \"locale\": \"<string>\",\n \"search\": {\n \"filters\": [\n {\n \"column\": \"<string>\",\n \"value\": \"<string>\",\n \"operator\": \"<string>\"\n }\n ],\n \"query\": \"\",\n \"in_attachments\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://document-assistant.us.aodocs.app/assistant/api/v2/tenants/{tenant}/chat:streamingResponse")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\",\n \"agent_id\": \"<string>\",\n \"conversation_id\": \"<string>\",\n \"library_ids\": [\n \"<string>\"\n ],\n \"document_ids\": [\n \"<string>\"\n ],\n \"view_id\": \"<string>\",\n \"timezone\": 0,\n \"read_only\": false,\n \"locale\": \"<string>\",\n \"search\": {\n \"filters\": [\n {\n \"column\": \"<string>\",\n \"value\": \"<string>\",\n \"operator\": \"<string>\"\n }\n ],\n \"query\": \"\",\n \"in_attachments\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://document-assistant.us.aodocs.app/assistant/api/v2/tenants/{tenant}/chat:streamingResponse")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"<string>\",\n \"agent_id\": \"<string>\",\n \"conversation_id\": \"<string>\",\n \"library_ids\": [\n \"<string>\"\n ],\n \"document_ids\": [\n \"<string>\"\n ],\n \"view_id\": \"<string>\",\n \"timezone\": 0,\n \"read_only\": false,\n \"locale\": \"<string>\",\n \"search\": {\n \"filters\": [\n {\n \"column\": \"<string>\",\n \"value\": \"<string>\",\n \"operator\": \"<string>\"\n }\n ],\n \"query\": \"\",\n \"in_attachments\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}chat-v2
Chat Streaming V2
Streaming chat endpoint with paragraph-level citations.
Event Format: The response is a stream of newline-delimited JSON events with type discriminators.
Event Types:
metadata: Sent once at start with conversation/message/response IDsparagraph: Response paragraphs with inline citations (sent as generated)thinking: Thinking steps (only if report_progress=true)done: Completion marker
Example Stream:
metadata: {"type":"metadata","conversation_id":"...","message_id":"...","response_id":"..."}
thinking: {"type":"thinking","step":"Searching for relevant documents..."}
paragraph: {"type":"paragraph","text":"Alice is 32 years old.","citations":[...],"links":[]}
paragraph: {"type":"paragraph","text":"She works at AODocs.","citations":[...],"links":[...]}
done: {"type":"done"}
Client Implementation:
Parse each line by splitting on the prefix (metadata:, paragraph:, etc.) and
parsing the JSON. Use the type field for type-safe handling.
Progressive Rendering: Paragraphs are sent as soon as they’re generated, enabling progressive UI updates with inline citations.
POST
/
assistant
/
api
/
v2
/
tenants
/
{tenant}
/
chat:streamingResponse
Chat Streaming V2
curl --request POST \
--url https://document-assistant.us.aodocs.app/assistant/api/v2/tenants/{tenant}/chat:streamingResponse \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>",
"agent_id": "<string>",
"conversation_id": "<string>",
"library_ids": [
"<string>"
],
"document_ids": [
"<string>"
],
"view_id": "<string>",
"timezone": 0,
"read_only": false,
"locale": "<string>",
"search": {
"filters": [
{
"column": "<string>",
"value": "<string>",
"operator": "<string>"
}
],
"query": "",
"in_attachments": true
}
}
'import requests
url = "https://document-assistant.us.aodocs.app/assistant/api/v2/tenants/{tenant}/chat:streamingResponse"
payload = {
"message": "<string>",
"agent_id": "<string>",
"conversation_id": "<string>",
"library_ids": ["<string>"],
"document_ids": ["<string>"],
"view_id": "<string>",
"timezone": 0,
"read_only": False,
"locale": "<string>",
"search": {
"filters": [
{
"column": "<string>",
"value": "<string>",
"operator": "<string>"
}
],
"query": "",
"in_attachments": True
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
message: '<string>',
agent_id: '<string>',
conversation_id: '<string>',
library_ids: ['<string>'],
document_ids: ['<string>'],
view_id: '<string>',
timezone: 0,
read_only: false,
locale: '<string>',
search: {
filters: [{column: '<string>', value: '<string>', operator: '<string>'}],
query: '',
in_attachments: true
}
})
};
fetch('https://document-assistant.us.aodocs.app/assistant/api/v2/tenants/{tenant}/chat:streamingResponse', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://document-assistant.us.aodocs.app/assistant/api/v2/tenants/{tenant}/chat:streamingResponse",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'message' => '<string>',
'agent_id' => '<string>',
'conversation_id' => '<string>',
'library_ids' => [
'<string>'
],
'document_ids' => [
'<string>'
],
'view_id' => '<string>',
'timezone' => 0,
'read_only' => false,
'locale' => '<string>',
'search' => [
'filters' => [
[
'column' => '<string>',
'value' => '<string>',
'operator' => '<string>'
]
],
'query' => '',
'in_attachments' => true
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://document-assistant.us.aodocs.app/assistant/api/v2/tenants/{tenant}/chat:streamingResponse"
payload := strings.NewReader("{\n \"message\": \"<string>\",\n \"agent_id\": \"<string>\",\n \"conversation_id\": \"<string>\",\n \"library_ids\": [\n \"<string>\"\n ],\n \"document_ids\": [\n \"<string>\"\n ],\n \"view_id\": \"<string>\",\n \"timezone\": 0,\n \"read_only\": false,\n \"locale\": \"<string>\",\n \"search\": {\n \"filters\": [\n {\n \"column\": \"<string>\",\n \"value\": \"<string>\",\n \"operator\": \"<string>\"\n }\n ],\n \"query\": \"\",\n \"in_attachments\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://document-assistant.us.aodocs.app/assistant/api/v2/tenants/{tenant}/chat:streamingResponse")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\",\n \"agent_id\": \"<string>\",\n \"conversation_id\": \"<string>\",\n \"library_ids\": [\n \"<string>\"\n ],\n \"document_ids\": [\n \"<string>\"\n ],\n \"view_id\": \"<string>\",\n \"timezone\": 0,\n \"read_only\": false,\n \"locale\": \"<string>\",\n \"search\": {\n \"filters\": [\n {\n \"column\": \"<string>\",\n \"value\": \"<string>\",\n \"operator\": \"<string>\"\n }\n ],\n \"query\": \"\",\n \"in_attachments\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://document-assistant.us.aodocs.app/assistant/api/v2/tenants/{tenant}/chat:streamingResponse")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"<string>\",\n \"agent_id\": \"<string>\",\n \"conversation_id\": \"<string>\",\n \"library_ids\": [\n \"<string>\"\n ],\n \"document_ids\": [\n \"<string>\"\n ],\n \"view_id\": \"<string>\",\n \"timezone\": 0,\n \"read_only\": false,\n \"locale\": \"<string>\",\n \"search\": {\n \"filters\": [\n {\n \"column\": \"<string>\",\n \"value\": \"<string>\",\n \"operator\": \"<string>\"\n }\n ],\n \"query\": \"\",\n \"in_attachments\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Body
application/json
V2 Chat request model with deprecated fields removed.
Changes from V1:
- Removed library_id (use library_ids)
- Removed document_id (use document_ids)
- Removed view_params (not needed in v2)
- Removed filters (handled internally)
Response
Successful Response