Developer guide: 12. In-product experiences
Guides, tours, announcements, early access and other in-product experiences over the API.
12. In-product experiences
Guides show tours, banners, checklists and other in-app UI. Interventions fire a payload to the SDK or a webhook when an event happens. Early-access programs let people opt in to a flagged feature. The toolbar is the in-page editor. Experience is the satisfaction score.
12.1 Guides
Route | Scope | Purpose |
|---|---|---|
|
| list |
|
| create (a draft) |
`GET | PUT | DELETE {p}/guides/{id}` |
|
| publish: |
|
| |
|
| |
|
| |
|
| |
|
| |
| shown, completed, dismissed people, daily series | |
| per account | |
|
| |
| holdout and A/B arms vs a goal event | |
| why a person does or does not see it: | |
| what references it | |
| history | |
`GET | PUT {p}/settings/guides` |
|
`GET | POST {p}/guide-themes | PUT |
`GET | POST {p}/guide-templates |
Body: name, kind (exactly tooltip, modal, banner, tour, checklist, resource_center, announcement, hotspot, beacon, badge, launcher, slideout, inline, carousel, form_validation), steps, targeting, appearance, tags (max 20, 1-50 chars), folder (1-100 chars).
Kinds
tooltip,modal,banner,announcement,hotspot,beacon,badge,slideout,inlinehave exactly one step (else400); the others take many.Every step needs a
titleor abody(400otherwise). Steps of kindtooltip,tour,hotspot,beacon,badgeandinlinealso need a non-emptyselector(400 step N: tour steps need a selector, at most 500 characters).Step:
{id, title?, body?, selector? (required fortour,tooltip,hotspot,beacon,badgeandinlinesteps), placement? (top|bottom|left|right), fallback_selectors? (max 5), wait_ms? (0-15000), advance? (button|click|input), auto_close_s? (1-600), confetti?, native_id?, url?, buttons?, branch?, complete_on?, i18n?, media?, automation?, validation?}. Button:{label, action, url?, event?, goto?, snooze_hours?}withactionone ofnext,back,dismiss,link,event,start_tour,snooze. Branch:{key, op (eq|neq|contains|exists|element_present|element_absent|flag_on|flag_off), value?, goto};gotoonly goes forward.automation:{action: click|focus|fill, selector, value}(fillneeds a constantvalueof 1-200 chars).validationrules (form_validation):required,email,url,phone,regex,min_length,max_length,number.Targeting keys:
url,url_match(exact|contains|regex),flag_key,flag_variant,sample_pct,wait_days,delay_seconds,devices(desktop|mobile|tablet),cohort_ids,exclude_cohort_ids,group_filters,seen_guides,not_seen_guides,schedule({start,end}RFC 3339,days0-6 Sunday=0,hours:{from 0-23,to 1-24},timezoneIANA),frequency({max_views 1-1000, per_days 1-365}),goal({event, window_days 1-90}),holdout_pct(0-90),holdout_scope(group|variant),ab_group,ab_weight(1-1000),qa_users(distinct ids who see a draft),pacing(asap|even;evenneedsschedule.startandend).appearance:{tokens, font_family, theme_id, theme_mode (auto|light|dark), dark:{tokens}, launcher_label, side (left|right), custom_css}.
THEME=$(lc -X POST "$P/guide-themes" -d '{"name":"Brand","tokens":{"background":"#ffffff","text":"#111111","accent":"#0a7","radius":8}}' | jq -r .id)
GUIDE=$(lc -X POST "$P/guides" -d '{"name":"Welcome tour","kind":"tour","folder":"Onboarding","tags":["onboarding"],
"steps":[{"id":"s1","title":"Welcome","body":"Start here","selector":"#nav","placement":"bottom","buttons":[{"label":"Next","action":"next"},{"label":"Skip","action":"dismiss"}]},
{"id":"s2","title":"Create a report","body":"Click new","selector":"#new-report","placement":"right","advance":"click","buttons":[{"label":"Done","action":"dismiss"}]}],
"targeting":{"url":"/app","url_match":"contains","sample_pct":100,"frequency":{"max_views":3,"per_days":7},"goal":{"event":"report_created","window_days":7},"qa_users":["qa1"]},
"appearance":{"theme_id":"'$THEME'","theme_mode":"auto"}}' | jq -r .id)
lc "$P/guides/$GUIDE/reach"
lc -X POST "$P/guides/$GUIDE/start" # status: live
lc "$P/guides/$GUIDE/results"
lc -X POST "$P/guides/$GUIDE/stop" # status: pausedDelivery to browsers: GET $LUCIDA_CAPTURE/v1/guides?api_key=$PK&distinct_id=<id>&url=<page url> returns {guides:[{id, name, kind, steps, conditions, ...}]} for live guides that match (draft guides show only to qa_users). The route does not filter strictly by page: the url is a hint, and the SDK checks the page rules again in the browser, so a response can include guides for other URLs. A guide started in the API reaches visitors within about 15 seconds (cache refresh). SDKs report progress to POST /v1/guide-state; POST /v1/guides/answer serves resource-center AI answers. PUT replaces the whole guide: send every field (read, change, write back). Events the SDK sends are $guide_*; use them in insights.
12.2 Interventions
An intervention fires when a matching event arrives for a person and delivers payload to their SDK (server-sent events), to webhooks, or both.
Route | Scope | Purpose |
|---|---|---|
`GET | POST {p}/interventions` |
|
`GET | PUT | DELETE {p}/interventions/{id}` |
|
|
|
|
| last 35 days of fires |
| poll |
Body: name (required), description, enabled, steps (up to 20 action steps, any one matches), action_id (an existing action instead of or with steps), payload (object, at most 8 KB), cap_per_user (1-1000, default 1), cap_window_secs (60 s to 30 days, default 1 day), cooldown_secs (0-30 days), deliver_sdk, deliver_webhook, ttl_secs (10 s to 1 day, default 300). With neither steps nor action_id the answer is 400 give steps or an action_id.
An action step: {event?, selector?, tag_name?, text?, text_match?, href?, href_match?, url?, url_match?, screen_name?, screen_name_match?, properties?}. properties is a nested filter group {"and":[{key, type, op, value}]} (or or), with type event or person. Unknown step fields are 400 invalid steps.
IV=$(lc -X POST "$P/interventions" -d '{"name":"Rescue checkout","description":"help after checkout error",
"steps":[{"event":"checkout_error","properties":{"and":[{"key":"code","type":"event","op":"eq","value":"card_declined"}]}}],
"payload":{"offer":"chat"},"cap_per_user":1,"cap_window_secs":86400,"deliver_sdk":true,"deliver_webhook":false,"ttl_secs":300,"enabled":true}' | jq -r .id)
lc -X POST "$P/interventions/$IV/test" -d '{"distinct_id":"qa1"}'
lc "$P/interventions/fires?intervention_id=$IV" | jq '.data[0]'
curl -sS "$LUCIDA_CAPTURE/v1/interventions?api_key=$PK&distinct_id=qa1"The worker only fires for events younger than 10 minutes. For webhooks subscribe an endpoint to intervention.fired (section on webhooks) and dedupe on fire_id.
12.3 Early-access programs
An early-access program wraps an existing flag so people can opt in. Scope flag:write for writes.
Route | Purpose |
|---|---|
`GET | POST {p}/early-access` |
`PATCH | DELETE {p}/early-access/{id}` |
|
|
|
|
|
|
| what the SDK lists: |
Create body: flag_key (an existing flag, required), name, description, stage (draft, concept, alpha, beta, ga; default beta; a draft is hidden from the SDK), payload (object shown by widgets), documentation_url.
EA=$(lc -X POST "$P/early-access" -d '{"flag_key":"cta-color","name":"New editor","description":"Try the new editor","stage":"beta","documentation_url":"https://example.com/docs/editor","payload":{"cta":"Join beta"}}' | jq -r .id)
lc -X POST "$P/early-access/$EA/enrol" -d '{"distinct_id":"user_123","enrolled":true}'
lc "$P/early-access/$EA/enrolled"
lc -X PATCH "$P/early-access/$EA" -d '{"stage":"ga"}'12.4 Toolbar, link templates, experience
Toolbar:
PUT {p}/toolbar/origins(admin){"origins":["https://example.com"]}replaces the allowed origins.POST {p}/toolbar/session{"origin"}mints a short-lived token{token, scopes, expires_at}for an allowed origin (a different origin is rejected); scopes areactions:write,heatmaps:read,flags:read,guides:write,experiments:write.GET {p}/toolbar/launch?url=redirects to the page with?__lc_toolbar=<token>; the page callsPOST /v1/toolbar/exchange{origin, token}once. See Chrome extension.Link templates:
GET|POST {p}/link-templates(write needsadmin),DELETE .../{id}. Body{kind, object_type (flag|experiment), title, url_template};url_templateis an http(s) URL with{key},{project},{name}; it is expanded on every flag or experiment (GET .../flags/{id}/linksreturnstemplated).Experience score:
GET {p}/experience?by=&dim=&steps=&from=&to=plus the same segment filters as heatmaps (channel,utm_source,country,url, ...).byissummary(default),trend,page,segment(withdim:channel,device_type,country,browser,os,referring_domain) orfunnel(withsteps, 2-10 ordered events).GET|PUT|DELETE {p}/experience/weightsread, set and reset the score weights (defaults:rage15,not_found15,bounce20,dead6,failed_action12,form_abandon12,backtrack6,speed_browsing10,cap3,happy_from80,unhappy_below50,custom[]).