curl --request POST \
--url https://{instance}.omniapp.co/api/v1/ai/routines \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"destination": {
"type": "email",
"recipientEmails": [
"blob.ross@blobsrus.com",
"blob.the.builder@blobsrus.com"
],
"userGroupIds": [
"550e8400-e29b-41d4-a716-446655440000"
]
},
"modelId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"prompt": "<string>",
"schedule": "<string>",
"timezone": "<string>",
"branchId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"topicName": "<string>"
}
'import requests
url = "https://{instance}.omniapp.co/api/v1/ai/routines"
payload = {
"destination": {
"type": "email",
"recipientEmails": ["blob.ross@blobsrus.com", "blob.the.builder@blobsrus.com"],
"userGroupIds": ["550e8400-e29b-41d4-a716-446655440000"]
},
"modelId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"prompt": "<string>",
"schedule": "<string>",
"timezone": "<string>",
"branchId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"topicName": "<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({
destination: {
type: 'email',
recipientEmails: ['blob.ross@blobsrus.com', 'blob.the.builder@blobsrus.com'],
userGroupIds: ['550e8400-e29b-41d4-a716-446655440000']
},
modelId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: '<string>',
prompt: '<string>',
schedule: '<string>',
timezone: '<string>',
branchId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
description: '<string>',
topicName: '<string>'
})
};
fetch('https://{instance}.omniapp.co/api/v1/ai/routines', 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://{instance}.omniapp.co/api/v1/ai/routines",
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([
'destination' => [
'type' => 'email',
'recipientEmails' => [
'blob.ross@blobsrus.com',
'blob.the.builder@blobsrus.com'
],
'userGroupIds' => [
'550e8400-e29b-41d4-a716-446655440000'
]
],
'modelId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => '<string>',
'prompt' => '<string>',
'schedule' => '<string>',
'timezone' => '<string>',
'branchId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'description' => '<string>',
'topicName' => '<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://{instance}.omniapp.co/api/v1/ai/routines"
payload := strings.NewReader("{\n \"destination\": {\n \"type\": \"email\",\n \"recipientEmails\": [\n \"blob.ross@blobsrus.com\",\n \"blob.the.builder@blobsrus.com\"\n ],\n \"userGroupIds\": [\n \"550e8400-e29b-41d4-a716-446655440000\"\n ]\n },\n \"modelId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"prompt\": \"<string>\",\n \"schedule\": \"<string>\",\n \"timezone\": \"<string>\",\n \"branchId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"description\": \"<string>\",\n \"topicName\": \"<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://{instance}.omniapp.co/api/v1/ai/routines")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"destination\": {\n \"type\": \"email\",\n \"recipientEmails\": [\n \"blob.ross@blobsrus.com\",\n \"blob.the.builder@blobsrus.com\"\n ],\n \"userGroupIds\": [\n \"550e8400-e29b-41d4-a716-446655440000\"\n ]\n },\n \"modelId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"prompt\": \"<string>\",\n \"schedule\": \"<string>\",\n \"timezone\": \"<string>\",\n \"branchId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"description\": \"<string>\",\n \"topicName\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{instance}.omniapp.co/api/v1/ai/routines")
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 \"destination\": {\n \"type\": \"email\",\n \"recipientEmails\": [\n \"blob.ross@blobsrus.com\",\n \"blob.the.builder@blobsrus.com\"\n ],\n \"userGroupIds\": [\n \"550e8400-e29b-41d4-a716-446655440000\"\n ]\n },\n \"modelId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"prompt\": \"<string>\",\n \"schedule\": \"<string>\",\n \"timezone\": \"<string>\",\n \"branchId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"description\": \"<string>\",\n \"topicName\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "880e8400-e29b-41d4-a716-446655440003"
}{
"detail": "Bad Request: prompt: Required",
"status": 400
}{
"error": "<response_code>",
"message": "<error_reason>"
}{
"error": "<response_code>",
"message": "<error_reason>"
}{
"detail": "Model 770e8400-e29b-41d4-a716-446655440002 not found",
"status": 404
}{
"detail": "User has reached the maximum of 100 routines",
"status": 429
}{
"error": "<response_code>",
"message": "<error_reason>"
}Create an AI Routine
AI routines must be enabled for your organization to use this endpoint.
Create a new AI Routine that will run on the specified schedule.
Each scheduled run executes once using the routine owner’s permissions, and every recipient receives the same result.
curl --request POST \
--url https://{instance}.omniapp.co/api/v1/ai/routines \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"destination": {
"type": "email",
"recipientEmails": [
"blob.ross@blobsrus.com",
"blob.the.builder@blobsrus.com"
],
"userGroupIds": [
"550e8400-e29b-41d4-a716-446655440000"
]
},
"modelId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"prompt": "<string>",
"schedule": "<string>",
"timezone": "<string>",
"branchId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"topicName": "<string>"
}
'import requests
url = "https://{instance}.omniapp.co/api/v1/ai/routines"
payload = {
"destination": {
"type": "email",
"recipientEmails": ["blob.ross@blobsrus.com", "blob.the.builder@blobsrus.com"],
"userGroupIds": ["550e8400-e29b-41d4-a716-446655440000"]
},
"modelId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"prompt": "<string>",
"schedule": "<string>",
"timezone": "<string>",
"branchId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"topicName": "<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({
destination: {
type: 'email',
recipientEmails: ['blob.ross@blobsrus.com', 'blob.the.builder@blobsrus.com'],
userGroupIds: ['550e8400-e29b-41d4-a716-446655440000']
},
modelId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: '<string>',
prompt: '<string>',
schedule: '<string>',
timezone: '<string>',
branchId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
description: '<string>',
topicName: '<string>'
})
};
fetch('https://{instance}.omniapp.co/api/v1/ai/routines', 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://{instance}.omniapp.co/api/v1/ai/routines",
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([
'destination' => [
'type' => 'email',
'recipientEmails' => [
'blob.ross@blobsrus.com',
'blob.the.builder@blobsrus.com'
],
'userGroupIds' => [
'550e8400-e29b-41d4-a716-446655440000'
]
],
'modelId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => '<string>',
'prompt' => '<string>',
'schedule' => '<string>',
'timezone' => '<string>',
'branchId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'description' => '<string>',
'topicName' => '<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://{instance}.omniapp.co/api/v1/ai/routines"
payload := strings.NewReader("{\n \"destination\": {\n \"type\": \"email\",\n \"recipientEmails\": [\n \"blob.ross@blobsrus.com\",\n \"blob.the.builder@blobsrus.com\"\n ],\n \"userGroupIds\": [\n \"550e8400-e29b-41d4-a716-446655440000\"\n ]\n },\n \"modelId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"prompt\": \"<string>\",\n \"schedule\": \"<string>\",\n \"timezone\": \"<string>\",\n \"branchId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"description\": \"<string>\",\n \"topicName\": \"<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://{instance}.omniapp.co/api/v1/ai/routines")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"destination\": {\n \"type\": \"email\",\n \"recipientEmails\": [\n \"blob.ross@blobsrus.com\",\n \"blob.the.builder@blobsrus.com\"\n ],\n \"userGroupIds\": [\n \"550e8400-e29b-41d4-a716-446655440000\"\n ]\n },\n \"modelId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"prompt\": \"<string>\",\n \"schedule\": \"<string>\",\n \"timezone\": \"<string>\",\n \"branchId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"description\": \"<string>\",\n \"topicName\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{instance}.omniapp.co/api/v1/ai/routines")
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 \"destination\": {\n \"type\": \"email\",\n \"recipientEmails\": [\n \"blob.ross@blobsrus.com\",\n \"blob.the.builder@blobsrus.com\"\n ],\n \"userGroupIds\": [\n \"550e8400-e29b-41d4-a716-446655440000\"\n ]\n },\n \"modelId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"prompt\": \"<string>\",\n \"schedule\": \"<string>\",\n \"timezone\": \"<string>\",\n \"branchId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"description\": \"<string>\",\n \"topicName\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "880e8400-e29b-41d4-a716-446655440003"
}{
"detail": "Bad Request: prompt: Required",
"status": 400
}{
"error": "<response_code>",
"message": "<error_reason>"
}{
"error": "<response_code>",
"message": "<error_reason>"
}{
"detail": "Model 770e8400-e29b-41d4-a716-446655440002 not found",
"status": 404
}{
"detail": "User has reached the maximum of 100 routines",
"status": 429
}{
"error": "<response_code>",
"message": "<error_reason>"
}Authorizations
Can be either an Organization API Key or Personal Access Token (PAT).
Include in the Authorization header as: Bearer YOUR_TOKEN
Query Parameters
Requires an Organization API key. Target user membership ID.
Body
Single delivery destination for the routine — email or Slack. To send results to multiple destinations, create one routine per destination.
- Option 1
- Option 2
Show child attributes
Show child attributes
The shared model the prompt runs against.
Customer-visible name of the routine, used as the email subject.
Natural language prompt Omni runs on each scheduled run.
Six-field cron expression (minute, hour, day-of-month, month, day-of-week, year; use ? for an unspecified day field).
IANA timezone identifier used to evaluate the schedule.
Branch of the shared model the prompt runs against, or null.
Display-only notes about the routine, or null.
Topic scoping query generation, or null.
Response
Routine created successfully
The unique identifier for the newly created routine.
"880e8400-e29b-41d4-a716-446655440003"
Was this page helpful?

