---
title: "List routines"
method: GET
path: "/api/v1/ai/routines"
tags: ["AI Routines"]
---

# List routines

`GET /api/v1/ai/routines`

List routines for the calling user, newest first. Includes routines paused by the owner or disabled by Omni, but excludes deleted routines. Use `pageInfo.nextCursor` from one response as the `cursor` query parameter on the next request. Organization API keys can pass `?userId=<membershipId>` to list routines for a specific organization member.

## Query parameters

- `cursor` string — Cursor for pagination (from previous response nextCursor)
- `pageSize` integer — Number of results per page (1-100, integer)
- `sortDirection` 'asc' | 'desc' — Sort direction for results
- `sortField` string — Field to sort results by
- `userId` string, uuid — Target user membership ID (for org-scoped API keys)

## Response `200`

Paginated list of routines.

- RoutinesListResponse
  - `pageInfo` PageInfo, required
    - `hasNextPage` boolean, required — Whether more results are available
    - `nextCursor` string, nullable, required — Cursor for fetching the next page
    - `pageSize` number, required — Number of results per page
    - `totalRecords` number, required — Total number of records matching the query
  - `records` RoutineResponse[], required — Routines returned for this request, newest first.
    - `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 — Delivery configuration for the routine.
      - RoutineEmailDestinationResponse
        - `recipientEmails` string[], required — Email addresses configured as direct recipients of each scheduled run, resolved from their current membership.
        - `type` 'email', required — Selects email delivery — each scheduled run is sent to the listed email recipients and user groups.
        - `userGroupIds` string[], required — 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
        - `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 — Customer-visible status of the last completed run.
      - `state` string, required — Machine-readable status of the last completed run.
    - `modelId` string, uuid, required — The model the prompt runs against.
    - `name` string, required — Customer-visible name of the routine. Used as the email subject for email destinations, and shown on Slack deliveries.
    - `prompt` string, required — Natural language prompt Omni runs on each scheduled run.
    - `recipientCount` integer, required — Number of distinct deliverable recipients. For email, user groups are expanded to members and duplicates removed; a Slack routine is always 1 (its single channel or DM).
    - `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 pagination cursor or `userId` value.
- `401` — Missing or invalid API key.
- `403` — AI routines or AI query generation are not enabled for the organization, or a user-scoped API key tried to list routines for another user.
- `404` — The `userId` membership was not found in the organization.

---

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