curl --request POST \
--url https://scheduler.studio.lyzr.ai/schedules/ \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data @- <<EOF
{
"user_id": "user@example.com",
"agent_id": "66e9b0f2a1c3d4e5f6a7b8c9",
"cron_expression": "0 9 * * 1-5",
"message": "Summarize yesterday's support tickets and flag anything urgent.",
"timezone": "Asia/Kolkata",
"max_retries": 3,
"retry_delay": 60
}
EOFimport requests
url = "https://scheduler.studio.lyzr.ai/schedules/"
payload = {
"user_id": "user@example.com",
"agent_id": "66e9b0f2a1c3d4e5f6a7b8c9",
"cron_expression": "0 9 * * 1-5",
"message": "Summarize yesterday's support tickets and flag anything urgent.",
"timezone": "Asia/Kolkata",
"max_retries": 3,
"retry_delay": 60
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
user_id: 'user@example.com',
agent_id: '66e9b0f2a1c3d4e5f6a7b8c9',
cron_expression: '0 9 * * 1-5',
message: 'Summarize yesterday\'s support tickets and flag anything urgent.',
timezone: 'Asia/Kolkata',
max_retries: 3,
retry_delay: 60
})
};
fetch('https://scheduler.studio.lyzr.ai/schedules/', 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://scheduler.studio.lyzr.ai/schedules/",
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([
'user_id' => 'user@example.com',
'agent_id' => '66e9b0f2a1c3d4e5f6a7b8c9',
'cron_expression' => '0 9 * * 1-5',
'message' => 'Summarize yesterday\'s support tickets and flag anything urgent.',
'timezone' => 'Asia/Kolkata',
'max_retries' => 3,
'retry_delay' => 60
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://scheduler.studio.lyzr.ai/schedules/"
payload := strings.NewReader("{\n \"user_id\": \"user@example.com\",\n \"agent_id\": \"66e9b0f2a1c3d4e5f6a7b8c9\",\n \"cron_expression\": \"0 9 * * 1-5\",\n \"message\": \"Summarize yesterday's support tickets and flag anything urgent.\",\n \"timezone\": \"Asia/Kolkata\",\n \"max_retries\": 3,\n \"retry_delay\": 60\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://scheduler.studio.lyzr.ai/schedules/")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"user_id\": \"user@example.com\",\n \"agent_id\": \"66e9b0f2a1c3d4e5f6a7b8c9\",\n \"cron_expression\": \"0 9 * * 1-5\",\n \"message\": \"Summarize yesterday's support tickets and flag anything urgent.\",\n \"timezone\": \"Asia/Kolkata\",\n \"max_retries\": 3,\n \"retry_delay\": 60\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://scheduler.studio.lyzr.ai/schedules/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_id\": \"user@example.com\",\n \"agent_id\": \"66e9b0f2a1c3d4e5f6a7b8c9\",\n \"cron_expression\": \"0 9 * * 1-5\",\n \"message\": \"Summarize yesterday's support tickets and flag anything urgent.\",\n \"timezone\": \"Asia/Kolkata\",\n \"max_retries\": 3,\n \"retry_delay\": 60\n}"
response = http.request(request)
puts response.read_body{
"id": "66f1c2a9e4b0a1b2c3d4e5f6",
"user_id": "user@example.com",
"agent_id": "66e9b0f2a1c3d4e5f6a7b8c9",
"message": "Summarize yesterday's support tickets and flag anything urgent.",
"cron_expression": "0 9 * * 1-5",
"timezone": "Asia/Kolkata",
"created_at": "2023-11-07T05:31:56Z",
"max_retries": 3,
"retry_delay": 60,
"is_active": true,
"updated_at": "2023-11-07T05:31:56Z",
"next_run_time": "2023-11-07T05:31:56Z",
"last_run_at": "2023-11-07T05:31:56Z",
"last_run_success": true
}Create Schedule
Run an agent on a cron schedule.
curl --request POST \
--url https://scheduler.studio.lyzr.ai/schedules/ \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data @- <<EOF
{
"user_id": "user@example.com",
"agent_id": "66e9b0f2a1c3d4e5f6a7b8c9",
"cron_expression": "0 9 * * 1-5",
"message": "Summarize yesterday's support tickets and flag anything urgent.",
"timezone": "Asia/Kolkata",
"max_retries": 3,
"retry_delay": 60
}
EOFimport requests
url = "https://scheduler.studio.lyzr.ai/schedules/"
payload = {
"user_id": "user@example.com",
"agent_id": "66e9b0f2a1c3d4e5f6a7b8c9",
"cron_expression": "0 9 * * 1-5",
"message": "Summarize yesterday's support tickets and flag anything urgent.",
"timezone": "Asia/Kolkata",
"max_retries": 3,
"retry_delay": 60
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
user_id: 'user@example.com',
agent_id: '66e9b0f2a1c3d4e5f6a7b8c9',
cron_expression: '0 9 * * 1-5',
message: 'Summarize yesterday\'s support tickets and flag anything urgent.',
timezone: 'Asia/Kolkata',
max_retries: 3,
retry_delay: 60
})
};
fetch('https://scheduler.studio.lyzr.ai/schedules/', 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://scheduler.studio.lyzr.ai/schedules/",
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([
'user_id' => 'user@example.com',
'agent_id' => '66e9b0f2a1c3d4e5f6a7b8c9',
'cron_expression' => '0 9 * * 1-5',
'message' => 'Summarize yesterday\'s support tickets and flag anything urgent.',
'timezone' => 'Asia/Kolkata',
'max_retries' => 3,
'retry_delay' => 60
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://scheduler.studio.lyzr.ai/schedules/"
payload := strings.NewReader("{\n \"user_id\": \"user@example.com\",\n \"agent_id\": \"66e9b0f2a1c3d4e5f6a7b8c9\",\n \"cron_expression\": \"0 9 * * 1-5\",\n \"message\": \"Summarize yesterday's support tickets and flag anything urgent.\",\n \"timezone\": \"Asia/Kolkata\",\n \"max_retries\": 3,\n \"retry_delay\": 60\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://scheduler.studio.lyzr.ai/schedules/")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"user_id\": \"user@example.com\",\n \"agent_id\": \"66e9b0f2a1c3d4e5f6a7b8c9\",\n \"cron_expression\": \"0 9 * * 1-5\",\n \"message\": \"Summarize yesterday's support tickets and flag anything urgent.\",\n \"timezone\": \"Asia/Kolkata\",\n \"max_retries\": 3,\n \"retry_delay\": 60\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://scheduler.studio.lyzr.ai/schedules/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_id\": \"user@example.com\",\n \"agent_id\": \"66e9b0f2a1c3d4e5f6a7b8c9\",\n \"cron_expression\": \"0 9 * * 1-5\",\n \"message\": \"Summarize yesterday's support tickets and flag anything urgent.\",\n \"timezone\": \"Asia/Kolkata\",\n \"max_retries\": 3,\n \"retry_delay\": 60\n}"
response = http.request(request)
puts response.read_body{
"id": "66f1c2a9e4b0a1b2c3d4e5f6",
"user_id": "user@example.com",
"agent_id": "66e9b0f2a1c3d4e5f6a7b8c9",
"message": "Summarize yesterday's support tickets and flag anything urgent.",
"cron_expression": "0 9 * * 1-5",
"timezone": "Asia/Kolkata",
"created_at": "2023-11-07T05:31:56Z",
"max_retries": 3,
"retry_delay": 60,
"is_active": true,
"updated_at": "2023-11-07T05:31:56Z",
"next_run_time": "2023-11-07T05:31:56Z",
"last_run_at": "2023-11-07T05:31:56Z",
"last_run_success": true
}message as if a user had sent it. The schedule is active as soon as it is created.
cron_expression uses standard five-field cron syntax, evaluated in timezone. See Cron expressions for the format and examples.
To test the schedule without waiting for the next cron time, call Trigger Schedule Now.Authorizations
Lyzr API key. Required on every endpoint except Trigger Webhook.
Body
User ID the agent runs on behalf of. Used to scope the agent's session and memory.
"user@example.com"
ID of the agent to run.
"66e9b0f2a1c3d4e5f6a7b8c9"
Five-field cron expression: minute hour day month day_of_week. Day-of-week follows standard cron numbering (0 or 7 = Sunday, 1 = Monday, ..., 6 = Saturday).
"0 9 * * 1-5"
Message sent to the agent on every run.
"Summarize yesterday's support tickets and flag anything urgent."
IANA timezone the cron expression is evaluated in.
"Asia/Kolkata"
Number of retry attempts if a run fails (0-5).
0 <= x <= 5Seconds to wait between retry attempts (10-3600).
10 <= x <= 3600Response
Schedule created.
Unique schedule ID.
"66f1c2a9e4b0a1b2c3d4e5f6"
"user@example.com"
"66e9b0f2a1c3d4e5f6a7b8c9"
"Summarize yesterday's support tickets and flag anything urgent."
"0 9 * * 1-5"
"Asia/Kolkata"
false when the schedule is paused.
When the schedule will next fire. null while paused.
Outcome of the most recent run. null if the schedule has never run.