curl --request POST \
--url https://api.example.com/api/conversations/{route_name} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"execution_key": "<string>",
"route_name": "<string>",
"target_name": "<string>",
"callback_url": "<string>",
"channel": "<string>",
"error_reply_text": "<string>",
"initial_mode": "agent",
"locale": "<string>",
"our_identity": "<string>",
"payload_expr": {
"content": "<string>",
"id": "<string>",
"kwargs": {}
},
"reply_expr": {
"content": "<string>",
"id": "<string>",
"kwargs": {}
},
"turns_per_hour_override": 1
}
'import requests
url = "https://api.example.com/api/conversations/{route_name}"
payload = {
"execution_key": "<string>",
"route_name": "<string>",
"target_name": "<string>",
"callback_url": "<string>",
"channel": "<string>",
"error_reply_text": "<string>",
"initial_mode": "agent",
"locale": "<string>",
"our_identity": "<string>",
"payload_expr": {
"content": "<string>",
"id": "<string>",
"kwargs": {}
},
"reply_expr": {
"content": "<string>",
"id": "<string>",
"kwargs": {}
},
"turns_per_hour_override": 1
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
execution_key: '<string>',
route_name: '<string>',
target_name: '<string>',
callback_url: '<string>',
channel: '<string>',
error_reply_text: '<string>',
initial_mode: 'agent',
locale: '<string>',
our_identity: '<string>',
payload_expr: {content: '<string>', id: '<string>', kwargs: {}},
reply_expr: {content: '<string>', id: '<string>', kwargs: {}},
turns_per_hour_override: 1
})
};
fetch('https://api.example.com/api/conversations/{route_name}', 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.example.com/api/conversations/{route_name}",
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([
'execution_key' => '<string>',
'route_name' => '<string>',
'target_name' => '<string>',
'callback_url' => '<string>',
'channel' => '<string>',
'error_reply_text' => '<string>',
'initial_mode' => 'agent',
'locale' => '<string>',
'our_identity' => '<string>',
'payload_expr' => [
'content' => '<string>',
'id' => '<string>',
'kwargs' => [
]
],
'reply_expr' => [
'content' => '<string>',
'id' => '<string>',
'kwargs' => [
]
],
'turns_per_hour_override' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.example.com/api/conversations/{route_name}"
payload := strings.NewReader("{\n \"execution_key\": \"<string>\",\n \"route_name\": \"<string>\",\n \"target_name\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"channel\": \"<string>\",\n \"error_reply_text\": \"<string>\",\n \"initial_mode\": \"agent\",\n \"locale\": \"<string>\",\n \"our_identity\": \"<string>\",\n \"payload_expr\": {\n \"content\": \"<string>\",\n \"id\": \"<string>\",\n \"kwargs\": {}\n },\n \"reply_expr\": {\n \"content\": \"<string>\",\n \"id\": \"<string>\",\n \"kwargs\": {}\n },\n \"turns_per_hour_override\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.example.com/api/conversations/{route_name}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"execution_key\": \"<string>\",\n \"route_name\": \"<string>\",\n \"target_name\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"channel\": \"<string>\",\n \"error_reply_text\": \"<string>\",\n \"initial_mode\": \"agent\",\n \"locale\": \"<string>\",\n \"our_identity\": \"<string>\",\n \"payload_expr\": {\n \"content\": \"<string>\",\n \"id\": \"<string>\",\n \"kwargs\": {}\n },\n \"reply_expr\": {\n \"content\": \"<string>\",\n \"id\": \"<string>\",\n \"kwargs\": {}\n },\n \"turns_per_hour_override\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/conversations/{route_name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"execution_key\": \"<string>\",\n \"route_name\": \"<string>\",\n \"target_name\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"channel\": \"<string>\",\n \"error_reply_text\": \"<string>\",\n \"initial_mode\": \"agent\",\n \"locale\": \"<string>\",\n \"our_identity\": \"<string>\",\n \"payload_expr\": {\n \"content\": \"<string>\",\n \"id\": \"<string>\",\n \"kwargs\": {}\n },\n \"reply_expr\": {\n \"content\": \"<string>\",\n \"id\": \"<string>\",\n \"kwargs\": {}\n },\n \"turns_per_hour_override\": 1\n}"
response = http.request(request)
puts response.read_body{
"data": {
"callback_secret": "<string>",
"created": true,
"route": {
"door": "api",
"execution_key": "<string>",
"execution_key_fingerprint": "<string>",
"route_name": "<string>",
"target_kind": "agent",
"target_name": "<string>",
"callback_url": "<string>",
"channel": "<string>",
"error_reply_text": "<string>",
"initial_mode": "agent",
"locale": "<string>",
"our_identity": "<string>",
"payload_expr": {
"content": "<string>",
"id": "<string>",
"kwargs": {}
},
"reply_expr": {
"content": "<string>",
"id": "<string>",
"kwargs": {}
},
"turns_per_hour_override": 1
},
"route_name": "<string>"
}
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}Create or replace a conversation route
Create a conversation route from its flat parameters — an UPSERT, so this is the create path AND the edit path for a route of that name.
initial_mode is the route’s default control mode (agent runs the turn, manual
suppresses it for an operator to answer) when a thread carries no per-thread override.
execution_key is the api-key identity the turn runs AS; the caller must be allowed
to delegate it and it must be usable by a tokenless fire, both decided BEFORE the write
so a refusal leaves any existing row untouched. target_name must merely EXIST — the
agent (target_kind=agent) or tool (target_kind=tool) — the key’s live grants
bound the turn at fire. A tool target’s payload_expr/reply_expr templated jq
programs, when given, are rendered and compiled here so an invalid one — or a by-id text
whose stored resource cannot be fetched — is refused at create, not at first message. A
channel row’s our_identity is stored canonicalized and must not already be routed
on that channel. An edit that would change the door of a route already HOLDING
threads is refused: the two doors key their threads differently, so the held threads
cannot be re-keyed under the new door.
An api row that declares a callback_url has its callback_secret minted here
and returned ONCE; a poll-only api row (no callback) mints none and reads its answers
back from the poll door. A positive
turns_per_hour_override runs this route’s per-address buckets at that rate instead
of the global per_address_turns_per_hour cap; None runs them at the global rate.
A non-blank error_reply_text is the participant-facing reply sent when a turn on this route
fails; None uses the built-in default.
A locale is the operator-declared default language templated reply parts render in when
a turn supplies none; it is the last fallback under a per-turn or stored-contact locale and
is stored canonicalized. None declares no route default (bare/English).
Returns {"created", "route_name", "route", "callback_secret"}.
curl --request POST \
--url https://api.example.com/api/conversations/{route_name} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"execution_key": "<string>",
"route_name": "<string>",
"target_name": "<string>",
"callback_url": "<string>",
"channel": "<string>",
"error_reply_text": "<string>",
"initial_mode": "agent",
"locale": "<string>",
"our_identity": "<string>",
"payload_expr": {
"content": "<string>",
"id": "<string>",
"kwargs": {}
},
"reply_expr": {
"content": "<string>",
"id": "<string>",
"kwargs": {}
},
"turns_per_hour_override": 1
}
'import requests
url = "https://api.example.com/api/conversations/{route_name}"
payload = {
"execution_key": "<string>",
"route_name": "<string>",
"target_name": "<string>",
"callback_url": "<string>",
"channel": "<string>",
"error_reply_text": "<string>",
"initial_mode": "agent",
"locale": "<string>",
"our_identity": "<string>",
"payload_expr": {
"content": "<string>",
"id": "<string>",
"kwargs": {}
},
"reply_expr": {
"content": "<string>",
"id": "<string>",
"kwargs": {}
},
"turns_per_hour_override": 1
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
execution_key: '<string>',
route_name: '<string>',
target_name: '<string>',
callback_url: '<string>',
channel: '<string>',
error_reply_text: '<string>',
initial_mode: 'agent',
locale: '<string>',
our_identity: '<string>',
payload_expr: {content: '<string>', id: '<string>', kwargs: {}},
reply_expr: {content: '<string>', id: '<string>', kwargs: {}},
turns_per_hour_override: 1
})
};
fetch('https://api.example.com/api/conversations/{route_name}', 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.example.com/api/conversations/{route_name}",
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([
'execution_key' => '<string>',
'route_name' => '<string>',
'target_name' => '<string>',
'callback_url' => '<string>',
'channel' => '<string>',
'error_reply_text' => '<string>',
'initial_mode' => 'agent',
'locale' => '<string>',
'our_identity' => '<string>',
'payload_expr' => [
'content' => '<string>',
'id' => '<string>',
'kwargs' => [
]
],
'reply_expr' => [
'content' => '<string>',
'id' => '<string>',
'kwargs' => [
]
],
'turns_per_hour_override' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.example.com/api/conversations/{route_name}"
payload := strings.NewReader("{\n \"execution_key\": \"<string>\",\n \"route_name\": \"<string>\",\n \"target_name\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"channel\": \"<string>\",\n \"error_reply_text\": \"<string>\",\n \"initial_mode\": \"agent\",\n \"locale\": \"<string>\",\n \"our_identity\": \"<string>\",\n \"payload_expr\": {\n \"content\": \"<string>\",\n \"id\": \"<string>\",\n \"kwargs\": {}\n },\n \"reply_expr\": {\n \"content\": \"<string>\",\n \"id\": \"<string>\",\n \"kwargs\": {}\n },\n \"turns_per_hour_override\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.example.com/api/conversations/{route_name}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"execution_key\": \"<string>\",\n \"route_name\": \"<string>\",\n \"target_name\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"channel\": \"<string>\",\n \"error_reply_text\": \"<string>\",\n \"initial_mode\": \"agent\",\n \"locale\": \"<string>\",\n \"our_identity\": \"<string>\",\n \"payload_expr\": {\n \"content\": \"<string>\",\n \"id\": \"<string>\",\n \"kwargs\": {}\n },\n \"reply_expr\": {\n \"content\": \"<string>\",\n \"id\": \"<string>\",\n \"kwargs\": {}\n },\n \"turns_per_hour_override\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/conversations/{route_name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"execution_key\": \"<string>\",\n \"route_name\": \"<string>\",\n \"target_name\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"channel\": \"<string>\",\n \"error_reply_text\": \"<string>\",\n \"initial_mode\": \"agent\",\n \"locale\": \"<string>\",\n \"our_identity\": \"<string>\",\n \"payload_expr\": {\n \"content\": \"<string>\",\n \"id\": \"<string>\",\n \"kwargs\": {}\n },\n \"reply_expr\": {\n \"content\": \"<string>\",\n \"id\": \"<string>\",\n \"kwargs\": {}\n },\n \"turns_per_hour_override\": 1\n}"
response = http.request(request)
puts response.read_body{
"data": {
"callback_secret": "<string>",
"created": true,
"route": {
"door": "api",
"execution_key": "<string>",
"execution_key_fingerprint": "<string>",
"route_name": "<string>",
"target_kind": "agent",
"target_name": "<string>",
"callback_url": "<string>",
"channel": "<string>",
"error_reply_text": "<string>",
"initial_mode": "agent",
"locale": "<string>",
"our_identity": "<string>",
"payload_expr": {
"content": "<string>",
"id": "<string>",
"kwargs": {}
},
"reply_expr": {
"content": "<string>",
"id": "<string>",
"kwargs": {}
},
"turns_per_hour_override": 1
},
"route_name": "<string>"
}
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}Authorizations
Path Parameters
Body
The client-facing create/edit body for a conversation route: the fields a caller supplies.
Binds a (target_kind, target_name) — an agent run or a tool dispatch — to
an execution_key the turn runs AS (bound with pass-role at create). A tool
target may carry a payload_expr (jq mapping the inbound message to the tool's
kwargs) and a reply_expr (jq mapping the tool's result to the reply); both are
tool-only. api rows MAY carry an https callback_url (the answer sink; when absent
the caller reads its answer back from the poll door); channel rows carry the
registry channel plus the our_identity the medium is texted at (N rows may
share a channel, each its own identity). The server-derived callback_secret and
execution_key_fingerprint are deliberately absent; :class:ConversationRoute is
this shape plus those. Frozen.
api, channel The api-key user_id the turn runs AS; its live stored grants authorize the agent run or tool dispatch and every tool call the turn makes.
1agent, tool 11 - 2000agent, manual A renderable text: its source plus the parameters its render takes.
EXACTLY ONE source is set — content (the text inline) or id (the id of a
stored resource holding the text); neither and both are refused at construction.
kwargs are the render parameters for the TEXT and apply either way, so moving a
text from inline to stored (or back) leaves its parameters untouched.
Show child attributes
Show child attributes
A renderable text: its source plus the parameters its render takes.
EXACTLY ONE source is set — content (the text inline) or id (the id of a
stored resource holding the text); neither and both are refused at construction.
kwargs are the render parameters for the TEXT and apply either way, so moving a
text from inline to stored (or back) leaves its parameters untouched.
Show child attributes
Show child attributes
x > 0Response
Success.
The created/replaced route. callback_secret is the api-door callback signing
secret surfaced ONCE (null for a channel route); route is the stored view
with its secret stripped.
Show child attributes
Show child attributes

