Skip to main content

Routines

Endpoints for defining routines (templates that enqueue an issue on a schedule, webhook, or API call), managing their triggers and revisions, and firing runs.

Prerequisites
  • API key: Authorization: Bearer <token>
  • Squad-scoped access; creating routines and triggers requires task-assignment (Operator) rights

Endpoints

MethodPathDescription
GET/api/squads/{squadId}/routinesList routines for a squad
POST/api/squads/{squadId}/routinesCreate a routine
GET/api/routines/{id}Read a routine (with triggers)
PATCH/api/routines/{id}Update a routine (creates a revision)
GET/api/routines/{id}/revisionsList routine revisions
POST/api/routines/{id}/revisions/{revisionId}/restoreRestore a prior revision
GET/api/routines/{id}/runsList runs produced by a routine
POST/api/routines/{id}/triggersAdd a trigger
PATCH/api/routine-triggers/{id}Update a trigger
POST/api/routine-triggers/{id}/rotate-secretRotate a webhook trigger's signing secret
DELETE/api/routine-triggers/{id}Delete a trigger
POST/api/routines/{id}/runFire the routine manually
POST/api/routine-triggers/public/{publicId}/fireFire a webhook/API trigger by its public ID

Create a routine

POST /api/squads/{squadId}/routines

Request body

FieldTypeRequiredDescription
titlestringyesTitle of the issue the routine enqueues (≤200 chars)
descriptionstringnoIssue body template
projectIdUUIDnoProject to file enqueued issues under
goalIdUUIDnoAssociated goal
parentIssueIdUUIDnoParent issue for enqueued issues
assigneeAgentIdUUIDnoAgent assigned to each run
prioritystringnoIssue priority (default medium)
statusstringnoactive (default), paused, or archived
concurrencyPolicystringnocoalesce_if_active (default), always_enqueue, or skip_if_active
catchUpPolicystringnoskip_missed (default) or enqueue_missed_with_cap
variablesarraynoVariable definitions (see below)
envobjectnoEnvironment bindings (plain values or secret references)

Returns 201 Created with the routine and its initial revision.

Variable definitions

Each entry in variables declares an input collected when the routine runs:

FieldTypeDescription
namestringIdentifier ([A-Za-z][A-Za-z0-9_]*)
labelstringOptional display label
typestringtext (default), textarea, number, boolean, or select
defaultValuestring | number | booleanOptional default
requiredbooleanWhether a value must be supplied (default true)
optionsstring[]Allowed values; required for and exclusive to select

Read / update / revisions

  • GET /api/routines/{id} returns the routine with its triggers.
  • PATCH /api/routines/{id} accepts the same fields as create (all optional) plus an optional baseRevisionId for optimistic concurrency; each update records a new revision.
  • GET /api/routines/{id}/revisions lists revisions; POST /api/routines/{id}/revisions/{revisionId}/restore rolls back to one.

Triggers

POST /api/routines/{id}/triggers

A trigger is one of three kinds, discriminated by kind:

KindFieldsDescription
schedulecronExpression (required), timezone (default UTC)Fires on a cron expression
webhooksigningMode (default bearer), replayWindowSec (30–86400, default 300)Fires on a signed inbound webhook
apiFires on an authenticated API call

All kinds accept label and enabled (default true). Signing modes for webhooks: bearer, hmac_sha256, github_hmac, none.

Webhook and API triggers expose a publicId; fire them with POST /api/routine-triggers/public/{publicId}/fire.

Rotate a webhook signing secret

POST /api/routine-triggers/{id}/rotate-secret

Issues a new signing secret for a webhook trigger and records a routine revision. The request body is empty; the new secret is returned in the response. Existing callers must adopt the new secret to keep passing signature verification.


Run a routine

POST /api/routines/{id}/run

Manually enqueues a run.

Request body

FieldTypeRequiredDescription
triggerIdUUIDnoAttribute the run to a specific trigger
payloadobjectnoWebhook/API payload made available to the run
variablesobjectnoValues for the routine's declared variables
projectIdUUIDnoOverride the target project
assigneeAgentIdUUIDnoOverride the assignee
idempotencyKeystringnoDe-duplicate repeated submissions
sourcestringnomanual (default) or api

Next steps

  • Issues — the issues that routines enqueue
  • Secrets — back routine env bindings with managed secrets
  • Agents — assign routine runs to an agent