Developer guide: 7. Insights, dashboards and notebooks

Saving queries as insights, dashboards, notebooks and sharing them.

Embed
Preview of the card
<a href="https://lucidace.com/help/developer-guide-insights-dashboards-and-notebooks"><img src="https://lucidace.com/help/_api/public/orgs/af34862a-c837-4478-8335-0505efe40459/spaces/2f4b888b-c4e6-488b-81bd-6e838fb12d2e/pages/3f645e6c-cf15-46d2-942c-67731522946f/social-card.svg?v=3e7ae33eec8b" alt="Developer guide: 7. Insights, dashboards and notebooks" width="600" height="315"></a>

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

GET {p}/insights

insight:read

List: `?q=&tag=&folder=&folder_id=<id

POST {p}/insights

insight:write

Create {name, query, description?, tags?, folder?, settings?}

GET/PATCH/DELETE {p}/insights/{id}

read / write

PATCH takes any of name, description, query, settings, tags, folder, favorited

GET {p}/insights/{id}/versions

insight:read

Version history (each save of query bumps version)

GET {p}/insights/{id}/chart.svg

insight:read

Server-rendered chart: `?mode=light

GET/POST {p}/insights/{id}/comments

insight:read

Comments (see 7.7)

GET/POST {p}/insights/{id}/shares, DELETE .../shares/{share_id}

read / write

Share links (7.5)

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

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 series

A 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

GET/POST {p}/folders

dashboard:read / dashboard:write

List; create {name, parent_id?}

PATCH/DELETE {p}/folders/{id}

dashboard:write

{name?, parent_id?} (null moves to the top level; 409 for a move into itself); delete

PUT {p}/objects/{rtype}/{rid}/folder

write on the object

{folder_id} (null takes it out). rtype: dashboard, insight, folder, flag, experiment, cohort, notebook, action, sql_view, ...

GET/PUT {p}/objects/{rtype}/{rid}/access

Read and set grants (restrict an object)

GET {p}/objects/{rtype}/{rid}/access/report

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

GET/POST {p}/dashboards

dashboard:read / dashboard:write

List; create {name, description?, filters?, pinned?, tags?}

GET/PATCH/DELETE {p}/dashboards/{id}

read / write

Read with tiles; update; delete

POST {p}/dashboards/bulk-delete

dashboard:write

{ids:[1-100], delete_orphan_insights?}

POST {p}/dashboards/{id}/duplicate

dashboard:write

{name?, duplicate_insights?} (default shares the insights)

GET {p}/dashboards/{id}/results

dashboard:read

Run every tile: ?refresh=&variables=&tile=<tile_id>

POST {p}/dashboards/{id}/tiles

dashboard:write

Add a tile

PATCH/DELETE {p}/dashboards/{id}/tiles/{tile_id}

dashboard:write

Update or remove

POST {p}/dashboards/{id}/tiles/{tile_id}/copy, .../move

dashboard:write

Copy and move both need {target_dashboard_id} in the body

GET {p}/dashboards/{id}/tiles/{tile_id}/usage

dashboard:read

Which dashboards use the tile's insight

GET/POST {p}/dashboards/{id}/comments

dashboard:read

Comments

GET/POST {p}/dashboards/{id}/shares, DELETE .../shares/{share_id}

read / write

Share links (7.5)

GET {p}/dashboard-templates

dashboard:read

{data, next_cursor}: built-ins (ids like builtin:product-health) and your own

POST {p}/dashboards/{id}/save-as-template

dashboard:write

`{name, description?, scope?: project

POST {p}/dashboard-templates/{id}/instantiate

dashboard:write

{name?, flag_key?} makes a new dashboard with copies of the insights; tiles with relative dates (-7d, now) are accepted

POST {p}/dashboard-templates/{id}/copy

dashboard:write

{target_project_id} (same org)

PATCH/DELETE {p}/dashboard-templates/{id}

dashboard:write

{name?, description?, scope?, tags?}

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

GET/POST/DELETE/PATCH {p}/quick-filters[/{id}]

insight:read / insight:write

Saved filter presets: `{surface: dashboard

GET/POST/PATCH/DELETE {p}/column-layouts[/{id}]

insight:read

Saved table layouts: `{table_kind: events

GET/PUT/DELETE {p}/chart-theme

insight:read / admin

Chart palette: PUT {light:[8 colours], dark:[8 colours]}; 400 if not exactly 8 per mode or a colour is too faint, malformed or repeated

GET/POST {p}/annotations, PATCH/DELETE .../{id}

insight:read / insight:write

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).

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

POST {p}/insights/{id}/shares

insight:write

Create

POST {p}/dashboards/{id}/shares

dashboard:write

Create

POST {p}/notebooks/{id}/shares

notebook:write

Create

`GET {p}/{insights

dashboards

notebooks}/{id}/shares`

`DELETE {p}/{insights

dashboards

notebooks}/{id}/shares/{share_id}`

GET/POST {p}/shares/{share_id}/passwords, DELETE .../{password_id}

insight:read

Extra passwords for one share: {password?(8-200, generated if omitted), note?(max 200)}; the password value comes back once, in the secret field of the create response; 409 at 10 live passwords

GET /v1/public/{kind}/{token}

none

Read a shared view. kind: insights, dashboards, notebooks, heatmaps, replays, replay-playlists, web. Query: refresh, grant, filters

POST /v1/public/{kind}/{token}/unlock

none

{password} returns {grant, expires_at} (24 h)

GET /v1/embed/{kind}/{token}

none

The embeddable HTML view (insights, dashboards, notebooks, replays, web)

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, title

Create 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

GET/POST {p}/notebooks

notebook:read / notebook:write

List; create {title, blocks?}

GET/PATCH/DELETE {p}/notebooks/{id}

read / write

PATCH {title?, blocks?, expected_version?}

GET {p}/notebooks/{id}/versions

notebook:read

History

GET/POST {p}/notebooks/{id}/shares, DELETE .../{share_id}

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

GET/POST {p}/insights/{id}/comments, GET/POST {p}/dashboards/{id}/comments

read

POST {body, mentions?:[user ids, max 20]}; @member and @team tokens in body also notify

DELETE {p}/comments/{id}

insight:read

Delete a comment

GET {p}/history/{resource_type}/{resource_id}

insight:read

Change history of one resource, newest first: ?limit=&cursor=. resource_type is the audit name (flag, cohort, dashboard, insight, ...)

GET {p}/activity

admin

Project activity log: `?since=&until=&user_id=&actor_kind=user

GET {p}/report-settings, PUT {p}/report-settings

insight:read / settings:write

Inbox report cap: PUT {daily_cap: 1-1000}; read returns {daily_cap, opened_today, resets_at}

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}.

Updated