Embedding requires the embedding add-on for Cloud Pro or Enterprise. Get in touch to add embedding to your plan. For self-hosted deployments, follow embedding setup.
Overview
Standalone data app embedding lets you render a data app on its own — no dashboard, no surrounding chrome — inside an iframe in your application. The app runs in the same sandboxed environment as it does in Lightdash, with every metric query proxied through Lightdash and authorized against the embed JWT. Use standalone embedding when you want to surface an entire data app as a feature in your product (for example, a customer-facing report or interactive narrative) rather than embedding it as one tile on a Lightdash dashboard.How it compares to other embed types
For tile-based embedding inside a dashboard, see View data apps in dashboards.
An app built from the Dashboard template is still a data app: embed it with the steps on this page, the same as an app from any other template. Dashboard embedding is for native Lightdash dashboards.
Setup
These steps assume you’ve already created a project embed secret — see the embedding quickstart if you haven’t.1. Enable the data app in embed settings
Open Settings → Embedding for your project and use the Allowed content section to authorize the data apps you want to embed:- Toggle Allow all data apps to permit any app in the project, or
- Add specific data apps to the allowlist.
2. Mint a data app JWT
Sign a JWT withcontent.type: 'dataApp' and the appUuid of the data app you want to embed. The JWT must be signed with your project’s embed secret.
dataApp token can only render the app named in its appUuid claim. It cannot be reused to render any other data app, chart, or dashboard.
3. Construct the embed URL
Data app embeds use the path/embed/{projectUuid}/app/{appUuid} with the JWT in the URL hash fragment:
4. Render the iframe
Shareable view state
Like the in-app view, a standalone embed keeps the app’s view state — selected filters, the active tab — in thestate query parameter of the embed URL; the JWT stays in the hash fragment and isn’t affected. Open the iframe with ?state=<URL-encoded JSON> appended to the embed URL to seed a specific view, and the app writes its own changes back to that parameter as the embed user interacts with it. See Sharing a link to the current view for the size limit, the JSON shape, and how app code reads and validates a key with useAppState(key, default, { scope: 'url' }).
Data app tiles on an embedded dashboard don’t read or write state.
Send events to your page
An embedded data app can tell the page that embeds it that something happened, such as a viewer confirming an import, so your page can react right away instead of polling. Ask the agent for it while you build the app, for example “when I click Confirm import, tell the host page with animport-confirmed event that includes the plan ID”. Apps built before app events were available don’t have emitEvent. Upgrade the app first, then ask the agent to add the event.
In app code, call emitEvent(name, payload) from @lightdash/query-sdk:
lightdash:appEvent embed event, so the same setup applies: embed events turned on for your page’s origin, and a targetOrigin parameter on the embed URL. The event’s payload holds the app’s name and its payload:
onEvent handler with the type appEvent.
- Names are up to 100 characters and can’t be empty.
- Payloads are up to 64 KB of JSON, or
nullwhen the app sends none. Send larger data through an external connection and emit a reference to it. - Your page receives the JSON form of the payload. Dates arrive as strings,
undefinedvalues and functions are dropped, and binary data doesn’t survive. emitEventthrows on an invalid name, a payload that isn’t JSON-serializable, or a payload over the limit, so the app can show the error. A call that doesn’t throw can still be dropped by the rate limit.- App events are rate limited. All app events from an embed share one limit, 10 events per second by default. Events over the limit are dropped without an error, so emit on viewer actions, not in loops. Self-hosted instances can change the limit with
EMBED_EVENT_RATE_LIMIT_MAX_EVENTSandEMBED_EVENT_RATE_LIMIT_WINDOW_MS(see embedding variables). - Outside an embed, such as when the app is open in Lightdash, nothing is relayed.
name and payload. The outer type is always lightdash:appEvent, so an app can’t send one of Lightdash’s own events. Both values come from the app’s author, so validate them before your page acts on them.
How access works
AdataApp JWT is intentionally narrow: it authorizes the named app for the named project and nothing else. In practice, this means:
- The token grants the embed user permission to view the specified data app only.
- The data app can run arbitrary metric queries across the project’s tables. Embedding an app means you are accepting project-wide column access for that token.
- Row-level filtering still applies. User attributes on the JWT are enforced inside every query, just like they are for dashboard and chart embeds. SQL filters defined on your tables continue to apply.
- A
dataApptoken cannot be used to load dashboards, charts, or the explore page. Each embed token is scoped to a single content type.
Limitations
- Embedded users can view data apps but can’t create or edit them. Build the app in Lightdash, then embed it with the steps on this page or as a dashboard tile.
- Standalone data app embedding is iframe-only. There is no React SDK component for it yet.
- The standalone embed has no controls bar or tile chrome — the app is rendered in isolation.
- Interactivity options like
canExportCsv,canExplore, anddashboardFiltersInteractivitydo not apply todataApptokens.