Skip to main content

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

FieldTypeRequiredDescription
actionParamsDict[str, Any]
actionType<enum EventRuleActionType
activeBoolean
appConnectionIdInteger
calendarEventTypeIdInteger
calendarIdInteger
celBlockedAtDateTime
conditionsString
createdAtDateTime
dataTypeIdInteger
dataTypeNameString
delayInteger
errorString
errorMessageString
eventType<enum EventRuleEventType
failedAtDateTime
idInteger
journeyIdInteger
journeyStepIdInteger
nameString
objectType<enum EventRuleObjectType
orderInteger
routineIdInteger
taskIdInteger
taskNameString
taskWorkflowIdInteger
triggerParamsDict[str, Any]
updatedAtDateTime
uuidString
workflowRevisionIdInteger

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

FieldTypeRequiredDescription
createdAtDateTime
cronStringString
descriptionString
eventRulesArrayDefault: []
idInteger
intervalSecondsInteger
limitInteger
memberFilterIdInteger
memberFilterNameString
nameString
nextRunDateTime
ownerIdInteger
repeatCountInteger
scheduleEnabledBoolean
scheduleModeString
scheduledTimeDateTime
startDateDateTime
targetMemberIdInteger
timezoneString
updatedAtDateTime
uuidString
visibilityString
webhookEnabledBooleanDefault: False
webhookSecretPlaintextString
workflowIdInteger

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

FieldTypeRequiredDescription
idInteger
nameString

Example:

{
"id": 0 // Integer,
"name": "string" // String
}

RoutineWorkflowAccessPreviewResponse

FieldTypeRequiredDescription
totalWarningsInteger
warningsArray

Example:

{
"warnings": [] // Array<RoutineWorkflowAccessWarningResponse>,
"totalWarnings": 0 // Integer
}

RoutineWorkflowAccessWarningResponse

FieldTypeRequiredDescription
actionTypeString
audienceRoleCountInteger
eventRuleIdInteger
missingRolesArray
routineIdInteger
routineNameString
targetKindString
workflowIdInteger
workflowNameString
workflowUuidString

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

FieldTypeRequiredDescription
countIntegerDefault: 5
cronStringString
timezoneString

Example:

{
"cronString": "string" // String,
"count": 0 // Integer, optional, default: 5,
"timezone": "string" // String, optional
}

SchedulePreviewResponse

FieldTypeRequiredDescription
nextRunsArray

Example:

{
"nextRuns": "string" // Array<String>
}

Endpoints

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: 1
  • pageSize (Integer) — min: 1, max: 100
  • sortBy (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:

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:

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:

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: 1
  • pageSize (Integer) — min: 1, max: 100
  • sortBy (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:

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)