# Create Watcher

```
POST 
/v1/watchers
```

Create a watcher: WHEN (`triggers`) x IF (an optional `check` query and a `condition`) x THEN (ordered `actions`).

Each trigger, condition and action is `{kind, params}`; `GET /v1/watcher-kinds` lists every kind with its params schema. Kinds are open strings; tolerate a kind you do not know. Later actions read earlier ones' outputs as `{{<id>.<output>}}`.

It runs as the caller, with the caller's own access, re-checked on every run, and the check runs once now: a check that errors refuses the write. Each member a `notify` names is evaluated as themselves and told only what holds on the rows they can see. Refused: a kind or a template token that is not listed, more than 20 members or 8 actions, an address in `to`, a schedule more often than every 5 minutes, `compare` without `{{window_end}}` in the SQL, and, while the account's memory is off, an action whose kind needs it (`needsMemory`; 403 `memory_off`). Every other kind is written and runs with memory off. Takes a creator or an admin; an API key needs `admin` access.

A `snapshot` takes a `capture`: Playwright source, one statement per line (`await page.goto('?f.region={region}');`), or the same as `captureRecipe` steps. It is parsed, never run as code, and stored as `captureRecipe`; a read returns `capturePlaywright` beside it. A `{column}` binds the row the check fired on: one picture per fired row, at most 5. A column the check does not return is refused here, with the columns it does return. A picture sent to a destination (an e-mail list, Slack, a webhook) shows what you see to everyone there, so it takes an owner who may share that dashboard.

`warnings`: one sentence per dataset the check reads through the calendar (`CURRENT_DATE`, `NOW()`, or a 1d / 7d / 28d / mtd / qtd window) that nothing refreshes, when that dataset's age is measured: its newest date, past, today or ahead, and that what this watcher sees change there is the calendar, not new data. A check over `{{since}}` reads the days since its last run, so its window is not read as the calendar: over a dataset nothing refreshes, its sentence says it fires when new days are loaded there (an upload, a refresh) and names that dataset's newest date. A dataset whose freshness could not be read gets a sentence saying so.

## Request[​](#request "Direct link to request")

## Responses[​](#responses "Direct link to Responses")

* 201
* 404
* 422

Successful Response

Not found

Validation Error
