Developer guide: 2. Organizations and projects
Orgs, creating projects, project routes, org administration and the routes only a session can call.
2. Organizations and projects
An org holds people, billing and projects. A project (a "site") holds all data and is the unit of keys, events, flags and settings. The usual agent flow: pick or create an org, create a project, keep PROJECT_ID, PK, SK.
Orgs: what an account key can do
Method and path | Scope | Purpose |
|---|---|---|
|
| orgs you belong to (and, for a restricted key, only its |
|
| create an org, |
|
|
|
|
|
|
|
|
|
| session only | any of those fields; an account key gets |
|
|
|
|
| projects in the org ( |
|
| create a project (below) |
|
| org-defined custom field definitions (writes are session only) |
lc "$LUCIDA_API/v1/orgs" | jq '.data[] | {id, name, plan}'
ORG_ID=$(lc "$LUCIDA_API/v1/orgs" | jq -r '.data[0].id') # or create one:
# ORG_ID=$(lc -X POST "$LUCIDA_API/v1/orgs" -d '{"name":"Acme Dev"}' | jq -r .id)
lc "$LUCIDA_API/v1/orgs/$ORG_ID/settings" | jq . # read; writing settings needs a sessionSafe provisioning. Add ?dry_run=true to POST /v1/orgs, POST /v1/orgs/{org_id}/projects, POST /v1/projects/{project_id}/keys and POST /v1/me/keys: everything is validated (limits, slug conflicts, scopes) and you get 200 with the would-be object, "dry_run": true, no ids and no secrets; nothing is written. Add an Idempotency-Key: <unique string> header to retry a create safely: the same key and body from the same account within 24 hours returns the first response with "replayed": true, "secrets_omitted": true and the header Idempotent-Replayed: true. Secrets are never stored, so a replay does not contain the key secret: if you lost it, rotate the key. The same Idempotency-Key with a different body is a 409.
An account key creating an org whose name (case-insensitive) matches an org you already own gets 409; send "allow_duplicate_name": true to create it anyway. An account key holding admin can DELETE /v1/orgs/{org_id} (you must be its owner) only within 24 hours of creating it, or while none of its projects has ingested events; otherwise it is a 409 and the org is deleted from a signed-in session. Still, do not create orgs to "test" something: use ?dry_run=true.
A slug conflict on project create is a 409 whose body carries existing_project_id; GET /v1/orgs/{org_id}/projects?slug=acme-com finds a project by slug.
Create a project
RESP=$(lc -X POST "$LUCIDA_API/v1/orgs/$ORG_ID/projects" -d '{"name":"acme.com"}') # 201
PROJECT_ID=$(echo "$RESP" | jq -r .project.id)
PK=$(echo "$RESP" | jq -r '.keys[] | select(.kind=="public") | .value')
SK=$(echo "$RESP" | jq -r '.keys[] | select(.kind=="secret") | .value') # shown once: store it now
echo "$RESP" | jq '.environments'The answer is {project, keys, environments, server_key_hint}: project has id, org_id, name, slug, region, timezone, week_start, fiscal_year_start_month, retention_days, replay_retention_days, compliance_profile, ip_capture, ip_truncate, ai_enabled, replay_mask_floor, geo_enabled, company_enabled, group_label, logo_url, tags, is_test, created_at. Two keys come with it (a public key, and a secret key named Secret key with scopes ["capture"], so it sends events and reads nothing), two environments (production, development) and a server_key_hint string:
{"project": {"id": "..."}, "environments": [...],
"keys": [{"kind": "public", "name": "Public key", "value": "lc_pk_...", "public_value": "lc_pk_..."},
{"kind": "secret", "name": "Secret key", "value": "lc_sk_...", "scopes": ["capture"]}]}The secret key is send-only (POST /v1/s2s/batch) and its value is shown once, in this answer. Read the key string from keys[].value for both kinds and pick the key by kind. The secret field is deprecated: it repeats value, and on a public key it holds the public value, which is not a secret. For a lost secret, mint a new one: POST {p}/keys {"kind":"secret","name":"...","scopes":["capture"]} (section 1). Create takes name, an optional slug and an optional settings_from template (below); set the rest with PATCH.
Setup steps after create. A new project is created with consent_mode: "opt_in" stored in its SDK settings: the SDK stores and sends nothing until the visitor consents, so wire a consent banner (or call optIn()) before you expect data. A site that needs no consent runs PATCH {p}/settings/sdk {"consent_mode":"off"}. Projects created before 2026-11-16 keep what they had (unset means off). Turning session_recording on sets replay_sample_rate to 1.0 when it was 0.
Settings templates (start a project from another project's settings)
Give a new tenant project the privacy and capture settings of a template project in the same org, in the same transaction as the create:
lc -X POST "$LUCIDA_API/v1/orgs/$ORG_ID/projects?dry_run=true" \
-d '{"name":"shop-42","slug":"shop-42","settings_from":"'$TEMPLATE_ID'","sections":["privacy","replay"]}' # 200, nothing written
lc -X POST "$LUCIDA_API/v1/projects/$PROJECT_ID/settings/copy" \
-d '{"from_project_id":"'$TEMPLATE_ID'","sections":["ingest","sdk"]}' # onto an existing projectsections(default all):sdk,ingest,replay,privacy,identity,profiles,guides.replayis thereplay_*,session_recordingandmask_all_inputsSDK keys plus the project columnsreplay_retention_daysandreplay_mask_floor.privacyis the consent keys of the SDK settings (consent_mode, cookieless_mode, respect_gpc, consent_banner, consent_geo_rules, autocapture_inputs), the server-event consent keys of the ingest settings, and the project columnsip_capture, ip_truncate, geo_enabled, company_enabled, retention_days.sdkandingestcopy every key those settings hold except the ones below. The sections overlap on purpose.The keys the source sets overwrite; keys it does not set stay as they are on the target.
Never copied: keys, members, data,
capture_allowed_origins(it names one tenant's origins), log-drain secrets and the replay exposure key.The copy needs read on the source and
adminon the target. A source that is inaccessible, or in another org, is404. A target under thehipaaprofile refusesprivacyandreplaywith409.The answer (
200) is{from_project_id, sections, settings: {<name>: [keys copied]}, columns: [...], dry_run}; on create it comes back assettings_copynext toprojectandkeys.?dry_run=truereports the same without writing. The copy is audited asproject.settings_copy.
Project routes
Method and path | Scope | Purpose |
|---|---|---|
|
| the project object above |
|
| any of: |
|
|
|
|
|
|
|
| project environments |
| read: | SDK behaviour served at |
| read: | ingestion switches; every key is in Ingest settings reference below (gateway and worker pick changes up in 30 to 60 s) |
| read: | per-project monthly caps: |
|
| the browser storage the SDK writes for this project, from the SDK manifest: |
|
| Profile API allow-lists |
|
| guide and log-drain settings |
|
|
|
|
| what AI features may see |
|
|
|
|
| project members |
|
|
|
| session only, |
|
|
| who in the org can open the project: |
|
|
|
|
| first-party proxy domains ( |
|
| origins allowed to launch the toolbar |
| session only |
|
| session only |
|
|
| copy one object to another project: |
|
| experiment layers: create |
Notes:
GET {p}/keysand key minting needadmin(orproject:writeto mint). Section 1 has the key rules.PATCH {p}validatesname(1 to 120 characters),retention_daysandreplay_retention_days(1 to 3650),week_start(0 to 6),fiscal_year_start_month(1 to 12) andtimezone, which must be a real IANA zone such asEurope/BerlinorUTC; a malformed or too-longtimezone(anything outside letters, digits and_/+-, or over 64 characters) is422witherrors[].fieldtimezone, like the other fields above; a well-formed name that is not an IANA zone is400 timezone: unknown IANA timezone "Mars/Olympus"with the sameerrors[]entry.IP handling is off by default (
ip_capture:false); turn onip_captureonly after consent rules are settled.compliance_profileisstandardby default; other profiles restrict some features and answer acomplianceproblem when blocked.Settings
PUTs merge the keys you send; read first, send only the keys you change.
Ingest settings reference
GET {p}/settings/ingest returns every key below, with its default when you have not set it, plus a defaults block. PUT merges: a key you send replaces the stored value, null clears it back to the default, a key you leave out stays. Unknown keys are rejected with 400, and defaults in a body is ignored, so you can send a fetched document back. Changes are written to the audit log.
Key | Type | Default | Effect |
|---|---|---|---|
| boolean |
| Record |
| integer, 1 to 1440 |
| Precision of |
| integer, 0 to 1,000,000 |
| Events per minute one distinct id may send. The excess goes to the overflow lane: no person processing and an |
| boolean |
| Drop |
| string: |
| Consent gate for events sent with a secret key. |
| boolean |
| Legacy alias of |
| list of strings, at most 100 names of 1 to 200 characters |
| Event names the server-event consent gate never drops |
| boolean |
| Keep the person properties |
| list of strings, at most 100 patterns of 1 to 200 characters |
| Drop every event, not just replay, whose |
| list of strings, at most 100 patterns of 1 to 200 characters |
| Allow-list: when set, keep only events whose |
| list of strings, at most 100 origins of 200 characters |
| Accept public-key events only from these origins, for example |
Org administration (members, roles, SSO, SCIM, audit, billing)
These are the org admin API: use an account key restricted to exactly one org with the matching area scope. Full detail and Terraform: Org admin API. Every call is also checked against the key owner's role (an admin's key cannot grant ownership or remove an owner).
# 1. Create the key with a session, or with an account key that holds these scopes (a key can mint a narrower key).
# POST /v1/me/keys {"name":"provisioning","scopes":["members:write","roles:read","audit:read"],"org_ids":["<org_id>"]}
# 2. Then, with that key:
curl -sS -H "Authorization: Bearer $ORG_ADMIN_KEY" "$LUCIDA_API/v1/orgs/$ORG_ID/members" | jq '.data'
curl -sS -X POST -H "Authorization: Bearer $ORG_ADMIN_KEY" -H 'Content-Type: application/json' \
-d '{"email":"new@example.com","role":"member"}' "$LUCIDA_API/v1/orgs/$ORG_ID/invites" | jq '{id, token}'An all-orgs account key gets 403 this route needs an account key restricted to this one organization with the members:read scope on these routes (verified); another org gets 404.
Method and path | Scope | Purpose |
|---|---|---|
|
| members with role |
|
|
|
|
| remove from this org only |
|
| open invites; tokens are never listed |
|
|
|
|
| revoke |
|
| built-in and custom roles |
|
| custom role |
|
|
|
|
| newest first. Filters: |
|
| NDJSON, oldest first; resume with the |
|
| the filtered log, newest first, at most 50 000 rows; the download is itself audited |
|
| recompute the tamper-evident hash chain |
|
| plan, daily usage, limits, quota. With |
|
| invoices ( |
|
| SSO connections (secrets are write-only) |
|
|
|
|
|
|
|
| checks the |
|
|
|
|
| delete |
|
| metadata only |
|
| issue (shown once) / revoke SCIM bearer tokens |
All paths above are under /v1/orgs/{org_id}. Your IdP then provisions with /v1/scim/v2/Users and /v1/scim/v2/Groups (SCIM 2.0, SCIM bearer token; PATCH Users/{id} active:false deprovisions): SCIM setup.
Session-only org routes (hand these to the user)
Area | Routes (all under |
|---|---|
Delete, leave, impersonate |
|
Billing |
|
Security |
|
Domains and identity |
|
Audit delivery |
|
People |
|
Apps and config |
|
Read-only discovery that works with any key: GET /v1/plans (public plan catalogue), GET /v1/regions (public; empty on single-region deployments).