---
related_nodes: ["schedule_event", "on_scheduled_event"]
---

# Scheduled Event Operation

Creates, lists, cancels, and modifies scheduled events. `schedule_event` is the create-only node;
this one manages events a workflow armed earlier.

## Inputs

- `input` — workflow data used for template interpolation.

## Configuration

One `operation`, chosen by `op`.

### create

Identical to `schedule_event`: `key`, `trigger_at`, `timezone`, `payload`, `recurrence_rule`.

Output: `{ "event_id": "..." }`

### list

- `key` — optional key filter. Empty lists every key in the workspace.
- `status` — `all` (default), `pending`, or `fired`.
- `limit` — 1 to 500, default 100.

Output: `{ "events": [...], "count": n }`, ordered by `trigger_at`. Each event carries `id`,
`workspace_id`, `key`, `trigger_at`, `payload`, `recurrence_rule`, `anchor_at`, `timezone`,
`status`, and `fired_at` (null while pending). `anchor_at` and `timezone` describe the series a
pending event belongs to, and are null once it has fired.

Listing by key recovers an `event_id` a workflow did not keep, and finds the live occurrence of a
recurring event.

### cancel

- `event_id` — the id to cancel.

Output: `{ "event_id": "...", "cancelled": true }`. Only pending events can be cancelled.

### modify

- `event_id` — the event to replace.
- `key`, `trigger_at`, `timezone`, `payload` — optional; anything left empty is carried over.
  `timezone` only reads a naive `trigger_at`; the series keeps the zone it was created with.
- `recurrence_mode` — `keep` (default), `set`, or `clear`.
- `recurrence_rule` — required when `recurrence_mode` is `set`.

A new `trigger_at` or rule starts the series afresh from the event's trigger time, so a `COUNT`
counts from there; otherwise the series keeps its anchor.

Output: `{ "event_id": "...", "previous_event_id": "..." }`. The id changes: store `event_id` from
the result, because the previous one no longer addresses anything. Only pending events can be
modified.

## Outputs

- `output` — the operation result described above.

## Related

- `schedule_event` — arm an event.
- `on_scheduled_event` — the trigger that receives a fired event.
