v4

latestOpenAPI 3.1.02026-08-01207318738.7 KB
AI Routines

Create a routine

Create a routine that runs a saved prompt on a schedule and delivers the AI response through a single destination — email (one or more recipients / user groups) or Slack (a single channel or direct message). Each scheduled run executes once using the routine owner's permissions, and every recipient receives the same result. Organization API keys can pass ?userId=<membershipId> to create the routine for a specific organization member.

post/api/v1/ai/routines

Query parameters

userIdstring uuid

Target user membership ID (for org-scoped API keys)

Target user membership ID (for org-scoped API keys)

Request body

branchIdstring uuid

Optional branch ID for the model. Must be a branch of the shared model specified by modelId.

descriptionstring

Optional human-readable notes about the routine. Display-only — never used as model input.

modelIdstring uuid required

The UUID of the model the prompt runs against. Must be a shared model, or a shared-extension model usable as a workbook base.

namestring required

Customer-visible name of the routine. Used as the email subject for email destinations, and shown on Slack deliveries.

promptstring required

Natural language prompt Omni runs on each scheduled run.

schedulestring required

Six-field cron expression (minute, hour, day-of-month, month, day-of-week, year; use ? for an unspecified day field). Minimum frequency is once per hour; contact Omni support if you need more frequent scheduling.

timezonestring required

IANA timezone identifier used to evaluate the schedule.

topicNamestring

Topic name to scope query generation. If omitted, the AI picks the best topic.

Example request

{
  "branchId": "550e8400-e29b-41d4-a716-446655440000",
  "description": "Weekly signups summary for the growth team.",
  "modelId": "770e8400-e29b-41d4-a716-446655440002",
  "name": "Weekly user signups",
  "prompt": "How many users signed up last week?",
  "schedule": "0 9 ? * MON *",
  "timezone": "America/New_York",
  "topicName": "users",
  "destination": {
    "recipientEmails": [
      "alice@example.com",
      "bob@example.com"
    ],
    "type": "email",
    "userGroupIds": [
      "550e8400-e29b-41d4-a716-446655440000"
    ]
  }
}

Response

Routine created successfully.

idstring uuid required

The unique identifier for the newly created routine.

Example response

{
  "id": "880e8400-e29b-41d4-a716-446655440003"
}