Routines
Tags: automation, routines
Routines — the unified automation primitive (schedule, webhook, and system-event triggers)
Resources
Request and response models used by the endpoints on this page.
EventRuleResponse
| Field | Type | Required | Description |
|---|---|---|---|
actionParams | Dict[str, Any] | ✓ | |
actionType | <enum EventRuleActionType | ✓ | |
active | Boolean | ✓ | |
appConnectionId | Integer | ||
calendarEventTypeId | Integer | ✓ | |
calendarId | Integer | ✓ | |
celBlockedAt | DateTime | ||
conditions | String | ✓ | |
createdAt | DateTime | ✓ | |
dataTypeId | Integer | ✓ | |
dataTypeName | String | ||
delay | Integer | ✓ | |
error | String | ✓ | |
errorMessage | String | ✓ | |
eventType | <enum EventRuleEventType | ✓ | |
failedAt | DateTime | ✓ | |
id | Integer | ✓ | |
journeyId | Integer | ||
journeyStepId | Integer | ✓ | |
name | String | ✓ | |
objectType | <enum EventRuleObjectType | ✓ | |
order | Integer | ✓ | |
routineId | Integer | ✓ | |
taskId | Integer | ✓ | |
taskName | String | ||
taskWorkflowId | Integer | ||
triggerParams | Dict[str, Any] | ✓ | |
updatedAt | DateTime | ✓ | |
uuid | String | ✓ | |
workflowRevisionId | Integer | ✓ |
Example:
{
"id": 0 // Integer,
"uuid": "string" // String,
"objectType": null // <enum EventRuleObjectType,
"name": "string" // String,
"eventType": null // <enum EventRuleEventType,
"conditions": "string" // String,
"actionType": null // <enum EventRuleActionType,
"actionParams": {} // Dict[str, Any],
"triggerParams": {} // Dict[str, Any],
"active": false // Boolean,
"createdAt": "2024-01-01T00:00:00Z" // DateTime,
"updatedAt": "2024-01-01T00:00:00Z" // DateTime,
"taskId": 0 // Integer,
"taskName": "string" // String, optional,
"taskWorkflowId": 0 // Integer, optional,
"dataTypeId": 0 // Integer,
"dataTypeName": "string" // String, optional,
"routineId": 0 // Integer,
"workflowRevisionId": 0 // Integer,
"calendarId": 0 // Integer,
"calendarEventTypeId": 0 // Integer,
"journeyStepId": 0 // Integer,
"journeyId": 0 // Integer, optional,
"appConnectionId": 0 // Integer, optional,
"error": "string" // String,
"errorMessage": "string" // String,
"failedAt": "2024-01-01T00:00:00Z" // DateTime,
"celBlockedAt": "2024-01-01T00:00:00Z" // DateTime, optional,
"delay": 0 // Integer,
"order": 0 // Integer
}
RoutineResponse
| Field | Type | Required | Description |
|---|---|---|---|
createdAt | DateTime | ✓ | |
cronString | String | ||
description | String | ||
eventRules | Array | Default: [] | |
id | Integer | ✓ | |
intervalSeconds | Integer | ||
limit | Integer | ✓ | |
memberFilterId | Integer | ||
memberFilterName | String | ||
name | String | ✓ | |
nextRun | DateTime | ||
ownerId | Integer | ✓ | |
repeatCount | Integer | ||
scheduleEnabled | Boolean | ✓ | |
scheduleMode | String | ✓ | |
scheduledTime | DateTime | ||
startDate | DateTime | ||
targetMemberId | Integer | ||
timezone | String | ||
updatedAt | DateTime | ✓ | |
uuid | String | ✓ | |
visibility | String | ✓ | |
webhookEnabled | Boolean | Default: False | |
webhookSecretPlaintext | String | ||
workflowId | Integer |
Example:
{
"id": 0 // Integer,
"uuid": "string" // String,
"name": "string" // String,
"description": "string" // String, optional,
"scheduleEnabled": false // Boolean,
"scheduleMode": "string" // String,
"scheduledTime": "2024-01-01T00:00:00Z" // DateTime, optional,
"intervalSeconds": 0 // Integer, optional,
"repeatCount": 0 // Integer, optional,
"cronString": "string" // String, optional,
"timezone": "string" // String, optional,
"startDate": "2024-01-01T00:00:00Z" // DateTime, optional,
"memberFilterId": 0 // Integer, optional,
"memberFilterName": "string" // String, optional,
"targetMemberId": 0 // Integer, optional,
"workflowId": 0 // Integer, optional,
"limit": 0 // Integer,
"visibility": "string" // String,
"ownerId": 0 // Integer,
"createdAt": "2024-01-01T00:00:00Z" // DateTime,
"updatedAt": "2024-01-01T00:00:00Z" // DateTime,
"eventRules": [] // Array<EventRuleResponse>, optional, default: [],
"nextRun": "2024-01-01T00:00:00Z" // DateTime, optional,
"webhookEnabled": false // Boolean, optional, default: False,
"webhookSecretPlaintext": "string" // String, optional
}
RoutineWorkflowAccessMissingRoleResponse
| Field | Type | Required | Description |
|---|---|---|---|
id | Integer | ✓ | |
name | String | ✓ |
Example:
{
"id": 0 // Integer,
"name": "string" // String
}
RoutineWorkflowAccessPreviewResponse
| Field | Type | Required | Description |
|---|---|---|---|
totalWarnings | Integer | ✓ | |
warnings | Array | ✓ |
Example:
{
"warnings": [] // Array<RoutineWorkflowAccessWarningResponse>,
"totalWarnings": 0 // Integer
}
RoutineWorkflowAccessWarningResponse
| Field | Type | Required | Description |
|---|---|---|---|
actionType | String | ✓ | |
audienceRoleCount | Integer | ✓ | |
eventRuleId | Integer | ||
missingRoles | Array | ✓ | |
routineId | Integer | ||
routineName | String | ||
targetKind | String | ✓ | |
workflowId | Integer | ✓ | |
workflowName | String | ✓ | |
workflowUuid | String | ✓ |
Example:
{
"routineId": 0 // Integer, optional,
"routineName": "string" // String, optional,
"eventRuleId": 0 // Integer, optional,
"actionType": "string" // String,
"workflowId": 0 // Integer,
"workflowUuid": "string" // String,
"workflowName": "string" // String,
"targetKind": "string" // String,
"missingRoles": [] // Array<RoutineWorkflowAccessMissingRoleResponse>,
"audienceRoleCount": 0 // Integer
}
SchedulePreviewRequest
| Field | Type | Required | Description |
|---|---|---|---|
count | Integer | Default: 5 | |
cronString | String | ✓ | |
timezone | String |
Example:
{
"cronString": "string" // String,
"count": 0 // Integer, optional, default: 5,
"timezone": "string" // String, optional
}
SchedulePreviewResponse
| Field | Type | Required | Description |
|---|---|---|---|
nextRuns | Array | ✓ |
Example:
{
"nextRuns": "string" // Array<String>
}
Endpoints
GET /api/v2/w/{workspace_uuid}/routines- ListPOST /api/v2/w/{workspace_uuid}/routines- CreatePOST /api/v2/w/{workspace_uuid}/routines/preview-schedule- Preview SchedulePOST /api/v2/w/{workspace_uuid}/routines/preview-workflow-access- Preview Workflow AccessGET /api/v2/w/{workspace_uuid}/routines/runs- RunsDELETE /api/v2/w/{workspace_uuid}/routines/{event_id}- Delete Event IdGET /api/v2/w/{workspace_uuid}/routines/{event_id}- Get Event IdPUT /api/v2/w/{workspace_uuid}/routines/{event_id}- Update Event IdPOST /api/v2/w/{workspace_uuid}/routines/{event_id}/run- RunDELETE /api/v2/w/{workspace_uuid}/routines/{event_id}/runs- Delete Runs
List
GET /api/v2/w/{workspace_uuid}/routines
Description:
List all Routines for the workspace with pagination.
Visibility rules: a member sees Routines they own (any visibility) plus
workspace-visible Routines owned by others. Private Routines owned by
other members are hidden by default. Callers with
AUTOMATIONS_ADMIN can request owner=all_including_private to
see every routine in the workspace for administrative operations.
The owner query param narrows within what the caller is allowed to
see — it cannot widen access beyond the caller's scopes.
Authorization: Requires automations:read scope
Parameters:
page(Integer) — min: 1pageSize(Integer) — min: 1, max: 100sortBy(RoutineSortField)sortOrder(SortOrder)owner(String)
Response: See PaginatedResponse[RoutineResponse]
Create
POST /api/v2/w/{workspace_uuid}/routines
Description:
Create a new Routine.
Authorization: Requires automations:write scope
Parameters:
request- See CreateRoutineRequest
Response: See RoutineResponse
Preview Schedule
POST /api/v2/w/{workspace_uuid}/routines/preview-schedule
Description:
Preview the next N run times for a cron expression.
Authorization: Requires automations:read scope
Parameters:
request- See SchedulePreviewRequest
Response: See SchedulePreviewResponse
Preview Workflow Access
POST /api/v2/w/{workspace_uuid}/routines/preview-workflow-access
Description:
Non-blocking preview of which audience roles lack Workflow USE.
Warn-not-block authoring assist. Read-only and non-persisting: it evaluates
the draft Routine's target audience (target Member / MemberFilter / owner
fallback) against every workflow-starting reference — workflowId plus the
active routine:triggered EventRule workflowUUID params — and returns
role-level warnings. It does NOT change authorization, auto-grant USE, or
emit an audit event (no PHI is read; role/Routine/Workflow names only).
Distinct from the hard _validate_routine_workflow create/update check,
which validates the CURRENT ACTOR's USE of Routine.workflow_id and still
blocks. This preview evaluates a DIFFERENT principal (the target audience)
across a wider reference set and only warns.
Authorization: Requires automations:write scope
Parameters:
request- See RoutineWorkflowAccessPreviewRequest
Response: See RoutineWorkflowAccessPreviewResponse
Runs
GET /api/v2/w/{workspace_uuid}/routines/runs
Description:
List all Routine runs for the workspace with pagination.
Only runs for Routines the caller can see are returned — i.e. runs of
their own Routines plus runs of workspace-visible Routines owned by
others. Without the visibility join a caller with AUTOMATIONS_READ
could enumerate history of any private Routine by guessing
routineId.
Authorization: Requires automations:read scope
Parameters:
page(Integer) — min: 1pageSize(Integer) — min: 1, max: 100sortBy(EventRunSortField)sortOrder(SortOrder)routineId(Integer)status(String)
Response: See PaginatedResponse[RoutineRunResponse]
Delete Event Id
DELETE /api/v2/w/{workspace_uuid}/routines/{event_id}
Description:
Delete a Routine.
Authorization: Requires automations:admin scope
Parameters:
event_id(Integer)
Get Event Id
GET /api/v2/w/{workspace_uuid}/routines/{event_id}
Description:
Get a specific Routine by ID.
Authorization: Requires automations:read scope
Parameters:
event_id(Integer)
Response: See RoutineResponse
Update Event Id
PUT /api/v2/w/{workspace_uuid}/routines/{event_id}
Description:
Update an existing Routine.
Authorization: Requires automations:write scope
Parameters:
event_id(Integer)request- See UpdateRoutineRequest
Response: See RoutineResponse
Run
POST /api/v2/w/{workspace_uuid}/routines/{event_id}/run
Description:
Run a Routine manually.
Authorization: Requires automations:write scope
Parameters:
event_id(Integer)member_id(Integer)member_filter_id(Integer)
Delete Runs
DELETE /api/v2/w/{workspace_uuid}/routines/{event_id}/runs
Description:
Reset/clear all runs for a Routine. This removes all run history for the Routine.
Authorization: Requires automations:admin scope
Parameters:
event_id(Integer)