curl --request POST \
--url https://api.hq.zone/v1/api/conversations/{id}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "<string>",
"attachments": [
{
"content_type": "<string>",
"data_b64": "<string>",
"document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filename": "<string>"
}
],
"browser_session": true,
"idempotency_key": "<string>",
"identity": "<unknown>",
"turn_source": "<string>"
}
'import requests
url = "https://api.hq.zone/v1/api/conversations/{id}/messages"
payload = {
"text": "<string>",
"attachments": [
{
"content_type": "<string>",
"data_b64": "<string>",
"document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filename": "<string>"
}
],
"browser_session": True,
"idempotency_key": "<string>",
"identity": "<unknown>",
"turn_source": "<string>"
}
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({
text: '<string>',
attachments: [
{
content_type: '<string>',
data_b64: '<string>',
document_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
filename: '<string>'
}
],
browser_session: true,
idempotency_key: '<string>',
identity: '<unknown>',
turn_source: '<string>'
})
};
fetch('https://api.hq.zone/v1/api/conversations/{id}/messages', 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://api.hq.zone/v1/api/conversations/{id}/messages",
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([
'text' => '<string>',
'attachments' => [
[
'content_type' => '<string>',
'data_b64' => '<string>',
'document_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'filename' => '<string>'
]
],
'browser_session' => true,
'idempotency_key' => '<string>',
'identity' => '<unknown>',
'turn_source' => '<string>'
]),
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://api.hq.zone/v1/api/conversations/{id}/messages"
payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"attachments\": [\n {\n \"content_type\": \"<string>\",\n \"data_b64\": \"<string>\",\n \"document_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"filename\": \"<string>\"\n }\n ],\n \"browser_session\": true,\n \"idempotency_key\": \"<string>\",\n \"identity\": \"<unknown>\",\n \"turn_source\": \"<string>\"\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://api.hq.zone/v1/api/conversations/{id}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\",\n \"attachments\": [\n {\n \"content_type\": \"<string>\",\n \"data_b64\": \"<string>\",\n \"document_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"filename\": \"<string>\"\n }\n ],\n \"browser_session\": true,\n \"idempotency_key\": \"<string>\",\n \"identity\": \"<unknown>\",\n \"turn_source\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hq.zone/v1/api/conversations/{id}/messages")
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 \"text\": \"<string>\",\n \"attachments\": [\n {\n \"content_type\": \"<string>\",\n \"data_b64\": \"<string>\",\n \"document_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"filename\": \"<string>\"\n }\n ],\n \"browser_session\": true,\n \"idempotency_key\": \"<string>\",\n \"identity\": \"<unknown>\",\n \"turn_source\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"accepted": true,
"idempotent": true,
"stream_url": "<string>"
}Post a message to a conversation
POST /v1/api/conversations/{id}/messages — Phase A.4 (#726).
Decoupled from the SSE stream: returns 202 Accepted after
idempotency check, spawns the turn driver in the background,
caller observes events via GET /v1/api/conversations/{id}/stream
(already attached or about to attach).
Idempotency is decided IN THIS HANDLER, before spawning. The
spawn passes idempotency_key: None so the inner pipeline’s
prepare_turn skips its own re-check — avoids a double
SETNX that would log a spurious “duplicate” on the fresh
path.
curl --request POST \
--url https://api.hq.zone/v1/api/conversations/{id}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "<string>",
"attachments": [
{
"content_type": "<string>",
"data_b64": "<string>",
"document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filename": "<string>"
}
],
"browser_session": true,
"idempotency_key": "<string>",
"identity": "<unknown>",
"turn_source": "<string>"
}
'import requests
url = "https://api.hq.zone/v1/api/conversations/{id}/messages"
payload = {
"text": "<string>",
"attachments": [
{
"content_type": "<string>",
"data_b64": "<string>",
"document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filename": "<string>"
}
],
"browser_session": True,
"idempotency_key": "<string>",
"identity": "<unknown>",
"turn_source": "<string>"
}
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({
text: '<string>',
attachments: [
{
content_type: '<string>',
data_b64: '<string>',
document_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
filename: '<string>'
}
],
browser_session: true,
idempotency_key: '<string>',
identity: '<unknown>',
turn_source: '<string>'
})
};
fetch('https://api.hq.zone/v1/api/conversations/{id}/messages', 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://api.hq.zone/v1/api/conversations/{id}/messages",
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([
'text' => '<string>',
'attachments' => [
[
'content_type' => '<string>',
'data_b64' => '<string>',
'document_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'filename' => '<string>'
]
],
'browser_session' => true,
'idempotency_key' => '<string>',
'identity' => '<unknown>',
'turn_source' => '<string>'
]),
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://api.hq.zone/v1/api/conversations/{id}/messages"
payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"attachments\": [\n {\n \"content_type\": \"<string>\",\n \"data_b64\": \"<string>\",\n \"document_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"filename\": \"<string>\"\n }\n ],\n \"browser_session\": true,\n \"idempotency_key\": \"<string>\",\n \"identity\": \"<unknown>\",\n \"turn_source\": \"<string>\"\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://api.hq.zone/v1/api/conversations/{id}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\",\n \"attachments\": [\n {\n \"content_type\": \"<string>\",\n \"data_b64\": \"<string>\",\n \"document_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"filename\": \"<string>\"\n }\n ],\n \"browser_session\": true,\n \"idempotency_key\": \"<string>\",\n \"identity\": \"<unknown>\",\n \"turn_source\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hq.zone/v1/api/conversations/{id}/messages")
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 \"text\": \"<string>\",\n \"attachments\": [\n {\n \"content_type\": \"<string>\",\n \"data_b64\": \"<string>\",\n \"document_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"filename\": \"<string>\"\n }\n ],\n \"browser_session\": true,\n \"idempotency_key\": \"<string>\",\n \"identity\": \"<unknown>\",\n \"turn_source\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"accepted": true,
"idempotent": true,
"stream_url": "<string>"
}Asynchronous turn — read the reply from the event stream
This endpoint does not return the agent’s reply. It accepts the message, starts the turn server-side, and returns immediately with202 Accepted. You observe progress and read the final reply on the conversation’s event stream.
Typical flow:
- Open
GET /v1/api/conversations/{id}/stream(SSE). POSTthe message here →202 Accepted.- Read this turn’s
text_delta…finalevents off the stream.
Idempotency-Key header to make retries safe — the same key on the same conversation returns the original turn instead of starting a duplicate (deduplicated for ~1 hour).Authorizations
Personal Access Token. Send as Authorization: Bearer hq_pat_....
Path Parameters
Conversation id
Body
Body for the 202-style submit endpoint. A slim subset of
[PostMessageBody]: agent / tenant / channel are derived from
the conversation row, so the caller never has to know them.
File attachments (base64-encoded). Same shape as the inline endpoint; carried through to TurnPayload.attachments.
Show child attributes
Show child attributes
True iff this is a local-browser turn (the extension's "Use my browser"
mode). Fails fast if the user's browser isn't connected, then scopes the
turn to computer_* + injects the browser prompt via the per-turn
browser_session Forge flag - exactly like POST /v1/agent-browser/ask,
but on the streaming path so the computer_* tool calls render live.
Optional dedup token. Same semantics as the inline endpoint:
re-POST with the same key inside the 24h TTL is a no-op and
returns idempotent: true. Caller should generate a UUID
per logical submit (e.g. per Studio chat-send button click).
Free-form identity claims from the caller. PAT auth (#729) will replace this with auth-derived chain; for now the trust boundary is network-level reach to controlplane.
Reply-to-source channel for this turn. Defaults to "web"; the browser
extension (#729) sets "extension" so artifacts/replies aren't pushed
back into a Slack thread the conv may have been born in. Drives
conversations.last_turn_channel via turn.rs.
Response
Turn accepted (spawned in the background); attach to stream_url for events