---
title: "Update an AI Routine"
method: PUT
path: "/v1/ai/routines/{routineId}"
tags: ["AI Routines"]
---

# Update an AI Routine

`PUT /v1/ai/routines/{routineId}`

Update an existing AI Routine. All request fields are optional, and only supplied fields are changed. Supplying `destination` replaces the full recipient configuration.

## Path parameters

- `id` string, uuid, required

## Query parameters

- `userId` string, uuid

## Request body

- object
  - `name` string, required — Display name for the routine
  - `description` string, nullable — Optional description of what the routine does
  - `prompt` string, required — The AI prompt that will be executed when the routine runs
  - `schedule` string, required — Cron expression or human-readable schedule (e.g., "daily", "weekly", "0 9 * * 1")
  - `modelId` string, uuid, nullable — Optional model ID to scope the routine to a specific data model
  - `isActive` boolean — Whether the routine is active and will execute on schedule

## Response `200`

Routine updated successfully

- Routine
  - `branchId` string, uuid, nullable, required — Branch of the shared model the prompt runs against, or null.
  - `createdAt` string, required — ISO 8601 timestamp when the routine was created.
  - `description` string, nullable, required — Display-only notes about the routine, or null.
  - `destination` union, required — Single delivery destination for the routine — email or Slack. To send results to multiple destinations, create one routine per destination.
    - RoutineEmailDestination — Email delivery configuration for the routine.
      - `recipientEmails` string[] — Email addresses that receive each scheduled run of the routine.
      - `type` 'email', required — Selects email delivery — each scheduled run is sent to the listed email recipients and user groups.
      - `userGroupIds` string[] — User group IDs whose active members receive each scheduled run. Omni expands each group to the members' current email addresses when the routine runs.
    - RoutineSlackDestination — Slack delivery configuration for the routine. Requires a Slack workspace connected to Omni; to deliver to a private channel, invite the Omni Slackbot to it first.
      - `recipientId` string, required — The Slack channel ID (e.g. `C01234567`) or user ID (e.g. `U01234567`) that receives each scheduled run. Exactly one recipient per Slack routine.
      - `slackRecipientType` 'channel' | 'users', required — Whether `recipientId` is a Slack channel or a user (delivered as a direct message).
      - `type` 'slack', required — Selects Slack delivery — each scheduled run is posted to one Slack channel or sent as a direct message to one user.
  - `disabled` boolean, required — Whether the owner has paused the routine.
  - `id` string, uuid, required — The unique identifier of the routine.
  - `lastRun` RoutineLastRun, nullable, required — Most recent completed run, or null if the routine has never completed a run.
    - `completedAt` string, nullable, required — ISO 8601 timestamp the last completed run finished.
    - `label` string, required — User-visible status of the last completed run.
    - `state` string, required — Machine-readable status of the last completed run.
  - `modelId` string, uuid, required — The shared model the prompt runs against.
  - `name` string, required — Customer-visible name of the routine, used as the email subject.
  - `prompt` string, required — Natural language prompt Omni runs on each scheduled run.
  - `recipientCount` integer, required — Number of distinct deliverable recipients after expanding user groups and removing duplicates.
  - `schedule` string, required — Six-field cron expression (minute, hour, day-of-month, month, day-of-week, year; use `?` for an unspecified day field).
  - `systemDisabled` boolean, required — Whether Omni disabled the routine because it could no longer run successfully or safely.
  - `systemDisabledReason` string, nullable, required — Reason Omni disabled the routine, or null.
  - `timezone` string, required — IANA timezone identifier used to evaluate the schedule.
  - `topicName` string, nullable, required — Topic scoping query generation, or null.
  - `updatedAt` string, required — ISO 8601 timestamp when the routine was last updated.

## Other responses

- `400` — Invalid request body
- `401` — Missing or invalid API key
- `403` — Forbidden Possible error messages: - `User does not have USE_AI permission` - `AI Routines feature is not enabled (aiScheduledTasks flag required)` - `Insufficient permissions to update this routine`
- `404` — Routine not found
- `429` — Too Many Requests - Rate limit exceeded (60 requests/minute)
- `500` — Internal Server Error

---

[API](https://skmtc.net/omni/apis/omni-api.md) · [All operations](https://skmtc.net/omni/apis/omni-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/omni/omni-api/revisions/6b02f7349d0e/schema)
