Skip to main content
POST
Create a scheduled trigger
The reference panel describes the current v3 operation. The notes below describe its v2 compatibility API. Follow the v3 request schema for current calls: v3 can move identifiers from the body or query into the URL. Keep the v2 method, path, and payload together when using the compatibility API.

v2 compatibility notes

POST /api/v2/workflows/createTrigger schedules a workflow: a cron trigger or a one-shot fire, exactly one.

Authentication

External App credential or platform API key, or a Personal key. Requires permission workflows:manage (an elevated permission) held at the workflow’s home and at the new trigger’s orgUnitId, as the Console decides it, on a workflow the caller may read (workflows:read at its home); otherwise 403, recorded, and nothing is written. Forge agents can never hold workflows:manage. Because the success returns what was written, the credential’s scopes must include workflows:read as well; otherwise 403 naming workflows:read. A workflow that is missing, trashed or unreadable answers 404. A Personal key acts as its owner; an External App or platform key acts as itself. The change is audited with that actor and, for an app or platform key, who granted it.

Body

{workflowId, orgUnitId, versionId?, cronExpression?, timezone?, oneShotFireAt?, backfillPolicy?, inputs?}. Name exactly one of cronExpression (with timezone, an IANA name) and oneShotFireAt (epoch milliseconds); both or neither is 400. orgUnitId is the org unit the trigger’s fires run at. Without versionId each fire runs the workflow’s active version; with it, every fire runs that published version. backfillPolicy (coalesce, the default, fire_each_missed or drop) says what happens to fires missed while the scheduler could not run. inputs are validated against the version’s input contract. A files_ id in inputs needs files:read (otherwise 403) and must name a file the caller could download at the request’s org unit, as at a dispatch (otherwise 422): a scheduled fire launches with the stored inputs, so they are decided when written. Unknown fields, including ownerId, are refused.

Version entitlement

A trigger runs a published version, so the version’s agents and bound companies are decided for the caller as at a publish: agents:use and credentials:use, each reached by its own scope. A refusal is 422 naming the gate’s code, and nothing is written.

Who a trigger belongs to

A Personal key’s trigger belongs to its owner’s worker seat and keeps firing after the key expires; a key whose owner has no active seat answers 422. An External App’s or platform key’s trigger belongs to the app or key, and stops (paused, audited) when the app or key loses workflows:manage. Editing a trigger never changes who it belongs to.

Idempotency

Send an Idempotency-Key to make a retry safe: a same-key retry within 24 hours returns the recorded result only while the caller may still read the trigger and holds workflows:manage at its org unit and the platform scope; otherwise 409 idempotency_result_unavailable, and the write never runs twice (see Idempotency).

Responses

data is {trigger, ingress}. trigger has the fields described in getTrigger; ingress is null for a cron or one-shot trigger, and otherwise the ingress configuration: status, tokenPrefix (for display only), inputMode, wrapKey, dedupeHeader, ratePerMinute, verification (mode, header and scheme, never the secret) and customerAttributionConfigured. The owner, creator, stored inputs, token and token hash are never returned.

Errors

Example

Authorizations

Authorization
string
header
required

An External App: the JWT it obtains from POST /oauth/token with OAuth2 client_credentials. Pass as Authorization: Bearer <jwt>. An app's static companion key also authenticates as the app, but is deprecated and is not protected by Idempotency-Key.

Headers

Idempotency-Key
string

Optional logical intent key. A same-key retry within 24 hours returns the recorded result without writing again.

Required string length: 1 - 255

Path Parameters

workflowId
string
required

The workflow to schedule.

Minimum string length: 1

Body

application/json
orgUnitId
string
required

The org unit its fires run at; you need workflows:manage there.

Minimum string length: 1
versionId
string

Pin this published version; absent: each fire runs the active version.

Minimum string length: 1
cronExpression
string
Minimum string length: 1
oneShotFireAt
number

Fire once at this time, epoch milliseconds.

timezone
string
Minimum string length: 1
backfillPolicy
enum<string>

What the scheduler does with fires missed while it could not run (default coalesce).

Available options:
coalesce,
fire_each_missed,
drop
inputs
object

Run inputs every fire uses, validated against the version's input contract.

Response

Created

data
object
required
meta
object
required