curl --request POST \
--url https://your-instance.example.com/api/ai/playground \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "Hi, I was hoping to book a tour for next Tuesday.",
"promptId": "5f7b1c2e8a1d4e0012c3b4a5",
"conversationId": "64d2f9c5e8a1d4e001a0b1c2",
"conversation": [
{
"role": "user",
"content": "Hello there"
},
{
"role": "assistant",
"content": "Hi! How can I help today?"
}
]
}
'import requests
url = "https://your-instance.example.com/api/ai/playground"
payload = {
"message": "Hi, I was hoping to book a tour for next Tuesday.",
"promptId": "5f7b1c2e8a1d4e0012c3b4a5",
"conversationId": "64d2f9c5e8a1d4e001a0b1c2",
"conversation": [
{
"role": "user",
"content": "Hello there"
},
{
"role": "assistant",
"content": "Hi! How can I help today?"
}
]
}
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: 'Hi, I was hoping to book a tour for next Tuesday.',
promptId: '5f7b1c2e8a1d4e0012c3b4a5',
conversationId: '64d2f9c5e8a1d4e001a0b1c2',
conversation: [
{role: 'user', content: 'Hello there'},
{role: 'assistant', content: 'Hi! How can I help today?'}
]
})
};
fetch('https://your-instance.example.com/api/ai/playground', 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://your-instance.example.com/api/ai/playground",
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' => 'Hi, I was hoping to book a tour for next Tuesday.',
'promptId' => '5f7b1c2e8a1d4e0012c3b4a5',
'conversationId' => '64d2f9c5e8a1d4e001a0b1c2',
'conversation' => [
[
'role' => 'user',
'content' => 'Hello there'
],
[
'role' => 'assistant',
'content' => 'Hi! How can I help today?'
]
]
]),
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://your-instance.example.com/api/ai/playground"
payload := strings.NewReader("{\n \"message\": \"Hi, I was hoping to book a tour for next Tuesday.\",\n \"promptId\": \"5f7b1c2e8a1d4e0012c3b4a5\",\n \"conversationId\": \"64d2f9c5e8a1d4e001a0b1c2\",\n \"conversation\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello there\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Hi! How can I help today?\"\n }\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://your-instance.example.com/api/ai/playground")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"Hi, I was hoping to book a tour for next Tuesday.\",\n \"promptId\": \"5f7b1c2e8a1d4e0012c3b4a5\",\n \"conversationId\": \"64d2f9c5e8a1d4e001a0b1c2\",\n \"conversation\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello there\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Hi! How can I help today?\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/ai/playground")
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\": \"Hi, I was hoping to book a tour for next Tuesday.\",\n \"promptId\": \"5f7b1c2e8a1d4e0012c3b4a5\",\n \"conversationId\": \"64d2f9c5e8a1d4e001a0b1c2\",\n \"conversation\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello there\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Hi! How can I help today?\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"response": "Great — I can book you for Friday at 2pm. Want me to send a confirmation text?",
"messageMetric": {
"organizationId": "64a1b2c3d4e5f60012345678",
"metricRunId": "run_64d2f9c5e8a1d4e001a0b1c2",
"aiAgentName": "Leasing Specialist",
"aiCalls": [],
"toolCalls": []
}
}{
"success": false,
"error": "approval_expired",
"message": "This approval request has expired or was already handled. Please send a new playground message to retry."
}{
"success": false,
"error": "approval_expired",
"message": "This approval request has expired or was already handled. Please send a new playground message to retry."
}{
"success": false,
"error": "approval_expired",
"message": "This approval request has expired or was already handled. Please send a new playground message to retry."
}Generate playground AI response
Runs a one-off playground turn against the specified prompt using the caller-supplied conversation history. Used by the prompt editor to preview replies; does not persist conversation state. ADMIN and SUPERADMIN callers also receive the captured MessageMetric for the turn.
curl --request POST \
--url https://your-instance.example.com/api/ai/playground \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "Hi, I was hoping to book a tour for next Tuesday.",
"promptId": "5f7b1c2e8a1d4e0012c3b4a5",
"conversationId": "64d2f9c5e8a1d4e001a0b1c2",
"conversation": [
{
"role": "user",
"content": "Hello there"
},
{
"role": "assistant",
"content": "Hi! How can I help today?"
}
]
}
'import requests
url = "https://your-instance.example.com/api/ai/playground"
payload = {
"message": "Hi, I was hoping to book a tour for next Tuesday.",
"promptId": "5f7b1c2e8a1d4e0012c3b4a5",
"conversationId": "64d2f9c5e8a1d4e001a0b1c2",
"conversation": [
{
"role": "user",
"content": "Hello there"
},
{
"role": "assistant",
"content": "Hi! How can I help today?"
}
]
}
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: 'Hi, I was hoping to book a tour for next Tuesday.',
promptId: '5f7b1c2e8a1d4e0012c3b4a5',
conversationId: '64d2f9c5e8a1d4e001a0b1c2',
conversation: [
{role: 'user', content: 'Hello there'},
{role: 'assistant', content: 'Hi! How can I help today?'}
]
})
};
fetch('https://your-instance.example.com/api/ai/playground', 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://your-instance.example.com/api/ai/playground",
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' => 'Hi, I was hoping to book a tour for next Tuesday.',
'promptId' => '5f7b1c2e8a1d4e0012c3b4a5',
'conversationId' => '64d2f9c5e8a1d4e001a0b1c2',
'conversation' => [
[
'role' => 'user',
'content' => 'Hello there'
],
[
'role' => 'assistant',
'content' => 'Hi! How can I help today?'
]
]
]),
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://your-instance.example.com/api/ai/playground"
payload := strings.NewReader("{\n \"message\": \"Hi, I was hoping to book a tour for next Tuesday.\",\n \"promptId\": \"5f7b1c2e8a1d4e0012c3b4a5\",\n \"conversationId\": \"64d2f9c5e8a1d4e001a0b1c2\",\n \"conversation\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello there\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Hi! How can I help today?\"\n }\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://your-instance.example.com/api/ai/playground")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"Hi, I was hoping to book a tour for next Tuesday.\",\n \"promptId\": \"5f7b1c2e8a1d4e0012c3b4a5\",\n \"conversationId\": \"64d2f9c5e8a1d4e001a0b1c2\",\n \"conversation\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello there\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Hi! How can I help today?\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/ai/playground")
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\": \"Hi, I was hoping to book a tour for next Tuesday.\",\n \"promptId\": \"5f7b1c2e8a1d4e0012c3b4a5\",\n \"conversationId\": \"64d2f9c5e8a1d4e001a0b1c2\",\n \"conversation\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello there\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Hi! How can I help today?\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"response": "Great — I can book you for Friday at 2pm. Want me to send a confirmation text?",
"messageMetric": {
"organizationId": "64a1b2c3d4e5f60012345678",
"metricRunId": "run_64d2f9c5e8a1d4e001a0b1c2",
"aiAgentName": "Leasing Specialist",
"aiCalls": [],
"toolCalls": []
}
}{
"success": false,
"error": "approval_expired",
"message": "This approval request has expired or was already handled. Please send a new playground message to retry."
}{
"success": false,
"error": "approval_expired",
"message": "This approval request has expired or was already handled. Please send a new playground message to retry."
}{
"success": false,
"error": "approval_expired",
"message": "This approval request has expired or was already handled. Please send a new playground message to retry."
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
The latest user turn to send into the agent. Appended to conversation server-side; do not include it twice.
Identifies the saved prompt to run this turn against. Required — the playground refuses to run without a target prompt.
Optional id of an existing conversation used for context lookup (variables, business context). The playground does not persist back into it.
Prior turns the editor is replaying for this playground session. The server does not load history from storage — whatever is sent here is the entire visible history.
Show child attributes
Show child attributes
Response
AI response generated
Playground turn result. approvalCards is only set when the agent paused for tool approval; messageMetric is only set for ADMIN/SUPERADMIN.
true Show child attributes
Show child attributes
MessageMetric snapshot captured for the playground turn — only included for ADMIN/SUPERADMIN callers. Surfaces underlying AI calls and tool calls for debugging.
Show child attributes
Show child attributes
{
"organizationId": "64a1b2c3d4e5f60012345678",
"metricRunId": "run_64d2f9c5e8a1d4e001a0b1c2",
"aiAgentName": "Leasing Specialist",
"aiCalls": [
{
"provider": "anthropic",
"model": "claude-sonnet-4-6",
"inputTokens": 412,
"outputTokens": 88,
"durationMs": 1742
}
],
"toolCalls": [
{
"name": "getContact",
"args": { "phone": "+14165550100" },
"durationMs": 84
}
]
}