curl --request POST \
--url https://scheduler.studio.lyzr.ai/http-schedules/ \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"url": "https://api.example.com/reports/refresh",
"cron_expression": "0 9 * * 1-5",
"method": "POST",
"headers": {
"Authorization": "Bearer TARGET_TOKEN"
},
"body": {
"report": "daily"
},
"timeout_seconds": 120,
"timezone": "UTC",
"max_retries": 3,
"retry_delay": 60,
"label": "Nightly report refresh"
}
'import requests
url = "https://scheduler.studio.lyzr.ai/http-schedules/"
payload = {
"url": "https://api.example.com/reports/refresh",
"cron_expression": "0 9 * * 1-5",
"method": "POST",
"headers": { "Authorization": "Bearer TARGET_TOKEN" },
"body": { "report": "daily" },
"timeout_seconds": 120,
"timezone": "UTC",
"max_retries": 3,
"retry_delay": 60,
"label": "Nightly report refresh"
}
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({
url: 'https://api.example.com/reports/refresh',
cron_expression: '0 9 * * 1-5',
method: 'POST',
headers: {Authorization: 'Bearer TARGET_TOKEN'},
body: JSON.stringify({report: 'daily'}),
timeout_seconds: 120,
timezone: 'UTC',
max_retries: 3,
retry_delay: 60,
label: 'Nightly report refresh'
})
};
fetch('https://scheduler.studio.lyzr.ai/http-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/http-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([
'url' => 'https://api.example.com/reports/refresh',
'cron_expression' => '0 9 * * 1-5',
'method' => 'POST',
'headers' => [
'Authorization' => 'Bearer TARGET_TOKEN'
],
'body' => [
'report' => 'daily'
],
'timeout_seconds' => 120,
'timezone' => 'UTC',
'max_retries' => 3,
'retry_delay' => 60,
'label' => 'Nightly report refresh'
]),
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/http-schedules/"
payload := strings.NewReader("{\n \"url\": \"https://api.example.com/reports/refresh\",\n \"cron_expression\": \"0 9 * * 1-5\",\n \"method\": \"POST\",\n \"headers\": {\n \"Authorization\": \"Bearer TARGET_TOKEN\"\n },\n \"body\": {\n \"report\": \"daily\"\n },\n \"timeout_seconds\": 120,\n \"timezone\": \"UTC\",\n \"max_retries\": 3,\n \"retry_delay\": 60,\n \"label\": \"Nightly report refresh\"\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/http-schedules/")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://api.example.com/reports/refresh\",\n \"cron_expression\": \"0 9 * * 1-5\",\n \"method\": \"POST\",\n \"headers\": {\n \"Authorization\": \"Bearer TARGET_TOKEN\"\n },\n \"body\": {\n \"report\": \"daily\"\n },\n \"timeout_seconds\": 120,\n \"timezone\": \"UTC\",\n \"max_retries\": 3,\n \"retry_delay\": 60,\n \"label\": \"Nightly report refresh\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://scheduler.studio.lyzr.ai/http-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 \"url\": \"https://api.example.com/reports/refresh\",\n \"cron_expression\": \"0 9 * * 1-5\",\n \"method\": \"POST\",\n \"headers\": {\n \"Authorization\": \"Bearer TARGET_TOKEN\"\n },\n \"body\": {\n \"report\": \"daily\"\n },\n \"timeout_seconds\": 120,\n \"timezone\": \"UTC\",\n \"max_retries\": 3,\n \"retry_delay\": 60,\n \"label\": \"Nightly report refresh\"\n}"
response = http.request(request)
puts response.read_body{
"id": "66f1c4d2e4b0a1b2c3d4e5f8",
"url": "https://api.example.com/reports/refresh",
"method": "POST",
"timeout_seconds": 120,
"cron_expression": "0 2 * * *",
"timezone": "UTC",
"created_at": "2023-11-07T05:31:56Z",
"headers": {},
"body": "<unknown>",
"max_retries": 3,
"retry_delay": 60,
"label": "Nightly report refresh",
"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,
"last_run_status": 123,
"last_attempt_count": 123
}Create HTTP Schedule
Call any URL on a cron schedule.
curl --request POST \
--url https://scheduler.studio.lyzr.ai/http-schedules/ \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"url": "https://api.example.com/reports/refresh",
"cron_expression": "0 9 * * 1-5",
"method": "POST",
"headers": {
"Authorization": "Bearer TARGET_TOKEN"
},
"body": {
"report": "daily"
},
"timeout_seconds": 120,
"timezone": "UTC",
"max_retries": 3,
"retry_delay": 60,
"label": "Nightly report refresh"
}
'import requests
url = "https://scheduler.studio.lyzr.ai/http-schedules/"
payload = {
"url": "https://api.example.com/reports/refresh",
"cron_expression": "0 9 * * 1-5",
"method": "POST",
"headers": { "Authorization": "Bearer TARGET_TOKEN" },
"body": { "report": "daily" },
"timeout_seconds": 120,
"timezone": "UTC",
"max_retries": 3,
"retry_delay": 60,
"label": "Nightly report refresh"
}
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({
url: 'https://api.example.com/reports/refresh',
cron_expression: '0 9 * * 1-5',
method: 'POST',
headers: {Authorization: 'Bearer TARGET_TOKEN'},
body: JSON.stringify({report: 'daily'}),
timeout_seconds: 120,
timezone: 'UTC',
max_retries: 3,
retry_delay: 60,
label: 'Nightly report refresh'
})
};
fetch('https://scheduler.studio.lyzr.ai/http-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/http-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([
'url' => 'https://api.example.com/reports/refresh',
'cron_expression' => '0 9 * * 1-5',
'method' => 'POST',
'headers' => [
'Authorization' => 'Bearer TARGET_TOKEN'
],
'body' => [
'report' => 'daily'
],
'timeout_seconds' => 120,
'timezone' => 'UTC',
'max_retries' => 3,
'retry_delay' => 60,
'label' => 'Nightly report refresh'
]),
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/http-schedules/"
payload := strings.NewReader("{\n \"url\": \"https://api.example.com/reports/refresh\",\n \"cron_expression\": \"0 9 * * 1-5\",\n \"method\": \"POST\",\n \"headers\": {\n \"Authorization\": \"Bearer TARGET_TOKEN\"\n },\n \"body\": {\n \"report\": \"daily\"\n },\n \"timeout_seconds\": 120,\n \"timezone\": \"UTC\",\n \"max_retries\": 3,\n \"retry_delay\": 60,\n \"label\": \"Nightly report refresh\"\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/http-schedules/")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://api.example.com/reports/refresh\",\n \"cron_expression\": \"0 9 * * 1-5\",\n \"method\": \"POST\",\n \"headers\": {\n \"Authorization\": \"Bearer TARGET_TOKEN\"\n },\n \"body\": {\n \"report\": \"daily\"\n },\n \"timeout_seconds\": 120,\n \"timezone\": \"UTC\",\n \"max_retries\": 3,\n \"retry_delay\": 60,\n \"label\": \"Nightly report refresh\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://scheduler.studio.lyzr.ai/http-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 \"url\": \"https://api.example.com/reports/refresh\",\n \"cron_expression\": \"0 9 * * 1-5\",\n \"method\": \"POST\",\n \"headers\": {\n \"Authorization\": \"Bearer TARGET_TOKEN\"\n },\n \"body\": {\n \"report\": \"daily\"\n },\n \"timeout_seconds\": 120,\n \"timezone\": \"UTC\",\n \"max_retries\": 3,\n \"retry_delay\": 60,\n \"label\": \"Nightly report refresh\"\n}"
response = http.request(request)
puts response.read_body{
"id": "66f1c4d2e4b0a1b2c3d4e5f8",
"url": "https://api.example.com/reports/refresh",
"method": "POST",
"timeout_seconds": 120,
"cron_expression": "0 2 * * *",
"timezone": "UTC",
"created_at": "2023-11-07T05:31:56Z",
"headers": {},
"body": "<unknown>",
"max_retries": 3,
"retry_delay": 60,
"label": "Nightly report refresh",
"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,
"last_run_status": 123,
"last_attempt_count": 123
}body is an object or array, it is sent as JSON. Any other value is sent as a raw string. cron_expression uses standard five-field cron syntax. See Cron expressions.Authorizations
Lyzr API key. Required on every endpoint except Trigger Webhook.
Body
Absolute URL to call.
"https://api.example.com/reports/refresh"
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"
HTTP method.
GET, POST, PUT, PATCH, DELETE Extra request headers, for example an API key for the target service.
Show child attributes
Show child attributes
{ "Authorization": "Bearer TARGET_TOKEN" }
Request body. Objects and arrays are sent as JSON; any other value is sent as a raw string.
{ "report": "daily" }
Per-request timeout in seconds (1-600).
1 <= x <= 600IANA timezone the cron expression is evaluated in.
Number of retry attempts if a request fails (0-5).
0 <= x <= 5Seconds to wait between retry attempts (10-3600).
10 <= x <= 3600Optional human-readable name for the schedule.
"Nightly report refresh"
Response
HTTP schedule created.
"66f1c4d2e4b0a1b2c3d4e5f8"
"https://api.example.com/reports/refresh"
"POST"
120
"0 2 * * *"
"UTC"
Show child attributes
Show child attributes
Stored request body.
"Nightly report refresh"
false when the schedule is paused.
When the schedule will next fire. null while paused.
HTTP status code returned by the target on the most recent run.
Number of attempts the most recent run took.