Preview Scenario Prompt
curl --request POST \
--url https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios/preview-prompt \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"situation": "The caller was charged twice for the same order and wants one charge refunded.",
"goal": "Get the duplicate charge refunded.",
"first_line": "Hi, I think I was charged twice for my last order.",
"stop_condition": "The agent confirms the refund or says it cannot be done."
}
'import requests
url = "https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios/preview-prompt"
payload = {
"situation": "The caller was charged twice for the same order and wants one charge refunded.",
"goal": "Get the duplicate charge refunded.",
"first_line": "Hi, I think I was charged twice for my last order.",
"stop_condition": "The agent confirms the refund or says it cannot be done."
}
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({
situation: 'The caller was charged twice for the same order and wants one charge refunded.',
goal: 'Get the duplicate charge refunded.',
first_line: 'Hi, I think I was charged twice for my last order.',
stop_condition: 'The agent confirms the refund or says it cannot be done.'
})
};
fetch('https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios/preview-prompt', 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.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios/preview-prompt",
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([
'situation' => 'The caller was charged twice for the same order and wants one charge refunded.',
'goal' => 'Get the duplicate charge refunded.',
'first_line' => 'Hi, I think I was charged twice for my last order.',
'stop_condition' => 'The agent confirms the refund or says it cannot be done.'
]),
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.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios/preview-prompt"
payload := strings.NewReader("{\n \"situation\": \"The caller was charged twice for the same order and wants one charge refunded.\",\n \"goal\": \"Get the duplicate charge refunded.\",\n \"first_line\": \"Hi, I think I was charged twice for my last order.\",\n \"stop_condition\": \"The agent confirms the refund or says it cannot be done.\"\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.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios/preview-prompt")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"situation\": \"The caller was charged twice for the same order and wants one charge refunded.\",\n \"goal\": \"Get the duplicate charge refunded.\",\n \"first_line\": \"Hi, I think I was charged twice for my last order.\",\n \"stop_condition\": \"The agent confirms the refund or says it cannot be done.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios/preview-prompt")
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 \"situation\": \"The caller was charged twice for the same order and wants one charge refunded.\",\n \"goal\": \"Get the duplicate charge refunded.\",\n \"first_line\": \"Hi, I think I was charged twice for my last order.\",\n \"stop_condition\": \"The agent confirms the refund or says it cannot be done.\"\n}"
response = http.request(request)
puts response.read_body{
"sections": [
{
"key": "situation",
"label": "<string>",
"value": "<string>"
}
],
"prompt": "<string>"
}{
"code": "invalid_api_key",
"detail": "Not authenticated"
}{
"code": "insufficient_access",
"detail": "User does not have access to workspace 42"
}{
"code": "agent_not_found",
"detail": "Agent with ID 17 not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Scenarios
Preview Scenario Prompt
Preview the prompt that would be used for a scenario.
Excludes the caller-persona prefix, profile facts and inbound/outbound footer that are added when the call is placed. Nothing is saved.
POST
/
api
/
v1
/
workspaces
/
{workspace_id}
/
agents
/
{agent_id}
/
scenarios
/
preview-prompt
Preview Scenario Prompt
curl --request POST \
--url https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios/preview-prompt \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"situation": "The caller was charged twice for the same order and wants one charge refunded.",
"goal": "Get the duplicate charge refunded.",
"first_line": "Hi, I think I was charged twice for my last order.",
"stop_condition": "The agent confirms the refund or says it cannot be done."
}
'import requests
url = "https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios/preview-prompt"
payload = {
"situation": "The caller was charged twice for the same order and wants one charge refunded.",
"goal": "Get the duplicate charge refunded.",
"first_line": "Hi, I think I was charged twice for my last order.",
"stop_condition": "The agent confirms the refund or says it cannot be done."
}
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({
situation: 'The caller was charged twice for the same order and wants one charge refunded.',
goal: 'Get the duplicate charge refunded.',
first_line: 'Hi, I think I was charged twice for my last order.',
stop_condition: 'The agent confirms the refund or says it cannot be done.'
})
};
fetch('https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios/preview-prompt', 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.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios/preview-prompt",
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([
'situation' => 'The caller was charged twice for the same order and wants one charge refunded.',
'goal' => 'Get the duplicate charge refunded.',
'first_line' => 'Hi, I think I was charged twice for my last order.',
'stop_condition' => 'The agent confirms the refund or says it cannot be done.'
]),
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.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios/preview-prompt"
payload := strings.NewReader("{\n \"situation\": \"The caller was charged twice for the same order and wants one charge refunded.\",\n \"goal\": \"Get the duplicate charge refunded.\",\n \"first_line\": \"Hi, I think I was charged twice for my last order.\",\n \"stop_condition\": \"The agent confirms the refund or says it cannot be done.\"\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.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios/preview-prompt")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"situation\": \"The caller was charged twice for the same order and wants one charge refunded.\",\n \"goal\": \"Get the duplicate charge refunded.\",\n \"first_line\": \"Hi, I think I was charged twice for my last order.\",\n \"stop_condition\": \"The agent confirms the refund or says it cannot be done.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios/preview-prompt")
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 \"situation\": \"The caller was charged twice for the same order and wants one charge refunded.\",\n \"goal\": \"Get the duplicate charge refunded.\",\n \"first_line\": \"Hi, I think I was charged twice for my last order.\",\n \"stop_condition\": \"The agent confirms the refund or says it cannot be done.\"\n}"
response = http.request(request)
puts response.read_body{
"sections": [
{
"key": "situation",
"label": "<string>",
"value": "<string>"
}
],
"prompt": "<string>"
}{
"code": "invalid_api_key",
"detail": "Not authenticated"
}{
"code": "insufficient_access",
"detail": "User does not have access to workspace 42"
}{
"code": "agent_not_found",
"detail": "Agent with ID 17 not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Path Parameters
Body
application/json
Scenario fields to preview the prompt for.