Create a scheduled test job
Creates a scheduled test job that runs the selected scenarios on a cron expression.
POST
/
ai
/
tests
/
schedules
/
v1
/
cron-jobs
Create a scheduled test job
curl --request POST \
--url https://api.telnyx.com/v2/ai/tests/schedules/v1/cron-jobs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"crontab_expression": "0 3 * * *",
"name": "Nightly regression",
"agent": 1259,
"scenarios": [
9512
],
"timezone": "America/Chicago",
"execution_mode": "voice",
"notify_on": "failure"
}
'import requests
url = "https://api.telnyx.com/v2/ai/tests/schedules/v1/cron-jobs"
payload = {
"crontab_expression": "0 3 * * *",
"name": "Nightly regression",
"agent": 1259,
"scenarios": [9512],
"timezone": "America/Chicago",
"execution_mode": "voice",
"notify_on": "failure"
}
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({
crontab_expression: '0 3 * * *',
name: 'Nightly regression',
agent: 1259,
scenarios: [9512],
timezone: 'America/Chicago',
execution_mode: 'voice',
notify_on: 'failure'
})
};
fetch('https://api.telnyx.com/v2/ai/tests/schedules/v1/cron-jobs', 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.telnyx.com/v2/ai/tests/schedules/v1/cron-jobs",
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([
'crontab_expression' => '0 3 * * *',
'name' => 'Nightly regression',
'agent' => 1259,
'scenarios' => [
9512
],
'timezone' => 'America/Chicago',
'execution_mode' => 'voice',
'notify_on' => 'failure'
]),
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.telnyx.com/v2/ai/tests/schedules/v1/cron-jobs"
payload := strings.NewReader("{\n \"crontab_expression\": \"0 3 * * *\",\n \"name\": \"Nightly regression\",\n \"agent\": 1259,\n \"scenarios\": [\n 9512\n ],\n \"timezone\": \"America/Chicago\",\n \"execution_mode\": \"voice\",\n \"notify_on\": \"failure\"\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.telnyx.com/v2/ai/tests/schedules/v1/cron-jobs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"crontab_expression\": \"0 3 * * *\",\n \"name\": \"Nightly regression\",\n \"agent\": 1259,\n \"scenarios\": [\n 9512\n ],\n \"timezone\": \"America/Chicago\",\n \"execution_mode\": \"voice\",\n \"notify_on\": \"failure\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/ai/tests/schedules/v1/cron-jobs")
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 \"crontab_expression\": \"0 3 * * *\",\n \"name\": \"Nightly regression\",\n \"agent\": 1259,\n \"scenarios\": [\n 9512\n ],\n \"timezone\": \"America/Chicago\",\n \"execution_mode\": \"voice\",\n \"notify_on\": \"failure\"\n}"
response = http.request(request)
puts response.read_body{
"id": 1188,
"name": "Nightly regression",
"agent": 1259,
"crontab_expression": "0 3 * * *",
"timezone": "America/Chicago",
"scenario_ids": [
9512
],
"scenarios_data": [
{
"id": 9512,
"agent": 1259,
"name": "Refund escalation flow",
"personality": 4643,
"personality_name": "Interruptive (High)"
}
],
"personality": null,
"personalities": [
4643
],
"tags": [
"regression"
],
"frequency": 1,
"run_as_text": false,
"execution_mode": "voice",
"notify_on": "failure",
"is_active": true,
"created_at": "2026-10-13T18:04:05.123456Z",
"updated_at": "2026-10-13T18:04:05.123456Z"
}{
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "The AI Tests service rejected the request."
}
]
}{
"errors": [
{
"code": "10003",
"title": "Unauthorized",
"detail": "The API key is missing or invalid."
}
]
}{
"errors": [
{
"code": "10005",
"title": "Not Found",
"detail": "The requested resource or URL could not be found."
}
]
}{
"errors": [
{
"code": "10018",
"title": "Unprocessable Entity",
"detail": "Validation failed for the request payload."
}
]
}{
"errors": [
{
"code": "10029",
"title": "Too Many Requests",
"detail": "Too many requests; retry later."
}
]
}{
"errors": [
{
"code": "10063",
"title": "Service Unavailable",
"detail": "The test framework service is temporarily unavailable."
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Cron expression controlling when the job runs.
Execution mode for the test runs, such as voice, text, or sip.
Available options:
never, success, failure, both Response
Scheduled test job created.
ID of the test agent the job belongs to.
Cron expression controlling when the job runs, in the job's timezone.
Scenario IDs the job executes.
Show child attributes
Show child attributes
Whether the job runs scenarios as text chat rather than voice calls.
Execution mode for the test runs, such as voice, text, or sip.
When the job sends a notification.
Available options:
never, success, failure, both Was this page helpful?
Create a scheduled test job
curl --request POST \
--url https://api.telnyx.com/v2/ai/tests/schedules/v1/cron-jobs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"crontab_expression": "0 3 * * *",
"name": "Nightly regression",
"agent": 1259,
"scenarios": [
9512
],
"timezone": "America/Chicago",
"execution_mode": "voice",
"notify_on": "failure"
}
'import requests
url = "https://api.telnyx.com/v2/ai/tests/schedules/v1/cron-jobs"
payload = {
"crontab_expression": "0 3 * * *",
"name": "Nightly regression",
"agent": 1259,
"scenarios": [9512],
"timezone": "America/Chicago",
"execution_mode": "voice",
"notify_on": "failure"
}
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({
crontab_expression: '0 3 * * *',
name: 'Nightly regression',
agent: 1259,
scenarios: [9512],
timezone: 'America/Chicago',
execution_mode: 'voice',
notify_on: 'failure'
})
};
fetch('https://api.telnyx.com/v2/ai/tests/schedules/v1/cron-jobs', 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.telnyx.com/v2/ai/tests/schedules/v1/cron-jobs",
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([
'crontab_expression' => '0 3 * * *',
'name' => 'Nightly regression',
'agent' => 1259,
'scenarios' => [
9512
],
'timezone' => 'America/Chicago',
'execution_mode' => 'voice',
'notify_on' => 'failure'
]),
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.telnyx.com/v2/ai/tests/schedules/v1/cron-jobs"
payload := strings.NewReader("{\n \"crontab_expression\": \"0 3 * * *\",\n \"name\": \"Nightly regression\",\n \"agent\": 1259,\n \"scenarios\": [\n 9512\n ],\n \"timezone\": \"America/Chicago\",\n \"execution_mode\": \"voice\",\n \"notify_on\": \"failure\"\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.telnyx.com/v2/ai/tests/schedules/v1/cron-jobs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"crontab_expression\": \"0 3 * * *\",\n \"name\": \"Nightly regression\",\n \"agent\": 1259,\n \"scenarios\": [\n 9512\n ],\n \"timezone\": \"America/Chicago\",\n \"execution_mode\": \"voice\",\n \"notify_on\": \"failure\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/ai/tests/schedules/v1/cron-jobs")
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 \"crontab_expression\": \"0 3 * * *\",\n \"name\": \"Nightly regression\",\n \"agent\": 1259,\n \"scenarios\": [\n 9512\n ],\n \"timezone\": \"America/Chicago\",\n \"execution_mode\": \"voice\",\n \"notify_on\": \"failure\"\n}"
response = http.request(request)
puts response.read_body{
"id": 1188,
"name": "Nightly regression",
"agent": 1259,
"crontab_expression": "0 3 * * *",
"timezone": "America/Chicago",
"scenario_ids": [
9512
],
"scenarios_data": [
{
"id": 9512,
"agent": 1259,
"name": "Refund escalation flow",
"personality": 4643,
"personality_name": "Interruptive (High)"
}
],
"personality": null,
"personalities": [
4643
],
"tags": [
"regression"
],
"frequency": 1,
"run_as_text": false,
"execution_mode": "voice",
"notify_on": "failure",
"is_active": true,
"created_at": "2026-10-13T18:04:05.123456Z",
"updated_at": "2026-10-13T18:04:05.123456Z"
}{
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "The AI Tests service rejected the request."
}
]
}{
"errors": [
{
"code": "10003",
"title": "Unauthorized",
"detail": "The API key is missing or invalid."
}
]
}{
"errors": [
{
"code": "10005",
"title": "Not Found",
"detail": "The requested resource or URL could not be found."
}
]
}{
"errors": [
{
"code": "10018",
"title": "Unprocessable Entity",
"detail": "Validation failed for the request payload."
}
]
}{
"errors": [
{
"code": "10029",
"title": "Too Many Requests",
"detail": "Too many requests; retry later."
}
]
}{
"errors": [
{
"code": "10063",
"title": "Service Unavailable",
"detail": "The test framework service is temporarily unavailable."
}
]
}