Routines API
A routine's steps is an ordered list of at most 20 steps (counted across blocks, at most 3 block levels, 32 KB): {id, kind, in: {name: {ref} | {literal}}, then?, otherwise?, do?}.
Implementation notes
A routine's steps is an ordered list of at most 20 steps (counted across blocks, at most 3 block levels, 32 KB): {id, kind, in: {name: {ref} | {literal}}, then?, otherwise?, do?}. id is 1 to 8 characters a-z0-9, unique (trigger and item are reserved); a ref names trigger, an earlier step visible from the step, or item inside a Repeat's do. The step kinds, their inputs and output types are listed by the catalogue route and in routines.md. Steps read tasks from the trigger or earlier steps: an input that takes one task (add_comment.task, start_timer.task, notify.task, note_text.of, append_to_note.of, clear_note.of, create_tasks.parent) and receives a list runs once per task (OpenSpec routines-dynamic-data). A task literal {"task": id} (on add_comment, start_timer, notify and get_task) is for rare fixed targets. take is Pick: from start (default), end or all, and n (default 1, ignored with all); filter is Pick's "where". of also takes {"project": id}. date outputs a Date (date: today by default, tomorrow, {"in_days": n} or YYYY-MM-DD); project_of outputs a task's project (the Inbox, an empty id, for a task without one); create_tasks.parent makes subtasks and refuses a project next to it; split_lines.only: "open_checkboxes" keeps only - [ ] … lines; find_tasks with a query or view finds completed tasks when the query names completed or open (a condition finds open tasks); in every form it never finds a task in the Trash or of a project in the Trash, and leaves out tasks of archived projects unless archived is {"literal": true} (OpenSpec routines-find-scope; the matching tasks of a schedule trigger with a condition follow the same rule). A schedule trigger takes weekdays or month_days (1 to 31 and "last"; a day a month lacks does not fire that month), exactly one; a condition may hold unchanged: {days: 1..365} (no field of the task changed in that many days). A routine is type-checked like the app does (400 invalid_input names the step and input, for example step b: notify: text expects Text, got Tasks), and every id inside it is resolved.
- POST
/api/v1/assistant/routine-draft - GET
/api/v1/me/rules/catalogue - GET
/api/v1/me/rules/proposals - GET
/api/v1/me/rules/proposals/{id} - DELETE
/api/v1/me/rules/proposals/{id} - POST
/api/v1/me/rules/proposals/{id}/apply - GET
/api/v1/me/rules/runs - POST
/api/v1/me/rules/runs/{run}/commit - POST
/api/v1/me/rules/runs/{run}/fail - GET
/api/v1/rules/{id}/ai-usage - POST
/api/v1/rules/{id}/run - GET
/api/v1/rules/{id}/runs/{run} - POST
/api/v1/rules/{id}/runs/{run}/dismiss - POST
/api/v1/rules/{id}/runs/{run}/undo - POST
/api/v1/rules/test
POST /api/v1/assistant/routine-draft
Assistant routine draft · Session only
{text} (at most 500 characters) → {draft, note, errors, warnings, usage}: Describe it (OpenSpec routines-describe-it). One assistant turn drafts a routine with the one tool draft_routine; the model gets the steps available to you and the names and ids of your projects (not archived), their sections, labels, saved views and enabled webhooks (by host) as untrusted text. The draft ({name, trigger, condition, steps}, or null when the model answered in words, then in note) is checked like a create plus the draft rules (no task chosen by hand: no get_task, no {"task": id}; only available steps, else unavailable); when it does not check, the errors go back to the model once, and errors lists what still does not ([{step?, input?, code, message}]). Nothing is saved, enabled, tested or run, and a draft never holds ai_apply. usage is {input, cached, cache_write, output, month_total, cap, own_key} as for a turn; the tokens count toward the assistant allowance and GET /api/v1/me/assistant/usage lists them as drafts. 404 not_found while the assistant is off, 409 encryption_enabled for an encrypted account (it drafts on its device), 403 consent_required, 413 too_large, 429 assistant_quota at the cap (with resets_at), 409 turn_in_progress while another answer runs, 429 rate_limited after 10 drafts in an hour, 422 ai_refused/ai_truncated, provider errors as for a turn (502, 504 timeout)
Needs a session; tokens are refused.
| Field | Type | Description |
|---|---|---|
text required | string |
| Field | Type | Description |
|---|---|---|
draft required | object | null | |
draft.condition required | string | |
draft.name required | string | |
draft.steps required | string | |
draft.trigger required | string | |
errors required | array of object | |
errors[].code required | string | |
errors[].input | string | |
errors[].message required | string | |
errors[].step | string | |
note required | string | |
usage required | object | |
usage.cache_write required | number | |
usage.cached required | number | |
usage.cap required | number | |
usage.input required | number | |
usage.month_total required | number | |
usage.output required | number | |
usage.own_key required | boolean | |
warnings required | array of object | |
warnings[].kind required | string | |
warnings[].message required | string | |
warnings[].reason required | string | |
warnings[].setting | string | |
warnings[].step required | string |
GET /api/v1/me/rules/catalogue
Get me rules catalogue · Token or session
{steps: [{kind, group, inputs, output, content, needs?, available, reason?, setting?}]}: every step kind and whether you can use it now
| Field | Type | Description |
|---|---|---|
steps required | array of object | |
steps[].available required | boolean | |
steps[].blocks | array of string | |
steps[].content required | boolean | |
steps[].group required | string | |
steps[].inputs required | array of object | |
steps[].inputs[].accepts required | array of string | |
steps[].inputs[].content | boolean | |
steps[].inputs[].enum | array of string | |
steps[].inputs[].literal | string | |
steps[].inputs[].max | number | |
steps[].inputs[].name required | string | |
steps[].inputs[].required | boolean | |
steps[].kind required | string | |
steps[].needs | string | |
steps[].one_of | array of array of string | |
steps[].output required | string | |
steps[].reason | string | |
steps[].same_as | string | |
steps[].setting | string | |
steps[].tool | string |
GET /api/v1/me/rules/proposals
List me rules proposals · Token or session
{proposals: [{id, rule_id, run_id, created_at, expires_at, state, items, applied, skipped, encrypted}]}: your waiting proposals, newest first
Refuses read and agent tokens.
| Field | Type | Description |
|---|---|---|
proposals required | array of object | |
proposals[].applied required | number | |
proposals[].created_at required | number | |
proposals[].encrypted required | boolean | |
proposals[].envelope | string | |
proposals[].expires_at required | number | |
proposals[].id required | string | |
proposals[].items required | number | |
proposals[].list | array of object | |
proposals[].list[].ai required | boolean | |
proposals[].list[].before | object | |
proposals[].list[].entity | string | |
proposals[].list[].fields | object | |
proposals[].list[].id | string | |
proposals[].list[].key required | string | |
proposals[].list[].kind required | string | |
proposals[].list[].side | object | null | |
proposals[].rule_id required | string | |
proposals[].run_id required | string | |
proposals[].skipped required | number | |
proposals[].state required | string |
GET /api/v1/me/rules/proposals/{id}
Get a me rules proposal · Token or session
one proposal; while waiting it carries list: [{key, kind, entity?, id?, fields?, before?, ai, side?}] (kind is create, change, notify, webhook or email; before the values the change was planned on; ai marks text the AI wrote), or for an encrypted account envelope
Refuses read and agent tokens.
| Field | Type | Description |
|---|---|---|
id required | string | path |
| Field | Type | Description |
|---|---|---|
applied required | number | |
created_at required | number | |
encrypted required | boolean | |
envelope | string | |
expires_at required | number | |
id required | string | |
items required | number | |
list | array of object | |
list[].ai required | boolean | |
list[].before | object | |
list[].entity | string | |
list[].fields | object | |
list[].id | string | |
list[].key required | string | |
list[].kind required | string | |
list[].side | object | null | |
list[].side.day | string | |
list[].side.delivery | object | null | |
list[].side.fired | object | null | |
list[].side.hook | string | |
list[].side.kind required | string | |
list[].side.mail | object | null | |
list[].side.members | array of string | |
list[].side.notice | object | null | |
list[].side.project | string | |
rule_id required | string | |
run_id required | string | |
skipped required | number | |
state required | string |
DELETE /api/v1/me/rules/proposals/{id}
Delete a me rules proposal · Token or session
→ 204: dismisses a waiting proposal and deletes its body; 409 proposal_closed otherwise
Refuses read and agent tokens.
| Field | Type | Description |
|---|---|---|
id required | string | path |
POST /api/v1/me/rules/proposals/{id}/apply
Me rules proposal apply · Token or session
{items?: [key, …]} (all when left out) → {state, applied, skipped, changed, refused, run_id, rule_id}: writes the items with device rule:<rule-id>, recorded on the run (Undo run takes them back); an item whose target was deleted or whose field changed since is skipped and counted (changed); 409 proposal_closed once applied, dismissed or expired; 409 encrypted for an encrypted account's proposal sent with items: a device decrypts its envelope, re-checks the items and sends the ticked ones as {changes, completing?, sides?, skipped?, changed?} in the commit route's form (ciphertext only, 400 plaintext otherwise)
Refuses read and agent tokens.
| Field | Type | Description |
|---|---|---|
id required | string | path |
| Field | Type | Description |
|---|---|---|
changed required | number | |
changes required | array of object | |
changes[].create | boolean | |
changes[].entity required | string | |
changes[].fields required | object | |
changes[].id required | string | |
completing required | array of string | |
items | array of string | |
sides required | array of object | |
sides[].kind required | string | |
sides[].step required | string | |
sides[].task | string | |
sides[].tasks | array of string | |
sides[].text | string | |
sides[].webhook | string | |
skipped required | number |
| Field | Type | Description |
|---|---|---|
applied required | number | |
changed required | number | |
refused required | number | |
rule_id required | string | |
run_id required | string | |
skipped required | number | |
state required | string |
GET /api/v1/me/rules/runs
List me rules runs · Token or session
?outcome=&source=&rule=&limit=&before= → {runs, before?}: every routine's runs, newest first (limit 1 to 100, default 50; before is the last run's id to page back)
| Field | Type | Description |
|---|---|---|
before | number | |
hide_successes | boolean | |
runs required | array of object | |
runs[].ai_auto required | boolean | |
runs[].at required | number | |
runs[].blocks | array of object | |
runs[].blocks[].date | string | |
runs[].blocks[].from | string | |
runs[].blocks[].ids | array of string | |
runs[].blocks[].kind required | string | |
runs[].blocks[].span | string | |
runs[].blocks[].to | string | |
runs[].changes required | string | |
runs[].depth required | number | |
runs[].device_id | string | |
runs[].duration_ms required | number | |
runs[].failed_step required | number | |
runs[].id required | number | |
runs[].kind | string | |
runs[].note_id | string | |
runs[].occurrence required | string | |
runs[].outcome required | string | |
runs[].project_id | string | |
runs[].proposal | object | null | |
runs[].proposal.applied required | number | |
runs[].proposal.created_at required | number | |
runs[].proposal.encrypted required | boolean | |
runs[].proposal.envelope | string | |
runs[].proposal.expires_at required | number | |
runs[].proposal.id required | string | |
runs[].proposal.items required | number | |
runs[].proposal.list | array of object | |
runs[].proposal.rule_id required | string | |
runs[].proposal.run_id required | string | |
runs[].proposal.skipped required | number | |
runs[].proposal.state required | string | |
runs[].reason | string | |
runs[].rule_id required | string | |
runs[].run_as required | string | |
runs[].run_id required | string | |
runs[].source required | string | |
runs[].steps | array of object | |
runs[].steps[].duration_ms required | number | |
runs[].steps[].error | string | |
runs[].steps[].ids required | array of string | |
runs[].steps[].index required | number | |
runs[].steps[].items required | number | |
runs[].steps[].kind required | string | |
runs[].steps[].output required | string | |
runs[].steps[].status required | string | |
runs[].steps[].step_id required | string | |
runs[].steps[].tokens | number | |
runs[].steps_count required | number | |
runs[].task_id | string | |
runs[].test required | boolean | |
runs[].tokens required | number | |
runs[].undone_at required | number | null | |
runs[].writes required | number | |
seen_at | number |
POST /api/v1/me/rules/runs/{run}/commit
Me rules run commit · Session only
a device run's result: {steps, outcome?, duration_ms?, tokens?, changes?: [{entity, id, create?, fields}], completing?: [task id], sides?: [{kind: "notify", step, text?, task?} | {kind: "fired", task} | {kind: "webhook", step, webhook, tasks?}], proposal?: {envelope, items}, blocks?: [block]} → {run, steps, writes, test}. blocks are the run's blocks (below), at most 4 (400 invalid_input otherwise). Content fields and a notice's text must be ciphertext (400 plaintext). 403 forbidden from another session than the one the run was sent to, 409 run_closed once it was committed, failed or missed, 409 routine_changed when the routine changed since it was sent (the run is recorded failed), 409 fallback when a routine with an AI step is not in auto mode or the result breaks auto mode's limits (commit a proposal instead), 400 write_limit past 500 items; nothing is written in each case
Needs a session; tokens are refused.
| Field | Type | Description |
|---|---|---|
run required | string | path |
| Field | Type | Description |
|---|---|---|
blocks required | array of object | |
blocks[].date | string | |
blocks[].from | string | |
blocks[].ids | array of string | |
blocks[].kind required | string | |
blocks[].span | string | |
blocks[].to | string | |
changes required | array of object | |
changes[].create | boolean | |
changes[].entity required | string | |
changes[].fields required | object | |
changes[].id required | string | |
completing required | array of string | |
duration_ms required | number | |
outcome required | string | |
proposal | object | null | |
proposal.envelope required | string | |
proposal.items required | number | |
sides required | array of object | |
sides[].kind required | string | |
sides[].step required | string | |
sides[].task | string | |
sides[].tasks | array of string | |
sides[].text | string | |
sides[].webhook | string | |
steps required | array of object | |
steps[].duration_ms required | number | |
steps[].error | string | |
steps[].ids required | array of string | |
steps[].index required | number | |
steps[].items required | number | |
steps[].kind required | string | |
steps[].output required | string | |
steps[].status required | string | |
steps[].step_id required | string | |
steps[].tokens | number | |
tokens required | number |
| Field | Type | Description |
|---|---|---|
device_run | object | null | |
device_run.at required | number | |
device_run.auto required | boolean | |
device_run.budget required | number | |
device_run.note | string | |
device_run.occurrence required | string | |
device_run.op required | string | |
device_run.rev required | string | |
device_run.rule required | string | |
device_run.run required | string | |
device_run.task | string | |
device_run.tokens required | number | |
run required | object | |
run.ai_auto required | boolean | |
run.at required | number | |
run.blocks | array of object | |
run.blocks[].date | string | |
run.blocks[].from | string | |
run.blocks[].ids | array of string | |
run.blocks[].kind required | string | |
run.blocks[].span | string | |
run.blocks[].to | string | |
run.changes required | string | |
run.depth required | number | |
run.device_id | string | |
run.duration_ms required | number | |
run.failed_step required | number | |
run.id required | number | |
run.note_id | string | |
run.occurrence required | string | |
run.outcome required | string | |
run.project_id | string | |
run.proposal | object | null | |
run.proposal.applied required | number | |
run.proposal.created_at required | number | |
run.proposal.encrypted required | boolean | |
run.proposal.envelope | string | |
run.proposal.expires_at required | number | |
run.proposal.id required | string | |
run.proposal.items required | number | |
run.proposal.list | array of object | |
run.proposal.rule_id required | string | |
run.proposal.run_id required | string | |
run.proposal.skipped required | number | |
run.proposal.state required | string | |
run.reason | string | |
run.rule_id required | string | |
run.run_as required | string | |
run.run_id required | string | |
run.source required | string | |
run.steps | array of object | |
run.steps[].duration_ms required | number | |
run.steps[].error | string | |
run.steps[].ids required | array of string | |
run.steps[].index required | number | |
run.steps[].items required | number | |
run.steps[].kind required | string | |
run.steps[].output required | string | |
run.steps[].status required | string | |
run.steps[].step_id required | string | |
run.steps[].tokens | number | |
run.steps_count required | number | |
run.task_id | string | |
run.test required | boolean | |
run.tokens required | number | |
run.undone_at required | number | null | |
run.writes required | number | |
steps required | array of object | |
steps[].changes | array of object | |
steps[].changes[].base | object | |
steps[].changes[].create | boolean | |
steps[].changes[].entity required | string | |
steps[].changes[].entityId required | string | |
steps[].changes[].patch required | object | |
steps[].duration_ms required | number | |
steps[].error | string | |
steps[].estimate | number | |
steps[].ids required | array of string | |
steps[].index required | number | |
steps[].items required | number | |
steps[].kind required | string | |
steps[].output required | string | |
steps[].preview | string | number | array of string | object | array of object | A preview of the step's output, by its type: text and a date are a string, lines a list of strings, a number a number, a task or a note {id, title}, a project {id, name}, tasks or notes a list of {id, title}. |
steps[].status required | string | |
steps[].step_id required | string | |
steps[].tokens | number | |
steps[].warning | object | null | |
steps[].warning.kind required | string | |
steps[].warning.message required | string | |
steps[].warning.reason required | string | |
steps[].warning.setting | string | |
steps[].warning.step required | string | |
test required | boolean | |
writes required | number |
POST /api/v1/me/rules/runs/{run}/fail
Me rules run fail · Session only
{step, code, steps?, duration_ms?, tokens?} → {run}: the device could not finish; the run is recorded failed with code
Needs a session; tokens are refused.
| Field | Type | Description |
|---|---|---|
run required | string | path |
| Field | Type | Description |
|---|---|---|
code required | string | |
duration_ms required | number | |
step required | number | |
steps required | array of object | |
steps[].duration_ms required | number | |
steps[].error | string | |
steps[].ids required | array of string | |
steps[].index required | number | |
steps[].items required | number | |
steps[].kind required | string | |
steps[].output required | string | |
steps[].status required | string | |
steps[].step_id required | string | |
steps[].tokens | number | |
tokens required | number |
| Field | Type | Description |
|---|---|---|
run required | object | |
run.ai_auto required | boolean | |
run.at required | number | |
run.blocks | array of object | |
run.blocks[].date | string | |
run.blocks[].from | string | |
run.blocks[].ids | array of string | |
run.blocks[].kind required | string | |
run.blocks[].span | string | |
run.blocks[].to | string | |
run.changes required | string | |
run.depth required | number | |
run.device_id | string | |
run.duration_ms required | number | |
run.failed_step required | number | |
run.id required | number | |
run.note_id | string | |
run.occurrence required | string | |
run.outcome required | string | |
run.project_id | string | |
run.proposal | object | null | |
run.proposal.applied required | number | |
run.proposal.created_at required | number | |
run.proposal.encrypted required | boolean | |
run.proposal.envelope | string | |
run.proposal.expires_at required | number | |
run.proposal.id required | string | |
run.proposal.items required | number | |
run.proposal.list | array of object | |
run.proposal.rule_id required | string | |
run.proposal.run_id required | string | |
run.proposal.skipped required | number | |
run.proposal.state required | string | |
run.reason | string | |
run.rule_id required | string | |
run.run_as required | string | |
run.run_id required | string | |
run.source required | string | |
run.steps | array of object | |
run.steps[].duration_ms required | number | |
run.steps[].error | string | |
run.steps[].ids required | array of string | |
run.steps[].index required | number | |
run.steps[].items required | number | |
run.steps[].kind required | string | |
run.steps[].output required | string | |
run.steps[].status required | string | |
run.steps[].step_id required | string | |
run.steps[].tokens | number | |
run.steps_count required | number | |
run.task_id | string | |
run.test required | boolean | |
run.tokens required | number | |
run.undone_at required | number | null | |
run.writes required | number |
GET /api/v1/rules/{id}/ai-usage
Get rule ai usage · Token or session
{days: [{day, tokens}], budget, mode}: the routine's AI tokens of the last 7 UTC days, its daily budget and its ai_mode (null without AI steps)
| Field | Type | Description |
|---|---|---|
id required | string | path |
| Field | Type | Description |
|---|---|---|
budget required | number | |
days required | array of object | |
days[].day required | string | |
days[].tokens required | number | |
mode required | object | |
mode.asked required | boolean | |
mode.at required | number | |
mode.auto required | boolean | |
mode.blocked required | object | |
mode.blocked.step required | string | |
mode.blocked.what required | string | |
mode.reason required | string |
POST /api/v1/rules/{id}/run
Rule run · Token or session
{run_id, task_id?, note_id?, test?, call_ai?, device?} → {run, steps, writes, test, device_run?}. note_id is the standalone note a routine triggered by a note, or run on a note (trigger: {kind: "manual", on: "note"}), runs on: 400 note_required without it or with a task_id instead, 400 invalid_input with both; the run then carries note_id instead of task_id. run_id is your UUID: the same value answers the first run again. test: true plans, logs a test run and writes nothing; its AI steps call the model only with call_ai: true (otherwise they answer nothing and carry their estimate of tokens). A disabled routine can be run; 409 paused while the server paused it, 409 automations_off when the owner turned automations off, 400 task_required when its steps read the trigger's task and task_id is missing, 429 rate_limited past 60 runs a minute (nothing is queued). On an encrypted account a routine with text or AI steps runs on a device (below): device (session cookies only) runs it on the calling device, which gets device_run (the routine.run request) and commits it; without device it is sent to an opted-in device
| Field | Type | Description |
|---|---|---|
id required | string | path |
| Field | Type | Description |
|---|---|---|
call_ai required | boolean | |
device required | string | |
note_id required | string | |
run_id required | string | |
task_id required | string | |
test required | boolean |
| Field | Type | Description |
|---|---|---|
device_run | object | null | |
device_run.at required | number | |
device_run.auto required | boolean | |
device_run.budget required | number | |
device_run.note | string | |
device_run.occurrence required | string | |
device_run.op required | string | |
device_run.rev required | string | |
device_run.rule required | string | |
device_run.run required | string | |
device_run.task | string | |
device_run.tokens required | number | |
run required | object | |
run.ai_auto required | boolean | |
run.at required | number | |
run.blocks | array of object | |
run.blocks[].date | string | |
run.blocks[].from | string | |
run.blocks[].ids | array of string | |
run.blocks[].kind required | string | |
run.blocks[].span | string | |
run.blocks[].to | string | |
run.changes required | string | |
run.depth required | number | |
run.device_id | string | |
run.duration_ms required | number | |
run.failed_step required | number | |
run.id required | number | |
run.note_id | string | |
run.occurrence required | string | |
run.outcome required | string | |
run.project_id | string | |
run.proposal | object | null | |
run.proposal.applied required | number | |
run.proposal.created_at required | number | |
run.proposal.encrypted required | boolean | |
run.proposal.envelope | string | |
run.proposal.expires_at required | number | |
run.proposal.id required | string | |
run.proposal.items required | number | |
run.proposal.list | array of object | |
run.proposal.rule_id required | string | |
run.proposal.run_id required | string | |
run.proposal.skipped required | number | |
run.proposal.state required | string | |
run.reason | string | |
run.rule_id required | string | |
run.run_as required | string | |
run.run_id required | string | |
run.source required | string | |
run.steps | array of object | |
run.steps[].duration_ms required | number | |
run.steps[].error | string | |
run.steps[].ids required | array of string | |
run.steps[].index required | number | |
run.steps[].items required | number | |
run.steps[].kind required | string | |
run.steps[].output required | string | |
run.steps[].status required | string | |
run.steps[].step_id required | string | |
run.steps[].tokens | number | |
run.steps_count required | number | |
run.task_id | string | |
run.test required | boolean | |
run.tokens required | number | |
run.undone_at required | number | null | |
run.writes required | number | |
steps required | array of object | |
steps[].changes | array of object | |
steps[].changes[].base | object | |
steps[].changes[].create | boolean | |
steps[].changes[].entity required | string | |
steps[].changes[].entityId required | string | |
steps[].changes[].patch required | object | |
steps[].duration_ms required | number | |
steps[].error | string | |
steps[].estimate | number | |
steps[].ids required | array of string | |
steps[].index required | number | |
steps[].items required | number | |
steps[].kind required | string | |
steps[].output required | string | |
steps[].preview | string | number | array of string | object | array of object | A preview of the step's output, by its type: text and a date are a string, lines a list of strings, a number a number, a task or a note {id, title}, a project {id, name}, tasks or notes a list of {id, title}. |
steps[].status required | string | |
steps[].step_id required | string | |
steps[].tokens | number | |
steps[].warning | object | null | |
steps[].warning.kind required | string | |
steps[].warning.message required | string | |
steps[].warning.reason required | string | |
steps[].warning.setting | string | |
steps[].warning.step required | string | |
test required | boolean | |
writes required | number |
GET /api/v1/rules/{id}/runs/{run}
Get a rule run · Token or session
one run with steps (index, step_id, kind, status: ok, skipped, ended, failed, unavailable or truncated, duration_ms, items, output, ids (at most 50), error)
| Field | Type | Description |
|---|---|---|
id required | string | path |
run required | string | path |
| Field | Type | Description |
|---|---|---|
ai_auto required | boolean | |
at required | number | |
blocks | array of object | |
blocks[].date | string | |
blocks[].from | string | |
blocks[].ids | array of string | |
blocks[].kind required | string | |
blocks[].span | string | |
blocks[].to | string | |
changes required | string | |
depth required | number | |
device_id | string | |
duration_ms required | number | |
failed_step required | number | |
id required | number | |
note_id | string | |
occurrence required | string | |
outcome required | string | |
project_id | string | |
proposal | object | null | |
proposal.applied required | number | |
proposal.created_at required | number | |
proposal.encrypted required | boolean | |
proposal.envelope | string | |
proposal.expires_at required | number | |
proposal.id required | string | |
proposal.items required | number | |
proposal.list | array of object | |
proposal.list[].ai required | boolean | |
proposal.list[].before | object | |
proposal.list[].entity | string | |
proposal.list[].fields | object | |
proposal.list[].id | string | |
proposal.list[].key required | string | |
proposal.list[].kind required | string | |
proposal.list[].side | object | null | |
proposal.rule_id required | string | |
proposal.run_id required | string | |
proposal.skipped required | number | |
proposal.state required | string | |
reason | string | |
rule_id required | string | |
run_as required | string | |
run_id required | string | |
source required | string | |
steps | array of object | |
steps[].duration_ms required | number | |
steps[].error | string | |
steps[].ids required | array of string | |
steps[].index required | number | |
steps[].items required | number | |
steps[].kind required | string | |
steps[].output required | string | |
steps[].status required | string | |
steps[].step_id required | string | |
steps[].tokens | number | |
steps_count required | number | |
task_id | string | |
test required | boolean | |
tokens required | number | |
undone_at required | number | null | |
writes required | number |
POST /api/v1/rules/{id}/runs/{run}/dismiss
Rule run dismiss · Token or session
→ 204: hides the run from the Inbox card on every device; another account's run answers 404 not_found
| Field | Type | Description |
|---|---|---|
id required | string | path |
run required | string | path |
POST /api/v1/rules/{id}/runs/{run}/undo
Rule run undo · Token or session
→ {restored, kept, not_undoable}: puts back what the run wrote that has not changed since, moves what it created to the Trash, stops a timer it started; notifications, deliveries and emails are listed in not_undoable; 409 already_undone the second time
| Field | Type | Description |
|---|---|---|
id required | string | path |
run required | string | path |
| Field | Type | Description |
|---|---|---|
kept required | number | |
not_undoable required | array of string | |
restored required | number |
POST /api/v1/rules/test
Rules test · Token or session
an unsaved draft {trigger, condition?, actions?, steps?, task_id?, call_ai?, workspace_id?} → {run, steps, writes, test}; validated like a create; nothing is written or logged; each step carries preview (its output, titles included, never stored) and the last one the planned changes; an AI step carries estimate and calls the model only with call_ai: true
| Field | Type | Description |
|---|---|---|
actions required | string | |
call_ai required | boolean | |
condition required | string | |
note_id required | string | |
project_id required | string | |
steps required | string | |
task_id required | string | |
trigger required | string | |
workspace_id required | string |
| Field | Type | Description |
|---|---|---|
device_run | object | null | |
device_run.at required | number | |
device_run.auto required | boolean | |
device_run.budget required | number | |
device_run.note | string | |
device_run.occurrence required | string | |
device_run.op required | string | |
device_run.rev required | string | |
device_run.rule required | string | |
device_run.run required | string | |
device_run.task | string | |
device_run.tokens required | number | |
run required | object | |
run.ai_auto required | boolean | |
run.at required | number | |
run.blocks | array of object | |
run.blocks[].date | string | |
run.blocks[].from | string | |
run.blocks[].ids | array of string | |
run.blocks[].kind required | string | |
run.blocks[].span | string | |
run.blocks[].to | string | |
run.changes required | string | |
run.depth required | number | |
run.device_id | string | |
run.duration_ms required | number | |
run.failed_step required | number | |
run.id required | number | |
run.note_id | string | |
run.occurrence required | string | |
run.outcome required | string | |
run.project_id | string | |
run.proposal | object | null | |
run.proposal.applied required | number | |
run.proposal.created_at required | number | |
run.proposal.encrypted required | boolean | |
run.proposal.envelope | string | |
run.proposal.expires_at required | number | |
run.proposal.id required | string | |
run.proposal.items required | number | |
run.proposal.list | array of object | |
run.proposal.rule_id required | string | |
run.proposal.run_id required | string | |
run.proposal.skipped required | number | |
run.proposal.state required | string | |
run.reason | string | |
run.rule_id required | string | |
run.run_as required | string | |
run.run_id required | string | |
run.source required | string | |
run.steps | array of object | |
run.steps[].duration_ms required | number | |
run.steps[].error | string | |
run.steps[].ids required | array of string | |
run.steps[].index required | number | |
run.steps[].items required | number | |
run.steps[].kind required | string | |
run.steps[].output required | string | |
run.steps[].status required | string | |
run.steps[].step_id required | string | |
run.steps[].tokens | number | |
run.steps_count required | number | |
run.task_id | string | |
run.test required | boolean | |
run.tokens required | number | |
run.undone_at required | number | null | |
run.writes required | number | |
steps required | array of object | |
steps[].changes | array of object | |
steps[].changes[].base | object | |
steps[].changes[].create | boolean | |
steps[].changes[].entity required | string | |
steps[].changes[].entityId required | string | |
steps[].changes[].patch required | object | |
steps[].duration_ms required | number | |
steps[].error | string | |
steps[].estimate | number | |
steps[].ids required | array of string | |
steps[].index required | number | |
steps[].items required | number | |
steps[].kind required | string | |
steps[].output required | string | |
steps[].preview | string | number | array of string | object | array of object | A preview of the step's output, by its type: text and a date are a string, lines a list of strings, a number a number, a task or a note {id, title}, a project {id, name}, tasks or notes a list of {id, title}. |
steps[].status required | string | |
steps[].step_id required | string | |
steps[].tokens | number | |
steps[].warning | object | null | |
steps[].warning.kind required | string | |
steps[].warning.message required | string | |
steps[].warning.reason required | string | |
steps[].warning.setting | string | |
steps[].warning.step required | string | |
test required | boolean | |
writes required | number |