Agent Testing
Batch Run Scenarios
Execute multiple test scenarios as a batch. Returns immediately with a batch ID while tests execute asynchronously.
POST
/
v1
/
agent-testing
/
batch-run
Batch Run Scenarios
curl --request POST \
--url https://api.bland.ai/v1/agent-testing/batch-run \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '
{
"scenario_ids": {},
"version_number": 123,
"webhook_url": "<string>"
}
'import requests
url = "https://api.bland.ai/v1/agent-testing/batch-run"
payload = {
"scenario_ids": {},
"version_number": 123,
"webhook_url": "<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({scenario_ids: {}, version_number: 123, webhook_url: '<string>'})
};
fetch('https://api.bland.ai/v1/agent-testing/batch-run', 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/batch-run",
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([
'scenario_ids' => [
],
'version_number' => 123,
'webhook_url' => '<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/batch-run"
payload := strings.NewReader("{\n \"scenario_ids\": {},\n \"version_number\": 123,\n \"webhook_url\": \"<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/batch-run")
.header("authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"scenario_ids\": {},\n \"version_number\": 123,\n \"webhook_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v1/agent-testing/batch-run")
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 \"scenario_ids\": {},\n \"version_number\": 123,\n \"webhook_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"batch_id": "e7a2c3d4-8f9b-4a1e-b5c6-d7e8f9a0b1c2",
"runs": [
{
"run_id": "a3f1b2c4-5d6e-7f8a-9b0c-1d2e3f4a5b6c",
"scenario_id": "1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d"
},
{
"run_id": "b4c2d3e5-6f7a-8b9c-0d1e-2f3a4b5c6d7e",
"scenario_id": "2b3c4d5e-6f7a-8b9c-0d1e-2f3a4b5c6d7e"
}
]
}
Headers
Body
Array of scenario IDs to run. All scenario IDs must belong to your organization.
URL to receive a webhook when the entire batch completes. The webhook payload will include the batch result summary.
Response
An array of run entries, one per scenario. Each entry contains:
run_id- The unique identifier for the individual test run.scenario_id- The scenario ID associated with this run.
{
"batch_id": "e7a2c3d4-8f9b-4a1e-b5c6-d7e8f9a0b1c2",
"runs": [
{
"run_id": "a3f1b2c4-5d6e-7f8a-9b0c-1d2e3f4a5b6c",
"scenario_id": "1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d"
},
{
"run_id": "b4c2d3e5-6f7a-8b9c-0d1e-2f3a4b5c6d7e",
"scenario_id": "2b3c4d5e-6f7a-8b9c-0d1e-2f3a4b5c6d7e"
}
]
}
This endpoint is rate limited per organization. All
scenario_ids must belong to your organization or the request will be rejected.Docs for agents: llms.txt
Was this page helpful?
⌘I
Batch Run Scenarios
curl --request POST \
--url https://api.bland.ai/v1/agent-testing/batch-run \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '
{
"scenario_ids": {},
"version_number": 123,
"webhook_url": "<string>"
}
'import requests
url = "https://api.bland.ai/v1/agent-testing/batch-run"
payload = {
"scenario_ids": {},
"version_number": 123,
"webhook_url": "<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({scenario_ids: {}, version_number: 123, webhook_url: '<string>'})
};
fetch('https://api.bland.ai/v1/agent-testing/batch-run', 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/batch-run",
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([
'scenario_ids' => [
],
'version_number' => 123,
'webhook_url' => '<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/batch-run"
payload := strings.NewReader("{\n \"scenario_ids\": {},\n \"version_number\": 123,\n \"webhook_url\": \"<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/batch-run")
.header("authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"scenario_ids\": {},\n \"version_number\": 123,\n \"webhook_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v1/agent-testing/batch-run")
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 \"scenario_ids\": {},\n \"version_number\": 123,\n \"webhook_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"batch_id": "e7a2c3d4-8f9b-4a1e-b5c6-d7e8f9a0b1c2",
"runs": [
{
"run_id": "a3f1b2c4-5d6e-7f8a-9b0c-1d2e3f4a5b6c",
"scenario_id": "1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d"
},
{
"run_id": "b4c2d3e5-6f7a-8b9c-0d1e-2f3a4b5c6d7e",
"scenario_id": "2b3c4d5e-6f7a-8b9c-0d1e-2f3a4b5c6d7e"
}
]
}