v7
OpenAPI 3.1.02026-08-06211328764.1 KBCreate 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. For organizations with conditional routines enabled and gating 'auto' (the default), the prompt's alert intent is derived in this same request: an alert prompt persists a conditional routine (the response carries the decision and a dry-run of its trigger), while an alert whose trigger can't be composed or verified is a 400 with a stable code and no routine is created.
Query parameters
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.",
"gating": "auto",
"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. trigger is present only when the prompt was evaluated for a delivery condition (see gating).
Example response
{
"id": "880e8400-e29b-41d4-a716-446655440003",
"trigger": {
"conditionPrompt": "total signups dropped more than 20% versus the prior week",
"conditionType": "RESULTS_PRESENT",
"decision": "alert",
"deliverablePrompt": "Summarize weekly signups by region",
"dryRun": {
"conditionMetNow": true,
"rowCount": 3
}
}
}