Generate Scenario from Call
curl --request POST \
--url https://api.bland.ai/v1/agent-testing/scenarios/generate-from-call \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '
{
"call_id": "<string>",
"pathway_id": "<string>",
"persona_id": "<string>"
}
'import requests
url = "https://api.bland.ai/v1/agent-testing/scenarios/generate-from-call"
payload = {
"call_id": "<string>",
"pathway_id": "<string>",
"persona_id": "<string>"
}
headers = {
"authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({call_id: '<string>', pathway_id: '<string>', persona_id: '<string>'})
};
fetch('https://api.bland.ai/v1/agent-testing/scenarios/generate-from-call', 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.bland.ai/v1/agent-testing/scenarios/generate-from-call",
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([
'call_id' => '<string>',
'pathway_id' => '<string>',
'persona_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <authorization>"
],
]);
$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.bland.ai/v1/agent-testing/scenarios/generate-from-call"
payload := strings.NewReader("{\n \"call_id\": \"<string>\",\n \"pathway_id\": \"<string>\",\n \"persona_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<authorization>")
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.bland.ai/v1/agent-testing/scenarios/generate-from-call")
.header("authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"call_id\": \"<string>\",\n \"pathway_id\": \"<string>\",\n \"persona_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v1/agent-testing/scenarios/generate-from-call")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"call_id\": \"<string>\",\n \"pathway_id\": \"<string>\",\n \"persona_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"name": "Inbound Appointment Booking - Returning Customer",
"description": "Simulates a returning customer calling to book a follow-up appointment. The caller provides their name and preferred time slot, and expects confirmation.",
"category": "HAPPY_PATH",
"tester_persona_prompt": "You are Sarah Chen, a returning customer. You previously visited for a consultation and want to book a follow-up appointment. You prefer afternoons, ideally next Thursday at 2 PM. Be polite but firm about your preferred time. If that slot is unavailable, accept an alternative within the same week.",
"tester_persona_name": "Sarah Chen",
"pathway_id": "pw_abc123",
"persona_id": null,
"request_data": {
"customer_name": "Sarah Chen",
"account_id": "cust_92841",
"appointment_type": "follow_up"
}
}
Agent Testing
Generate Scenario from Call
Generate a test scenario from a historical call transcript using AI analysis.
POST
/
v1
/
agent-testing
/
scenarios
/
generate-from-call
Generate Scenario from Call
curl --request POST \
--url https://api.bland.ai/v1/agent-testing/scenarios/generate-from-call \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '
{
"call_id": "<string>",
"pathway_id": "<string>",
"persona_id": "<string>"
}
'import requests
url = "https://api.bland.ai/v1/agent-testing/scenarios/generate-from-call"
payload = {
"call_id": "<string>",
"pathway_id": "<string>",
"persona_id": "<string>"
}
headers = {
"authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({call_id: '<string>', pathway_id: '<string>', persona_id: '<string>'})
};
fetch('https://api.bland.ai/v1/agent-testing/scenarios/generate-from-call', 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.bland.ai/v1/agent-testing/scenarios/generate-from-call",
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([
'call_id' => '<string>',
'pathway_id' => '<string>',
'persona_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <authorization>"
],
]);
$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.bland.ai/v1/agent-testing/scenarios/generate-from-call"
payload := strings.NewReader("{\n \"call_id\": \"<string>\",\n \"pathway_id\": \"<string>\",\n \"persona_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<authorization>")
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.bland.ai/v1/agent-testing/scenarios/generate-from-call")
.header("authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"call_id\": \"<string>\",\n \"pathway_id\": \"<string>\",\n \"persona_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v1/agent-testing/scenarios/generate-from-call")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"call_id\": \"<string>\",\n \"pathway_id\": \"<string>\",\n \"persona_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"name": "Inbound Appointment Booking - Returning Customer",
"description": "Simulates a returning customer calling to book a follow-up appointment. The caller provides their name and preferred time slot, and expects confirmation.",
"category": "HAPPY_PATH",
"tester_persona_prompt": "You are Sarah Chen, a returning customer. You previously visited for a consultation and want to book a follow-up appointment. You prefer afternoons, ideally next Thursday at 2 PM. Be polite but firm about your preferred time. If that slot is unavailable, accept an alternative within the same week.",
"tester_persona_name": "Sarah Chen",
"pathway_id": "pw_abc123",
"persona_id": null,
"request_data": {
"customer_name": "Sarah Chen",
"account_id": "cust_92841",
"appointment_type": "follow_up"
}
}
Headers
string
required
Your API key for authentication.
Body
string
required
The ID of the historical call to generate a scenario from. The call transcript will be analyzed by AI to extract a realistic test scenario.
string
The pathway to bind the generated scenario to. Either
pathway_id or persona_id is required.string
The persona to bind the generated scenario to. Either
pathway_id or persona_id is required.Response
The response contains the generated scenario data. This data is not yet saved — it is returned so you can review and use it to create a scenario.Sensitive data such as phone numbers, webhook URLs, and API keys is automatically stripped from the generated
request_data.string
An AI-generated name summarizing the scenario.
string
An AI-generated description of what the scenario tests based on the call transcript.
string
The inferred category for the scenario (e.g.,
HAPPY_PATH, EDGE_CASE, ANGRY_CALLER).string
An AI-generated prompt that instructs the simulated caller to replicate the behavior observed in the original call.
string
A name for the simulated caller persona derived from the call.
string
The pathway the scenario is bound to (if provided).
string
The persona the scenario is bound to (if provided).
object
Request data extracted from the call with sensitive fields automatically removed.
{
"name": "Inbound Appointment Booking - Returning Customer",
"description": "Simulates a returning customer calling to book a follow-up appointment. The caller provides their name and preferred time slot, and expects confirmation.",
"category": "HAPPY_PATH",
"tester_persona_prompt": "You are Sarah Chen, a returning customer. You previously visited for a consultation and want to book a follow-up appointment. You prefer afternoons, ideally next Thursday at 2 PM. Be polite but firm about your preferred time. If that slot is unavailable, accept an alternative within the same week.",
"tester_persona_name": "Sarah Chen",
"pathway_id": "pw_abc123",
"persona_id": null,
"request_data": {
"customer_name": "Sarah Chen",
"account_id": "cust_92841",
"appointment_type": "follow_up"
}
}
Docs for agents: llms.txt
Was this page helpful?