Create scheduled task
curl --request POST \
--url https://api.whirl.sh/api/v1/scheduled-tasks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"workspaceId": "<string>",
"agentId": "<string>",
"prompt": "<string>",
"cron": "<string>",
"title": "<string>"
}
'import requests
url = "https://api.whirl.sh/api/v1/scheduled-tasks"
payload = {
"workspaceId": "<string>",
"agentId": "<string>",
"prompt": "<string>",
"cron": "<string>",
"title": "<string>"
}
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>',
agentId: '<string>',
prompt: '<string>',
cron: '<string>',
title: '<string>'
})
};
fetch('https://api.whirl.sh/api/v1/scheduled-tasks', 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.whirl.sh/api/v1/scheduled-tasks",
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>',
'agentId' => '<string>',
'prompt' => '<string>',
'cron' => '<string>',
'title' => '<string>'
]),
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.whirl.sh/api/v1/scheduled-tasks"
payload := strings.NewReader("{\n \"workspaceId\": \"<string>\",\n \"agentId\": \"<string>\",\n \"prompt\": \"<string>\",\n \"cron\": \"<string>\",\n \"title\": \"<string>\"\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.whirl.sh/api/v1/scheduled-tasks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"workspaceId\": \"<string>\",\n \"agentId\": \"<string>\",\n \"prompt\": \"<string>\",\n \"cron\": \"<string>\",\n \"title\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.whirl.sh/api/v1/scheduled-tasks")
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 \"agentId\": \"<string>\",\n \"prompt\": \"<string>\",\n \"cron\": \"<string>\",\n \"title\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{}{
"title": "<string>",
"status": 123,
"code": "<string>",
"type": "<string>",
"detail": "<string>"
}{
"title": "<string>",
"status": 123,
"code": "<string>",
"type": "<string>",
"detail": "<string>"
}{
"title": "<string>",
"status": 123,
"code": "<string>",
"type": "<string>",
"detail": "<string>"
}{
"title": "<string>",
"status": 123,
"code": "<string>",
"type": "<string>",
"detail": "<string>"
}{
"title": "<string>",
"status": 123,
"code": "<string>",
"type": "<string>",
"detail": "<string>"
}{
"title": "<string>",
"status": 123,
"code": "<string>",
"type": "<string>",
"detail": "<string>"
}Scheduled tasks
Create scheduled task
Have an agent run a prompt on a repeating schedule.
POST
/
scheduled-tasks
Create scheduled task
curl --request POST \
--url https://api.whirl.sh/api/v1/scheduled-tasks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"workspaceId": "<string>",
"agentId": "<string>",
"prompt": "<string>",
"cron": "<string>",
"title": "<string>"
}
'import requests
url = "https://api.whirl.sh/api/v1/scheduled-tasks"
payload = {
"workspaceId": "<string>",
"agentId": "<string>",
"prompt": "<string>",
"cron": "<string>",
"title": "<string>"
}
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>',
agentId: '<string>',
prompt: '<string>',
cron: '<string>',
title: '<string>'
})
};
fetch('https://api.whirl.sh/api/v1/scheduled-tasks', 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.whirl.sh/api/v1/scheduled-tasks",
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>',
'agentId' => '<string>',
'prompt' => '<string>',
'cron' => '<string>',
'title' => '<string>'
]),
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.whirl.sh/api/v1/scheduled-tasks"
payload := strings.NewReader("{\n \"workspaceId\": \"<string>\",\n \"agentId\": \"<string>\",\n \"prompt\": \"<string>\",\n \"cron\": \"<string>\",\n \"title\": \"<string>\"\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.whirl.sh/api/v1/scheduled-tasks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"workspaceId\": \"<string>\",\n \"agentId\": \"<string>\",\n \"prompt\": \"<string>\",\n \"cron\": \"<string>\",\n \"title\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.whirl.sh/api/v1/scheduled-tasks")
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 \"agentId\": \"<string>\",\n \"prompt\": \"<string>\",\n \"cron\": \"<string>\",\n \"title\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{}{
"title": "<string>",
"status": 123,
"code": "<string>",
"type": "<string>",
"detail": "<string>"
}{
"title": "<string>",
"status": 123,
"code": "<string>",
"type": "<string>",
"detail": "<string>"
}{
"title": "<string>",
"status": 123,
"code": "<string>",
"type": "<string>",
"detail": "<string>"
}{
"title": "<string>",
"status": 123,
"code": "<string>",
"type": "<string>",
"detail": "<string>"
}{
"title": "<string>",
"status": 123,
"code": "<string>",
"type": "<string>",
"detail": "<string>"
}{
"title": "<string>",
"status": 123,
"code": "<string>",
"type": "<string>",
"detail": "<string>"
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Body
application/json
Workspace id from list_workspaces.
Required string length:
1 - 64Agent id from list_agents; the agent must belong to the workspace.
Required string length:
1 - 64What the agent should do on every run, written like a task for the agent.
Required string length:
1 - 20000Five-field cron in the organization's timezone (returned as timezone). Supported shapes: hourly 'M * * * *', daily 'M H * * *', weekdays 'M H * * 1-5', weekly 'M H * * D' (D 0-6, 0 = Sunday), monthly 'M H DOM * *' (DOM 1-31). Example: '0 9 * * 1-5' is 09:00 every weekday.
Required string length:
9 - 100Short name for the task. Omit to have Whirl generate one.
Required string length:
1 - 200Response
Success
The response is of type object.

