Automations (legacy API)
Create Cron Job
Schedule an agent to run on a recurring basis.
POST
/
api
/
cron-jobs
Create cron job
curl --request POST \
--url https://www.sontairo.com/api/cron-jobs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"workspaceId": "<string>",
"name": "<string>",
"schedule": "<string>",
"prompt": "<string>",
"projectId": "<string>",
"agentId": "<string>",
"description": "<string>",
"timezone": "UTC"
}
'import requests
url = "https://www.sontairo.com/api/cron-jobs"
payload = {
"workspaceId": "<string>",
"name": "<string>",
"schedule": "<string>",
"prompt": "<string>",
"projectId": "<string>",
"agentId": "<string>",
"description": "<string>",
"timezone": "UTC"
}
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({
workspaceId: '<string>',
name: '<string>',
schedule: '<string>',
prompt: '<string>',
projectId: '<string>',
agentId: '<string>',
description: '<string>',
timezone: 'UTC'
})
};
fetch('https://www.sontairo.com/api/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://www.sontairo.com/api/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([
'workspaceId' => '<string>',
'name' => '<string>',
'schedule' => '<string>',
'prompt' => '<string>',
'projectId' => '<string>',
'agentId' => '<string>',
'description' => '<string>',
'timezone' => 'UTC'
]),
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://www.sontairo.com/api/cron-jobs"
payload := strings.NewReader("{\n \"workspaceId\": \"<string>\",\n \"name\": \"<string>\",\n \"schedule\": \"<string>\",\n \"prompt\": \"<string>\",\n \"projectId\": \"<string>\",\n \"agentId\": \"<string>\",\n \"description\": \"<string>\",\n \"timezone\": \"UTC\"\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://www.sontairo.com/api/cron-jobs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"workspaceId\": \"<string>\",\n \"name\": \"<string>\",\n \"schedule\": \"<string>\",\n \"prompt\": \"<string>\",\n \"projectId\": \"<string>\",\n \"agentId\": \"<string>\",\n \"description\": \"<string>\",\n \"timezone\": \"UTC\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.sontairo.com/api/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 \"workspaceId\": \"<string>\",\n \"name\": \"<string>\",\n \"schedule\": \"<string>\",\n \"prompt\": \"<string>\",\n \"projectId\": \"<string>\",\n \"agentId\": \"<string>\",\n \"description\": \"<string>\",\n \"timezone\": \"UTC\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"workspaceId": "<string>",
"projectId": "<string>",
"name": "<string>",
"description": "<string>",
"schedule": "<string>",
"prompt": "<string>",
"timezone": "<string>",
"isActive": true,
"agentId": "<string>",
"agent": {
"id": "<string>",
"name": "<string>"
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}Authorizations
bearerAuthcookieAuth
Session token issued by the desktop/native auth exchange, sent as Authorization: Bearer .
Body
application/json
Required string length:
1 - 100Cron expression (e.g. 0 9 * * *)
Required string length:
1 - 100Task instruction for each run
Required string length:
1 - 10000Agent to run
Maximum string length:
500Maximum string length:
50Response
201 - application/json
Cron job created
Show child attributes
Show child attributes
⌘I
Create cron job
curl --request POST \
--url https://www.sontairo.com/api/cron-jobs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"workspaceId": "<string>",
"name": "<string>",
"schedule": "<string>",
"prompt": "<string>",
"projectId": "<string>",
"agentId": "<string>",
"description": "<string>",
"timezone": "UTC"
}
'import requests
url = "https://www.sontairo.com/api/cron-jobs"
payload = {
"workspaceId": "<string>",
"name": "<string>",
"schedule": "<string>",
"prompt": "<string>",
"projectId": "<string>",
"agentId": "<string>",
"description": "<string>",
"timezone": "UTC"
}
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({
workspaceId: '<string>',
name: '<string>',
schedule: '<string>',
prompt: '<string>',
projectId: '<string>',
agentId: '<string>',
description: '<string>',
timezone: 'UTC'
})
};
fetch('https://www.sontairo.com/api/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://www.sontairo.com/api/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([
'workspaceId' => '<string>',
'name' => '<string>',
'schedule' => '<string>',
'prompt' => '<string>',
'projectId' => '<string>',
'agentId' => '<string>',
'description' => '<string>',
'timezone' => 'UTC'
]),
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://www.sontairo.com/api/cron-jobs"
payload := strings.NewReader("{\n \"workspaceId\": \"<string>\",\n \"name\": \"<string>\",\n \"schedule\": \"<string>\",\n \"prompt\": \"<string>\",\n \"projectId\": \"<string>\",\n \"agentId\": \"<string>\",\n \"description\": \"<string>\",\n \"timezone\": \"UTC\"\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://www.sontairo.com/api/cron-jobs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"workspaceId\": \"<string>\",\n \"name\": \"<string>\",\n \"schedule\": \"<string>\",\n \"prompt\": \"<string>\",\n \"projectId\": \"<string>\",\n \"agentId\": \"<string>\",\n \"description\": \"<string>\",\n \"timezone\": \"UTC\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.sontairo.com/api/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 \"workspaceId\": \"<string>\",\n \"name\": \"<string>\",\n \"schedule\": \"<string>\",\n \"prompt\": \"<string>\",\n \"projectId\": \"<string>\",\n \"agentId\": \"<string>\",\n \"description\": \"<string>\",\n \"timezone\": \"UTC\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"workspaceId": "<string>",
"projectId": "<string>",
"name": "<string>",
"description": "<string>",
"schedule": "<string>",
"prompt": "<string>",
"timezone": "<string>",
"isActive": true,
"agentId": "<string>",
"agent": {
"id": "<string>",
"name": "<string>"
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}