curl --request POST \
--url https://api.modem.dev/v1/automations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"prompt": "<string>",
"schedule": {
"expr": "<string>",
"type": "cron"
},
"timezone": "<string>",
"allowedCapabilities": [
"<string>"
],
"enabled": true,
"templateSlug": "<string>"
}
'import requests
url = "https://api.modem.dev/v1/automations"
payload = {
"name": "<string>",
"prompt": "<string>",
"schedule": {
"expr": "<string>",
"type": "cron"
},
"timezone": "<string>",
"allowedCapabilities": ["<string>"],
"enabled": True,
"templateSlug": "<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({
name: '<string>',
prompt: '<string>',
schedule: {expr: '<string>', type: 'cron'},
timezone: '<string>',
allowedCapabilities: ['<string>'],
enabled: true,
templateSlug: '<string>'
})
};
fetch('https://api.modem.dev/v1/automations', 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.modem.dev/v1/automations",
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' => '<string>',
'prompt' => '<string>',
'schedule' => [
'expr' => '<string>',
'type' => 'cron'
],
'timezone' => '<string>',
'allowedCapabilities' => [
'<string>'
],
'enabled' => true,
'templateSlug' => '<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.modem.dev/v1/automations"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"prompt\": \"<string>\",\n \"schedule\": {\n \"expr\": \"<string>\",\n \"type\": \"cron\"\n },\n \"timezone\": \"<string>\",\n \"allowedCapabilities\": [\n \"<string>\"\n ],\n \"enabled\": true,\n \"templateSlug\": \"<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.modem.dev/v1/automations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"prompt\": \"<string>\",\n \"schedule\": {\n \"expr\": \"<string>\",\n \"type\": \"cron\"\n },\n \"timezone\": \"<string>\",\n \"allowedCapabilities\": [\n \"<string>\"\n ],\n \"enabled\": true,\n \"templateSlug\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.modem.dev/v1/automations")
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 \"name\": \"<string>\",\n \"prompt\": \"<string>\",\n \"schedule\": {\n \"expr\": \"<string>\",\n \"type\": \"cron\"\n },\n \"timezone\": \"<string>\",\n \"allowedCapabilities\": [\n \"<string>\"\n ],\n \"enabled\": true,\n \"templateSlug\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"allowedCapabilities": [
"<string>"
],
"capabilityMode": "all",
"enabled": true,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"lastErrorMessage": "<string>",
"modelLevel": "high",
"name": "<string>",
"outputChannels": [
{
"channel": "discord",
"destinations": [
"<string>"
],
"mode": "any-internal"
}
],
"prompt": "<string>",
"schedule": {
"expr": "<string>",
"type": "cron"
},
"status": "completed",
"templateSlug": "<string>",
"timezone": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"lastAttemptAt": "2023-11-07T05:31:56Z",
"lastRunAt": "2023-11-07T05:31:56Z",
"nextRunAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}{
"code": "NOT_FOUND",
"defined": true,
"message": "<string>",
"status": 404,
"data": "<unknown>"
}{
"code": "NOT_FOUND",
"defined": true,
"message": "<string>",
"status": 404,
"data": "<unknown>"
}{
"code": "NOT_FOUND",
"defined": true,
"message": "<string>",
"status": 404,
"data": "<unknown>"
}{
"code": "NOT_FOUND",
"defined": true,
"message": "<string>",
"status": 404,
"data": "<unknown>"
}{
"code": "NOT_FOUND",
"defined": true,
"message": "<string>",
"status": 404,
"data": "<unknown>"
}{
"code": "NOT_FOUND",
"defined": true,
"message": "<string>",
"status": 404,
"data": "<unknown>"
}{
"code": "NOT_FOUND",
"defined": true,
"message": "<string>",
"status": 404,
"data": "<unknown>"
}Create automation
Create an automation for the API key’s organization. Modem assigns the organization’s earliest owner.
Provide a complete automation definition. Event schedules accept canonical registered event names only. To send output to Slack or Discord, provide sourceName and sourceChannelId together. Otherwise Modem uses the organization’s saved default output destination. Requests fail when no valid destination is available.
This operation supports Idempotency-Key and accepts organization API keys only; service JWTs are rejected.
curl --request POST \
--url https://api.modem.dev/v1/automations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"prompt": "<string>",
"schedule": {
"expr": "<string>",
"type": "cron"
},
"timezone": "<string>",
"allowedCapabilities": [
"<string>"
],
"enabled": true,
"templateSlug": "<string>"
}
'import requests
url = "https://api.modem.dev/v1/automations"
payload = {
"name": "<string>",
"prompt": "<string>",
"schedule": {
"expr": "<string>",
"type": "cron"
},
"timezone": "<string>",
"allowedCapabilities": ["<string>"],
"enabled": True,
"templateSlug": "<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({
name: '<string>',
prompt: '<string>',
schedule: {expr: '<string>', type: 'cron'},
timezone: '<string>',
allowedCapabilities: ['<string>'],
enabled: true,
templateSlug: '<string>'
})
};
fetch('https://api.modem.dev/v1/automations', 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.modem.dev/v1/automations",
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' => '<string>',
'prompt' => '<string>',
'schedule' => [
'expr' => '<string>',
'type' => 'cron'
],
'timezone' => '<string>',
'allowedCapabilities' => [
'<string>'
],
'enabled' => true,
'templateSlug' => '<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.modem.dev/v1/automations"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"prompt\": \"<string>\",\n \"schedule\": {\n \"expr\": \"<string>\",\n \"type\": \"cron\"\n },\n \"timezone\": \"<string>\",\n \"allowedCapabilities\": [\n \"<string>\"\n ],\n \"enabled\": true,\n \"templateSlug\": \"<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.modem.dev/v1/automations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"prompt\": \"<string>\",\n \"schedule\": {\n \"expr\": \"<string>\",\n \"type\": \"cron\"\n },\n \"timezone\": \"<string>\",\n \"allowedCapabilities\": [\n \"<string>\"\n ],\n \"enabled\": true,\n \"templateSlug\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.modem.dev/v1/automations")
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 \"name\": \"<string>\",\n \"prompt\": \"<string>\",\n \"schedule\": {\n \"expr\": \"<string>\",\n \"type\": \"cron\"\n },\n \"timezone\": \"<string>\",\n \"allowedCapabilities\": [\n \"<string>\"\n ],\n \"enabled\": true,\n \"templateSlug\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"allowedCapabilities": [
"<string>"
],
"capabilityMode": "all",
"enabled": true,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"lastErrorMessage": "<string>",
"modelLevel": "high",
"name": "<string>",
"outputChannels": [
{
"channel": "discord",
"destinations": [
"<string>"
],
"mode": "any-internal"
}
],
"prompt": "<string>",
"schedule": {
"expr": "<string>",
"type": "cron"
},
"status": "completed",
"templateSlug": "<string>",
"timezone": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"lastAttemptAt": "2023-11-07T05:31:56Z",
"lastRunAt": "2023-11-07T05:31:56Z",
"nextRunAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}{
"code": "NOT_FOUND",
"defined": true,
"message": "<string>",
"status": 404,
"data": "<unknown>"
}{
"code": "NOT_FOUND",
"defined": true,
"message": "<string>",
"status": 404,
"data": "<unknown>"
}{
"code": "NOT_FOUND",
"defined": true,
"message": "<string>",
"status": 404,
"data": "<unknown>"
}{
"code": "NOT_FOUND",
"defined": true,
"message": "<string>",
"status": 404,
"data": "<unknown>"
}{
"code": "NOT_FOUND",
"defined": true,
"message": "<string>",
"status": 404,
"data": "<unknown>"
}{
"code": "NOT_FOUND",
"defined": true,
"message": "<string>",
"status": 404,
"data": "<unknown>"
}{
"code": "NOT_FOUND",
"defined": true,
"message": "<string>",
"status": 404,
"data": "<unknown>"
}Authorizations
Organization API key (modem_…).
Headers
Replays a successful mutating request for 24 hours. Reuse with a different payload returns 409.
255Body
- Option 1
- Option 2
11 - 130000- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
Show child attributes
Show child attributes
1Explicit capability keys when capabilityMode is custom. Null means all.
Whether this task uses all visible capabilities or a custom subset.
all, custom Persisted model level for automation execution.
high, low, med ^[a-z0-9-]+$Response
OK
Explicit capability keys when capabilityMode is custom. Null means all.
Whether this task uses all visible capabilities or a custom subset.
all, custom Whether the task is actively being scheduled.
Most recent error message if status is error.
Persisted model level for automation execution.
high, low, med Human-readable name for the automation.
11Show child attributes
Show child attributes
AI prompt or instructions executed when the task runs.
1- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
Show child attributes
Show child attributes
Current health status of the automation.
completed, error, healthy, paused ^[a-z0-9-]+$IANA timezone identifier for schedule evaluation.
1Timestamp when the task was created.
Timestamp when the most recent execution attempt started, including manual runs.
Timestamp of the most recent scheduler-managed execution, used to calculate the next run.
Timestamp of the next scheduled execution.
Timestamp when the task was last updated.
Was this page helpful?