Developer guide: 7. Insights, dashboards and notebooks
Saving queries as insights, dashboards, notebooks and sharing them.
7. Insights, dashboards and notebooks
An insight is a saved query. A dashboard arranges insights as tiles. A notebook mixes text, insights, replays and queries. All three can be shared by link and embedded.
7.1 Insights
Method and path | Scope | Purpose |
|---|---|---|
|
| List: `?q=&tag=&folder=&folder_id=<id |
|
| Create |
| read / write | PATCH takes any of |
|
| Version history (each save of |
|
| Server-rendered chart: `?mode=light |
|
| Comments (see 7.7) |
| read / write | Share links (7.5) |
| Alerts (9.1) |
INSIGHT_ID=$(lc -X POST "$P/insights" -d '{"name":"Daily signups","description":"dau of signed_up","tags":["growth"],
"query":{"kind":"trends","date_range":{"from":"-30d","to":"now"},"interval":"day","series":[{"source":{"type":"event","name":"signed_up"},"math":"dau"}]},
"settings":{"display":"line"}}' | jq -r .id)
lc -X PATCH "$P/insights/$INSIGHT_ID" -d '{"name":"Daily signups (dau)","tags":["growth","guide"]}' | jq '{name, version}'
lc "$P/insights/$INSIGHT_ID/chart.svg?mode=dark" -o chart.svg # image/svg+xml, 422 if the result is not a time seriesA saved query is a JSON object stored as jsonb: key order is not preserved, so compare queries by value, not by text. Create stores the query as sent after validating it; it adds no default values, and relative dates such as -30d stay relative. Stored JSON comes back with object keys in storage order, not the order you sent. To tell a real change from key order, compare the ETag header: GET, POST and PATCH of an insight or a dashboard return one (a hash of the key-sorted JSON), and GET with If-None-Match: <etag> answers 304 when nothing changed. GET ...?canonical=1 returns the body with keys sorted at every level.
The insight object has id, name, description, kind, query, settings, tags, folder, folder_id, version, favorited, created_by, created_at, updated_at. kind is taken from the query. settings is display-only, an object of at most 16 KB (display, overlay, chart, retention, funnel options). favorited applies to the calling user and is ignored for API keys. The insight keeps relative dates and re-resolves them on every run. Run an insight by reading its query and posting it to {p}/query.
7.2 Folders and object access
Dashboards, insights, flags, experiments, cohorts, notebooks, actions and SQL views can sit in nestable folders and be restricted to chosen users.
Method and path | Scope | Purpose |
|---|---|---|
|
| List; create |
|
|
|
| write on the object |
|
| Read and set grants (restrict an object) | |
| Who can see it |
FOLDER_ID=$(lc -X POST "$P/folders" -d '{"name":"Growth"}' | jq -r .id)
lc -X PUT "$P/objects/insight/$INSIGHT_ID/folder" -d "{\"folder_id\":\"$FOLDER_ID\"}"
lc "$P/insights?folder_id=$FOLDER_ID" | jq '.data | length'Use PUT .../folder to put any object in a folder. For an insight, PATCH {p}/insights/{id} also accepts folder_id (a folder id, or null to take it out; an unknown folder id is 404). The folder string on an insight is only a free-text label and does not move it. A restricted object answers 404 to everyone without a grant.
7.3 Dashboards, tiles, results, templates
Method and path | Scope | Purpose |
|---|---|---|
|
| List; create |
| read / write | Read with tiles; update; delete |
|
|
|
|
|
|
|
| Run every tile: |
|
| Add a tile |
|
| Update or remove |
|
| Copy and move both need |
|
| Which dashboards use the tile's insight |
|
| Comments |
| read / write | Share links (7.5) |
|
|
|
|
| `{name, description?, scope?: project |
|
|
|
|
|
|
|
|
|
DASH_ID=$(lc -X POST "$P/dashboards" -d '{"name":"Growth","description":"weekly view","tags":["growth"],
"filters":{"date_range":{"from":"-14d","to":"now"}}}' | jq -r .id)
TILE_ID=$(lc -X POST "$P/dashboards/$DASH_ID/tiles" -d "{\"insight_id\":\"$INSIGHT_ID\",\"layout\":{\"x\":0,\"y\":0,\"w\":6,\"h\":4}}" | jq -r .id)
lc -X POST "$P/dashboards/$DASH_ID/tiles" -d '{"kind":"text","text_body":"## Notes\nWeekly review"}'
lc "$P/dashboards/$DASH_ID/results" | jq '.tiles[] | {tile_id, error, rows: (.result.rows | length)}'Tile kind is insight, text, button or widget (inferred from insight_id / text_body when absent). config holds a button {label, url, style?, placement?, transparent?} or widget {widget, limit?}. overrides per tile: {date_range?, interval?, breakdown?, filters?, special_filters?, filter_test_accounts?}; ignore_dashboard_filters opts the tile out. position defaults to the end. Dashboard filters: {date_range?, filters?: <property group>, variables?: [{name, kind, default}]} apply to every insight tile; tiles opt into variables through layout.variables. Results: {dashboard_id, tiles:[{tile_id, insight_id, result:{columns, rows, meta}, error, notes}]}; a tile that fails carries its own error.
7.4 Dashboard and insight helpers
Method and path | Scope | Purpose |
|---|---|---|
|
| Saved filter presets: `{surface: dashboard |
|
| Saved table layouts: `{table_kind: events |
|
| Chart palette: |
|
| Dated notes on charts |
lc -X POST "$P/quick-filters" -d '{"surface":"dashboard","name":"Pro only","filters":{"and":[{"key":"plan","type":"person","op":"eq","value":"pro"}]}}'
lc -X POST "$P/column-layouts" -d '{"table_kind":"persons","name":"Compact","columns":[{"key":"email","visible":true,"width":240},{"key":"plan","visible":true}],"sort":{"key":"created_at","dir":"desc"},"shared":true}'
lc -X PUT "$P/chart-theme" -d '{"light":["#1d4ed8","#b91c1c","#15803d","#7e22ce","#c2410c","#0e7490","#a16207","#be185d"],
"dark":["#60a5fa","#f87171","#4ade80","#c084fc","#fb923c","#22d3ee","#facc15","#f472b6"]}'
lc -X POST "$P/annotations" -d '{"content":"Launched pricing v2","at":"2026-11-05T09:00:00Z","emoji":"🚀","scope":"project"}'
lc "$P/annotations?from=2026-11-01T00:00:00Z&to=2026-11-30T00:00:00Z"Annotation scope: project (default), organization, insight or dashboard (the last two need scope_id). emoji is one emoji of at most 8 characters, no letters or digits; "" clears it on PATCH. GET {p}/chart-theme answers {source, theme} (source is null when the default applies, project when set).
7.5 Share links, public views and embeds
Share an insight, dashboard or notebook with someone who has no account. Heatmaps, replays, replay playlists and web reports share the same way from their own areas.
Method and path | Scope | Purpose |
|---|---|---|
|
| Create |
|
| Create |
|
| Create |
`GET {p}/{insights | dashboards | notebooks}/{id}/shares` |
`DELETE {p}/{insights | dashboards | notebooks}/{id}/shares/{share_id}` |
|
| Extra passwords for one share: |
| none | Read a shared view. |
| none |
|
| none | The embeddable HTML view ( |
SHARE=$(lc -X POST "$P/insights/$INSIGHT_ID/shares" -d '{"expires_in_days":7,
"options":{"hide_branding":true,"theme":"dark","show_rows":false},"allowed_origins":["https://example.com"]}')
echo "$SHARE" | jq '{id, url, expires_at, password_protected}' # url and token appear only now
TOKEN=$(echo "$SHARE" | jq -r .token) # lc_shr_...
curl -sS "$LUCIDA_API/v1/public/insights/$TOKEN" | jq 'keys' # branding, computed_at, kind, options, panels, titleCreate body, all optional: expires_in_days (default 7, at most 90), never_expires (needs the org setting permanent_shares, 403 otherwise), password (8-200 characters, stored as an argon2id hash), allowed_origins (origins allowed to frame the embed; empty allows any, and the embed sends frame-ancestors), options (hide_branding, hide_legend, show_queries, show_recordings, show_rows, viewer_filters booleans, lock_filters object, theme string). The answer has id, resource_type, resource_id, expires_at, revoked_at, allowed_origins, password_protected, options, created_at, token, url (https://<host>/share/<kind>/<token>).
A password-protected share answers 403 this link is password-protected until you unlock it, then send the grant as ?grant=. A wrong password and an unknown token both answer 404, and every attempt counts against the token and the caller's address. A revoked or expired link answers 404. Public views cache results; they never expose other project data. See Share links and exports.
7.6 Notebooks
Method and path | Scope | Purpose |
|---|---|---|
|
| List; create |
| read / write | PATCH |
|
| History |
| read / write | Share links (7.5) |
NB=$(lc -X POST "$P/notebooks" -d "{\"title\":\"Signup review\",\"blocks\":[
{\"type\":\"markdown\",\"text\":\"# Signups\"},{\"type\":\"insight\",\"insight_id\":\"$INSIGHT_ID\"}]}" | jq -r .id)
lc -X PATCH "$P/notebooks/$NB" -d '{"title":"Signup review v2","expected_version":1}' | jq '{title, version}'A stale expected_version answers 409 with the detail the notebook changed since version <n>; reload it and apply your edit again.
Block type values: markdown{text}, insight{insight_id}, insight_inline{query}, replay{session_id}, playlist{playlist_id}, query{language,text}, persons and events{filters?,limit?}, groups{group_type}, cohort{cohort_id}, flag{flag_key}, image{url,alt}, link{url}, latex{text}, mermaid{text}, table{rows}; each takes an optional title; at most 200 blocks. The answer is {id, title, content:{blocks:[...]}, version, ...} and every block gets an id. Send expected_version (the version you loaded) to avoid overwriting a concurrent edit: a mismatch is 409.
7.7 Comments, history, activity, report settings
Method and path | Scope | Purpose |
|---|---|---|
| read |
|
|
| Delete a comment |
|
| Change history of one resource, newest first: |
|
| Project activity log: `?since=&until=&user_id=&actor_kind=user |
|
| Inbox report cap: |
History and activity rows are {id, seq, org_id, project_id, actor_user_id, actor_kind, action, resource_type, resource_id, detail, ip, created_at}.