JavaScript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: process.env['RETELL_API_KEY'], // This is the default and can be omitted
});
const batchTestResponse = await client.tests.createBatchTest({
response_engine: { llm_id: 'llm_id', type: 'retell-llm' },
test_case_definition_ids: ['string'],
});
console.log(batchTestResponse.test_case_batch_job_id);import os
from retell import Retell
client = Retell(
api_key=os.environ.get("RETELL_API_KEY"), # This is the default and can be omitted
)
batch_test_response = client.tests.create_batch_test(
response_engine={
"llm_id": "llm_id",
"type": "retell-llm",
},
test_case_definition_ids=["string"],
)
print(batch_test_response.test_case_batch_job_id)curl --request POST \
--url https://api.retellai.com/create-batch-test \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"test_case_definition_ids": [
"<string>"
],
"response_engine": {
"type": "retell-llm",
"llm_id": "<string>",
"version": 0
}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.retellai.com/create-batch-test",
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([
'test_case_definition_ids' => [
'<string>'
],
'response_engine' => [
'type' => 'retell-llm',
'llm_id' => '<string>',
'version' => 0
]
]),
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.retellai.com/create-batch-test"
payload := strings.NewReader("{\n \"test_case_definition_ids\": [\n \"<string>\"\n ],\n \"response_engine\": {\n \"type\": \"retell-llm\",\n \"llm_id\": \"<string>\",\n \"version\": 0\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://api.retellai.com/create-batch-test")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"test_case_definition_ids\": [\n \"<string>\"\n ],\n \"response_engine\": {\n \"type\": \"retell-llm\",\n \"llm_id\": \"<string>\",\n \"version\": 0\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.retellai.com/create-batch-test")
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 \"test_case_definition_ids\": [\n \"<string>\"\n ],\n \"response_engine\": {\n \"type\": \"retell-llm\",\n \"llm_id\": \"<string>\",\n \"version\": 0\n }\n}"
response = http.request(request)
puts response.read_body{
"test_case_batch_job_id": "<string>",
"response_engine": {
"type": "retell-llm",
"llm_id": "<string>",
"version": 0
},
"pass_count": 1,
"fail_count": 1,
"error_count": 1,
"total_count": 1,
"creation_timestamp": 123,
"user_modified_timestamp": 123
}{
"status": "error",
"message": "Invalid request format, please check API reference."
}{
"status": "error",
"message": "API key is missing or invalid."
}{
"status": "error",
"message": "Trial has ended, please add payment method."
}{
"status": "error",
"message": "Account rate limited, please throttle your requests."
}{
"status": "error",
"message": "An unexpected server error occurred."
}Batch Tests
Create Batch Test
Create a batch test to run multiple test cases
POST
/
create-batch-test
JavaScript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: process.env['RETELL_API_KEY'], // This is the default and can be omitted
});
const batchTestResponse = await client.tests.createBatchTest({
response_engine: { llm_id: 'llm_id', type: 'retell-llm' },
test_case_definition_ids: ['string'],
});
console.log(batchTestResponse.test_case_batch_job_id);import os
from retell import Retell
client = Retell(
api_key=os.environ.get("RETELL_API_KEY"), # This is the default and can be omitted
)
batch_test_response = client.tests.create_batch_test(
response_engine={
"llm_id": "llm_id",
"type": "retell-llm",
},
test_case_definition_ids=["string"],
)
print(batch_test_response.test_case_batch_job_id)curl --request POST \
--url https://api.retellai.com/create-batch-test \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"test_case_definition_ids": [
"<string>"
],
"response_engine": {
"type": "retell-llm",
"llm_id": "<string>",
"version": 0
}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.retellai.com/create-batch-test",
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([
'test_case_definition_ids' => [
'<string>'
],
'response_engine' => [
'type' => 'retell-llm',
'llm_id' => '<string>',
'version' => 0
]
]),
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.retellai.com/create-batch-test"
payload := strings.NewReader("{\n \"test_case_definition_ids\": [\n \"<string>\"\n ],\n \"response_engine\": {\n \"type\": \"retell-llm\",\n \"llm_id\": \"<string>\",\n \"version\": 0\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://api.retellai.com/create-batch-test")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"test_case_definition_ids\": [\n \"<string>\"\n ],\n \"response_engine\": {\n \"type\": \"retell-llm\",\n \"llm_id\": \"<string>\",\n \"version\": 0\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.retellai.com/create-batch-test")
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 \"test_case_definition_ids\": [\n \"<string>\"\n ],\n \"response_engine\": {\n \"type\": \"retell-llm\",\n \"llm_id\": \"<string>\",\n \"version\": 0\n }\n}"
response = http.request(request)
puts response.read_body{
"test_case_batch_job_id": "<string>",
"response_engine": {
"type": "retell-llm",
"llm_id": "<string>",
"version": 0
},
"pass_count": 1,
"fail_count": 1,
"error_count": 1,
"total_count": 1,
"creation_timestamp": 123,
"user_modified_timestamp": 123
}{
"status": "error",
"message": "Invalid request format, please check API reference."
}{
"status": "error",
"message": "API key is missing or invalid."
}{
"status": "error",
"message": "Trial has ended, please add payment method."
}{
"status": "error",
"message": "Account rate limited, please throttle your requests."
}{
"status": "error",
"message": "An unexpected server error occurred."
}Authorizations
Authentication header containing API key (find it in dashboard). The format is "Bearer YOUR_API_KEY"
Body
application/json
Response
Test case batch job created successfully
Unique identifier for the test case batch job
Status of the batch job
Available options:
in_progress, complete - Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
Number of test cases that passed
Required range:
x >= 0Number of test cases that failed
Required range:
x >= 0Number of test cases that encountered errors
Required range:
x >= 0Total number of test cases in the batch
Required range:
x >= 0Timestamp when the batch job was created (milliseconds since epoch)
Timestamp when the batch job was last modified (milliseconds since epoch)
Was this page helpful?
⌘I

