Alerts on insights

Create an alert on a trend, funnel or retention insight, replay it with simulate, pick a check interval and notification channels, and see when it fires.

Embed
Preview of the card
<a href="https://lucidace.com/help/alerts"><img src="https://lucidace.com/help/_api/public/orgs/af34862a-c837-4478-8335-0505efe40459/spaces/2f4b888b-c4e6-488b-81bd-6e838fb12d2e/pages/d19407d3-e3ae-483b-bffe-7898452826ef/social-card.svg?v=3e7ae33eec8b" alt="Alerts on insights" width="600" height="315"></a>

An alert watches a saved insight and tells you when its value crosses a rule. Authenticate as in Queries and insights over the API; the schemas are in GET /v1/openapi.json.

Create one

curl -X POST https://<your-host>/v1/projects/$PROJECT/insights/$INSIGHT/alerts \
  -H "Authorization: Bearer $LUCIDA_KEY" -H "Content-Type: application/json" \
  -d '{"name": "Signups dropped", "condition": {"op": "below", "threshold": 100},
       "check_interval": "hourly",
       "channels": [{"type": "email", "to": "team@example.com"}]}'

condition.op is one of above, below, pct_up, pct_down, delta_up, delta_down (percent or absolute change from the previous point). An unknown op is a 400 that names the valid ones. Funnels use {"kind": "funnel_conversion", ...}, retention {"kind": "retention", ...}, and any trend can use {"kind": "anomaly", "sensitivity": "medium"}. hysteresis keeps a value hovering at the threshold from flapping.

Simulate before you save

POST /v1/projects/$PROJECT/insights/$INSIGHT/alerts/simulate with {"condition": {...}, "days": 30} replays the rule over the last 1 to 365 days and returns every point with its state, plus fires and resolves: each fire is one notification you would have received. Use it to tune the threshold. The llm detector is not replayed.

Check intervals

check_interval is one of every_1m, every_5m, every_15m, hourly, daily, weekly, monthly (default daily). Alerts are evaluated on a schedule: a new alert starts as ok with last_checked_at empty until the first scheduled pass reaches it, which for a coarse interval can take up to that interval. The every_1m and every_5m alerts run on a faster tick. To check an alert right away, use Check now in the alerts dialog or POST /v1/projects/$PROJECT/insights/$INSIGHT/alerts/{id}/check (write access; an alert on another insight or project is a 404). It runs the same evaluation as the schedule, so it updates state and last_checked_at, records history, and notifies on a state change (respecting snooze), then returns the updated alert.

Channels

channels is a list: {"type":"email","to":"..."}, {"type":"slack","url":"..."} or {"type":"webhook",...}. Slack URLs are sealed at rest and never returned. The alert's creator also gets a notification in the notification center.

Firing

When the value crosses the rule the alert moves from ok to firing, notifies every channel once and emits alert.fired; when it recovers it emits alert.resolved and notifies again. It does not repeat while it stays in the same state. History is at GET /v1/projects/$PROJECT/alerts/{id}/events (add ?transitions=true for only the state changes). PATCH and DELETE on /v1/projects/$PROJECT/alerts/{id} change or remove it.

Updated