Skip to main content
POST
/
api
/
v1
/
runtime
/
v1
/
schedules
Create a schedule
curl --request POST \
  --url https://api.runflow.ai/api/v1/runtime/v1/schedules \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Daily Report",
  "type": "interval",
  "message": "Run the daily report task",
  "interval": 60,
  "time": "09:00",
  "cron": "0 9 * * *",
  "timezone": "America/Sao_Paulo",
  "maxExecutions": 0,
  "metadata": {
    "reportType": "daily"
  },
  "executionContext": {}
}
'
import requests

url = "https://api.runflow.ai/api/v1/runtime/v1/schedules"

payload = {
"name": "Daily Report",
"type": "interval",
"message": "Run the daily report task",
"interval": 60,
"time": "09:00",
"cron": "0 9 * * *",
"timezone": "America/Sao_Paulo",
"maxExecutions": 0,
"metadata": { "reportType": "daily" },
"executionContext": {}
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Daily Report',
type: 'interval',
message: 'Run the daily report task',
interval: 60,
time: '09:00',
cron: '0 9 * * *',
timezone: 'America/Sao_Paulo',
maxExecutions: 0,
metadata: {reportType: 'daily'},
executionContext: {}
})
};

fetch('https://api.runflow.ai/api/v1/runtime/v1/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://api.runflow.ai/api/v1/runtime/v1/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([
'name' => 'Daily Report',
'type' => 'interval',
'message' => 'Run the daily report task',
'interval' => 60,
'time' => '09:00',
'cron' => '0 9 * * *',
'timezone' => 'America/Sao_Paulo',
'maxExecutions' => 0,
'metadata' => [
'reportType' => 'daily'
],
'executionContext' => [

]
]),
CURLOPT_HTTPHEADER => [
"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.runflow.ai/api/v1/runtime/v1/schedules"

payload := strings.NewReader("{\n \"name\": \"Daily Report\",\n \"type\": \"interval\",\n \"message\": \"Run the daily report task\",\n \"interval\": 60,\n \"time\": \"09:00\",\n \"cron\": \"0 9 * * *\",\n \"timezone\": \"America/Sao_Paulo\",\n \"maxExecutions\": 0,\n \"metadata\": {\n \"reportType\": \"daily\"\n },\n \"executionContext\": {}\n}")

req, _ := http.NewRequest("POST", url, payload)

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.runflow.ai/api/v1/runtime/v1/schedules")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Daily Report\",\n \"type\": \"interval\",\n \"message\": \"Run the daily report task\",\n \"interval\": 60,\n \"time\": \"09:00\",\n \"cron\": \"0 9 * * *\",\n \"timezone\": \"America/Sao_Paulo\",\n \"maxExecutions\": 0,\n \"metadata\": {\n \"reportType\": \"daily\"\n },\n \"executionContext\": {}\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.runflow.ai/api/v1/runtime/v1/schedules")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Daily Report\",\n \"type\": \"interval\",\n \"message\": \"Run the daily report task\",\n \"interval\": 60,\n \"time\": \"09:00\",\n \"cron\": \"0 9 * * *\",\n \"timezone\": \"America/Sao_Paulo\",\n \"maxExecutions\": 0,\n \"metadata\": {\n \"reportType\": \"daily\"\n },\n \"executionContext\": {}\n}"

response = http.request(request)
puts response.read_body

Body

application/json
name
string
required

Schedule name

Example:

"Daily Report"

type
enum<string>
required

Schedule type

Available options:
interval,
daily,
cron
Example:

"interval"

message
string
required

Message sent to agent on each scheduled execution

Example:

"Run the daily report task"

interval
number

Interval in minutes (required for type "interval")

Required range: 1 <= x <= 43200
Example:

60

time
string

Time in HH:mm format (required for type "daily")

Example:

"09:00"

cron
string

Cron expression (required for type "cron")

Example:

"0 9 * * *"

timezone
string
default:America/Sao_Paulo

Timezone for scheduled executions

Example:

"America/Sao_Paulo"

maxExecutions
number
default:0

Maximum number of executions (0 = unlimited)

Required range: x >= 0
Example:

0

metadata
object

Additional metadata for the schedule

Example:
{ "reportType": "daily" }
executionContext
object

Conversation context captured automatically by the SDK (entityType, entityValue, sessionId, userId)

Response

201

Schedule created successfully.