v4
latestOpenAPI 3.1.02026-08-01207318738.7 KBAI 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
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.
Example response
{
"id": "880e8400-e29b-41d4-a716-446655440003"
}