Developer guide: 9. Alerts, subscriptions, reports and exports

Alerts, subscriptions, scheduled reports, exports and share links.

Embed
Preview of the card
<a href="https://lucidace.com/help/developer-guide-alerts-and-exports"><img src="https://lucidace.com/help/_api/public/orgs/af34862a-c837-4478-8335-0505efe40459/spaces/2f4b888b-c4e6-488b-81bd-6e838fb12d2e/pages/f683b261-6ee1-4a90-bc8f-c640084f44ba/social-card.svg?v=3e7ae33eec8b" alt="Developer guide: 9. Alerts, subscriptions, reports and exports" width="600" height="315"></a>

9. Alerts, subscriptions, reports and exports

9.1 Insight alerts

An alert watches a saved insight and notifies when a rule is crossed. Alerts run on a schedule; simulate first, then create.

Method and path

Scope

Purpose

POST {p}/insights/{id}/alerts/simulate

insight:read

Replay a condition over past data: {condition, days?(1-365, default 30)}

POST {p}/insights/{id}/alerts

insight:write

Create {name, condition, channels, check_interval?, flag_action?}

POST {p}/insights/{insight_id}/alerts/{alert_id}/check

insight:write

Evaluate now (answers the alert with last_checked_at, last_value)

GET {p}/alerts

insight:read

List alerts

PATCH/DELETE {p}/alerts/{id}

insight:write

PATCH {name?, condition?, channels?, check_interval?, enabled?, snoozed_until?, flag_action?}

GET {p}/alerts/{id}/events

insight:read

History: ?transitions=true for state changes only

lc -X POST "$P/insights/$INSIGHT_ID/alerts/simulate" -d '{"condition":{"op":"below","threshold":1},"days":14}' | jq '{fires, resolves}'
ALERT_ID=$(lc -X POST "$P/insights/$INSIGHT_ID/alerts" -d '{"name":"Signups dropped","condition":{"op":"below","threshold":1,"hysteresis":0},
  "check_interval":"hourly","channels":[{"type":"webhook"}]}' | jq -r .id)
lc -X POST "$P/insights/$INSIGHT_ID/alerts/$ALERT_ID/check" | jq '{state, last_checked_at, last_value}'

condition.op is above, below, pct_up, pct_down, delta_up, delta_down with threshold; optional hysteresis (stops flapping), series (index) and breakdown (a breakdown value). Funnels use {"kind":"funnel_conversion",...}, retention {"kind":"retention",...}, and a trend can use {"kind":"anomaly","sensitivity":"medium"}. check_interval is every_1m, every_5m, every_15m, hourly, daily (default), weekly or monthly. Simulate answers {fires, resolves, points:[{at, value, measure, firing, transition}]}. A new alert starts ok with last_checked_at: null until its first scheduled pass or a check call. It then moves ok to firing (notify once, emit alert.fired) and back (alert.resolved).

Channels (channels, at most 10, others are 400): {"type":"email","to":"a@b.com"}, {"type":"slack","url":"https://hooks.slack.com/..."}, {"type":"teams","url":...}, {"type":"discord","url":...} (chat URLs are checked, sealed at rest and never returned), {"type":"webhook"} (fires your project webhooks subscribed to alert.fired / alert.resolved; with none it sends nothing external, so it is the safe choice for tests), and {"type":"account_team",...} (the people on the account's relationships, 8.7). The creator always also gets an in-app notification. flag_action is {flag_id, environment, action} and changes a flag when the alert fires. See Alerts on insights.

9.2 Subscriptions and digests

A subscription sends an insight, a dashboard, a digest or a web report on a schedule by email or Slack. These deliver real messages: use your own address or a test Slack webhook.

Method and path

Scope

Purpose

GET/POST {p}/subscriptions

insight:read / insight:write

List; create

PATCH/DELETE {p}/subscriptions/{id}

insight:write

Update; delete

POST {p}/subscriptions/{id}/test

insight:write

Deliver now (204; 409 if switched off by a failure, 422 delivery failed (the destination or channel refused it))

POST {p}/subscriptions/schedule-preview

insight:read

`{cron

GET {p}/subscriptions/slack-channels

insight:write

Channels of the installed Slack app

GET {p}/digest/recommendations

insight:read

What the weekly digest would suggest

lc -X POST "$P/subscriptions/schedule-preview" -d '{"schedule":{"every":1,"unit":"week","time":"09:00","timezone":"Europe/Berlin","weekdays":[1]}}'
# {"next":["2026-11-16T08:00:00Z","2026-11-23T08:00:00Z","2026-11-30T08:00:00Z"]}
lc -X POST "$P/subscriptions" -d "{\"channel\":\"email\",\"insight_id\":\"$INSIGHT_ID\",\"recipients\":[\"me@your-company.test\"],\"cron\":\"0 9 * * 1\",\"title\":\"Weekly signups\"}"
lc -X POST "$P/subscriptions" -d '{"digest":true,"channel":"email","recipients":["me@your-company.test"],"schedule":{"every":1,"unit":"week","time":"09:00"}}'

Give exactly one subject: insight_id, dashboard_id, digest: true, web_report: true or prompt (a question the assistant answers each time, at most 2000 characters, with prompt_window_days 1-365). channel is email (up to 20 recipients, or one target) or slack (target = incoming-webhook URL stored sealed, or a slack_channel from the installed app). A Slack target must be an https://hooks.slack.com/services/..., /workflows/... or /triggers/... URL; anything else is 400 with errors[] field target. Schedule: cron (five fields, UTC, at most hourly) or schedule {every, unit: day|week|month, time: "HH:MM", timezone?, weekdays?: [1,5], monthly?}. Other fields: title, message (max 1000), format (table default or pdf), ai_summary, insight_ids (dashboard: 1-20), variables. Each newly added email recipient gets a notice mail. The digest and web report are described in Weekly digest. Note: a Slack subscription accepts any https URL as target (an example.com URL was accepted at create time), so validate the URL yourself.

9.3 Reports (inbox) and signals

Signals are findings from any source (your scripts, scouts, Lucida itself). Signals with the same group key land in one inbox report that people triage.

Method and path

Scope

Purpose

POST {p}/signals

insight:write

Raise a signal

GET {p}/reports

insight:read

Inbox: ?for_me=&assignee=<user id>&state=&priority=&source=&outcome=&limit=&cursor=

GET/PATCH {p}/reports/{id}

read / write

PATCH {state?, assignee?, outcome?, note?, snooze_until?, pr_url?}

POST {p}/reports/{id}/claim, /release

insight:write

Assign to yourself; release

POST {p}/reports/{id}/merge

insight:write

{into: <open report id>}

POST {p}/reports/{id}/follow-up

insight:write

{title, priority?} opens a new report after one is resolved (400 while it is still open)

lc -X POST "$P/signals" -d '{"source":"web","finding":"Pricing page bounce rate doubled","dedupe_key":"pricing-bounce",
  "priority":"P2","title":"Pricing bounce up","evidence":{"metric":"bounce_rate","from":0.31,"to":0.62},
  "suggested_action":"Check the pricing experiment","tags":["web"]}' | jq '{id, state, priority, title}'
lc -X PATCH "$P/reports/$REPORT_ID" -d '{"state":"resolved","outcome":"fixed","pr_url":"https://example.com/pr/1"}'

Signal body: source (friction, forms, flags, experiments, ingestion, web, or a scout name), finding, dedupe_key (same key while the report is open means the same signal, refreshed), optional title, group_key (defaults to dedupe_key), priority P0 to P4 (default P3; an open report keeps the most urgent), evidence, suggested_action, tags, account. It answers the report: {id, state, priority, title, sources, signal_count, tags, assignee_id, ...}. state is actionable, needs_input, snoozed, resolved or dismissed; resolved is final (409 on later edits). outcome is fixed, wont_fix, duplicate, not_reproducible or expected. Opening is capped per UTC day by report-settings (7.7): a 409 says the cap is reached.

9.4 Insight feed and notifications

The insight feed is a list of cards in the app (GET/POST {p}/insight-feed).

lc -X POST "$P/insight-feed" -d '{"kind":"note","title":"Pricing bounce up","body":"See the pricing dashboard","severity":"warning","dedupe_key":"pricing-bounce-feed","data":{"dashboard_id":"'$DASH_ID'"}}'
lc "$P/insight-feed?limit=10&include_dismissed=false"
lc -X POST "$P/insight-feed/$FEED_ID/dismiss"        # 204

severity is info, warning or critical; the same dedupe_key refreshes the card in place. GET needs insight:read; POST and dismiss need insight:write. Personal notifications (GET /v1/notifications, /unread-count, POST /v1/notifications/read-all, POST /v1/notifications/{id}/read) belong to a signed-in user: an account key gets 404 there.

9.5 Export schedules (batch exports)

Export schedules write a stream to your storage or warehouse on a timer. The full guide, with permissions per destination, is Batch exports. Reads need connector:read, writes connector:write.

Method and path

Purpose

GET/POST {p}/export-schedules

List ({data, next_cursor}); create. The body may set "enabled":false to create the schedule paused; a field the API does not know is 400 unknown or immutable field

GET/PATCH/DELETE {p}/export-schedules/{id}

PATCH only name, interval_secs, enabled

POST {p}/export-schedules/test

Check a destination without saving (writes and removes a probe object). 200 when it works; 422 problem+json when the destination refuses the probe, with the destination's message in detail

POST {p}/export-schedules/{id}/pause, /resume

Stop, restart

POST {p}/export-schedules/{id}/run

Run the next window now (202, schedule must be enabled)

POST {p}/export-schedules/{id}/backfills

{start_at, end_at}: export [start_at, end_at), split into one run per schedule interval (8 days on a daily schedule is 8 runs). Answers 201 with the first run and every run under runs. More than 366 days or 366 intervals, or start_at >= end_at, is 400. A window with no rows succeeds with 0 rows. A backfill selects rows by event time (timestamp), so it exports imported history; scheduled runs select by ingestion time, so late and back-dated events go out with the run that follows their arrival

GET {p}/export-schedules/{id}/runs, .../runs/{rid}

Runs (`?kind=scheduled

POST {p}/export-schedules/{id}/runs/{rid}/retry, /cancel

Retry a failed run; cancel a queued or running one

BODY='{"name":"events-s3","stream":"events","format":"jsonl.gz","interval_secs":3600,"chunk_secs":3600,
  "destination":{"kind":"s3","endpoint":"https://s3.us-east-1.amazonaws.com","bucket":"my-exports","region":"us-east-1","prefix":"lucida"},
  "credentials":{"dest":{"access_key":"AKIA...","secret_key":"..."}},"options":{}}'
lc -X POST "$P/export-schedules/test" -d "$BODY"      # 422 when the destination refuses the probe
lc -X POST "$P/export-schedules" -d "$BODY"

Cloudflare in front of lucidace.com replaces the body of any origin 502 or 504 with the plain text error code: 502, so on the public host read the status code, not the body (the service itself sends problem+json).

Required: name, stream, format, destination, interval_secs, chunk_secs, credentials, options (send {} if unused). stream is events, persons, sessions, groups, source_rows, query or replays; format is jsonl.gz or parquet. A bad body is 422 invalid export schedule with the reason. warehouse ({kind, params}) adds a load step. Options include include_events, exclude_events, key_template, max_file_mb, compression, manifest, consent_categories, consent_missing, apply_deletes, sensitive, query. Credentials are sealed on save and never returned: to rotate one, delete and recreate the schedule. Destination errors (the 422 of test, a run's error) show only the S3 Code: Message (for example AccessDenied: Access Denied), never the raw XML, and anything shaped like an AWS access key id is replaced by [redacted]. Delivery is at-least-once, so load idempotently. A failing schedule shows as export_failing in pipeline health.

9.6 Recommendations (recs)

Item-to-item and popularity recommendations for product pages, served through placements.

Method and path

Scope

Purpose

GET/PUT {p}/recs/settings

experiment:read / experiment:write

`{enabled, catalog_source: events

POST {p}/recs/items/feed

experiment:write

Upload a catalog: `{format: csv

GET {p}/recs/items

experiment:read

?q=&limit=&cursor=

PUT/DELETE {p}/recs/items/{item_id}

experiment:write

{name, url, image_url, price, category, in_stock, attributes}

GET/POST {p}/recs/placements, GET/PATCH/DELETE .../{id}, GET .../{id}/stats

read / write

Placements `{key, name, strategy, strategies?, limit, fallback: popular

POST {p}/recs/build

experiment:write

Refresh the catalog and rebuild every placement's lists

GET {p}/recs/recommendations

experiment:read

?placement=&item_id=&distinct_id=&strategy=&limit= returns {placement, strategy, items}

strategy is popular, trending, viewed_with, bought_with or recently_viewed. Build runs after you configure settings and send view and purchase events with the item id property; with no behaviour data the lists stay empty (items: []) even though the catalog is loaded.

lc -X PUT "$P/recs/settings" -d '{"enabled":true,"catalog_source":"feed","item_id_property":"item_id","view_event":"product_viewed","purchase_event":"purchase","lookback_days":30}'
lc -X POST "$P/recs/items/feed" -d '{"format":"json","data":"[{\"item_id\":\"sku-1\",\"name\":\"Mug\",\"price\":[9.5](/help/developer-guide-alerts-and-exports#95-export-schedules-batch-exports),\"category\":\"home\"}]"}'
lc -X POST "$P/recs/placements" -d '{"key":"pdp-similar","name":"Product page","strategy":"popular","limit":4,"fallback":"popular","exclude_anchor":true}'
lc -X POST "$P/recs/build" && lc "$P/recs/recommendations?placement=pdp-similar&item_id=sku-1"
Updated