# AI agents Source: https://docs.lightdash.com/agents Explore and build your agentic analytics platform [Pro](/support/feature-badges#pro) [Enterprise](/support/feature-badges#enterprise) Agents are the core of everything in Lightdash. They leverage your team's knowledge and metrics to provide consistent answers, then build those components into a self-improving context layer, so you can focus on putting your data to work. Whether helping leadership monitor KPIs, data scientists forecast growth, or building data apps to empower your sales team with a custom GTM tool, Lightdash agents weave trustworthy data into your daily work. ## Ask more questions [Set up an agent](/agents/set-up-agents) for your team, then start asking questions. You can manage as many threads as you need, and agents always have the right context. Compare freely across segments and time periods, get hands on exploring the charts and tables that come back, then zoom back out to the agent for more iteration. Because agents are integrated everywhere in Lightdash, you've got a full analytics platform to dig in with (unlike hooking Claude up to your database). When you find something useful, just ask the agent to build whatever you envision. You can go from spotting a trend to [deep causal analysis](/agents/deep-research), then building those insights into a [new team dashboard](/agents/enable-content-tools), all in a single thread. ## Get trustworthy answers Traditional dashboards decay into sprawl the more a team uses them. Agents get better, because every question tests what your project knows. Metric questions run on the definitions and joins in your semantic layer, so agents start from [the foundations](/agents/effective-analytics-with-agents) your team has already built and keep raising the bar from there. When an agent picks the wrong table or misreads a term, [Issues](/agents/issues) catches it in the background, traces it to a root cause, and drafts the fix: a missing metric, a clearer description, or a note in your shared [project context](/agents/agent-context). Once your team merges it, every agent that reads that context answers better. [Autopilot](/agents/autopilot) keeps your content healthy on its own schedule, repairing broken charts, retiring stale ones, and drafting the charts people keep asking for. [Evaluation suites](/agents/create-evaluation-suites) built from real threads catch regressions before your team ever sees them. ## Build your agentic data platform Once teams rely on an agent, it stops being a one-off conversation and becomes part of how they work. Shape each agent around the team it serves. Give a finance agent your revenue recognition policy as a [knowledge document](/agents/knowledge-documents), teach it how your team runs a monthly variance analysis with a [skill](/agents/custom-agent-skills), and point it at [verified answers](/agents/verified-answers) for the questions it should answer the same way every time. Set its [data access](/agents/data-access) and [permissions](/agents/agent-permissions) to match the job, and you can hand it more ambitious work, from building dashboards to opening pull requests. With [agents as code](/agents/agents-as-code), all of that configuration, along with its skills and evaluation suites, lives in Git, goes through review, and promotes from a preview project to production. Conversations can change the project too. Ask an agent to add the metric it couldn't find, and [AI writeback](/agents/ai-writeback) edits your dbt or Lightdash YAML, validates it, and opens a pull request for your team to merge. The [AI coding agent](/agents/ai-coding-agent) does the same for other repositories your organization connects, so a question in chat can end as a reviewed change wherever the fix belongs. ## Integrate everything The work doesn't have to stay in Lightdash. Connect an agent to a [Slack channel](/agents/set-up-slack-agents) so a sales team can check pipeline numbers in the thread where they're already discussing a deal, or [embed an agent](/embed/embed-ai-agents) in your product so your customers can ask about their own data. When an analysis is something people should see every week, turn it into a [recurring delivery](/agents/use-ai-agents#schedule-a-recurring-delivery-from-a-conversation) from the same conversation. MCP works in both directions. Connect Claude, ChatGPT, Cursor, or your own agents to the [Lightdash MCP server](/agents/lightdash-mcp), and they get the same metrics, verified content, and agent context your team uses in Lightdash. They can build charts and dashboards or open a writeback pull request without leaving the tool they're in. In the other direction, [external MCP servers](/agents/connect-external-mcp-servers) let your Lightdash agents act on what they find, like filing a Linear issue when a metric drifts or pulling a spec from Notion before building the dashboard it describes. # Agent access to restricted data Source: https://docs.lightdash.com/agents/agent-access-to-restricted-data Run agents over explores that user attributes restrict, with answers that say who they cover A common setup: your aggregate explores are open to everyone, and the record-level explore underneath them is restricted by role with [user attributes](/workspace-admin/user-attributes). Anyone can ask "what was pipeline in EMEA last quarter?", but "which EMEA accounts have open opportunities?" only returns the accounts the person asking is allowed to see. The catch is that a question can sound aggregate and still run on the restricted explore. "How many open opportunities do EMEA reps have?" is answered from the account grain, so its denominator depends on who asked. This guide covers how to keep that setup governed and make the agent clear about what a number includes. ## Keep the boundary in the semantic layer Restrict the record-level explore with [`sql_filter`, `required_attributes` or `any_attributes`](/workspace-admin/user-attributes#using-user-attributes-in-lightdash) in the model, not with agent instructions. An agent in its default mode [inherits the asking user's attributes](/agents/data-access#user-attributes-and-permissions) on every query, so one restriction covers Explore, dashboards, and every agent that can see the explore. An instruction like "only show users their own region" is guidance the model can misread, and it does nothing in Explore, so the same user could see different rows in the agent and in Explore. Use [agent tags](/agents/data-access#limiting-access-to-specific-explores-and-fields) for the other half of the problem: an agent that can't see the record-level explore can't be talked into querying it. A "Regional overview" agent tagged onto the aggregate explores and a separate "Account desk" agent for the restricted one is easier to reason about than one agent that has to know when to be careful. ## Make the agent say who is included When a number depends on the asking user's attributes, the answer should say so. Someone with a broad role sees the full population, someone with a narrow role sees a subset, and neither is told unless you tell the agent to say it. Where you put that instruction depends on how many agents need it: * **One agent:** add it to the agent's [instructions](/agents/set-up-agents#instructions). For example: "Answers from the opportunities explore only cover accounts the person asking can see. Say which population the numbers cover in one clause, such as 'across the accounts you have access to'." * **Every agent that touches the explore:** add a `context` entry to [`lightdash.project_context.yml`](/agents/agent-context) scoped with `objects` to the restricted explore. Any agent reasoning about that explore picks it up, and it survives agents being added or renamed. ```yaml lightdash.project_context.yml theme={null} version: 2 entries: - id: opportunities-scope-disclosure kind: context content: "fct_opportunities is filtered by the asking user's territory attributes. When answering from it, say which population the numbers cover, for example 'across the accounts you have access to'." objects: - type: explore name: fct_opportunities ``` Describe the population, not the mechanism. "Across the accounts you have access to" is enough. Attribute names and values are implementation detail that doesn't belong in an answer. ## Treat convenience scopes as their own explores "My accounts", "my team" and "my open tickets" aren't restrictions. A manager may be allowed to see the whole region and still mean their own book when they say "my". Model the scope explicitly so the agent has something concrete to select instead of guessing the right filter. The simplest shape is a dedicated explore whose `sql_filter` keys on the asking user's verified email: ```yaml theme={null} models: - name: my_accounts description: Accounts owned by the person asking. One row per account. meta: sql_filter: ${TABLE}.owner_email = ${lightdash.user.email} ai_hint: - Use this explore when the user says "my accounts", "my book" or "my customers". It is already filtered to their own accounts; do not add an owner filter. ``` The [`ai_hint`](/semantic-layer/writing-descriptions#layer-ai-hints-on-top-of-descriptions) maps the phrase to the explore. Without it the agent has to guess between `accounts` and `my_accounts`. If ownership lives in another table, a join with [`sql_on`](/workspace-admin/user-attributes#filtering-joins-with-sql%5Fon) that references `${lightdash.user.email}` does the same job. You can't put the reference inside a dimension's own `sql:`. User attributes are [only accepted in `sql_filter`, `required_attributes`, `any_attributes` and `sql_on`](/workspace-admin/user-attributes#using-user-attributes-in-lightdash). Keep the convenience explore separate from the restricted one. The user's access rules still apply on top of it, so "my accounts" never widens what they can see. ## Keep raw SQL away from restricted roles User attributes are enforced by the semantic layer, so they apply to every query built from an explore: Explore, charts and dashboards, and AI agents answering in their default (semantic) mode. Anything that runs raw SQL against the warehouse runs outside the semantic layer, and `sql_filter`, `required_attributes` and `any_attributes` do not apply to it: * The [SQL Runner](/explore/sql-runner) * [SQL mode](/agents/use-ai-agents#sql-mode) in an AI agent conversation * The **Run SQL** tool of the [Lightdash MCP server](/agents/lightdash-mcp) * Hand-written SQL inside a semantic query: custom SQL dimensions, custom SQL metrics, and SQL [table calculations](/explore/table-calculations). They're pasted into the query as written, which is why authoring them needs `manage:CustomFields` or `manage:CustomSqlTableCalculations`. Every surface on this list needs a permission that Developer and Admin roles hold by default: `manage:SqlRunner` for the first three, `manage:CustomFields` or `manage:CustomSqlTableCalculations` for the last. A user without those cannot run raw SQL from any of them, whatever an agent's instructions say. If someone needs raw SQL and warehouse-enforced permissions at the same time, require [personal warehouse credentials](/personal-settings/personal-warehouse-connections) on the project so their queries run as their own warehouse user, and put the restrictions in the warehouse. In practice: give restricted roles Viewer, Interactive Viewer or Editor, or a [custom role](/workspace-admin/custom-roles) without `manage:SqlRunner`. The agent then follows your semantic layer restrictions for them, whatever its instructions say. Reserve SQL Runner access for the people who own the model. If any of them also need restricting, require personal warehouse credentials on the project. [Agent data scope](/agents/data-access#scoping-raw-sql-to-specific-schemas) is another lever, but it only restricts the AI agent's own raw SQL (SQL mode and the MCP Run SQL tool) at the schema or catalog level — it doesn't restrict SQL Runner users or change warehouse permissions, and it can't separate restricted and open tables that live in the same schema. ## Protect small groups by limiting the grain, not the filters An open aggregate explore with enough filters can single out one record. "Churn for enterprise accounts in Lisbon that signed in March" may be a group of one, and the number is then that account's data, even though the record-level explore never ran. Lightdash has no minimum group size for results, and no per-row masking of a column, because user attributes can't appear in a dimension's `sql:`. Baking a threshold into a few metrics doesn't help much either: an agent composes filters freely, and the next slice won't go through those metrics. Three levers work: * **Keep identifying records on the restricted explore.** The open explores should carry the aggregates people need and nothing that identifies a single record. * **Keep identifying dimensions off the open agent.** Use [field-level agent tags](/agents/data-access#limiting-access-to-specific-explores-and-fields) so the open agent can't slice by high-cardinality or sensitive dimensions such as signup date, programme status, or postcode. Fewer ways to slice means fewer groups of one. * **Hide fine-grained dimensions from most users.** Set [`required_attributes` on the dimension](/workspace-admin/user-attributes#column-filtering-with-required_attributes) so only users with the attribute can see or filter by it, in Explore and in every agent that answers from the semantic layer. Tags limit one agent; `required_attributes` follows the user. An agent instruction such as "don't break results down by postcode" helps the agent choose sensible slices, but it isn't enforced on the query. Use it on top of these levers, not instead of them. If one metric genuinely needs a threshold, compute it in dbt so the suppression is fixed in the warehouse regardless of which filters ran, for example a metric that returns null when its group is below the threshold, and expose only that metric on the open explore. # Agent context Source: https://docs.lightdash.com/agents/agent-context Give every agent in a project the same terminology, table choices, and business rules Agent context is shared background knowledge every AI agent in a project reads before answering. It lives in a single file, `lightdash.project_context.yml`, that sits next to `lightdash.config.yml` inside your dbt or [native Lightdash YAML](/semantic-layer/yaml) project — in the **Project directory path** you set on the connection, which isn't always your repository root. Notes you add here change future agent behavior without changing the semantic layer. The file is committed to your project repository and travels with the rest of your project metadata. ## When agents load it Two things have to be true, beyond the file existing in your repository: * **Review AI agent turns is on.** Lightdash only reads `lightdash.project_context.yml` into a project when the organization setting [**Review AI agent turns**](/agents/issues#enabling-issues) (**Settings → Ask AI → General**) is enabled. Turn it on, then click **Refresh dbt** (**Refresh models** for native projects), or run `lightdash refresh`, so Lightdash compiles the project and picks up the file. `lightdash deploy` uploads models compiled on your machine and doesn't read the file. * **The project connects to a Git repository.** Agents only load project context on projects connected to a repository (GitHub, GitLab, Bitbucket or Azure DevOps). A project with no repository connection — including a preview created with `lightdash preview`, `lightdash start-preview`, or `lightdash deploy` with no repository connection — has no project context at all, regardless of the setting above: nothing is ingested and agents load nothing. Lightdash reads the file from the branch set on the project connection, so commit and push an edit before you refresh. A preview built from a connected branch reads `lightdash.project_context.yml` from that branch at compile time, the same as any other project file. A CLI-created preview with no repository connection doesn't — there's no branch to read it from. ## When to use it Reach for agent context when the data model itself is fine but the agent is missing background knowledge — terminology, which table to prefer, or business rules that aren't expressible as semantic definitions. If the fact would also help a new analyst joining the team, edit the semantic layer instead. Agents pick up new context on their next turn, so the loop between "notice a gap" and "agents behave better" is short. Agent context replaces agent memories, which are deprecated. Agents no longer learn new memories or read existing ones. **Settings** → **Ask AI** → **Memories** still lists memories saved earlier so you can review them; add anything worth keeping here instead. ## How entries are added There are two ways entries land in the file: * **Through Issues writeback.** When a [project context](/agents/issues) fix runs, Lightdash proposes a single entry and opens a pull request against your project repository. The first time this happens the file is created (with a header explaining what it's for). Subsequent fixes add or update entries in the same file. * **By hand.** You can edit `lightdash.project_context.yml` directly. Writeback uses the GitHub API to merge one entry at a time, preserving comments, quoting, and key order in the rest of the file, so manual edits and writeback coexist cleanly. Either way, the same validation rules apply: an invalid file fails the refresh, and the error marks the part of the file that broke the schema. The two most common causes are a `{ entries }` document with no `version` and plain strings in the `objects` of a `version: 2` file, both covered in [File shape](#file-shape). The full JSON Schema is published at [`lightdash-project-context-2.0.json`](https://github.com/lightdash/lightdash/blob/main/packages/common/src/schemas/json/lightdash-project-context-2.0.json) — point your editor at it for autocomplete and validation. ## File shape ```yaml lightdash.project_context.yml theme={null} version: 2 entries: - id: aov kind: definition content: "AOV means average order value — total revenue divided by number of orders in the period." terms: ["AOV", "average order value"] objects: [] - id: active-customers-table kind: context content: "Use `fct_customer_activity` for active-customer questions; `dim_customers` is a slowly-changing dimension and double-counts churned customers." terms: ["active customers"] objects: - type: explore name: fct_customer_activity - type: field explore: dim_customers fieldId: dim_customers_customer_id ``` The top-level document is `{ version, entries }`. A bare array of entries is also accepted for backward compatibility, but new files are written in the canonical shape. If you use the document shape, `version: 2` is required: leaving it out fails validation at the document root. ### Top-level properties | Property | Type | Required | Description | | - | - | - | - | | `version` | number | yes | Schema version. Currently `2`. Files with `version: 1`, and bare arrays, still load, but any `objects` list that isn't made of typed references is dropped. | | `entries` | array | yes | The list of context entries. May be empty. | ### Entry properties Each item in `entries` is a single self-contained fact your agents should know. | Property | Type | Required | Description | | - | - | - | - | | `kind` | `"definition"` \| `"context"` | yes | How the entry is retrieved. Use `definition` for term-triggered facts (acronyms, vocabulary, "X means Y"). Use `context` for object-scoped guidance (routing rules, join rules, durable facts about a model). | | `content` | string | yes | One self-contained sentence. This is what the agent reads. Keep it short and unambiguous. | | `id` | string | no | Stable identifier used to update the entry later. Optional — Lightdash derives one from `terms[0]` (or `content`) at ingest if you omit it, suffixing on collision. Provide an explicit id if you want to hand-edit later without worrying about churn. | | `terms` | string\[] | no | Prompt-facing trigger words and phrases. Used to surface `definition` entries when a user's question mentions one of them. Defaults to `[]`. | | `objects` | object\[] | no | Semantic objects this entry concerns, as typed references: `{ type: explore, name }` for an explore, or `{ type: field, explore, fieldId }` for a field. Plain strings are rejected in `version: 2` files. Used to surface `context` entries when the agent is reasoning about one of these objects. Defaults to `[]`. | Unknown keys on an entry are preserved on round-trip, so a field a newer Lightdash version adds won't be silently dropped if you edit the file by hand. ## Related * [Issues](/agents/issues) — the board that proposes project context fixes and opens pull requests against this file. * [Effective analytics with agents](/agents/effective-analytics-with-agents) — knowledge documents and other ways to hand agents context upfront. # Agent identity Source: https://docs.lightdash.com/agents/agent-identity Choose who AI agents run as in your warehouse, so its grants and policies decide what they can read [Beta](/support/feature-badges#beta) [Enterprise](/support/feature-badges#enterprise) > [!NOTE] > > Agent identity is behind the `agent-identity` feature flag. On Lightdash Cloud, ask Lightdash support to turn it on for your organization. On a self-hosted instance, [enable the flag](/self-host/enterprise-features/ai-agents#agent-identity). Agent sign-in on Snowflake also needs the Snowflake agent integration. AI agents run SQL in your warehouse. By default, an agent query uses the same credentials as the person who asked. The warehouse cannot tell the agent from the person, so it applies the same rules to both. Agent identity lets an organization admin choose a different identity for agent queries. The warehouse then sees agent queries as that identity, and your warehouse grants and policies decide what agents can read. Lightdash's own controls still apply on top. See [Data access control](/agents/data-access). Agent identity is available on the warehouses that can enforce it: Snowflake, BigQuery, Databricks, Athena, Postgres, Redshift, Trino and ClickHouse. | Warehouse | The person | The person's agent sign-in | The shared agent account | | - | - | - | - | | Snowflake | | | | | BigQuery | | | | | Databricks | | | | | Athena | | | | | Postgres | | | | | Redshift | | | | | Trino | | | | | ClickHouse | | | | What the warehouse sees with each identity: * **The person:** the person. This is the default. * **The person's agent sign-in:** the person, in a session that Snowflake verifies as an agent session. * **The shared agent account:** one Snowflake user, BigQuery service account, Databricks service principal, AWS identity for Athena, Postgres login role, Redshift database user, Trino user or ClickHouse user that an admin adds to the project connection. Lightdash also tags agent queries with the person they ran for and the agent that ran them, so you can find them in query history. On Snowflake, the tags are in `query_tag`. On BigQuery, they are job labels. Tags are not an identity: warehouse policies can't act on them. See [Find agent queries in the warehouse](#find-agent-queries-in-the-warehouse). Jump to [the organization rule](#choose-who-agents-run-as), [Snowflake agent sign-in](#snowflake-agent-sign-in-for-each-person), [the Snowflake shared agent account](#snowflake-the-shared-agent-account), [the BigQuery shared agent account](#bigquery-the-shared-agent-account), [the Databricks shared agent account](#databricks-the-shared-agent-account), [the Athena shared agent account](#athena-the-shared-agent-account), [the Postgres shared agent account](#postgres-the-shared-agent-account), [the Redshift shared agent account](#redshift-the-shared-agent-account), [the Trino shared agent account](#trino-the-shared-agent-account), [the ClickHouse shared agent account](#clickhouse-the-shared-agent-account), [finding agent queries](#find-agent-queries-in-the-warehouse) or [what gets recorded](#what-gets-recorded). ## Choose who agents run as Organization admins set one rule for each warehouse type. A rule applies to every connection of that type in every project. A separate identity is always required. When you pick **The person's agent sign-in** or **A shared agent account**, Lightdash refuses every agent query that cannot run as that identity. It never falls back to the person's own credentials. Put the identity in place before you switch the rule: * **Snowflake, agent sign-in:** set up the Snowflake agent integration. After you turn it on, Lightdash asks each person who uses agents to connect their agent. See [Set up the Snowflake agent integration](#set-up-the-snowflake-agent-integration) and [Connect your agent](#connect-your-agent). * **Snowflake, shared agent account:** an admin adds a shared agent account on every Snowflake project connection. See [Set up the Snowflake shared agent account](#set-up-the-snowflake-shared-agent-account). * **BigQuery:** an admin adds a shared agent account key on every BigQuery project connection. See [Set up the shared agent account](#set-up-the-bigquery-shared-agent-account). * **Databricks:** an admin adds a shared agent account on every Databricks project connection. See [Set up the Databricks shared agent account](#set-up-the-databricks-shared-agent-account). * **Athena:** an admin adds a shared agent account on every Athena project connection. See [Set up the Athena shared agent account](#set-up-the-athena-shared-agent-account). * **Postgres:** an admin adds a shared agent account on every Postgres project connection. See [Set up the Postgres shared agent account](#set-up-the-postgres-shared-agent-account). * **Redshift:** an admin adds a shared agent account on every Redshift project connection. See [Set up the Redshift shared agent account](#set-up-the-redshift-shared-agent-account). * **Trino:** an admin adds a shared agent account on every Trino project connection. See [Set up the Trino shared agent account](#set-up-the-trino-shared-agent-account). * **ClickHouse:** an admin adds a shared agent account on every ClickHouse project connection. See [Set up the ClickHouse shared agent account](#set-up-the-clickhouse-shared-agent-account). **1. Open Agents** Go to **Organization settings → Agents** and find the **Identity** section. It has one chip for each warehouse that your organization has a project on. **2. Choose the identity** Select the chip for your warehouse. A menu opens with the identities for that warehouse, each with one line that explains it. A tick marks the saved identity. Choose an identity. **3. Confirm the change** A confirmation opens and states the effect of the change. Select the confirm button to save. An "Agent identity saved." notification confirms it. **Cancel** closes the confirmation, and the rule does not change. ### Read the chips ![The Identity section with three chips: Snowflake with Agent sign-in and a green tick, BigQuery with Shared account and an orange 2, and Postgres with an icon only](https://mintcdn.com/lightdash/KafA2i3NlUJIK4kg/images/agents/agent-identity/org-agent-identity-chips.png?fit=max\&auto=format\&n=KafA2i3NlUJIK4kg\&q=85\&s=c3ac524c3ea2e0a4b71c10ec830a0d69) Each chip shows the warehouse, an icon for who agents run as, and the state of the setup: | On the chip | What it means | | - | - | | An icon only | The rule is **The person**. | | **Shared account** | The rule is **A shared agent account**. | | **Agent sign-in** | The rule is **The person's agent sign-in**. Snowflake only. | | A green tick | The setup is complete: every project on the warehouse has a shared agent account, or the Snowflake agent integration is verified. | | An orange number | The number of projects on the warehouse that have no shared agent account. Agents are refused on them until a project admin adds one. Hold the pointer over the number, or open the chip, for a link to each project's **Agent identity** page. | | An orange warning | The Snowflake agent integration needs attention. | Hold the pointer over a chip for one sentence that says who agents run as on that warehouse. ![The BigQuery chip's menu: the warning 2 projects have no shared agent account, Agents are refused on them until a project admin adds one, links to the Finance and Marketing projects, and the choices The person and A shared agent account under BigQuery agents run as, with a tick on A shared agent account](https://mintcdn.com/lightdash/KafA2i3NlUJIK4kg/images/agents/agent-identity/org-agent-identity-chip-menu.png?fit=max\&auto=format\&n=KafA2i3NlUJIK4kg\&q=85\&s=8568be60e6ccd69ea507d1a65c8ccb96) A warehouse with no project shows no chip while its rule is **The person**. When the organization has no project, the section says "No warehouses in use yet." Nothing saves until you confirm: * **To A shared agent account.** The confirmation lists the projects on that warehouse that have no shared agent account yet, with a link to each project's **Agent identity** page. Agents stop working on these projects until a project admin adds one. * **Back to The person.** The confirmation states that agents get the same warehouse access as the person who asks. * **To The person's agent sign-in.** No confirmation opens and nothing saves. The setup steps open under the chips. The rule changes when you select **Turn on**. See [Set up the Snowflake agent integration](#set-up-the-snowflake-agent-integration). ![The confirmation Use a shared agent account for BigQuery?, with the note 2 projects have no shared agent account yet: Finance, Marketing. Agents stop working on them until a project admin adds one, and Cancel and Use a shared agent account buttons](https://mintcdn.com/lightdash/RAdZRkxizSYzVmys/images/agents/agent-identity/org-agent-identity-confirm-ai-service-account.png?fit=max\&auto=format\&n=RAdZRkxizSYzVmys\&q=85\&s=b0f826f619bd698e60fedbca38102af2) ![The confirmation Run agents as the person on BigQuery?, which says agents will get the same BigQuery access as the person asking, with Cancel and Run as the person buttons](https://mintcdn.com/lightdash/RAdZRkxizSYzVmys/images/agents/agent-identity/org-agent-identity-confirm-same-credentials.png?fit=max\&auto=format\&n=RAdZRkxizSYzVmys\&q=85\&s=434b1c954b8d1e2f239f669336f81e44) With **The person**, Lightdash never refuses an agent query for a missing identity. Changing the rule does not create warehouse grants or policies. Set those up in your warehouse for the identity you choose. ### When an identity changes Lightdash checks the identity on every agent query. A change applies from the next agent query: * **An admin changes the rule.** The next agent query runs as the new identity. * **A person disconnects their agent sign-in.** Lightdash refuses their next agent query on Snowflake until they connect again. * **Snowflake revokes an agent sign-in.** Lightdash refuses the next agent query, and the person connects again. * **An admin removes the shared agent account key.** Lightdash refuses the next agent query on that project. * **An admin replaces the shared agent account key.** The next agent query runs with the new key. * **An admin deactivates a person.** Lightdash deletes that person's Snowflake agent sign-in. See [When you take agent access away](/agents/agent-permissions#when-you-take-agent-access-away). Results follow the identity too. Lightdash does not serve results that an agent produced as an identity that is no longer current. This covers results that an agent already showed, results that a later query reuses, and cached results. A person's own queries never get cached results that an agent identity produced. A new query runs as the current identity. One exception: when you switch the BigQuery rule away from **A shared agent account** and back, and the key did not change, the results that the key produced become available again. Replace the key to stop this. ### Who can read a saved result While agent identity is on, Lightdash checks every read of a saved or cached query result. Both must be true: * The reader still has access to the project, the content and the fields. * The identity that produced the result matches the reader. So: * A person cannot read results that a shared agent account, an agent sign-in, or another person's own credentials produced. * An agent reads only results that its own agent produced. * When a person's user attributes or field access rules change, they cannot read their older results. * Results saved before agent identity was turned on cannot be read. These reads are refused with: "These results are not compatible with your current access. Run the query again." A new query runs as the current identity and with the current access. This check does not cover scheduled delivery attachments or signed download links yet. ### When the shared agent account is missing or fails While the rule for a warehouse is **A shared agent account**, Lightdash refuses agent queries on a project that has no working shared agent account. It never falls back to the connection's own credentials. The refusals are: * **No shared agent account:** "Agents can't run on this project yet. It needs a shared agent account." * **The shared agent account failed to sign in:** "Agents can't query Jaffle shop right now. Its shared agent account failed to sign in. A project admin can check it in Agent identity." Each surface points to the project's **Agent identity** page, where the fix is: * **In the app,** the chat shows the refusal. People who can manage the project also see an **Open project agent settings** link. * **In Slack,** the agent posts only the refusal message with an **Open project agent settings** button, and the task card says "Needs an admin". * **In MCP,** the tool result shows the refusal message. ### The Lightdash CLI While agent identity is on, the Lightdash CLI runs as the person. CLI queries use the person's own warehouse access. Lightdash does not mark them as agent queries, and [agent permissions](/agents/agent-permissions) do not limit them. `lightdash agent status` and `lightdash agent connect` say "The CLI runs as you until agent connect issues an agent credential." On a project where agents use a shared agent account, both commands print "Not needed: agents on this project use the shared agent account" and exit with code 0. See [`lightdash agent status`](/workflow/cli/reference#lightdash-agent-status). ## Find agent queries in the warehouse Lightdash records two identities on every agent query: * **Who the agent ran for:** the Lightdash user, or the Lightdash service account. * **Which agent ran it:** the surface and the client. Lightdash keeps both in its query history, and sends them to the warehouse as tags. Use the tags to audit agent activity next to the warehouse's own record of who ran the query. | Tag | Value | | - | - | | `agent` | `true` on every agent query. | | `user_uuid` | The UUID of the Lightdash user that triggered the query, which is the person the agent ran for. | | `agent_surface` | Where the agent ran. See the table below. | | `agent_client` | The client of that agent. See the table below. | | `agent_uuid` | The UUID of the Lightdash AI agent that ran the query, for in-app chat and Slack agents. Not set for MCP queries. | | `agent_surface` | `agent_client` | | - | - | | `in_app_agent` | `lightdash-chat` | | `mcp` | The OAuth client ID of the MCP client. `unknown` when the client authenticates with a personal access token or a service account token. | | `slack_agent` | The Slack app ID. | | `data_app` | `lightdash-data-app`, for data app sample queries. | | `ai_summary` | `lightdash-ai-summary`, for AI summaries in scheduled deliveries. | `agent_client` is the client ID in lower case. When the ID has characters that a label cannot hold, or is longer than 60 characters, the value is `h-` followed by a 32-character hash. The same ID always gives the same hash. On BigQuery, every agent job has the `agent`, `agent_surface` and `agent_client` labels, and `agent_uuid` and `user_uuid` when they are set. They come before the other labels, so the 64-label limit does not drop them. On Snowflake, the same keys come first in the JSON `query_tag`, so the 2,000-character limit does not cut them. To group BigQuery cost by agent and user, see [Attribute BigQuery cost with job labels](/workspace-admin/usage-analytics#attribute-bigquery-cost-with-job-labels). ```sql BigQuery theme={null} SELECT creation_time, user_email, job_id, (SELECT value FROM UNNEST(labels) WHERE key = 'user_uuid') AS lightdash_user_uuid, (SELECT value FROM UNNEST(labels) WHERE key = 'agent_surface') AS agent_surface, (SELECT value FROM UNNEST(labels) WHERE key = 'agent_client') AS agent_client, (SELECT value FROM UNNEST(labels) WHERE key = 'agent_uuid') AS agent_uuid FROM `region-us`.INFORMATION_SCHEMA.JOBS WHERE creation_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 DAY) AND EXISTS ( SELECT 1 FROM UNNEST(labels) AS label WHERE label.key = 'agent_surface' AND label.value = 'mcp' ) ORDER BY creation_time DESC; ``` ```sql Snowflake theme={null} SELECT start_time, user_name, agent_type, TRY_PARSE_JSON(query_tag):user_uuid::STRING AS lightdash_user_uuid, TRY_PARSE_JSON(query_tag):agent_surface::STRING AS agent_surface, TRY_PARSE_JSON(query_tag):agent_client::STRING AS agent_client FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY WHERE start_time >= DATEADD('day', -1, CURRENT_TIMESTAMP()) AND TRY_PARSE_JSON(query_tag):agent_surface::STRING = 'mcp' ORDER BY start_time DESC; ``` Each example lists the agent queries from MCP in the last day. Change the `agent_surface` filter, or filter on `agent_client` to find one client, for example one Slack app. On BigQuery, replace `region-us` with the region of your datasets. For the account each query ran as, read `user_email` on BigQuery and `user_name` on Snowflake. Other Lightdash query tags are listed in [Query tags](/workspace-admin/usage-analytics#query-tags). Agent queries skip the warehouse's own result cache on BigQuery, Snowflake, Databricks, Redshift and ClickHouse. Each agent query runs in the warehouse with the current identity, and the warehouse applies its policies at that time. ## What gets recorded When an agent changes content, Lightdash records that an agent made the change and for which person. The record has the surface (in-app agent, MCP or Slack agent), the client and the agent. It comes only from the signed-in credential and the agent runtime. Request headers and tool arguments cannot set it. * **Content with versions.** New versions of charts, dashboards, SQL charts, documents and data apps record the agent. Chart and dashboard version history show "Changed by an agent for" followed by the person and the surface. When you restore a version, the new version does not copy the agent of the restored version. * **Other writes and refusals.** Agent writes that make no version, and agent refusals, go to the agent action log. Examples are spaces, scheduled deliveries, content verification, access changes, share links and dbt write-back commits. Each entry has the organization, project, time, agent, object, action, outcome (allowed or denied), the policy that decided and a reason code. It never has data, tool arguments, SQL, recipients, URLs or secrets. ![Chart version history with two versions marked Changed by an agent for David Attenborough, one from the In-app agent and one from MCP, and an older version Updated by David Attenborough](https://mintcdn.com/lightdash/RAdZRkxizSYzVmys/images/agents/agent-identity/chart-version-history-agent.png?fit=max\&auto=format\&n=RAdZRkxizSYzVmys\&q=85\&s=14a3a42266b00759acd8517da3e5ba89) Each agent action log entry also goes to the application audit log. See [Agent identity audit entries and logs](/self-host/enterprise-features/ai-agents#agent-identity-audit-entries-and-logs). The query history cleanup job deletes old entries, with the same retention as query history (`QUERY_HISTORY_RETENTION_DAYS`). ## Snowflake: agent sign-in for each person With this identity, each person connects their agent through a separate Snowflake OAuth sign-in. Snowflake then knows that the session is an agent session. Your row access policies, masking policies, session policies and views can act on that. The result: Snowflake, not Lightdash, enforces what agents may read. A person can see a value in a dashboard while their agent sees `REDACTED`. ### Who sees what | Signal | Where it appears | What it tells you | | - | - | - | | Agent tag | `query_tag` in Snowflake query history | Lightdash ran the query for an agent. | | Agent session | `SYS_CONTEXT('SNOWFLAKE$CURRENT', 'IS_AGENT_ACTIVATED')` inside the session | Snowflake verified the session as an agent session. Policies read this value. | | Agent type | `agent_type = 'EXTERNAL_AGENT'` in `SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY` | Snowflake ran the query in a verified agent session. | A query tag alone does not prove that Snowflake verified the session. The agent session value and `agent_type` do. ### Before you start * **The Snowflake agent integration is set up for your organization.** See [Set up the Snowflake agent integration](#set-up-the-snowflake-agent-integration). Until it is set up, the option **The person's agent sign-in** shows "Needs a one-time Snowflake setup". * **Your project uses the same Snowflake account as the integration.** An organization has one agent integration for one Snowflake account. A project on a second Snowflake account cannot complete the agent connection. * **Each person has an allowed default role.** Snowflake blocks the `ACCOUNTADMIN`, `SECURITYADMIN`, `ORGADMIN` and `GLOBALORGADMIN` roles from OAuth sessions. The agent sign-in uses the person's default role. Each person who uses agents needs a default role outside that list. The agent sign-in is separate from the person's normal [Sign in with Snowflake](/integrations/connect-project#sign-in-with-snowflake) connection. A person can have both. ### Set up the Snowflake agent integration An organization admin sets up the integration once, from **Organization settings → Agents**. The setup shows only after you choose **The person's agent sign-in** in the Snowflake row. The rule does not change until you select **Turn on**, so agents keep running as each person during the setup. **1. Choose agent sign-in** Select the Snowflake chip and choose **The person's agent sign-in**. In the menu, this choice says "Setup needed" until the integration is set up. The **Set up the Snowflake agent integration** steps open under the chips, with a "Not active yet" badge. The rule does not change yet. **2. Copy and run in Snowflake** Copy the `CREATE SECURITY INTEGRATION` SQL and run it in Snowflake as `ACCOUNTADMIN`. The SQL has the redirect URL of your instance. The second statement returns the client ID and the client secret. **3. Add your Snowflake account and client details** Enter the **Snowflake account URL**, for example `https://myorg-myaccount.snowflakecomputing.com`. Paste the `OAUTH_CLIENT_ID` and `OAUTH_CLIENT_SECRET` values from the query in step 1 into **Client ID** and **Client secret**. Select **Save**. A "Snowflake client saved." notification confirms it. Lightdash works out the sign-in and token addresses from the account URL. **4. Verify** Select **Verify integration**. Lightdash runs the checks below and names each missing piece. **5. Turn on** Select **Turn on**. It stays disabled until the required checks pass. **Cancel** closes the steps and keeps the saved rule. ![The Set up the Snowflake agent integration steps with a Not active yet badge: the CREATE SECURITY INTEGRATION SQL with a copy button, the Add your Snowflake account and client details form with the placeholders OAUTH\_CLIENT\_ID from the query above and OAUTH\_CLIENT\_SECRET from the query above, and Verify with OAuth client settings Failed: Not saved, Authorization endpoint Not checked and Agent session Not checked](https://mintcdn.com/lightdash/RAdZRkxizSYzVmys/images/agents/agent-identity/org-agent-identity-snowflake-setup.png?fit=max\&auto=format\&n=RAdZRkxizSYzVmys\&q=85\&s=ce1512de97892613a7bfc25c714d0307) Lightdash stores the client for your organization and encrypts the secret. It never shows the secret again. Only organization admins can save or replace the client. After you save, step 2 shows the account URL, the client ID, "Client secret saved" and a **Replace client** button. ![Step 2 Add your Snowflake account and client details after a save: the Snowflake account URL, the client ID, Client secret saved and a Replace client button](https://mintcdn.com/lightdash/RAdZRkxizSYzVmys/images/agents/agent-identity/org-agent-identity-snowflake-client-saved.png?fit=max\&auto=format\&n=RAdZRkxizSYzVmys\&q=85\&s=28b0d36134da7aed579c13d871215b1d) When you replace the client, the agent sign-ins that people made with the old client stop working. Each person connects their agent again. | Check | Required for **Turn on** | What it checks | | - | - | - | | OAuth client settings | Yes | A client is saved for your organization. With no client, the result is "Not saved. Paste the client ID and secret from Snowflake in the form above, then verify again." It never shows the client secret. | | Authorization endpoint | Yes | Snowflake's sign-in page answers. A pass says "Snowflake's sign-in page responded." With no client, the result is "Save the OAuth client first." A pass does not prove that the integration settings are correct. When the endpoint returns HTTP 404 or 405, check the Snowflake account URL. | | Agent session | No | At least one person in the organization has connected their agent. Lightdash saves an agent connection only when Snowflake marks the session as an agent session. Until then, the result links to **My agent identity**. | ![Verify results: OAuth client settings Passed, Using the client saved for this organisation; Authorization endpoint Passed, Snowflake's sign-in page responded; Agent session Not checked, with a My agent identity link](https://mintcdn.com/lightdash/RAdZRkxizSYzVmys/images/agents/agent-identity/org-agent-identity-snowflake-verify-passed.png?fit=max\&auto=format\&n=RAdZRkxizSYzVmys\&q=85\&s=6c320e8bf59e136d232f794201453e42) Lightdash cannot sign in to Snowflake for you, so Verify checks only what the server can reach. The agent session check passes after the first person connects. When the integration is already set up, choosing **The person's agent sign-in** skips the steps and shows **Turn on agent sign-in** with **Turn on** and **Cancel**. After you turn it on, the setup closes and the Snowflake chip shows a green tick. To see the setup again, select the Snowflake chip, then **View setup**. The setup opens under the chips with the line "Verified · Snowflake agent integration · checked" followed by the time. **Hide setup** closes it. When a later check fails, the chip shows an orange warning and the setup opens by itself. ![The Identity section with the Snowflake setup open under the chips: the line Verified · Snowflake agent integration · checked less than a minute ago, a Hide setup button, and the three setup steps each with a green tick](https://mintcdn.com/lightdash/KafA2i3NlUJIK4kg/images/agents/agent-identity/org-agent-identity-snowflake-view-setup.png?fit=max\&auto=format\&n=KafA2i3NlUJIK4kg\&q=85\&s=68998561efada58357de5d398facf12a) Lightdash does not save **The person's agent sign-in** while no OAuth client is configured. This keeps an admin from saving a rule that refuses every agent query. ### Connect your agent Each person who uses agents connects their own agent once, after an admin turns on agent sign-in. **1. Open My agent identity** Go to **Settings → My agent identity** and find the **Snowflake** card. **2. Select Connect agent** Select **Connect agent**. A Snowflake sign-in opens in a popup. **3. Approve the sign-in** Sign in to Snowflake and approve the request. Lightdash checks that Snowflake marks the session as an agent session before it saves the connection. The card then shows **Connected**, a **Disconnect** button and "Your agent sign-in lasts until" followed by the date, for example "7 Jan 2027". ![My agent identity with a Snowflake card marked Connected, the line Your agent sign-in lasts until 7 Jan 2027 and a Disconnect button, and a Databricks card that says agents run as the shared agent account your admin set up](https://mintcdn.com/lightdash/RAdZRkxizSYzVmys/images/agents/agent-identity/my-agent-connections-connected.png?fit=max\&auto=format\&n=RAdZRkxizSYzVmys\&q=85\&s=058efb2413657d0dd1acab597089de49) To remove the agent connection, select **Disconnect**. While the Snowflake rule is **The person's agent sign-in**, AI features lock again for that person until they reconnect. > [!NOTE] > > Disconnecting in Lightdash removes the saved connection in Lightdash only. Reconnecting signs the person in with their Snowflake default role again, so if they keep getting the wrong role, change their default role in Snowflake, then reconnect. This connection is separate from your [personal warehouse connections](/personal-settings/personal-warehouse-connections). Dashboards and the SQL Runner keep using your normal credentials. ### My agent identity **Settings → My agent identity** shows when the organization's rule for at least one warehouse is not **The person**. The page has one card for each warehouse where the person has a project and the rule needs one: * **The person's agent sign-in** (Snowflake): a card with the person's sign-in status and a button. * **A shared agent account** (Snowflake, BigQuery, Databricks, Athena, Postgres, Redshift, Trino or ClickHouse): a card that says, for example, "Agents on Databricks projects run as the shared agent account your admin set up. They read only what that account can read. Your own access doesn't change." There is nothing to do. When no card shows, the page says "Agents use your own warehouse access. There's nothing to connect." ![My agent identity with Snowflake, BigQuery and Databricks cards, each saying agents on that warehouse's projects run as the shared agent account your admin set up, read only what that account can read, and your own access doesn't change](https://mintcdn.com/lightdash/RAdZRkxizSYzVmys/images/agents/agent-identity/my-agent-connections-ai-service-account.png?fit=max\&auto=format\&n=RAdZRkxizSYzVmys\&q=85\&s=948e2acedf52d1bd9126b8006899e810) The Snowflake sign-in card shows one of these states: | State | What it means | Button | | - | - | - | | **Not connected** | The person has not connected their agent. Their AI questions on Snowflake projects are refused. | **Connect agent** | | **Connected** | The agent sign-in works. The card says "Your agent sign-in lasts until" followed by the date. | **Disconnect** | | **Expired** | The agent sign-in has ended. The card says when it ended, for example "Your Snowflake agent sign-in ended on 7 Oct 2026. Sign in again to keep using agents on Snowflake projects." | **Sign in again** | | **Failing** | The last sign-in from this page failed. The card shows the error. | **Connect agent** | | **Not available** | The Snowflake agent integration is not set up. The card says "Agent sign-in is not set up yet. Ask an admin to finish the Snowflake setup." | None | When the browser blocks the sign-in window, the card says "Your browser blocked the Snowflake sign-in window. Allow pop-ups for this site, then try again." The state does not change. ![My agent identity with a Snowflake card marked Expired, the line Your Snowflake agent sign-in ended on 7 Oct 2026, and a Sign in again button, and a Databricks card for the shared agent account](https://mintcdn.com/lightdash/RAdZRkxizSYzVmys/images/agents/agent-identity/my-agent-connections-expired.png?fit=max\&auto=format\&n=RAdZRkxizSYzVmys\&q=85\&s=60e9c69e60ade17637ea1310db03e8a8) ### How long the agent connection lasts Lightdash refreshes the agent sign-in in the background while the Snowflake grant lasts, so people do not sign in again for each session. The length of the grant comes from `OAUTH_REFRESH_TOKEN_VALIDITY` on the Snowflake security integration. **Settings → My agent identity** shows "Your agent sign-in lasts until" followed by the date. Snowflake decides when the connection ends: * **The grant ended or Snowflake revoked it.** Snowflake returns `invalid_grant`. Lightdash refuses the agent query with "Your agent connection expired. Connect again." The person connects again. * **Snowflake is not available for a short time.** For example, a network error, a timeout, a rate limit or a server error. The agent query fails with an error that you can retry. The agent connection stays in place. * **Snowflake rejects the Lightdash OAuth client.** Lightdash refuses the agent query with "The warehouse OAuth client was rejected. Ask an administrator to check the agent sign-in settings." Connecting again does not help. An admin checks the security integration in Snowflake and the client on **Organization settings → Agents**. See [Set up the Snowflake agent integration](#set-up-the-snowflake-agent-integration). ### Set the Snowflake rule An organization admin selects **Turn on** for **The person's agent sign-in** on **Organization settings → Agents**. See [Set up the Snowflake agent integration](#set-up-the-snowflake-agent-integration). Tell people before you turn it on: until each person connects, Lightdash refuses their agent queries on Snowflake. While the rule is set: * Every AI query on a Snowflake connection must run through the person's agent connection. Lightdash refuses queries from people who have not connected. * This covers chat, [MCP](/agents/lightdash-mcp), [Slack](/integrations/slack) and data app sample queries. * Every Snowflake connection form shows "Agent identity required by your organisation", with a link to the organization settings. ![The Type field of a Snowflake connection form with the read-only note Agent identity required by your organisation and an Organisation settings link](https://mintcdn.com/lightdash/LRLOrRwsbA2U0H2D/images/agents/agent-identity/snowflake-connection-requirement.png?fit=max\&auto=format\&n=LRLOrRwsbA2U0H2D\&q=85\&s=5d66e91f63fe9a3f40f4448b9bfc6b92) The rule does not create Snowflake policies. Without policies, agent sessions read the same data as the person. See [Write Snowflake policies for agent sessions](#write-snowflake-policies-for-agent-sessions). Changing the Snowflake row back to **The person** does not revoke Snowflake tokens that people already issued. ### Until a person connects While the Snowflake rule is **The person's agent sign-in** and a person has not connected their agent, Lightdash refuses their AI queries on Snowflake projects. The refusal message is "Connect your agent to the warehouse once so it can run as you." When the agent connection has expired, the message is "Your agent connection expired. Connect again." Each surface shows the person how to connect: * **In the app,** AI composers are hidden for Snowflake projects. This includes the Ask AI launcher, the homepage ask box and AI help in other parts of the app. The agent chat shows a **Connect your agent to your warehouse** card with a **Connect agent** button and a **Manage agent connections** link. * **In Slack,** the agent posts only the refusal: "I need you to sign in to Snowflake before I can run this. It takes about 30 seconds. Then ask me again." It has a **Connect agent** button, and the task card says "Needs your sign-in". * **In MCP,** the tool result shows the refusal message and a link to connect, and tells the agent to run the same call again after the person connects. The `connect_agent` tool returns the person's connection status and the same link, so an MCP client can offer it before the first query. * **In the CLI,** `lightdash agent status` shows the refusal message and the link. `lightdash agent connect` prints the link, opens it in the browser and counts down while it waits for the person to approve. When the person approves, it shows who agents now run as and until when, and asks them to run their last command again. See [`lightdash agent connect`](/workflow/cli/reference#lightdash-agent-connect). Every **Connect agent** button and link opens the same Snowflake sign-in as **Connect agent** in **Settings → My agent identity**. When a refusal needs an admin instead, for example because the last check of the agent connection failed, Slack posts only the refusal message with an **Open agent settings** button, and the task card says "Needs an admin". The button opens **Organization settings → Agents**. ![The Connect your agent to your warehouse card with a Connect agent button](https://mintcdn.com/lightdash/LRLOrRwsbA2U0H2D/images/agents/agent-identity/connect-agent-chat-card.png?fit=max\&auto=format\&n=LRLOrRwsbA2U0H2D\&q=85\&s=3e69999ffd94426b0295d268a8e7f889) ### Write Snowflake policies for agent sessions Snowflake owns the data rules. Your policies decide what agent sessions may read. Lightdash does not create these policies. Adapt the examples to your data and existing policies before you attach them. Use a Snowflake role with the required policy privileges. Each example reads `SYS_CONTEXT('SNOWFLAKE$CURRENT', 'IS_AGENT_ACTIVATED')`. The value is true only in a verified agent session. #### Hide rows from agents A row access policy can exclude sensitive rows from agent sessions: ```sql theme={null} CREATE ROW ACCESS POLICY agent_rows AS (is_sensitive BOOLEAN) RETURNS BOOLEAN -> NOT COALESCE(SYS_CONTEXT('SNOWFLAKE$CURRENT', 'IS_AGENT_ACTIVATED')::BOOLEAN, FALSE) OR NOT is_sensitive; ALTER TABLE protected_records ADD ROW ACCESS POLICY agent_rows ON (is_sensitive); ``` #### Mask values from agents A masking policy can hide a value from agent sessions: ```sql theme={null} CREATE MASKING POLICY agent_mask AS (value STRING) RETURNS STRING -> CASE WHEN SYS_CONTEXT('SNOWFLAKE$CURRENT', 'IS_AGENT_ACTIVATED')::BOOLEAN THEN 'REDACTED' ELSE value END; ALTER TABLE protected_records MODIFY COLUMN email SET MASKING POLICY agent_mask; ``` #### Use a view on Snowflake Standard Edition Row access and masking policies need Snowflake Enterprise Edition. On Standard Edition, a view gives the same result for the columns it covers: ```sql theme={null} CREATE OR REPLACE VIEW customers_v AS SELECT customer_id, name, CASE WHEN SYS_CONTEXT('SNOWFLAKE$CURRENT', 'IS_AGENT_ACTIVATED')::BOOLEAN THEN 'REDACTED' ELSE phone END AS phone FROM customers; ``` Point your dbt model at the view, not the table. #### Limit what an agent session can do A session policy can limit the privileges of an agent session: ```sql theme={null} CREATE SESSION POLICY agent_session_scope AGENT_RESTRICTED_SESSION_SCOPE = 'SNOWFLAKE$DATA_READ_WITH_AI'; ALTER USER example_user SET SESSION POLICY agent_session_scope; ``` The restricted scope limits the privileges the role already has. It does not grant new privileges. Review any existing session policy before you replace it. For the full Snowflake reference, see [agent identity](https://docs.snowflake.com/en/user-guide/agent-identity) and [restricted session scopes](https://docs.snowflake.com/en/user-guide/restricted-session-scope). ### Verify on Snowflake Run the same check in an agent session and in a normal session for the same person. For the agent session, ask an agent to run the SQL, for example in [SQL mode](/agents/use-ai-agents#sql-mode) or through the MCP `run_sql` tool. For the normal session, run it in a Snowflake worksheet as that person. ```sql theme={null} SELECT SYS_CONTEXT('SNOWFLAKE$CURRENT', 'IS_AGENT_ACTIVATED') AS agent_activated, SYS_CONTEXT('SNOWFLAKE$SESSION', 'ACTIVE_RESTRICTED_SESSION_SCOPES') AS active_scopes; ``` `agent_activated` is true only in the agent session. Then inspect recent query history with a role that can read account usage: ```sql theme={null} SELECT query_id, start_time, user_name, role_name, agent_type, query_tag FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY WHERE start_time >= DATEADD('hour', -1, CURRENT_TIMESTAMP()) ORDER BY start_time DESC; ``` The agent query has `agent_type = 'EXTERNAL_AGENT'` and the Lightdash agent tag in `query_tag`. `QUERY_HISTORY` has an ingestion delay, so new queries can take a while to appear. See [QUERY\_HISTORY](https://docs.snowflake.com/en/sql-reference/account-usage/query_history). Finally, query a protected table through an agent and as the person. Check that your row access, masking and session policies give the restrictions you expect. ## Snowflake: the shared agent account With this identity, agent queries on a Snowflake project run as one Snowflake user that signs in with a key pair. An admin adds the user, its private key, a role and a warehouse to the project connection. Snowflake then applies that role's grants and your policies to every agent query. > [!WARNING] > > Every person's agent gets the same access: the grants of the shared agent account's role. Snowflake does not apply each person's own role to agent queries. Grant the role only the data that every agent user may see. Use this identity when every agent user may see the same data. To let Snowflake apply each person's own access to their agent, use [the person's agent sign-in](#snowflake-agent-sign-in-for-each-person) instead. The shared agent account replaces only the identity of the connection: the user, key, role and warehouse. The account, database and schema stay from the connection. The connection's custom query tag does not carry over. Lightdash still tags each agent query with the person it ran for. See [Find agent queries in the warehouse](#find-agent-queries-in-the-warehouse). ### Set up the Snowflake shared agent account While the project has no shared agent account, the **Shared agent account** card on **Project settings → Agent identity** shows three setup steps: create the account in Snowflake, grant it only the data agents may read, and add it here and select **Test**. Each step has its SQL and a copy button. **1. Create a key pair** Create an RSA key pair for the user. See [Key-pair authentication](https://docs.snowflake.com/en/user-guide/key-pair-auth). **2. Create the account in Snowflake** Create a separate Snowflake user and role for agents. The role and warehouse must exist: ```sql theme={null} CREATE USER AI_AGENT TYPE = SERVICE_AGENT RSA_PUBLIC_KEY = '' DEFAULT_ROLE = AI_AGENT_ROLE DEFAULT_WAREHOUSE = AI_AGENT_WH; GRANT ROLE AI_AGENT_ROLE TO USER AI_AGENT; ``` `TYPE = SERVICE_AGENT` is recommended, not required. With it, Snowflake marks every session of the user as an agent session. **3. Grant it only the data agents may read** Grant the role `USAGE` on the warehouse, database and schema, and `SELECT` on each table that agents may read: ```sql theme={null} GRANT USAGE ON WAREHOUSE AI_AGENT_WH TO ROLE AI_AGENT_ROLE; GRANT USAGE ON DATABASE TO ROLE AI_AGENT_ROLE; GRANT USAGE ON SCHEMA . TO ROLE AI_AGENT_ROLE; GRANT SELECT ON TABLE .. TO ROLE AI_AGENT_ROLE; ``` **4. Add the shared agent account** Select **Add shared agent account**. Enter the **User**, upload or paste the **Private key**, and enter the **Passphrase** if the key has one, the **Role** and the **Warehouse**. Select **Test and save**. Lightdash signs in with the key pair before it saves. **Test** checks the values without saving them. **5. Set the Snowflake rule** Add a shared agent account on every Snowflake project connection first. Then an organization admin selects the Snowflake chip on **Organization settings → Agents** and chooses **A shared agent account**. See [Choose who agents run as](#choose-who-agents-run-as). ![The shared agent account card on a Snowflake project with no account: the alert Agents are refused on this project until you add a shared agent account, an Add shared agent account button, and the setup steps with the CREATE USER SQL, the GRANT statements and Add it here and select Test](https://mintcdn.com/lightdash/18J8lppse3Q52tRw/images/agents/agent-identity/snowflake-ai-service-account-setup.png?fit=max\&auto=format\&n=18J8lppse3Q52tRw\&q=85\&s=489a2d0823554235ae43fd221400f7c8) ![The shared agent account form for Snowflake with User, Private key with Upload file and Paste key options and the key blurred, Passphrase (optional), Role and Warehouse fields, the line Signs in as AI\_AGENT · AI\_AGENT\_ROLE, and Cancel, Test and Test and save buttons](https://mintcdn.com/lightdash/aFaeNoL9dy2TdEbL/images/agents/agent-identity/snowflake-ai-service-account-form.png?fit=max\&auto=format\&n=aFaeNoL9dy2TdEbL\&q=85\&s=f3ecda51dd0a63336c5bc6f79c478a7e) The Snowflake chip on **Organization settings → Agents** shows the number of projects that have no shared agent account. See [Read the chips](#read-the-chips). ### Agent sessions and your policies With `TYPE = SERVICE_AGENT`, `SYS_CONTEXT('SNOWFLAKE$CURRENT', 'IS_AGENT_ACTIVATED')` is true in every session of the shared agent account. The row access, masking and session policies in [Write Snowflake policies for agent sessions](#write-snowflake-policies-for-agent-sessions) then apply to agent queries. With another user type, Snowflake does not mark the sessions, and only the role's grants restrict agents. See [SERVICE\_AGENT users](https://docs.snowflake.com/en/sql-reference/sql/create-user). ### Test, replace and remove **Test** signs in with the key pair. The card then shows "Signs in as" followed by the user and role that Snowflake returns, for example "AI\_AGENT with role AI\_AGENT\_ROLE", the method **Key pair**, and when it was tested and added. Test proves that the key pair, role and warehouse work. It does not check what the role can read. ![The shared agent account card on a Snowflake project, marked In use: Agents on this project run as this account. The organization rule for Snowflake requires it, an Organization settings link, Signs in as AI\_AGENT with role AI\_AGENT\_ROLE, Key pair, Tested 9 Oct 2026. Added 9 Oct 2026, and Test, Replace and Remove buttons](https://mintcdn.com/lightdash/18J8lppse3Q52tRw/images/agents/agent-identity/snowflake-ai-service-account-card.png?fit=max\&auto=format\&n=18J8lppse3Q52tRw\&q=85\&s=8dfba8986846002d2b42fdde8d4b6f97) * To change the user, key, role or warehouse, select **Replace**. A failed sign-in keeps the saved account. * To remove the shared agent account, select **Remove** and confirm. Agent queries on that project are refused until an admin adds one again. Preview projects use the shared agent account of their parent project. See [Preview projects](#preview-projects). ### What agents and people see on Snowflake When the Snowflake rule is **A shared agent account**: * Chat, [MCP](/agents/lightdash-mcp), [Slack](/integrations/slack) and data app sample queries on Snowflake run as the shared agent account. * Agent sessions turn off the Snowflake result cache, and Lightdash does not reuse cached results for these queries. * People have nothing to set up. They do not connect an agent. When a project has no shared agent account, or Snowflake rejects the key pair, Lightdash refuses the agent query. See [When the shared agent account is missing or fails](#when-the-shared-agent-account-is-missing-or-fails). ### Verify the Snowflake shared agent account Ask an agent to run this SQL, for example in [SQL mode](/agents/use-ai-agents#sql-mode) or through the MCP `run_sql` tool: ```sql theme={null} SELECT CURRENT_USER() AS principal, CURRENT_ROLE() AS role, SYS_CONTEXT('SNOWFLAKE$CURRENT', 'IS_AGENT_ACTIVATED') AS agent_activated; ``` The result is the shared agent account user and role. With `TYPE = SERVICE_AGENT`, `agent_activated` is true. ## BigQuery: the shared agent account With this identity, agent queries on a BigQuery project run as a separate Google Cloud service account. An admin adds the account's key to the project connection. BigQuery then applies that account's grants to every agent query, so you decide what agents can read with ordinary BigQuery permissions. > [!WARNING] > > Every person's agent gets the same access: the grants of the shared agent account. BigQuery does not apply each person's own row-level access policies or column masking to agent queries. Grant the shared agent account only the data that every agent user may see. You can write row access policies and masking rules that target the shared agent account itself. See [Decide what agents can read](#decide-what-agents-can-read). The shared agent account replaces only the credentials of the connection. The project, dataset and location stay from the connection. ### Set up the BigQuery shared agent account While the project has no shared agent account, the **Shared agent account** card on **Project settings → Agent identity** shows three setup steps: create the account in BigQuery, grant it only the data agents may read, and add it here and select **Test**. The commands create the account, grant `roles/bigquery.jobUser` on the project that runs the jobs, and grant `roles/bigquery.dataViewer` on the dataset of the connection. The project, the execution project and the dataset come from the connection. Select the copy button to copy the commands. ![The shared agent account card on a BigQuery project with no account: the alert Agents are refused on this project until you add a shared agent account, an Add shared agent account button, and the setup steps with gcloud and bq commands in steps 1 and 2 and Add it here and select Test in step 3](https://mintcdn.com/lightdash/18J8lppse3Q52tRw/images/agents/agent-identity/ai-service-account-setup.png?fit=max\&auto=format\&n=18J8lppse3Q52tRw\&q=85\&s=31fe8deb7b7f9e7b4abfb65518434e1d) The commands use the account name `lightdash-agents`. Change it if your organization uses a different name. **1. Create a service account** In Google Cloud, create a service account for agents. Use a different account from the one the project connection uses, so agents get their own grants. See [Create service accounts](https://cloud.google.com/iam/docs/service-accounts-create). **2. Grant read access** Grant the account `roles/bigquery.jobUser` on the Google Cloud project of the connection, so that it can run queries. Then grant it read access only to the data that agents may use, for example `roles/bigquery.dataViewer` on each dataset. Do not grant data roles on the whole project unless agents may read every dataset in it. See [Decide what agents can read](#decide-what-agents-can-read) and [BigQuery IAM roles](https://cloud.google.com/bigquery/docs/access-control). **3. Create a JSON key** Create a JSON key for the account and download the key file. See [Create and delete service account keys](https://cloud.google.com/iam/docs/keys-create-delete). **4. Add the key in Lightdash** A project admin goes to **Project settings → Agent identity** and finds the **Shared agent account** card. Select **Add shared agent account**, then select the JSON key file in **Service account key file**. **5. Test the key** Select **Test**. Lightdash runs `SELECT SESSION_USER()` with the key and shows "Signs in as" followed by the account that BigQuery returns. Check that this is the shared agent account and not the connection's own account. Test saves nothing. **6. Save** Select **Save**. An "Shared agent account saved." notification confirms it. **7. Set the BigQuery rule** Add a key on every BigQuery project connection first. Then an organization admin selects the BigQuery chip on **Organization settings → Agents** and chooses **A shared agent account**. See [Choose who agents run as](#choose-who-agents-run-as). ### The project Agent identity page People who can manage a project find **Agent identity** in the project settings sidebar, after **Tables configuration**. The page has one **Shared agent account** card, with the same layout on Snowflake, BigQuery, Databricks, Athena, Postgres, Redshift, Trino and ClickHouse: * **Status.** A badge says **In use** or **Not in use**, and one line gives the reason from the organization rule, for example "Agents on this project run as this account. The organization rule for BigQuery requires it." An **Organization settings** link opens the rule. Only an organization admin can change it. * **Missing.** When the rule requires a shared agent account and the project has none, an alert says "Agents are refused on this project until you add a shared agent account." The card has an **Add shared agent account** button. * **Summary.** After you save an account, the card shows "Signs in as" followed by the account, the method (**Key file**, **Key pair** or **Client ID and secret**), and when it was tested and added. Before the first Test, it says "Not tested yet. Select Test to see who it signs in as." * **Buttons.** **Test**, **Replace** and **Remove**. A failed Test shows the error in an alert. * **Setup steps.** While the project has no shared agent account, the card shows three setup steps for the warehouse. After you save an account, the card does not show them. A [preview project](#preview-projects) never shows them, because its account comes from the parent project. ![The shared agent account card on a BigQuery project, marked In use: Agents on this project run as this account. The organization rule for BigQuery requires it, an Organization settings link, Not tested yet, Key file, Added 9 Oct 2026 and Test, Replace and Remove buttons](https://mintcdn.com/lightdash/18J8lppse3Q52tRw/images/agents/agent-identity/project-ai-service-account-in-use.png?fit=max\&auto=format\&n=18J8lppse3Q52tRw\&q=85\&s=c59b8a727b85a171936190a8165de9b8) When the rule is **The person**, the card says **Not in use**, and agents use each person's own credentials. When the Snowflake rule is **The person's agent sign-in**, the card says agents use each person's own agent sign-in for Snowflake. On BigQuery, the setup steps also show the bytes-billed limit for agent queries, for example "Agent queries are limited to 500,000,000,000 bytes billed." To change it, set **AI agent maximum bytes billed** in the project connection. That limit applies whichever identity agents run as. See [AI agent maximum bytes billed](/integrations/connect-project#ai-agent-maximum-bytes-billed). Lightdash does not check that the shared agent account differs from the account of the connection. Use the Test result to confirm it. To check what agents can read, see [Verify on BigQuery](#verify-on-bigquery). ### Decide what agents can read The shared agent account reads only what you grant it. BigQuery checks those grants on every agent query, so you restrict agents with BigQuery permissions and policies on the shared agent account. You can combine the levels below. The examples use `lightdash-agents@my-project.iam.gserviceaccount.com` for the shared agent account and `lightdash@my-project.iam.gserviceaccount.com` for the connection's own account. Replace them with your accounts. Agents query the same explores, and so the same tables, as people. Put each restriction on the tables behind those explores. A question that needs data the shared agent account cannot read fails with an access denied error in chat, MCP and Slack. Keep the explores that agents use within what the shared agent account can read. To hide explores and fields from agents, use [agent tags](/agents/data-access#limiting-access-to-specific-explores-and-fields). #### Datasets Grant `roles/bigquery.dataViewer` only on the datasets that agents may use: ```sql theme={null} GRANT `roles/bigquery.dataViewer` ON SCHEMA `my-project`.jaffle_shop TO "serviceAccount:lightdash-agents@my-project.iam.gserviceaccount.com"; ``` The account can then query every table in that dataset, and no table in a dataset where it has no grant. See [GRANT statement](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-control-language#grant_statement). #### Tables To give agents only some tables in a dataset, grant Data Viewer on each table instead of on the dataset: ```sql theme={null} GRANT `roles/bigquery.dataViewer` ON TABLE `my-project`.jaffle_shop.orders TO "serviceAccount:lightdash-agents@my-project.iam.gserviceaccount.com"; ``` See [table-level access control](https://cloud.google.com/bigquery/docs/table-access-controls-intro). #### Columns Policy tags protect individual columns. You create a taxonomy with a policy tag, for example `pii`, and attach it to the sensitive columns. Then you choose what the shared agent account sees in those columns: * **Masked values.** Add a data policy with a masking rule to the policy tag. Grant the shared agent account the Masked Reader role, `roles/bigquerydatapolicy.maskedReader`, on the data policy. The account then reads masked values: for example `NULL` with the Nullify rule, or an empty string for a `STRING` column with the Default masking value rule. This is the BigQuery equivalent of the Snowflake `REDACTED` example. * **No access.** Do not grant the shared agent account the Fine-Grained Reader role, `roles/datacatalog.categoryFineGrainedReader`, or the Masked Reader role. A query that selects the column fails with an error. Agent questions that do not use the column still work. For example, with the Nullify rule on the `email` column of `protected_records`: | Account | Role | `SELECT email FROM protected_records` | | - | - | - | | The connection's own account | Fine-Grained Reader on the policy tag | The real email addresses | | The shared agent account | Masked Reader on the data policy | `NULL` in every row | | The shared agent account | Neither role | An access denied error | When a policy tag has a data policy, or its taxonomy enforces access control, every account that reads the column needs one of the two roles. Grant Fine-Grained Reader on the policy tag to the connection's own account, and to people who query with their own Google accounts. Otherwise their dashboards fail on that column too. See [column-level access control](https://cloud.google.com/bigquery/docs/column-level-security-intro) and [dynamic data masking](https://cloud.google.com/bigquery/docs/column-data-masking-intro). #### Rows A row access policy limits the rows that the shared agent account can read. The account still needs Data Viewer on the table: ```sql theme={null} CREATE ROW ACCESS POLICY agent_rows ON `my-project.jaffle_shop.protected_records` GRANT TO ('serviceAccount:lightdash-agents@my-project.iam.gserviceaccount.com') FILTER USING (is_sensitive = FALSE); ``` > [!WARNING] > > When a table has a row access policy, accounts that no policy grants see no rows. This includes the connection's own account. Add a policy with the `TRUE` filter for that account, and for people who query with their own Google accounts. ```sql theme={null} CREATE ROW ACCESS POLICY connection_all_rows ON `my-project.jaffle_shop.protected_records` GRANT TO ('serviceAccount:lightdash@my-project.iam.gserviceaccount.com') FILTER USING (TRUE); ``` See [row-level security](https://cloud.google.com/bigquery/docs/row-level-security-intro), [manage row access policies](https://cloud.google.com/bigquery/docs/managing-row-level-security) and [the `TRUE` filter](https://cloud.google.com/bigquery/docs/using-row-level-security-with-features#the_true_filter). Column-level access control, dynamic data masking and row-level security need BigQuery Enterprise or Enterprise Plus edition, or on-demand pricing. See [BigQuery editions](https://cloud.google.com/bigquery/docs/editions-intro). ### One key for each project connection Each project connection holds its own shared agent account. While the BigQuery rule is **A shared agent account**, agents are refused on every BigQuery project that has no key. A preview project uses the key of its parent, see [Preview projects](#preview-projects). Add a key on every BigQuery project connection. You can use the same key file on more than one project. Each chip on **Organization settings → Agents** that uses **A shared agent account** shows the number of projects that have no shared agent account yet. When every project has one, the chip shows a green tick. See [Read the chips](#read-the-chips). #### Preview projects A preview project always uses the shared agent account of its parent project for the matching connection. A preview has no shared agent account of its own, and you cannot add one on a preview. Developers can ask agents about a preview with no extra setup. Lightdash does not copy the account: it reads the account of the parent on each query. When an admin replaces or removes the account of the parent, previews use the new state on their next query. The **Shared agent account** card on the preview's **Agent identity** page is read-only. To add or change the account, go to the parent project. * **The parent has an account.** The card says "Uses the shared agent account from" followed by a link to the parent. It shows "Signs in as" followed by the account, the method, and when it was tested. Select **Test** to test the parent's account on the preview's connection. * **The parent has no account, and the rule requires one.** A warning says "Agents are refused on this preview until the parent project has a shared agent account for this connection. Ask an admin to add one on the parent project." The last words link to the parent project. * **The parent has no account, and the rule does not require one.** The card says "The parent project has no shared agent account. Add one on the parent project." * **Lightdash can't read the parent's account.** An alert says that agents are refused on the preview. Ask an admin of the parent project to replace the parent's account. ![The shared agent account card on a Postgres preview project, marked In use: Agents on this project run as this account. The organization rule for Postgres requires it, an Organization settings link, Uses the shared agent account from Jaffle shop, Signs in as followed by the account, User and password, Tested 11 Oct 2026, and a Test button](https://mintcdn.com/lightdash/cqFtbc_Jed_Xh3cL/images/agents/agent-identity/preview-parent-shared-agent-account.png?fit=max\&auto=format\&n=cqFtbc_Jed_Xh3cL\&q=85\&s=3e598808a860130c6471e9f176fcf599) ![The shared agent account card on a preview project with the warning Agents are refused on this preview until the parent project has a shared agent account for this connection. Ask an admin to add one on the parent project](https://mintcdn.com/lightdash/cqFtbc_Jed_Xh3cL/images/agents/agent-identity/preview-parent-no-shared-agent-account.png?fit=max\&auto=format\&n=cqFtbc_Jed_Xh3cL\&q=85\&s=d12715ac8ff99e72dab037180cec84c5) The original connection of a preview matches the original connection of the parent. An extra connection matches the extra connection of the parent with the same name and warehouse type. A preview does not use the parent's account when no connection matches or when the parent is in another organization. The preview then has no shared agent account. A preview of a preview uses the account of its direct parent. A preview whose parent project was deleted is an ordinary project and keeps its own shared agent account. Anyone who can query a preview can make agents run as the parent's shared agent account on that preview. Only admins of the parent can change the parent's account. **Grant the parent's account access to preview data.** Agent queries on a preview run as the parent's account, so that account needs read access to the datasets or schemas that previews build into. Without it, agent queries on the preview fail: * **Postgres, Redshift, Trino and ClickHouse:** the error starts with "This preview uses the parent's shared agent account, which can't read this preview's data. Ask an admin to grant it access.", followed by the warehouse error. * **BigQuery, Snowflake, Databricks and Athena:** the person sees the warehouse error only. ### What agents and people see When the BigQuery rule is **A shared agent account**: * Chat, [MCP](/agents/lightdash-mcp), [Slack](/integrations/slack) and data app sample queries on BigQuery run as the shared agent account. * BigQuery agent jobs carry the label `agent: true` and skip the BigQuery query cache. Lightdash does not reuse cached results for these queries. * **Settings → My agent identity** shows a BigQuery card that says agents run as the shared agent account your admin set up. People have nothing to set up. See [My agent identity](#my-agent-identity). When a project has no shared agent account, Lightdash refuses the agent query and blocks AI composers on the project. The shared agent account card on the project's **Agent identity** page shows a warning for admins. See [When the shared agent account is missing or fails](#when-the-shared-agent-account-is-missing-or-fails). When BigQuery rejects the saved key, Lightdash refuses the agent query. Replace the key on the shared agent account card. To remove the key, select **Remove** on the card and confirm. Agent queries on that project are refused until an admin adds a key again. ### Verify on BigQuery Ask an agent to run this SQL, for example in [SQL mode](/agents/use-ai-agents#sql-mode) or through the MCP `run_sql` tool: ```sql theme={null} SELECT SESSION_USER() AS principal; ``` The result is the email address of the shared agent account. Then find recent agent jobs in the jobs view for the region of your data. Run it as an account that can run queries and list all jobs in the project, for example one with the BigQuery Resource Viewer and BigQuery Job User roles: ```sql theme={null} SELECT creation_time, user_email, job_id, query FROM `region-us`.INFORMATION_SCHEMA.JOBS WHERE creation_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 HOUR) AND EXISTS ( SELECT 1 FROM UNNEST(labels) AS label WHERE label.key = 'agent' AND label.value = 'true' ) ORDER BY creation_time DESC; ``` Replace `region-us` with the region of your datasets. Agent jobs show the shared agent account in `user_email`. See [JOBS view](https://cloud.google.com/bigquery/docs/information-schema-jobs). Finally, ask an agent about an explore whose table the shared agent account cannot read. BigQuery refuses the query with an access denied error. ## Databricks: the shared agent account With this identity, agent queries on a Databricks project run as a separate Databricks service principal. An admin adds the service principal's OAuth client ID and secret (OAuth machine-to-machine) to the project connection. Unity Catalog then applies that service principal's grants, row filters and column masks to every agent query. > [!WARNING] > > Every person's agent gets the same access: the grants of the service principal. Unity Catalog applies its row filters and column masks to the service principal, not to the person who asked. Grant the service principal only the data that every agent user may see. Databricks does not offer **The person's agent sign-in**, and has no service principal for each group. The shared agent account replaces only the sign-in of the connection. The host, HTTP path, catalog, schema and compute stay from the connection. ### Before you start * The `agent-identity` feature flag is on. See the note at the top of this page. * You are an admin of the Lightdash project, and an organization admin sets the rule. * The project connection uses a Databricks SQL warehouse in the workspace. ### Set up the Databricks shared agent account While the project has no shared agent account, the **Shared agent account** card on **Project settings → Agent identity** shows three setup steps: create the account in Databricks, grant it only the data agents may read, and add it here and select **Test**. **1. Create the service principal and an OAuth secret** In the Databricks account console, create a service principal and an OAuth secret for it. Add the service principal to the workspace, and give it the `CAN USE` permission on the SQL warehouse of the connection. The application ID of the service principal is the client ID. See [Service principals](https://docs.databricks.com/aws/en/admin/users-groups/service-principals) and [OAuth machine-to-machine authentication](https://docs.databricks.com/aws/en/dev-tools/auth/oauth-m2m). **2. Grant access to the data agents may read** Grant the service principal `USE CATALOG`, `USE SCHEMA` and `SELECT`. The card has the statements with the catalog and schema of the connection, and a copy button. Replace the placeholders, and repeat `SELECT` for each table or view that agents may read: ```sql theme={null} GRANT USE CATALOG ON CATALOG `analytics` TO ``; GRANT USE SCHEMA ON SCHEMA `analytics`.`marts` TO ``; GRANT SELECT ON TABLE `analytics`.`marts`.`
` TO ``; ``` **3. Add the client ID and secret** Select **Add shared agent account**. Enter the service principal's application ID in **Client ID** and the **Client secret**, then select **Test and save**. **Test** checks the values without saving them. **4. Set the Databricks rule** Add a shared agent account on every Databricks project connection first. Then an organization admin selects the Databricks chip on **Organization settings → Agents** and chooses **A shared agent account**. See [Choose who agents run as](#choose-who-agents-run-as). ![The shared agent account card on a Databricks project with no account: the alert Agents are refused on this project until you add a shared agent account, an Add shared agent account button, and the setup steps with the service principal steps, the GRANT statements and a copy button, and Add it here and select Test](https://mintcdn.com/lightdash/18J8lppse3Q52tRw/images/agents/agent-identity/databricks-ai-service-account-card.png?fit=max\&auto=format\&n=18J8lppse3Q52tRw\&q=85\&s=69a270af808e397317b0de6df9374ba0) ![The shared agent account form with Client ID and Client secret fields and Cancel, Test and Test and save buttons](https://mintcdn.com/lightdash/RAdZRkxizSYzVmys/images/agents/agent-identity/databricks-ai-service-account-form.png?fit=max\&auto=format\&n=RAdZRkxizSYzVmys\&q=85\&s=5b46c98726805b0487ff30f401ff6397) ### Test, replace and remove **Test** signs in as the service principal and runs `SELECT current_user()`. The card then shows "Signs in as" followed by the application ID, the method **Client ID and secret**, and when it was tested and added. Test proves that the client ID and secret work. It does not check what the service principal can read. * To change the service principal or the secret, select **Replace**. * Databricks OAuth secrets expire. Create a new secret before the old one expires, then select **Replace** and enter it. * To remove the shared agent account, select **Remove** and confirm. Agent queries on that project are refused until an admin adds one again. Preview projects use the shared agent account of their parent project. See [Preview projects](#preview-projects). ### What agents and people see on Databricks When the Databricks rule is **A shared agent account**: * Chat, [MCP](/agents/lightdash-mcp), [Slack](/integrations/slack) and data app sample queries on Databricks run as the service principal. * Agent queries skip the Databricks result cache. * People have nothing to set up. When a project has no shared agent account, or Databricks rejects the client ID or secret, Lightdash refuses the agent query. See [When the shared agent account is missing or fails](#when-the-shared-agent-account-is-missing-or-fails). ### Verify on Databricks Ask an agent to run this SQL, for example in [SQL mode](/agents/use-ai-agents#sql-mode) or through the MCP `run_sql` tool: ```sql theme={null} SELECT current_user() AS principal; ``` The result is the application ID of the service principal. Then ask an agent about an explore whose table the service principal cannot read. Databricks refuses the query with a permission error. ## Athena: the shared agent account With this identity, agent queries on an Athena project run as a separate AWS identity, with its own Athena workgroup and its own S3 results location. An admin adds the identity's access keys to the project connection. Lake Formation grants and data filters on that identity then decide what agents can read. > [!WARNING] > > Every person's agent gets the same access: the grants of the shared agent account. Grant it only the data that every agent user may see. The shared agent account takes only the region, catalog, database and query settings from the connection. The keys, workgroup and S3 locations come from the shared agent account. The connection's own role, web identity, keys, workgroup and S3 locations never apply to agent queries. ### Choose the AWS identity Lightdash signs in with access keys. It cannot renew keys yet. * **A dedicated IAM user for agents (recommended for now).** Give the user only the permissions agents need, and use its long-lived access keys. Rotate the keys on your normal schedule, and select **Replace** to add the new keys. * **An IAM role.** The setup steps in the card create a role. Keys from an assumed role expire within hours. When they expire, Lightdash refuses agent queries until an admin adds new keys. Lightdash will support keyless sign-in later. ### Set up the Athena shared agent account While the project has no shared agent account, the **Shared agent account** card on **Project settings → Agent identity** shows three setup steps. It has copy buttons for each policy and grant, built from the connection's region, catalog and database. **1. Create the AWS identity** Create an IAM user or role for agents. Create an Athena workgroup and an S3 results location for agents only. Attach the **Permission policy** from the setup steps. It allows queries through the agent workgroup, reads of the catalog metadata, and the results location. For a role, also use the **Role trust policy**, and give the trusted caller permission to assume the role. KMS keys and cross-account catalogs need extra permissions. See [Athena workgroups](https://docs.aws.amazon.com/athena/latest/ug/workgroups-manage-queries-control-costs.html). **2. Grant it only the data agents may read** As a Lake Formation administrator, run the **Lake Formation grant** from the setup steps for each table that agents may read. Grant to the user or role ARN, not to a session ARN. To limit rows or columns, use the **Filtered table grant** with a data filter instead. Other grants on the table can still allow more. See [Lake Formation data filters](https://docs.aws.amazon.com/lake-formation/latest/dg/data-filters-about.html). **3. Add the shared agent account** Select **Add shared agent account**. Enter the **Access key ID** and **Secret access key**, the **Session token** if the keys come from an assumed role, the **Agent workgroup**, the **S3 results location** and, if needed, the **S3 data location**. Select **Test and save**. **Test** checks the values without saving them. **4. Set the Athena rule** Add a shared agent account on every Athena project connection first. Then an organization admin selects the Athena chip on **Organization settings → Agents** and chooses **A shared agent account**, and confirms. See [Choose who agents run as](#choose-who-agents-run-as). ![The shared agent account form for Athena with Access key ID, Secret access key, Session token (optional), Agent workgroup, S3 results location and S3 data location (optional) fields, and Cancel, Test and Test and save buttons](https://mintcdn.com/lightdash/RAdZRkxizSYzVmys/images/agents/agent-identity/athena-ai-service-account-form.png?fit=max\&auto=format\&n=RAdZRkxizSYzVmys\&q=85\&s=92713e805220d1a0ca6f16f3dee08e8a) ### Test, replace and remove **Test** checks the AWS identity with `GetCallerIdentity`, then runs a simple query through the agent workgroup. The card then shows "Signs in as" followed by the identity's ARN, the method **Access keys**, and when it was tested and added. Test proves that the keys, workgroup and results location work. It does not check table grants. Test gives a specific message for rejected keys, denied access, a results location problem and a missing workgroup. ![The shared agent account card on an Athena project, marked In use: Agents on this project run as this account. The organization rule for Athena requires it, an Organization settings link, Signs in as followed by an assumed-role ARN, Access keys, Tested 9 Oct 2026. Added 8 Oct 2026, and Test, Replace and Remove buttons](https://mintcdn.com/lightdash/RAdZRkxizSYzVmys/images/agents/agent-identity/athena-ai-service-account-card.png?fit=max\&auto=format\&n=RAdZRkxizSYzVmys\&q=85\&s=6b3c44b7d5414331deefc6c079c4778b) * To add new keys, select **Replace**. * To remove the shared agent account, select **Remove** and confirm. Agent queries on that project are refused until an admin adds one again. Preview projects use the shared agent account of their parent project. See [Preview projects](#preview-projects). ### What agents and people see on Athena When the Athena rule is **A shared agent account**: * Chat, [MCP](/agents/lightdash-mcp), [Slack](/integrations/slack) and data app sample queries on Athena run as the shared agent account, through its workgroup. * **Settings → My agent identity** shows an Athena card. People have nothing to set up. See [My agent identity](#my-agent-identity). When a project has no shared agent account, or AWS rejects the keys, Lightdash refuses the agent query. Expired keys from an assumed role cause this too. See [When the shared agent account is missing or fails](#when-the-shared-agent-account-is-missing-or-fails). Lightdash never falls back to the connection's own credentials. ## Postgres: the shared agent account With this identity, agent queries on a Postgres project sign in as a separate Postgres login role, with its own user and password. Postgres then applies that role's grants and row-level security policies to every agent query. > [!WARNING] > > Every person's agent gets the same access: the grants of the shared agent account's role. Grant it only the data that every agent user may see. The shared agent account replaces only the user and password of the connection. The host, port, database, schema, SSL mode, root certificate and SSH tunnel stay from the connection. The connection's client certificates and its `role` setting never apply to agent queries. ### Set up the Postgres shared agent account While the project has no shared agent account, the **Shared agent account** card on **Project settings → Agent identity** shows three setup steps, with a **Copy SQL** button for each block. The SQL uses the database and schema of the connection. **1. Create a read-only login role** As a superuser or a role with `CREATEROLE`, create a separate login role for agents. Choose a strong password: ```sql theme={null} CREATE ROLE "ai_agents" LOGIN PASSWORD '' NOSUPERUSER NOCREATEDB NOCREATEROLE NOBYPASSRLS; ALTER ROLE "ai_agents" SET default_transaction_read_only = on; GRANT CONNECT ON DATABASE "" TO "ai_agents"; ``` **2. Grant the schemas that agents may read** Grant only the data that every agent user may see: ```sql theme={null} GRANT USAGE ON SCHEMA "" TO "ai_agents"; GRANT SELECT ON ALL TABLES IN SCHEMA "" TO "ai_agents"; ALTER DEFAULT PRIVILEGES IN SCHEMA "" GRANT SELECT ON TABLES TO "ai_agents"; ``` `ALTER DEFAULT PRIVILEGES` applies only to new tables that the role running it creates. Run it as each role that creates tables. **3. Add the shared agent account** Select **Add shared agent account**. Enter the **User** and **Password** of the login role, then select **Test and save**. **Test** checks the values without saving them. **4. Set the Postgres rule** Add a shared agent account on every Postgres project connection first. Then an organization admin selects the Postgres chip on **Organization settings → Agents** and chooses **A shared agent account**, and confirms. See [Choose who agents run as](#choose-who-agents-run-as). ![The shared agent account card on a Postgres project with no account, marked Not in use, with an Add shared agent account button and the three setup steps: Create the account in Postgres with the CREATE ROLE SQL, Grant it only the data agents may read with the GRANT statements and the row-level security template, and Add it here and select Test](https://mintcdn.com/lightdash/iSpJAup9JhRthojh/images/agents/agent-identity/postgres-ai-service-account-setup.png?fit=max\&auto=format\&n=iSpJAup9JhRthojh\&q=85\&s=e2b6375cebb0fd63e19be1260fbb94b3) ### Limit rows and columns To limit the rows that agents read, add a row-level security policy for the role. Replace the table and condition placeholders: ```sql theme={null} ALTER TABLE ""."
" ENABLE ROW LEVEL SECURITY; CREATE POLICY "ai_agents_rows" ON ""."
" FOR SELECT TO "ai_agents" USING (); ``` Row-level security does not apply to superusers, to roles with `BYPASSRLS`, or to the table owner unless the table has `FORCE ROW LEVEL SECURITY`. See [Row security policies](https://www.postgresql.org/docs/current/ddl-rowsecurity.html). To hide sensitive columns, replace the table-wide `SELECT` grant with a column grant, for example `GRANT SELECT (col_a, col_b) ON ""."
" TO "ai_agents";`. A table-wide grant still allows every column. ### Test, replace and remove **Test** signs in as the login role and runs `SELECT current_user, session_user`. Test fails when either value differs from the saved user. The card then shows "Signs in as" followed by the user, and when it was tested and added. Test proves that the user and password work. It does not check what the role can read. When Test fails, the card gives a fixed message for each cause: rejected credentials, a role without `LOGIN`, a `pg_hba.conf` rule that blocks the user, no `CONNECT` on the database, or a database that does not exist. Lightdash never shows the driver message, so a password never reaches the page or the logs. * To change the user or password, select **Replace**. * To remove the shared agent account, select **Remove** and confirm. Agent queries on that project are refused until an admin adds one again. Preview projects use the shared agent account of their parent project. See [Preview projects](#preview-projects). ### What agents and people see on Postgres When the Postgres rule is **A shared agent account**: * Chat, [MCP](/agents/lightdash-mcp), [Slack](/integrations/slack) and data app sample queries on Postgres sign in as the shared agent account. On a connection with an SSH tunnel, they use the same tunnel. * **Settings → My agent identity** shows a Postgres card. People have nothing to set up. See [My agent identity](#my-agent-identity). When a project has no shared agent account, or Postgres rejects the user or password, Lightdash refuses the agent query. See [When the shared agent account is missing or fails](#when-the-shared-agent-account-is-missing-or-fails). Lightdash never falls back to the connection's own credentials. ## Redshift: the shared agent account With this identity, agent queries on a Redshift project sign in as a separate Redshift database user, with its own user and password. Redshift then applies that user's grants, row-level security and masking policies to every agent query. > [!WARNING] > > Every person's agent gets the same access: the grants of the shared agent account. Grant it only the data that every agent user may see. Do not give the user superuser, `IGNORE RLS` or `sys:secadmin` rights, and check its inherited and `PUBLIC` grants. The shared agent account always signs in with a user and password, also when the project connection uses IAM. The host, port, database, schema, SSL settings and SSH tunnel stay from the connection. No IAM, SSO or personal sign-in fields apply to agent queries. ### Set up the Redshift shared agent account While the project has no shared agent account, the **Shared agent account** card on **Project settings → Agent identity** shows three setup steps, with a **Copy SQL** button for each block. The SQL uses the schema of the connection. **1. Create the database user** As a superuser or a user with `CREATE USER`, create a separate user for agents. Use a password of 8 to 64 ASCII characters, with an uppercase letter, a lowercase letter and a number. Do not use spaces, quotes, backslashes, slashes or `@`: ```sql theme={null} CREATE USER ai_agents PASSWORD '' NOCREATEDB NOCREATEUSER SYSLOG ACCESS RESTRICTED; ``` **2. Grant the schemas that agents may read** In the project database, grant only the data that every agent user may see: ```sql theme={null} GRANT USAGE ON SCHEMA "" TO ai_agents; GRANT SELECT ON ALL TABLES IN SCHEMA "" TO ai_agents; ALTER DEFAULT PRIVILEGES FOR USER "" IN SCHEMA "" GRANT SELECT ON TABLES TO ai_agents; ``` `ALTER DEFAULT PRIVILEGES` grants access to future tables of one owner. Repeat it for each table owner. **3. Add the shared agent account** Select **Add shared agent account**. Enter the **User** and **Password**, then select **Test and save**. **Test** checks the values without saving them. **4. Set the Redshift rule** Add a shared agent account on every Redshift project connection first. Then an organization admin selects the Redshift chip on **Organization settings → Agents** and chooses **A shared agent account**, and confirms. See [Choose who agents run as](#choose-who-agents-run-as). ![The shared agent account card on a Redshift project with no account: the alert Agents are refused on this project until you add a shared agent account, an Add shared agent account button, and the setup steps with the CREATE USER and GRANT statements](https://mintcdn.com/lightdash/RAdZRkxizSYzVmys/images/agents/agent-identity/redshift-ai-service-account-setup.png?fit=max\&auto=format\&n=RAdZRkxizSYzVmys\&q=85\&s=605a752e7651ebc7d92c00949d57c559) ### Limit rows and columns on Redshift The setup steps have templates for a row-level security policy and a masking policy. Replace the table, column, type and condition, and match the mask type to the column: ```sql theme={null} CREATE RLS POLICY ai_agents_rows WITH ("" ) USING (); ATTACH RLS POLICY ai_agents_rows ON ""."
" TO ai_agents; ALTER TABLE ""."
" ROW LEVEL SECURITY ON; CREATE MASKING POLICY ai_agents_mask WITH (value VARCHAR(256)) USING ('[redacted]'::VARCHAR(256)); ATTACH MASKING POLICY ai_agents_mask ON ""."
" ("") TO ai_agents; ``` Check the policy settings and limits for external and shared tables. See [Row-level security](https://docs.aws.amazon.com/redshift/latest/dg/t_rls.html) and [Dynamic data masking](https://docs.aws.amazon.com/redshift/latest/dg/t_ddm.html). ### Test, replace and remove **Test** signs in as the user and runs `SELECT current_user, session_user`. Both values must be the same, and must match the saved user. Redshift folds unquoted user names to lower case, so the lower-case form of the saved user also matches. The card then shows "Signs in as" followed by the user, and when it was tested and added. Test proves that the user and password work. It does not check what the user can read. When Test fails, the card gives a fixed message: rejected credentials, a missing database, missing grants, or a general message. Lightdash never shows the driver message. * To change the user or password, select **Replace**. * To remove the shared agent account, select **Remove** and confirm. Agent queries on that project are refused until an admin adds one again. Preview projects use the shared agent account of their parent project. See [Preview projects](#preview-projects). ### What agents and people see on Redshift When the Redshift rule is **A shared agent account**: * Chat, [MCP](/agents/lightdash-mcp), [Slack](/integrations/slack) and data app sample queries on Redshift sign in as the shared agent account. On a connection with an SSH tunnel, they use the same tunnel. * Agent queries skip the Redshift result cache. * **Settings → My agent identity** shows a Redshift card. People have nothing to set up. See [My agent identity](#my-agent-identity). When a project has no shared agent account, or Redshift rejects the user or password, Lightdash refuses the agent query. See [When the shared agent account is missing or fails](#when-the-shared-agent-account-is-missing-or-fails). Lightdash never falls back to the connection's own credentials. ## Trino: the shared agent account With this identity, agent queries on a Trino project sign in as a separate Trino user, with its own user and password. Trino access control then decides what agents read. > [!WARNING] > > Every person's agent gets the same access: the access of the shared agent account's user. Grant it only the data that every agent user may see. The shared agent account replaces only the user and password of the connection. The host, port, scheme, catalog, schema and source stay from the connection. Lightdash signs in to Trino with password (basic) authentication only, so the shared agent account has no JWT, OAuth 2.0, Kerberos or certificate sign-in. A Starburst Galaxy service account works, because it signs in with a user name and password. ### Set up the Trino shared agent account While the project has no shared agent account, the **Shared agent account** card on **Project settings → Agent identity** shows three setup steps, with copy buttons. The templates use the catalog and schema of the connection. **1. Create or choose the Trino login** Trino has no `CREATE USER`. Ask a Trino admin to add a user to the password file or LDAP. Turn on password authentication over HTTPS. Without it, Trino does not check the password. On Starburst Galaxy, create a service account with a restricted role, and use its user name and generated password. **2. Limit what the login can read** Use file-based access control or SQL roles. See [Limit what the Trino login can read](#limit-what-the-trino-login-can-read). **3. Add the shared agent account** Select **Add shared agent account**. Enter the **User** and **Password**, then select **Test and save**. **Test** checks the values without saving them. **4. Set the Trino rule** Add a shared agent account on every Trino project connection first. Then an organization admin selects the Trino chip on **Organization settings → Agents** and chooses **A shared agent account**, and confirms. See [Choose who agents run as](#choose-who-agents-run-as). ![The shared agent account card on a Trino project, marked Not in use, with an Add shared agent account button and the setup steps: Create or choose the Trino login, and Limit what the login can read with the file-based access control rules.json template](https://mintcdn.com/lightdash/RAdZRkxizSYzVmys/images/agents/agent-identity/trino-ai-service-account-setup.png?fit=max\&auto=format\&n=RAdZRkxizSYzVmys\&q=85\&s=e35adbe66c195c39ca469542d3c8649f) ### Limit what the Trino login can read **File-based access control.** Set `access-control.name=file`, and point `security.config-file` to a `rules.json` file. The setup steps have a template. It allows read-only access to one catalog, schema and table for the agent user, with an optional row filter and column mask, and denies everything else to that user: ```json theme={null} { "catalogs": [ { "user": "", "catalog": "", "allow": "read-only" }, { "user": "", "allow": "none" } ], "schemas": [ { "user": "", "catalog": "", "schema": "", "owner": false }, { "user": "", "owner": false } ], "tables": [ { "user": "", "catalog": "", "schema": "", "table": "
", "privileges": ["SELECT"], "filter": "", "columns": [{ "name": "", "mask": "" }] }, { "user": "", "privileges": [] } ] } ``` Merge these rules above your broader rules. Rules match from top to bottom, and the first match wins. Names in rules are regular expressions, so escape regex characters in your values. The `filter` and `columns` fields are optional. If your authenticator maps the login to another user, use the user that Test shows. See [File-based access control](https://trino.io/docs/current/security/file-system-access-control.html). **SQL roles and grants.** Use this only with a system access control that supports SQL roles and grants: ```sql theme={null} CREATE ROLE ai_agents_read; GRANT SELECT ON TABLE "".""."
" TO ROLE ai_agents_read; GRANT ai_agents_read TO USER ""; ``` Connector roles, such as Hive roles, need `IN ""` on `CREATE ROLE` and on the role grant. Check inherited and public grants. ### Test, replace and remove **Test** signs in and runs `SELECT current_user`. The card then shows "Signs in as" followed by the user that Trino returns, and when it was tested and added. Lightdash does not compare that user with the login, because Trino user mapping can change it. Test proves that the user and password work. It does not check what the user can read. When Test fails, the card gives a fixed message: rejected credentials, missing access, or a general message. Lightdash never shows the driver message. * To change the user or password, select **Replace**. * To remove the shared agent account, select **Remove** and confirm. Agent queries on that project are refused until an admin adds one again. Preview projects use the shared agent account of their parent project. See [Preview projects](#preview-projects). ### What agents and people see on Trino When the Trino rule is **A shared agent account**: * Chat, [MCP](/agents/lightdash-mcp), [Slack](/integrations/slack) and data app sample queries on Trino sign in as the shared agent account. * Agent queries skip the Lightdash results cache and pre-aggregates. Trino has no result cache setting. * **Settings → My agent identity** shows a Trino card. People have nothing to set up. See [My agent identity](#my-agent-identity). When a project has no shared agent account, or Trino rejects the user or password, Lightdash refuses the agent query. See [When the shared agent account is missing or fails](#when-the-shared-agent-account-is-missing-or-fails). Lightdash never falls back to the connection's own credentials. ## ClickHouse: the shared agent account With this identity, agent queries on a ClickHouse project sign in as a separate read-only ClickHouse user, with its own user and password. ClickHouse then applies that user's grants and row policies to every agent query. > [!WARNING] > > Every person's agent gets the same access: the grants of the shared agent account. Grant it only the data that every agent user may see. The shared agent account replaces only the user and password of the connection. The host, port, database, `secure` setting and timezone stay from the connection. ### Set up the ClickHouse shared agent account While the project has no shared agent account, the **Shared agent account** card on **Project settings → Agent identity** shows three setup steps, with a **Copy SQL** button for each block. The SQL uses the database of the connection. **1. Create the account in ClickHouse** As a user with `CREATE USER` permission, create a separate user for agents. Replace the password placeholder: ```sql theme={null} CREATE USER ai_agents IDENTIFIED WITH sha256_password BY '' SETTINGS readonly = 2; ``` `readonly = 2` keeps the user read-only, and lets agent queries set the query settings they need. Every agent query sends query tags and a session timezone. ClickHouse rejects these settings for a `readonly = 1` user, unless its profile allows them. **2. Grant it only the data agents may read** Grant `SELECT` on the project database, or limit the grant to specific tables: ```sql theme={null} GRANT SELECT ON ``.* TO ai_agents; ``` **3. Add the shared agent account** Select **Add shared agent account**. Enter the **User** and **Password**, then select **Test and save**. **Test** checks the values without saving them. **4. Set the ClickHouse rule** Add a shared agent account on every ClickHouse project connection first. Then an organization admin selects the ClickHouse chip on **Organization settings → Agents** and chooses **A shared agent account**, and confirms. See [Choose who agents run as](#choose-who-agents-run-as). ![The shared agent account card on a ClickHouse project, marked Not in use, with an Add shared agent account button and the setup steps: the CREATE USER SQL with readonly = 2, the GRANT SELECT statement, the row policy template, and Add it here and select Test](https://mintcdn.com/lightdash/RAdZRkxizSYzVmys/images/agents/agent-identity/clickhouse-ai-service-account-setup.png?fit=max\&auto=format\&n=RAdZRkxizSYzVmys\&q=85\&s=a1489bbc3fa80c6a30cb1047e105e0cd) ### Limit rows on ClickHouse The setup steps have a row policy template. Replace the table and condition before you run it: ```sql theme={null} CREATE ROW POLICY ai_agents_rows ON ``.`
` FOR SELECT USING TO ai_agents; ``` See [Row policies](https://clickhouse.com/docs/sql-reference/statements/create/row-policy). ### Test, replace and remove **Test** signs in and runs `SELECT currentUser(), getSetting('readonly'), getSetting('use_query_cache')`, with the same query tags and timezone as an agent query. Test fails when: * The user is not the saved user. The match is exact, including case. * `readonly` is 0, so the user can write. * The query cache is on. * ClickHouse blocks the query settings. The card then shows "Signs in as" followed by the user, and when it was tested and added. Test does not check what the user can read. When Test fails, the card gives a fixed message: rejected credentials, blocked settings, missing grants, or a general message. Lightdash never shows the driver message. * To change the user or password, select **Replace**. * To remove the shared agent account, select **Remove** and confirm. Agent queries on that project are refused until an admin adds one again. Preview projects use the shared agent account of their parent project. See [Preview projects](#preview-projects). ### What agents and people see on ClickHouse When the ClickHouse rule is **A shared agent account**: * Chat, [MCP](/agents/lightdash-mcp), [Slack](/integrations/slack) and data app sample queries on ClickHouse sign in as the shared agent account. * Agent queries turn the ClickHouse query cache off. * **Settings → My agent identity** shows a ClickHouse card. People have nothing to set up. See [My agent identity](#my-agent-identity). When a project has no shared agent account, or ClickHouse rejects the user or password, Lightdash refuses the agent query. See [When the shared agent account is missing or fails](#when-the-shared-agent-account-is-missing-or-fails). Lightdash never falls back to the connection's own credentials. # Agent permissions Source: https://docs.lightdash.com/agents/agent-permissions Limit what AI agents can do, and choose who can use them [Beta](/support/feature-badges#beta) [Enterprise](/support/feature-badges#enterprise) > [!NOTE] > > Agent permissions are behind the `agent-identity` feature flag. On Lightdash Cloud, ask Lightdash support to turn it on for your organization. On a self-hosted instance, [enable the flag](/self-host/enterprise-features/ai-agents#agent-identity). By default, an agent can do what the person who asked can do. Agent permissions let an organization admin limit that: which actions agents may take, and who can use agents. Limits only reduce what agents can do. They never give a person more access than their roles allow. [Agent identity](/agents/agent-identity) decides who agents run as in the warehouse. Agent permissions decide what agents may do in Lightdash. ## Choose what agents can do Agent permissions are in the **Permissions** section of **Organization settings → Agents**, after the **Identity** section. Under **What agents can do**, choose one of three: | Choice | What agents can do | | - | - | | **Same as the person** | Anything the person can do. Lightdash adds no limit. This is the choice until an admin saves another one. | | **Read and query** | Find content, query data and export results. Agents change nothing. It allows **Read and discover**, **Query data**, **Export results** and **Raw SQL**. | | **Custom** | What you leave ticked. Everything starts on, and you untick what agents must not do. | A **Current** badge marks the saved choice. **Read and query** does not make SQL read-only. Raw SQL runs with the warehouse permissions of the identity that agents run as, so limit writes in the warehouse. See [Agent identity](/agents/agent-identity). ### Custom **Custom** shows one switch for each capability, in three groups. **Developer and admin** opens when you select it. ![The Permissions section with Custom selected and every switch on: Read and discover, Query data, Export results and Raw SQL under Read and query, Create and edit content, Delete content and Publish and share under Make changes, the Developer and admin row, the note that these limits apply to every role, custom roles included, and that custom roles keep their own agent permissions, Who can use agents with Everyone whose role allows AI selected, and 1 unsaved change with Discard and Review and save](https://mintcdn.com/lightdash/BjhWgsIX7dql4WhX/images/agents/agent-permissions/agent-permissions-custom.png?fit=max\&auto=format\&n=BjhWgsIX7dql4WhX\&q=85\&s=15da935f9280f88d56435caa64395fcc) * **A switch applies to every role.** People with a built-in role get every capability that is ticked, within their own permissions. When you untick a capability, no agent can use it, whatever the person's role. This includes people with a [custom role](#custom-roles). * **Unticking everything turns agents off.** The page says "Agents are turned off for everyone." No one can use Ask AI, the Slack agent, MCP clients or the CLI. People can still do the work themselves. When you choose **Custom** again after another choice, you get your saved Custom list back. ## Capabilities An agent can do something only when the person's own permissions allow it and the limits allow the capability. Refusals name the capability. | Group | Capability | What it allows | | - | - | - | | Read and query | Read and discover | Find and read projects, data models, content, context and existing query results. | | Read and query | Query data | Run queries through the data models and run saved content. | | Read and query | Export results | Download results, render charts and export to supported destinations. | | Read and query | Raw SQL | List warehouse tables and write or run SQL directly. | | Make changes | Create and edit content | Create or edit charts, dashboards, documents and data apps. It does not change access, create spaces or share. | | Make changes | Delete content | Delete content, files and objects. | | Make changes | Publish and share | Publish, share or deliver content. | | Developer and admin | Deploy and upload | Deploy project changes and upload files. | | Developer and admin | Git repository changes (dbt) | Change any file in the project's Git repository, and open, update or close pull requests. Not only dbt files. | | Developer and admin | Administration | Administrative actions that agents may take. Actions reserved for people stay with people. | | Developer and admin | External tools | Call tools enabled on a connected external service. It does not grant what those tools do. | ### Operations that need several capabilities Some operations need more than one capability. Lightdash refuses the operation when any one of them is not allowed: | Operation | Needs | | - | - | | Create or edit a scheduled delivery | Create and edit content and Publish and share | | Sync to Google Sheets as code | Create and edit content and Publish and share | | Run a saved SQL chart | Query data and Raw SQL | | Create a SQL chart, or edit a saved SQL chart in any way | Create and edit content and Raw SQL | | Delete or rename a file in the Git repository | Git repository changes (dbt) and Delete content | | Pull content from Git | Git repository changes (dbt) and Create and edit content | | Set up a preview deploy | Deploy and upload and Git repository changes (dbt) | An agent that changes the Git repository needs Delete content only when its change deletes or renames a file. Lightdash checks the change before it commits or pushes anything. ### Refusals When the organization's agent permissions block an action, the refusal says so, for example: "Your organization's agent permissions do not allow Raw SQL. Ask an admin to change Permissions on the Agents page." When the person's own roles block it, the refusal says: "Your roles do not allow" followed by the capability, and asks them to have an admin review their permissions. An action can fail more than one check. Lightdash stops at the first check that fails, and the first line of the refusal names it. In the in-app chat and in [MCP](/agents/lightdash-mcp) clients, the refusal then lists everything else that blocks the action: * **Also needed** names the other blockers, for example: "Also needed: Publish and share". A blocker is a capability from the table above, or another limit, such as "access to agents". * **See why** links to [My agent identity](/agents/agent-identity#my-agent-identity). So a person can ask an admin for every change in one request. When the action is in a project that the person cannot see, the refusal leaves out the blockers that belong to that project. Replies in Slack channels show only the first line, and embedded chat does not show the **See why** link. ### Turn off Raw SQL for agents **Raw SQL** lets an agent list warehouse tables and run SQL outside the data models. An agent can use it when the person's own permissions allow raw SQL and the limits allow **Raw SQL**. A project needs no other setup. To turn it off for every agent, choose **Custom**, untick **Raw SQL**, then review and save. Agents then get the refusal "Your organization's agent permissions do not allow Raw SQL." ## Who can use agents Under **Who can use agents**, choose: * **Everyone whose role allows AI.** Anyone with a role that allows AI can use agents. * **Only these groups.** People must belong to at least one of the groups you choose. Their role must also allow AI. Only members of these groups can use Ask AI, the Slack agent, MCP clients and the CLI. ![The Permissions section with the three choices under What agents can do, and Who can use agents with Only these groups selected, the groups Data team (3) and Analysts (2) chosen, and the line Only members of these groups can use Ask AI, the Slack agent, MCP clients and the CLI](https://mintcdn.com/lightdash/tlKeCXpGJlzR1fBp/images/agents/agent-permissions/agent-permissions-who-can-use-agents.png?fit=max\&auto=format\&n=tlKeCXpGJlzR1fBp\&q=85\&s=f1f0142ae35646ffe565b0e463a6f3ec) You choose people by [group](/workspace-admin/manage-groups) only. This limit applies with every choice under **What agents can do**, also with **Same as the person**. * The **Who can use agents** row shows only when your deployment has an Enterprise license. [Group management](/workspace-admin/manage-groups) itself is available to every organization. * **Only these groups** needs at least one group. * When every group you chose is deleted, the page warns "No one can use agents. All chosen groups are deleted." Choose other groups, or **Everyone whose role allows AI**. This setting covers every agent in the organization. To limit who can use one agent, set **Who can use the agent** in that agent's settings: see [user and group access](/agents/set-up-agents#user-and-group-access-optional). Creating and managing agents needs the developer or admin role, or a [custom role](/workspace-admin/custom-roles) with the `manage:AiAgent` scope. `manage:AiAgent` also lets a person use every agent in the project, including agents kept to admins and developers or to specific users and groups. With `view:AiAgent` instead, a person can use agents open to everyone in the project, plus any agent that names them or one of their groups. Roles add up: a project-level custom role without `manage:AiAgent` doesn't take it away from someone whose organization role is Developer or Admin. ## Review and save Changes under **What agents can do** and **Who can use agents** are not saved one at a time. The page counts them, for example "4 unsaved changes". **Discard** goes back to the saved state. **1. Select Review and save** The **Review changes to agent permissions** dialog opens. **2. Read the review** **STOPS** lists what agents can no longer do, **ALLOWS** lists what they can do again, and **WHO** says who can use agents. When every capability is unticked, it says "Agents are turned off for everyone". **3. Save** Select **Save changes**. **Back** returns to the page and keeps your changes. ![The Review changes to agent permissions dialog: STOPS Publish and share for agents, for every role, custom roles included; Agent limits are turned on; the note Personal access tokens are not limited; and Back and Save changes buttons](https://mintcdn.com/lightdash/BjhWgsIX7dql4WhX/images/agents/agent-permissions/agent-permissions-review.png?fit=max\&auto=format\&n=BjhWgsIX7dql4WhX\&q=85\&s=742bcd0c86d68117d02f4e0dac35ae25) If another admin saves first, an "Agent permissions changed" warning shows. Your unsaved changes stay on the page. Select **Reload latest** to discard them and load the saved permissions. ## Agents over MCP The **Agents over MCP** switch lets MCP clients use the organization's agents and their context. It is about [MCP](/agents/lightdash-mcp#using-ai-agent-context) only: turning it off does not stop Ask AI or the Slack agent. To turn agents off everywhere, choose **Custom** and untick every capability. * The switch saves at once. It is not part of **Review and save**. * It shows only to people who can change the setting. * For these people, **Settings → MCP → General** shows **Enable agents over MCP** as **On** or **Off**, with a **Change on the Agents page** link. * **Allow content changes via MCP** stays on **Settings → MCP → General**. ![The Enable agents over MCP card on the MCP General settings page, showing On and a Change on the Agents page link](https://mintcdn.com/lightdash/19_FUQnZpeBCOTjR/images/agents/agent-permissions/mcp-settings-agents-over-mcp.png?fit=max\&auto=format\&n=19_FUQnZpeBCOTjR\&q=85\&s=6798d1673e90775f97d43ea72a004b42) ## Custom roles [Enterprise](/support/feature-badges#enterprise) [Custom roles](/workspace-admin/custom-roles) have an **Agent permissions** group in the **AI Features** section of the role editor, with the 11 capabilities above. A new custom role starts with **Read and discover**, **Query data**, **Export results** and **Raw SQL** on. Custom roles keep their own agent permissions. The organization's choice under **What agents can do** can only narrow them: an agent of a person with a custom role gets what the role allows, without the capabilities that the organization unticked. ![The custom role editor with the AI Features section open and the Agent permissions group, with Read and discover and Query data checked under Read and query](https://mintcdn.com/lightdash/RAdZRkxizSYzVmys/images/agents/agent-permissions/custom-role-agent-permissions.png?fit=max\&auto=format\&n=RAdZRkxizSYzVmys\&q=85\&s=865855f54c5cfb2a14ec3f68fe272f6e) ## When you take agent access away Lightdash reads agent access when it checks a request. It does not copy the access into a token. So a change applies at the next check, not at a fixed time. A request that has already passed its checks can finish. This applies when: * An admin deactivates a person. * A person loses a role, or a custom role loses a capability. The capability stays when another role of the person still allows it. * An admin unticks a capability, or unticks every capability to turn agents off. * An admin removes a group from **Who can use agents**, or a person leaves every group that is allowed. When an admin deactivates a person, Lightdash also deletes that person's Snowflake [agent sign-in](/agents/agent-identity#snowflake-agent-sign-in-for-each-person). ### Work that is queued or running Some agent work runs after the person asked for it. This work checks the person again when it starts, and again before it delivers or publishes. When a check refuses, the later steps do not happen. What the work has already published stays. | Work | What the person sees when it is refused | | - | - | | A Slack agent answer | The answer stops and the remaining messages, charts and files are not posted. The thread gets the refusal message. | | A scheduled delivery with an AI summary | The delivery goes out without the summary. | | An [Autopilot](/agents/autopilot) run | The run stops and posts nothing more. It is recorded as failed, with "Run blocked". | | [dbt writeback](/agents/ai-writeback) | Lightdash does not create the branch, the commit or the pull request that come after the check. The card in the thread shows an error. | | A fix for a review finding | The fix is marked as failed. | Lightdash checks at these points, not all the time. A step that has passed its check can finish, also when it takes long. ### What a change does not cover * **Personal access tokens and service account tokens.** Agent permissions do not limit them. A narrower limit does not narrow what a client does with one of these tokens. See [Personal access tokens](#personal-access-tokens). * **A person's ordinary role.** A change to a person's role can take up to about 30 seconds to apply to a browser session or a token. The agent permission check itself has no delay. * **Tokens that the warehouse has issued.** Lightdash does not ask the warehouse to revoke a token that the warehouse has already issued. The warehouse decides how long that token is valid. Work that already has a warehouse connection can finish. ## Reserved for people With **Read and query** or **Custom**, agents cannot do some operations, whatever is ticked. Allowing **Administration** does not change this: * Change roles, groups, and project or space access. * Manage custom roles, service accounts, personal access tokens, invite links and OAuth clients. * Change the agent permissions or the agent identity rules. * Change feature flag overrides. * Get the Google Drive access token. * Change the AI organization settings. ## Personal access tokens Personal access tokens and service account tokens are not limited. An agent that uses a person's personal access token, for example through [MCP](/agents/lightdash-mcp), has that person's access. # AI agents as code Source: https://docs.lightdash.com/agents/agents-as-code Download AI agents to YAML, review them in Git, and promote them between projects You can serialize a project's AI agents to YAML with the Lightdash CLI, keep them under version control, and promote them between environments — preview, staging, production — using the standard `lightdash download` / `lightdash upload` flow. Use agents as code when you want to: * Review agent instructions, tags, model settings, and [evaluation suites](/agents/create-evaluation-suites) in pull requests before they reach production * Version the [custom skills](/agents/custom-agent-skills) an agent depends on alongside its configuration * Copy a working agent from one project to another (for example, from a preview into production) without recreating it in the UI * Roll agent config back to a known-good version using Git history * Bootstrap new projects with the same set of agents you use elsewhere Agent config as code is **opt-in**. A bare `lightdash download` does not include agents — you have to ask for them with `--include-agents` or `--agents`. This is part of the same content-as-code system as [dashboards as code](/workflow/content-as-code). The same disposable-vs-Git-managed tradeoff and CI patterns apply. ## On-disk layout Agent files live under `lightdash/ai-agents/` next to your `charts/` and `dashboards/` folders. Each agent is a single `.yml` file named after its slug: ```text theme={null} lightdash/ ├── ai-agents/ │ ├── orders-support-agent.yml │ └── revenue-analyst.yml ├── skills/ │ └── investigate-kpi-change/ │ ├── SKILL.md │ └── resources/ │ └── metric-definitions.md ├── charts/ └── dashboards/ ``` `lightdash upload` automatically picks up every `.yml` (or `.yaml`) file in `lightdash/ai-agents/` and syncs it to the [selected project](/workflow/cli/reference#lightdash-config-set-project). ## Downloading agents Use one of the two flags below to include agents in a download. Neither is set by default. Download every AI agent in the project (paginated automatically by the CLI): ```bash theme={null} lightdash download --include-agents ``` Download only specific agents by slug or UUID: ```bash theme={null} lightdash download --agents orders-support-agent revenue-analyst ``` You can combine agent flags with the usual `--charts`, `--dashboards`, `--project`, and `-p / --path` flags on [`lightdash download`](/workflow/cli/reference#lightdash-download). ## Uploading agents `lightdash upload` uploads every agent file in `lightdash/ai-agents/` by default. Uploads are **idempotent**: the server creates missing agents, updates existing agents by slug, and leaves unchanged agents alone. Upload every agent along with charts and dashboards: ```bash theme={null} lightdash upload ``` Upload only specific agents by slug: ```bash theme={null} lightdash upload --agents orders-support-agent ``` Skip agent uploads entirely, even when files exist under `lightdash/ai-agents/`: ```bash theme={null} lightdash upload --skip-agents ``` > [!NOTE] > > Unlike charts and dashboards, you do **not** need `--force` to create a new agent. Uploading a file whose `slug` does not exist in the target project creates the agent; changing the `slug` in an existing file creates a new agent under the new slug (the old one is not deleted). ### Exit codes and validation The CLI validates each agent file before uploading. Invalid YAML, missing required fields, wrong `contentType`, or duplicate slugs across files cause `lightdash upload` to exit with a non-zero status, which is what you want in CI so bad config fails the build. ## YAML schema Every agent file uses the following top-level shape. The schema is versioned independently from the runtime engine — `version` describes the as-code file format, and `agentVersion` records which runtime version the agent uses. ```yaml lightdash/ai-agents/orders-support-agent.yml theme={null} contentType: ai_agent version: 1 agentVersion: 2 slug: orders-support-agent name: Orders Support Agent description: Answers questions about orders, fulfillment, and refunds. imageUrl: null instruction: | You are a support analyst for the ecommerce team. Use the orders and shipments explores to answer questions about order status, refunds, and fulfillment SLAs. Always report totals in GBP. tags: - ai - orders enableDataAccess: true enableContentTools: false enableUserContext: true modelConfig: modelName: gpt-4o modelProvider: openai reasoning: false skills: - investigate-kpi-change evaluations: - title: Orders regression suite prompts: - prompt: How many orders were refunded last month? expectedResponse: Uses the refunds metric and filters to last month. - prompt: Which orders are currently delayed? expectedResponse: null ``` ### Field reference | Field | Type | Description | | - | - | - | | `contentType` | string | Always `ai_agent`. The CLI refuses to upload files with any other value. | | `version` | number | Schema version of the file itself. Currently `1`. | | `agentVersion` | `1` \| `2` | Runtime version of the agent. Both v1 and v2 round-trip through download and upload. | | `slug` | string | Stable identifier used to match against agents in the target project. Changing the slug creates a new agent on upload. | | `name` | string | Human-readable name shown in the UI. | | `description` | string \| null | Short description used by the [AI Router](/agents/enable-ai-router) when choosing between agents. See [Effective analytics with agents](/agents/effective-analytics-with-agents#understand-names-and-descriptions-in-yaml) for authoring guidance. | | `imageUrl` | string \| null | URL for the agent's avatar. Uploaded-avatar provenance is preserved across environments. | | `instruction` | string \| null | The agent's system prompt / instructions. See [getting started](/agents/set-up-agents#instructions) for guidance on what to include. | | `tags` | string\[] \| null | Semantic tags used for [data access control](/agents/data-access#limiting-access-to-specific-explores-and-fields). | | `enableDataAccess` | boolean | Whether the agent can execute queries and read actual data. See [data access](/agents/data-access). | | `enableContentTools` | boolean | Whether the agent can create and edit charts and dashboards. See [creating & editing content](/agents/enable-content-tools). | | `enableUserContext` | boolean | Whether the agent receives the asking user's identity for [personalized answers](/agents/data-access#personalizing-answers-to-who-is-asking). | | `modelConfig` | object \| null | Default model settings: `modelName`, `modelProvider`, and optional `reasoning` flag. When `null`, the agent inherits the [organization default](/workspace-admin/ai-settings#set-an-organization-default-ai-model). | | `threadRetentionHours` | number \| null (optional) | Per-agent [thread retention](/agents/thread-retention) window. Only applies when the feature is enabled for your organization — see [agents as code semantics](/agents/thread-retention#agents-as-code). | | `skills` | string\[] (optional) | Names of custom skills attached to the agent. Omitting the field preserves existing bindings; a present list replaces them. | | `evaluations` | object\[] (optional) | Evaluation suite definitions to create or update by title. Downloads include this field even when the agent has no suites (`evaluations: []`). | | `knowledgeDocuments` | object\[] (optional) | [Knowledge documents](/agents/knowledge-documents) owned solely by this agent, authoritative on upload. Downloads always include this field, even when empty (`knowledgeDocuments: []`). | ### Evaluation suites Use the optional `evaluations` field to keep an agent's [evaluation suites](/agents/create-evaluation-suites) and prompts in Git with the rest of its configuration. Each suite has this shape: | Field | Type | Description | | - | - | - | | `title` | string | The suite name and stable identifier used to find an existing suite on upload. Titles must be non-empty and unique within the agent file. | | `prompts` | object\[] | Questions to run against the agent. Each prompt object contains `prompt` and `expectedResponse`. | | `prompts[].prompt` | string | A non-empty question to send to the agent. | | `prompts[].expectedResponse` | string \| null | A description of a correct answer for the LLM-as-judge scorer. Use `null` when you want to review the response manually. | Downloads are deterministic: suites are sorted by title, and prompts are sorted by their prompt and expected response. This avoids noisy Git diffs when the same definitions were created in a different order in the UI. On upload, Lightdash matches each declared suite by its exact title: * A new title creates a suite. * An existing title updates that suite's prompts when they have changed. * Suites that are not declared in YAML remain unchanged in the target project. * Omitting `evaluations` preserves all existing suites. Setting `evaluations: []` also does not delete them. > [!WARNING] > > Evaluation suite syncing does not delete undeclared suites. Removing a suite from YAML, or changing its title, leaves the old suite in Lightdash; a changed title creates a new suite. Delete the old suite in the UI if you no longer need it. Uploads fail with a non-zero exit code before changing the agent if a file contains duplicate suite titles, an empty title, or an empty prompt. An upload also fails when the target agent has multiple existing suites that match a declared title, because Lightdash cannot choose which suite to update. ### Knowledge documents `lightdash download --include-agents` (or `--agents`) always includes the agent's own [knowledge documents](/agents/knowledge-documents) in `knowledgeDocuments`, writing each document's content to its own file under `/knowledge-documents/` next to the agent's YAML. The YAML lists each document by `name`, `file` (the path to its content, relative to the YAML), and `alwaysIncludeInContext`. Documents shared with the agent from another agent's settings, and organization-level documents, are never included in this list and are never touched by this agent's upload. > [!WARNING] > > `knowledgeDocuments` is authoritative for documents owned solely by this agent: on upload, Lightdash creates or updates every document declared in the list and **permanently deletes** any of the agent's own documents that are no longer declared. Download the agent before editing its file to pick up documents created or changed in the UI since the last download — otherwise the next upload deletes them. ## Skills as code Custom skills are organization assets, but you can keep the skills an agent depends on in the same project checkout. Download the agents and their attached skills together: ```bash theme={null} lightdash download --include-agents --include-skills ``` Lightdash writes each skill to `lightdash/skills//`. The folder must contain `SKILL.md` and can contain Markdown resources directly under `resources/`. To download named skills without downloading agents, use: ```bash theme={null} lightdash download --skills investigate-kpi-change weekly-business-review ``` A normal `lightdash upload` uploads local skill folders before agent files, then resolves each agent's `skills` list by name. Use `--skills ` to limit a filtered upload to named skills. Removing a local skill folder does not delete the organization skill. Deletion is explicit: ```bash theme={null} lightdash upload --delete-skills obsolete-skill ``` > [!WARNING] > > Deleting a skill detaches it from every agent in the organization. Check its bindings before using `--delete-skills`. Use `lightdash download --organization` when you want the complete organization skill library alongside other organization-level content. See [custom agent skills](/agents/custom-agent-skills) for the authoring format and invocation behavior. ## What is not versioned Some pieces of an agent are runtime state and are deliberately kept out of the YAML file — they stay in the target environment and are preserved across create/update/no-op uploads: * **Conversations and threads.** Chat history is runtime state and never written to YAML. Uploading a change to an agent does not touch existing threads. * **Evaluation run history.** Suite definitions and prompts can be versioned in `evaluations`, but previous runs and their results remain in the target environment and are never downloaded. * **User and group access lists.** Access control is project-specific and stays managed in the target environment. See [user and group access](/agents/set-up-agents#user-and-group-access-optional). * **Slack integrations.** Slack channel bindings are per-environment and are not serialized. * **MCP server references.** [MCP server](/agents/connect-external-mcp-servers) references stay in the target project. This split lets you promote agent behavior (instructions, tags, model config, skill bindings, capability flags, and the agent's own [knowledge documents](#knowledge-documents)) through Git while still letting each environment own the things that don't make sense to copy — production Slack channels, per-project MCP servers, and per-environment access lists. ## Lifecycle examples Assuming a file at `lightdash/ai-agents/orders-support-agent.yml`: * **Create.** The target project has no agent with slug `orders-support-agent`. `lightdash upload` creates it. * **Update.** The target project already has `orders-support-agent`. Editing `instruction` or `tags` in the file and running `lightdash upload` updates the existing agent in place. * **No-op.** Nothing has changed since the last upload. The CLI reports the agent as skipped and makes no API call. * **Rename by slug.** Changing `slug: orders-support-agent` to `slug: orders-support-agent-v2` and uploading creates a new agent under the new slug. The original agent is untouched. * **Per-project isolation.** Uploading with `--project ` only affects that project — the same slug in different projects refers to different agents. Each agent belongs to one project, with its own threads, evaluations and access lists, so one agent can't be shared across projects. To run the same agent in several projects, keep its file in Git and upload it to each project. ## API The CLI is a thin wrapper around two permission-gated project endpoints: * **`GET /api/v1/projects/{projectUuid}/aiAgents/code`** — paginated download of agents as code. Accepts repeated `ids` query params (slug or UUID) to filter, and an `offset` for pagination. * **`POST /api/v1/projects/{projectUuid}/aiAgents/code`** — idempotent create-or-update by slug for one or more agents. Accepts a `force` query flag. Returns a summary of `created`, `updated`, `unchanged`, and `deleted` slugs. Both endpoints require project-level permission to manage AI agents. See the [API reference](/api-reference/v1/introduction) for the full request and response schema. ## CI/CD Because upload is idempotent and returns a non-zero exit code on invalid files, agents as code fits the same CI patterns as [Git-managed dashboards](/workflow/content-as-code#git-managed-dashboards): 1. Store `lightdash/ai-agents/` in Git. 2. On PR, run `lightdash upload --skip-charts --skip-dashboards --agents ` against a [preview project](/workflow/preview-projects) to sanity-check the change. 3. On merge to `main`, run `lightdash upload` against production. Creating a [preview project](/workflow/preview-projects) copies the source project's agents into it along with charts and dashboards, unless you create it with `--skip-copy-content`. Each preview gets its own copies, which are deleted when the preview project is deleted. If your preview workflow runs `lightdash upload` for charts and dashboards only, add `--skip-agents` so it doesn't also create or update agents in every preview. Lock down agent editing in the UI (via role permissions) if you want the YAML files to be the definitive source of truth for agent config. # AI coding agent Source: https://docs.lightdash.com/agents/ai-coding-agent Ask an agent in chat to edit any connected repository and open a pull request [Beta](/support/feature-badges#beta) [Enterprise](/support/feature-badges#enterprise) > [!NOTE] > > The AI coding agent requires the `ai-coding-agent` feature flag. Contact Lightdash support to enable it for your organization. The AI coding agent lets you ask an AI agent in chat to change files in **any repository your organization has connected to Lightdash** — not only the dbt repo behind a project — and have the agent open a pull request (or GitLab merge request) with the change. It's the general-purpose counterpart to [AI writeback](/agents/ai-writeback): where writeback edits the dbt project that backs a Lightdash project and validates the change with `lightdash compile`, the coding agent targets any repo you can write to and delegates verification to that repository's own CI. ## When to use it Use the coding agent when the change belongs in a repository that isn't your dbt project — for example: * Update a copy string or config value in a frontend or backend app repo * Fix a typo in a README or a docs site * Add a small feature or tweak business logic in a service repo * Adjust a shared library used by several services For changes that belong in the dbt / semantic-layer repository backing a Lightdash project, keep using [AI writeback](/agents/ai-writeback) — it also runs `lightdash compile` to validate the diff before opening the PR. For questions that don't need a code change, the agent will pick a different tool: | You want to… | The agent uses… | | - | - | | Ask a question about data | Query and discovery tools | | Edit an existing chart or dashboard in Lightdash | `editContent` | | Change the dbt project behind a Lightdash project | `editDbtProject` (AI writeback) | | Change any other connected repository | `editRepo` (this feature) | ## Prerequisites * The **AI coding agent** feature flag (`ai-coding-agent`) must be enabled for your organization. * Your instance must have a valid enterprise license. * The Lightdash **GitHub App** (or **GitLab App**) must be installed on the repository you want to edit, and the installation must grant write access. * Your user account must itself have access to that repository. The agent only acts on repositories where **both** the org's Lightdash Git App and your user can write. * The user asking for the change needs the **manage source code** permission on the project. Without it, the agent can't open a pull request, but [Issues](/agents/issues#ai-filed-findings) still captures findings from the conversation when it's enabled. * On self-hosted instances you need to bring your own E2B and Anthropic API keys, the same way you do for AI writeback. See [self-hosting AI writeback](/self-host/enterprise-features/ai-agents#ai-writeback) — the coding agent uses a separate, leaner sandbox image but the same key setup. ## How it works When you ask the agent for a code change, it calls a tool called `editRepo`. The tool: 1. Resolves the target repository against the connected Lightdash Git app and confirms that both the app installation and your user can write to it. Non-writable repos are rejected up front. 2. Starts a fresh, isolated E2B sandbox — a **lean** image containing only `git` and the Claude CLI. There is no dbt toolchain and no `lightdash compile` step, so the sandbox has no way to run a build even if it wanted to. 3. Clones the target repo with a short-lived, `contents:read`-scoped token, subject to a pre-clone repository size guard. 4. Edits files based on a self-contained instruction generated from your request. The sandbox does not see your chat history. 5. Pushes a new branch and opens a **pull request** on GitHub or a **merge request** on GitLab against the repository's default branch. 6. Returns the PR / MR URL to you in chat. Verification is deliberately delegated to the PR's own CI — the coding agent does not run tests or a build inside the sandbox. Whatever checks are configured on the target repository (unit tests, linters, type-checks, deploy previews) run on the PR just like they would for any human contribution. GitHub commits are signed by the Lightdash GitHub App. GitLab commits are pushed over OAuth and are unsigned. The tool call is synchronous and can take a few minutes. The agent tells you a pull request is being prepared while it waits. ## Using it in chat Phrase your request as a direct change to a specific repository, and, where possible, name the files or areas you want touched. The more specific you are, the more reliably the agent finds the right place to edit. **Good prompts** ```text theme={null} In acme/web-app, update the copy in components/PricingBanner.tsx so the CTA reads "Start free trial" instead of "Sign up now." ``` ```text theme={null} In acme/checkout-service, add a feature flag called `enable_new_tax_calc` to config/flags.yaml, defaulted to false, and gate the code path in services/tax.ts on it. ``` ```text theme={null} Fix the typo in the README of acme/web-app: change "recieve" to "receive" in the "Notifications" section. ``` ### Mentioning repositories with `@` Type `@` in the chat input to open the mention menu. Alongside Charts, Dashboards, and Files, you'll see the repositories your organization has connected. Each entry is badged so you can tell at a glance which repos the agent can and can't write to — non-writable repositories are shown as read-only. Picking a repository inserts it as a pill in your message and pins the coding agent to that target. ```text theme={null} Update @acme/web-app: bump the `default_theme` in config/app.yaml from "light" to "auto" and adjust the fallback in src/theme/index.ts to match. ``` The badge is a display hint. The real authorisation check runs server-side when the tool executes and always fails closed if the repository isn't writable at that moment. **Less effective prompts** ```text theme={null} Clean up our repos. ``` ```text theme={null} Make the frontend nicer. ``` ## Multiple pull requests in one thread A single conversation can hold **several workstreams** in parallel. Each workstream is one repository + one open pull request, and a thread can have multiple workstreams — even more than one against the same repository (for example, two independent changes to `acme/web-app`). The agent uses two extra tools to keep them straight: * `listWorkstreams` — lists the pull requests this conversation has already opened, optionally filtered to one repository. The agent calls this before `editRepo` when it needs to decide whether a follow-up should continue an existing PR or start a new one. * `closePullRequest` — closes (without merging) a PR the conversation opened, for example after folding the change into another PR or when it's no longer wanted. Closing is reversible on the provider. Follow-up messages are routed automatically: * **Continuing existing work.** If you ask for a related change and there's already an open PR on the same repo for this thread, the agent commits onto that PR's branch and refreshes the PR title / description. * **Starting a separate PR.** If you make it clear the next change is independent — a different area of the codebase, a different feature — the agent opens a fresh pull request in the same thread rather than piling everything onto the previous one. * **Pasting a PR link.** Include the PR URL in your message to force the agent to iterate on that specific pull request. There is a **cap of 3 concurrent sandboxes per thread**, and a per-workstream lock so two overlapping turns against the same PR serialise safely instead of racing. The chat thread shows a **Pull requests in this conversation** panel with every workstream the thread has opened, their status, and links back to the provider. ## Security and safety The coding agent runs under several deliberate constraints: * **Repository allowlist.** Only repos writable by *both* the Lightdash Git App installation *and* the user asking for the change are eligible. If your user's own access can't be confirmed (for example, GitHub's API is rate-limiting the check), the agent fails closed and refuses to edit the repo. * **Denied-path commit gate.** The host inspects every commit before opening the PR and rejects any change that touches: * CI configuration — `.github/workflows/**`, `.gitlab-ci.yml`/`.yaml`, `azure-pipelines.yml`/`.yaml`, `bitbucket-pipelines.yml`/`.yaml`. * Secret-shaped files — `.env` and `.env` (including `prod.env`, `app.env.local`), key material (`*.pem`, `*.key`, `*.keystore`, `*.jks`), and credential files. A commit that touches any of these is refused and no PR is opened. * **No shell in the sandbox.** The general-purpose agent's tool allowlist has zero `Bash` entries. Combined with a lean image that has no dbt, no build tools, and no Lightdash CLI, there is nothing on the sandbox to run even if a prompt tried. * **Scoped clone token.** The token used to clone your repo is minted with `contents:read`, held only long enough to clone, and revoked immediately after. The sandbox has no long-lived credentials. * **Pre-clone size guard.** Repositories larger than the configured ceiling (default 500 MB) are rejected before any clone, with a clear error, instead of failing later with an opaque timeout. * **Audit logging.** Every write is logged with the acting user, repo, and PR. ## Reviewing and acting on the pull request The coding agent posts a chat card for each PR it opens with the same actions as writeback: * **View ▾** — dropdown with **Pull request** (opens on GitHub/GitLab) and, when applicable, **Diff** (opens an in-Lightdash diff viewer with a file list and per-file `+/−` counts). Coding-agent PRs don't build a Lightdash preview project, so the **Preview** entry isn't shown. * **Close PR** / **Merge PR** — merge is disabled until the provider reports the PR as mergeable (CI green, no conflicts, branch not blocked). The card pins the head commit SHA it was opened against so a later commit can't be merged by mistake. * Once the PR is merged or closed, the button group collapses to a **Merged** / **Closed** marker and the card stops polling. Because verification is delegated to the target repository's CI, treat coding-agent PRs the same way you'd treat any other machine-generated pull request: **review the diff, wait for CI, and rely on the target repo's branch protection**. The agent is a contributor, not a merger. ## Iterating on an existing pull request You can continue an existing coding-agent PR in three ways: * **Same thread, related change.** Ask for a follow-up in the same thread — the agent picks the right open PR automatically. * **Force a specific PR.** Paste the PR / MR URL alongside your request. The URL must belong to a repo this feature is enabled for, and the PR must be open. Merged or closed PRs are rejected. * **Force a new PR.** Say the next change is separate. The agent opens a fresh pull request in the same thread instead of committing onto the previous one. ## What happens if it can't run | Situation | Result | | - | - | | Feature flag is off | The `editRepo` tool isn't available. The agent answers normally without offering to open a pull request in another repo. | | Repository isn't writable by the Git App installation or by your user | The agent refuses the edit with a `repo_write_forbidden` error and explains which check failed. | | Lightdash GitHub App / GitLab App isn't installed for the org | The agent surfaces a `github_not_installed` / `gitlab_not_installed` error with an install CTA. | | Repository is over the size ceiling | The agent rejects the request before cloning with a `repo_too_large` error. | | Commit touches a denied path (CI or secrets) | The commit is refused, no PR is opened, and the agent reports which path was blocked. | | Pasted PR link is merged, closed, or from a different repo | The agent rejects the link and does not open a new pull request. | | Agent makes no file changes | No pull request is opened. The agent reports back that nothing needed to change. | ## Related * [AI writeback](/agents/ai-writeback) — the same experience for changes to your project's dbt repository, with `lightdash compile` validation built in. * [Self-hosting AI writeback](/self-host/enterprise-features/ai-agents#ai-writeback) — E2B and Anthropic key setup that also applies to the coding agent. # AI writeback Source: https://docs.lightdash.com/agents/ai-writeback Ask an AI agent to edit dbt or native Lightdash YAML files and open a pull request AI writeback lets you ask an AI agent in chat or Slack to edit the repository that backs your project and open a pull request with the change. It can update dbt models or [native Lightdash YAML models](/semantic-layer/yaml#ai-writeback-and-issues), including metrics, dimensions, and descriptions. Use it for changes that need editing across project files. To promote an individual custom field, use the write-back action in the Explore view. For changes that don't belong in the semantic layer project — for example, editing an app repo, a service, or a docs site — use the [AI coding agent](/agents/ai-coding-agent) instead. ## When to use it Use AI writeback when the change belongs in your semantic layer project files: * Rename a metric in a YAML file * Add a metric or dimension to a model * Edit field SQL, or a dbt model's SQL * Update a description, label, or dbt `meta` block * Fix a typo in a column definition For other kinds of changes, the agent will pick a different tool: | You want to… | The agent uses… | | - | - | | Ask a question about data | Query and discovery tools | | Edit an existing chart or dashboard in Lightdash | `editContent` | | Change dbt or native Lightdash YAML source files | `editDbtProject` | ## Prerequisites * Use a supported repository connection: **GitHub**, **GitLab.com**, or **Bitbucket Cloud** for dbt; **GitHub** or **Bitbucket Cloud** for native Lightdash YAML. Azure DevOps, dbt Cloud, and CLI-only connections are not supported for AI writeback. * Configure repository access so the agent can open requests: * **GitHub** — install the Lightdash GitHub App on the repository. * **GitLab** — connect the Lightdash GitLab App for your organization. Writeback works against GitLab.com; self-hosted GitLab domains aren't reachable from the writeback sandbox yet. * **Bitbucket Cloud** — configure the [project API token and writeback permissions](/integrations/connect-project#bitbucket-cloud-api-token). * You need at least [project Developer](/workspace-admin/roles) permissions on the project. Without them, the agent can't open a pull request for you, but [Issues](/agents/issues#ai-filed-findings) still captures findings from your conversations when it's enabled. For native projects, follow [Connect through GitHub or Bitbucket Cloud](/semantic-layer/yaml#connect-through-github) and select **Native Lightdash YAML** as the semantic layer format. ## How it works When you ask the agent for a change that belongs in the repo, it calls a tool called `editDbtProject`. The tool: 1. Generates a self-contained instruction from your request and starts a sandboxed environment with no memory of your chat. A follow-up to the same change resumes that environment; an unrelated request gets a fresh one. 2. Edits the relevant files and validates the result. dbt projects use `lightdash compile`; native projects use [native YAML validation](/semantic-layer/yaml#ai-writeback-and-issues) without setting up dbt. 3. Pushes a new branch and opens a pull request (GitHub or Bitbucket) or merge request (GitLab) against a base branch: * **dbt projects on GitHub or GitLab** — the repository's default branch, as set on the git host. The **Branch** field on your project connection doesn't change this. To target another branch, such as a `qa` branch that promotes to `main`, change the repository's default branch. Pull requests that are already open keep the base branch they were opened against. * **Bitbucket Cloud, and native Lightdash YAML projects on GitHub** — the branch configured in your project connection. 4. Returns the pull request URL to you in chat. The tool call can take a few minutes. The agent tells you a pull request is being prepared, and the chat card auto-updates in place with the pull request URL as soon as the run finishes — you don't need to send another message or refresh the thread. If you're driving writeback from an external client via MCP rather than the in-product chat, see [Editing the dbt project](/agents/lightdash-mcp#editing-the-dbt-project) — the MCP flow returns a run id immediately and you poll `get_ai_writeback_status` for the pull request URL. By default, GitHub commits are signed by the Lightdash GitHub App. If you've [linked your personal GitHub account](/workflow/pull-requests#pull-request-author), AI writeback pull requests are attributed to you instead (as long as your linked account can access the repository) — and the agent itself may prompt you in chat to link your account if you haven't yet. GitLab commits are pushed over OAuth and are unsigned. ### Bitbucket Cloud behavior Bitbucket AI writeback edits dbt or native Lightdash YAML files in the connected repository. Follow-up requests can add commits to the same open pull request. If that request has been merged or declined, a follow-up starts a fresh pull request. Review and merge Bitbucket pull requests in Bitbucket, then sync the project in Lightdash. The integration does not provide automatic preview projects, Bitbucket Pipelines status, or merging from the chat card. Repository browsing and file mentions have separate provider requirements, described below. Bitbucket Server/Data Center and general-purpose coding-agent access are outside this Bitbucket integration. ## Using it in chat Phrase your request as a direct change to the repo and, where possible, name the file, model, or field you want touched. The more specific you are, the more reliably the agent finds the right place to edit. **Good prompts** ```text theme={null} In models/orders.yml, rename the metric `total_revenue` to `net_revenue` and update its description to "Revenue after refunds and discounts." ``` ```text theme={null} Add a new metric `active_users_7d` to the users model. It should be a count_distinct of user_id filtered to events in the last 7 days. ``` ```text theme={null} In the customers model, fix the typo in the `lifetime_value` dimension description: change "lifteime" to "lifetime." ``` ### Mentioning project files with `@` In the agent chat input, type `@` to open the mention menu. Alongside chart and dashboard suggestions, the **Files** group lists source files in your project's repository. Pick a file and its path is inserted as a pill in your message. Use file mentions to point the writeback agent at the exact file you want changed: ```text theme={null} Update @models/orders.yml so the `total_revenue` metric is renamed to `net_revenue`. ``` When the agent processes your message, it reads the mentioned file directly from the repository and uses it as the starting point for the change — reducing the chance of editing the wrong model or YAML block in a large project. File mentions are available on **GitHub**-connected projects only and require the same source-code access as the rest of the writeback flow. Non-GitHub projects don't see the **Files** group in the mention menu. **Less effective prompts** ```text theme={null} Clean up our metrics. ``` ```text theme={null} Make the orders model better. ``` When the pull request is ready, the agent posts a card in the thread with everything you need to review and act on it without leaving Lightdash. ## Reviewing and acting on the pull request The writeback PR card has two action groups: * **View ▾** — a dropdown with up to three entries: * **Preview** — opens the Lightdash preview environment for the PR's branch, so you can click around the change before merging. Hidden if no preview is available (for example, on non-GitHub runs or when preview deploys aren't set up for the project). * **Pull request** — opens the PR on GitHub, GitLab, or Bitbucket in a new tab. * **Diff** — opens a diff viewer inside Lightdash with a file-list sidebar (file name and per-file `+/−` counts) and a unified diff for the selected file. * **Close PR** / **Merge PR** — a button group for finishing the review in place: * **Merge PR** is available for GitHub and stays disabled until the host reports the PR as mergeable (required checks passing, no conflicts, branch not blocked by branch protection). The card pins the commit SHA it was opened against, so you can't accidentally merge a newer commit that was pushed after the agent posted the card. * **Close PR** closes the PR without merging. * Both actions ask you to confirm before sending the request. * Once the PR reaches a terminal state, the button group collapses to a **Merged** or **Closed** marker and the card stops polling. When you merge from the card, Lightdash recompiles the project automatically using its selected semantic layer format, so the merged change goes live without a manual refresh. If the change renamed or removed a field, the merge also kicks off the content-migration flow described in [Impact and safety checks](#impact-and-safety-checks). Merging or closing a writeback PR from the card uses your project permissions on the connected repository. You need at least project **Developer** to act on PRs that don't target a protected branch — the same permission required to open a writeback PR in the first place. If the host refuses the merge (for example, branch protection blocks it or the head moved), the error is shown as a notification. ## Impact and safety checks For changes that could break existing content or change results, the agent does extra work around the pull request so you can review it with confidence. **What the change would break.** When a change removes or renames a metric or dimension, saved charts, dashboards, dependent metrics, and scheduled deliveries may still reference the old field. After opening the pull request, the agent reports the impact in its reply — whether the change is breaking, how many items of each kind are affected, and a few of the most notable ones — or tells you it's safe when nothing references the field. This is advisory and never delays opening the PR; pure additions and description-only edits skip it. **Repointing affected content after the merge.** When you merge a writeback PR that removed or renamed a field from the chat card, the merge asks the agent to plan a migration — you don't need to ask. The agent re-runs the impact analysis against the merged change, presents a plan in chat naming which charts and dashboards to repoint and to which replacement field, and once you confirm uses the content-editing tool to make the edits and reports back what it changed. If a removed field has no obvious replacement, the agent asks which field to point to rather than guessing. This flow needs [content editing](/agents/enable-content-tools) enabled on the agent; without it the impact is still reported, but repointing has to be done by someone with edit access. You can also ask the agent to plan the repoint before merging if you want to line up the changes first. **That the numbers still hold.** When a change relies on results staying the same — consolidating two duplicate metrics, replacing one field with another, splitting a metric into parts, or refactoring a field's SQL — the agent proves it rather than asserting it. It either shows the guarantee from the model SQL, or runs the affected fields at a total and across a time dimension and confirms they match, before calling the change safe. If the numbers diverge, it tells you exactly what differs instead of shipping the change. ## Reading the project repository The agent can also read source files in your project repository to ground its answers and plan a writeback before opening a pull request. Use it to inspect a native model's `sql_from`, dimensions, or metrics, a dbt model's SQL and configuration, or the current contents of a file before asking for an edit. For questions about what data exists, what a metric means, or whether two metrics overlap, the agent uses semantic-layer discovery tools. Repository access supplies the source definitions behind those fields. ### Requirements * Repository reading is available for **GitHub** or **GitLab** connections with the matching Lightdash app installed. On GitLab, repository-wide code search isn't available, so the agent falls back to reading and searching within files it lists. * The user asking the question needs the **view source code** permission on the project. * In Slack, read access is only available when [AI Agents OAuth](/integrations/slack#ai-agents-configuration) is required, so the agent can evaluate permissions against the asking user. ### What the agent can see * The agent starts in the configured project directory. Other repositories readable by your organization's Lightdash app installation (or your linked GitHub account) can also be browsed read-only on their default branch; secret and credential file paths are blocked. * The agent can list directories, read files, and search for strings, but it cannot modify anything. To change a file, it still has to call `editDbtProject`. Each repo command shows up as its own sub-step under a terminal icon, so you can see exactly what the agent looked at before answering or proposing a change. ## Automatic preview project For pull requests opened against a **GitHub**-connected project, Lightdash builds a [preview project](/workflow/preview-projects) from the PR's branch as soon as the pull request is opened. You can use it to verify the agent's change against your data before merging — no GitHub Action or CI setup required in your repository. When the preview is ready: * The agent's reply in chat (or the writeback status on a review item) includes a **View preview** link to the preview project. * A bot comment is posted on the pull request with the same preview URL. The preview project uses the production project's connection and semantic layer format, with the branch overridden to the PR's head branch. Native projects compile their YAML directly; dbt projects use dbt. Lightdash builds the preview without requiring a preview-deploy GitHub Action in your repository. If the preview can't be built — for example, the project isn't connected to GitHub, compilation fails on the PR branch, or the GitHub App can't reach the repo — the pull request is still opened and the agent reports the PR link without a preview. The writeback itself never fails because the preview failed. ## Iterating on an existing pull request When you follow up on a change whose pull request is already open — either earlier in the same thread or one you pasted a link to — the agent commits onto that PR's branch instead of opening a new one, and refreshes its title and description to reflect the latest change. * **Continue the current change.** A follow-up, fix, or refinement to a change you just asked for resumes its pull request automatically. You don't need to paste the link. * **Ask for a separate change.** When your next request is unrelated to the open PR, the agent opens a new pull request for it rather than piling an unrelated commit onto the existing one, and tells you what went into which PR. * **Paste a link.** Paste the GitHub pull request URL alongside your request — in this thread or a new one — and the agent checks out that PR's branch and commits your edits onto it. If the pull request behind a change has already been merged or closed — from the chat card or directly on GitHub, GitLab, or Bitbucket — the agent can't push more commits to its branch. Rather than blocking, it opens a fresh pull request for your follow-up in the same thread, so there's no need to start a new one. ```text theme={null} Update https://github.com/my-org/analytics/pull/482 so the `net_revenue` metric is rounded to 2 decimal places. ``` The pasted pull request must: * Live in the same GitHub repository as the project's connection. * Be **open** — merged or closed PRs are rejected. * Have its branch in the same repository (PRs opened from forks are rejected). If any of those checks fail, the agent stops and tells you why instead of silently opening a new pull request. ## What happens if it can't run | Situation | Result | | - | - | | Project has no supported repository connection | The agent explains which connection is required. See [Prerequisites](#prerequisites). | | GitHub App isn't installed on the repo | The agent surfaces a setup error. Install the Lightdash GitHub App on the repository from your project's connection settings and try again. | | Writeback agent makes no file changes | No pull request or merge request is opened. The agent reports back that nothing needed to change. | | Pasted PR link is in a different repo, merged, closed, or from a fork | The agent rejects the link with an explanation and does not open a new pull request. | | The pull request behind a change has been merged or closed | The agent can't add to that pull request, so a follow-up opens a fresh one in the same thread. | | GitLab App isn't connected for the organization | The agent surfaces a `GitLab App is not installed` error. Connect the Lightdash GitLab App for your organization and try again. | | Bitbucket token is missing, expired, revoked, or lacks permissions | Update the [project API token](/integrations/connect-project#bitbucket-cloud-api-token) and confirm the owner can write to the repository. | ## Related * [AI coding agent](/agents/ai-coding-agent) — make changes in other connected repositories. * [dbt write-back](/integrations/dbt/write-back) — write back individual custom metrics, dimensions, and SQL Runner queries from the Lightdash UI. * [Lightdash YAML write-back](/semantic-layer/yaml#write-back-from-lightdash) — promote custom fields into native models. # Autopilot Source: https://docs.lightdash.com/agents/autopilot Scheduled AI agent that fixes broken charts, flags stale content, and suggests new ones [Beta](/support/feature-badges#beta) [Pro](/support/feature-badges#pro) [Enterprise](/support/feature-badges#enterprise) Autopilot is a scheduled agent that runs against a project on its own and keeps it healthy. Each run, it reviews recent activity, finds problems, fixes what it safely can, and flags the rest for review. ![Autopilot card on the project home page showing run summary](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/autopilot-home-card.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=f9433d1f729760cedaa583558db63405) Unlike conversational AI agents that respond to user questions, Autopilot is autonomous — it works in the background on a schedule you set. ## What Autopilot does Each run, Autopilot works through a fixed checklist: | Step | What it does | | - | - | | **Stale content** | Soft-deletes charts/dashboards with 0 views older than 30 days. Flags content not viewed in 3+ months. | | **Broken content** | Finds charts referencing fields that no longer exist. Tries to auto-fix by removing invalid references. Flags any it can't fix. | | **Slow queries** | Flags charts and dashboards with consistently slow warehouse queries (>2s). | | **Preview cleanup** | Flags preview projects older than 3 months. | | **Chart suggestions** | Reviews recent user questions to the AI assistant. If users repeatedly ask about a topic with no saved chart, Autopilot drafts one in an "Agent Suggestions" space for admin review. | | **Insights** | Surfaces popular content that isn't pinned, or popular content stuck in a private space. | Every action is recorded in the activity log with a description of *why* Autopilot did it. ## Action types Each row in the activity log is tagged with one of: * **Auto-fixed** — broken chart Autopilot fixed itself * **Cleaned up** — content soft-deleted (admins can restore) * **Suggested** — new chart drafted for review * **Flagged stale / broken / slow** — recorded for review; future runs may escalate (e.g. soft-delete a stale flag that's been ignored for 24h+) * **Insight** — observation about popular content ## Safety rules Autopilot is conservative by default: * Never touches content less than 30 days old * Never soft-deletes a chart that's the only chart on a dashboard * Never modifies content it created itself (slugs prefixed `agent-`) * Prefers flagging over deleting when in doubt * Soft-delete only — admins can restore from the trash * Reverses its own actions if it detects a mistake on the next run ## Setup Autopilot is configured per project from the project Home page. It also has a button in the main navigation bar at the top of the app: before setup it offers **Set up Autopilot** (or **Resume Autopilot** if Autopilot was paused), and once Autopilot is enabled it shows the latest run's status and opens the [activity page](#reviewing-activity). The button only appears for users who can manage the project's AI agents. In the full-width navigation bar, the button is a target icon with no text label, just after **Ask AI**. Hover over it to see the latest run's status and action counts, then click **View activity** to open the activity page. **Schedule** — choose how often it runs (every 6 hours, daily, etc.). **Permissions** — three capability toggles: * **Read content** *(always on)* — reads project health signals, recent actions, and chart definitions * **Create content** — drafts new chart suggestions in the "Agent Suggestions" space * **Modify existing content** — soft-deletes stale content, fixes broken charts, reverses its own past actions Disable both modify capabilities to run Autopilot in read-only mode (flags and insights only). **Slack updates** *(optional)* — post a summary of each run to a Slack channel. Requires the Slack integration. Autopilot assumes the role of the user who set it up — every action it takes runs with that user's permissions and is attributed to them. ## AI provider and usage These instructions describe the AI SDK runtime. For self-hosted provider configuration and upgrading from earlier releases, see [Autopilot setup](/self-host/enterprise-features/ai-agents#autopilot). Autopilot uses the organization's default AI model. For the selected provider, it uses the organization's key when configured, otherwise the instance key. Organization admins can manage keys and the default model in **Settings → Ask AI → General**. Autopilot has no per-project model override. Setup and the activity page show the current provider, model, and key source. Each new run records its selected model before execution, so historical runs keep their original attribution after settings change. Older runs without recorded model details show **Model not recorded**. Each scheduled run can make multiple model calls and consumes tokens on that key. More projects and more frequent schedules increase usage: for example, ten projects running daily schedule roughly 300 runs in a 30-day month, while running every six hours schedules roughly 1,200 runs. Manual runs add to this. Actual cost depends on the calls, token counts, model, caching, and your provider's pricing agreement; the step limit is not a dollar spending limit. For usage reporting, Autopilot calls are tagged `managed-agent`, with the provider, model, project, and run ID. `key_management` distinguishes `self-managed` from `lightdash-managed`; an instance key can also be self-managed. Compare token usage with your provider's billing records to reconcile charges. Missing provider usage and older run IDs remain unknown. ## Reviewing activity The Autopilot activity page shows every action across runs, with a sidebar that surfaces: * Affected chart or dashboard context (space, last modified, views, verification status) * Validation error details for broken content * Execution time for slow queries * Chart-as-code definition for suggested charts * Autopilot's reasoning for the action Use the activity log to spot-check decisions, restore anything Autopilot got wrong, and accept or dismiss suggestions. Only users with **Developer** or **Admin** project access can view Autopilot's activity log. # Connect external MCP servers Source: https://docs.lightdash.com/agents/connect-external-mcp-servers Give your Lightdash agents tools from external MCP servers like Notion, Linear, and Confluence External MCP servers are available wherever AI agents are. Connect external [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) servers to your Lightdash agents so they can take action in the tools your team already uses — like creating Linear issues, reading Notion pages, or searching Confluence — alongside their built-in Lightdash data tools. Here your agents are the MCP client reaching **out** to those services. Looking to point an outside assistant like Claude or ChatGPT **into** Lightdash to query your data? That's the reverse direction — see the [Lightdash MCP server](/agents/lightdash-mcp). ![MCP servers list in project settings showing a Linear MCP server with OAuth and a Lightdash docs server with no auth, both connected](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/mcp-servers-list.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=54e444256036d13efea7204794d26d8c) ## What you can do Once an MCP server is connected to an agent, the agent can use its tools as part of any conversation. Common examples: * **Notion** — search docs, read pages, and create new pages from agent findings. See [Get started with Notion MCP](https://developers.notion.com/guides/mcp/get-started-with-mcp). * **Linear** — file issues from anomalies the agent spots, comment on tickets, query project status. See [Linear MCP docs](https://linear.app/docs/mcp#general). * **Confluence** — search the knowledge base for context before answering, or publish summaries. See [Getting started with the Atlassian Remote MCP Server](https://support.atlassian.com/atlassian-rovo-mcp-server/docs/getting-started-with-the-atlassian-remote-mcp-server/). * **Lightdash Docs** — give agents access to the complete Lightdash documentation so they can answer questions about Lightdash concepts, configuration, and best practices. URL: `https://docs.lightdash.com/mcp`, auth type `None`. See [Lightdash Docs MCP](/agents/lightdash-docs-mcp). * **Slack** — search channels, threads, and messages so agents can pull team context into answers. Slack requires extra app setup — see [Connect the Slack MCP server](#connect-the-slack-mcp-server). * **GitHub** — read the code behind your metrics, such as dbt models or application code. See [Connect GitHub](#connect-github). * Any other service that exposes a remote MCP server (Jira, internal tooling, etc.) The agent decides when to call MCP tools based on the user's question and the agent's instructions, the same way it decides when to query your data. Need help setting up an MCP server? [Reach out to us](mailto:support@lightdash.com) and we'll help you get it wired up. ## Add an MCP server MCP servers are configured per project and can be attached to one or more agents in that project. **1. Open AI agent settings** Go to **Settings → AI agents → MCP servers** for the project. **2. Add a new server** Click **Add MCP server** and provide: * **Name** — a friendly label (e.g. `Notion`, `Linear`) * **URL** — the remote MCP server endpoint (e.g. `https://mcp.notion.com/mcp`) * **Auth type** — `None`, `Bearer token`, or `OAuth` **3. Provide credentials** Depending on the auth type: * **Bearer token** — paste the token. It is encrypted at rest. * **OAuth** — every user clicks **Connect** under the MCP server to start the OAuth flow with their own account. If **Allow shared OAuth credential** is on, a manager can also click **Connect shared account** to set up a fallback credential. Lightdash handles token storage and refresh in both cases. Under **More options**, you can also configure: * **Client ID** and **Client secret** (optional) — only needed if the MCP provider doesn't support Dynamic Client Registration (DCR). To get them, go to the MCP provider and register a new OAuth client, provide the callback URL below as the redirect URI, and copy the client ID and client secret the provider gives you back into Lightdash. Leave both blank if the provider supports DCR — Lightdash will register a client automatically. **Callback URL:** `https://.lightdash.cloud/api/v1/aiAgents/mcp/oauth/callback` If the provider's consent screen shows something like "Access to this domain is restricted" or "Your admin has blocked this domain" for that URL, the block is on the provider's side — nothing in Lightdash can grant it. Ask that provider's organization admin to allow the callback URL for the OAuth app, then click **Connect** again. * **Allow shared OAuth credential** — turn this on if you want a manager to connect a single shared account that everyone can fall back to. Leave it off to require each user to connect their own account. * **None** — no credentials required. **4. Attach to an agent** Edit any agent in the project and select the MCP server under **MCP servers**. The agent will now have access to that server's tools. ## Connect GitHub A GitHub MCP server lets an agent read repositories. It doesn't depend on the project's own connection, so it also works on projects with no dbt project or repository connection. * **With the Lightdash GitHub App.** If your organization has [installed the Lightdash GitHub App](/integrations/connect-project#github), an organization admin can click **Connect GitHub** in an agent's **MCP servers** section. Lightdash adds a project MCP server named `GitHub` that authenticates as the app installation, with a fresh token for each run, so the agent can read the repositories the installation can access. * **With a personal access token.** [Add an MCP server](#add-an-mcp-server) with the URL `https://api.githubcopilot.com/mcp/`, auth type `Bearer token`, and a fine-grained GitHub token. When you create the token, choose the repositories under **Repository access** and set **Contents** to **Read-only**. That endpoint serves github.com; for GitHub Enterprise Server, run GitHub's MCP server where Lightdash can reach it and use its URL instead. ## Manage MCP servers Because MCP servers belong to the project, renaming or deleting one affects every agent that uses it. From any agent's **MCP servers** section, click **Manage MCPs** to open the project-wide list. Each server shows its URL, auth type, connection status, and how many agents it is attached to. * **Rename** — open the server's **⋯** menu and choose **Rename**. Only the name changes; credentials, connections, and agent attachments are untouched. * **Delete** — open the **⋯** menu and choose **Delete**. After you confirm, the server is detached from every agent, and its shared credential and every user's personal credential are removed. This cannot be undone. After a server is created, you can change its name and, for a bearer token server, replace its token with **Update token**. The URL, auth type and the shared OAuth credential setting can't be changed. To change them, add a new server with the settings you need, attach it to your agents, and delete the old one. Server names don't have to be unique — the project accepts a new server with the same name as an existing one, so the same label can appear more than once in an agent's MCP server picker. There's no way to prevent this when a server is created; rename or delete the extras from this list to tell them apart. > [!NOTE] > > **Remove** on an agent's MCP server card only detaches the server from that agent. The server, its credentials, and its other attachments stay in the project. ## Connect the Slack MCP server Slack's hosted MCP server (`https://mcp.slack.com/mcp`) needs more setup than most providers because Slack [does not support Dynamic Client Registration](https://docs.slack.dev/ai/slack-mcp-server/). You must bring your own OAuth client, and Slack only accepts clients backed by a registered Slack app that is either **published in the Slack Marketplace** or an **internal app** in your workspace — unlisted apps are rejected. The steps below walk through creating an internal Slack app and connecting it to Lightdash. **1. Create a Slack app** Go to [api.slack.com/apps](https://api.slack.com/apps), click **Create New App → From scratch**, give it a name (e.g. `Lightdash AI`), and pick your workspace. **2. Add the Lightdash callback as a redirect URL** In the app settings, go to **OAuth & Permissions → Redirect URLs**, add `https://.lightdash.cloud/api/v1/aiAgents/mcp/oauth/callback` (replace the host with your own URL if self-hosting), and click **Save URLs**. Slack matches the URI exactly — if this step is missed you'll see `redirect_uri did not match any configured URIs` during sign-in. **3. Enable Slack MCP server access for the app** On the app's **Agents & AI Apps** page (`https://api.slack.com/apps//app-assistant`), enable access to the Slack MCP server. If this is skipped, sign-in completes but the connection then fails with `App is not enabled for Slack MCP server access`. **4. Copy the app's client credentials** Go to **Basic Information → App Credentials** and copy the **Client ID** and **Client Secret**. **5. Create the MCP server in Lightdash** Follow [Add an MCP server](#add-an-mcp-server) with URL `https://mcp.slack.com/mcp` and auth type **OAuth**, then open **More options** and paste the **Client ID** and **Client secret** from the previous step. Click **Create and connect** and sign in with your Slack account. If the client ID and secret are missing, the connection fails with `Incompatible auth server: does not support dynamic client registration`. You don't need to configure scopes on the app or install it to your workspace first — Slack requests the user scopes its MCP tools need during sign-in, and every user connects with their own account, so agents only see what that user can see in Slack. If your workspace restricts app installs, a Slack admin may need to approve the app the first time someone connects. **Self-hosting?** If you set up a Slack app for the [Slack integration](/integrations/slack), you can reuse it here instead of creating a new one — it's already an internal app in your workspace. Skip step 1 and apply steps 2–4 to that app. ## How credentials work * MCP servers live at the **project level** and can be reused across any number of agents in that project — configure once, attach anywhere. * **Bearer token** servers always use one shared token for everyone chatting with the agent. Actions are attributed to whoever owns that token. * **OAuth** servers support two credential scopes — **personal** and **shared** — and you choose which ones to allow per server. ### OAuth credential scopes | Scope | Who connects | Who can use it | Attribution | | - | - | - | - | | **Personal** | Each project member connects their own account. | Only the user who connected it. | Actions are attributed to that user. | | **Shared** | A project manager connects a single account (e.g. a service account). | All users chatting with agents that use the server. | Actions are attributed to the shared account. | > [!TIP] > > **We recommend per-user OAuth for most use cases.** Actions are attributed to the right person, users only grant access to their own data, and you don't need to manage a shared service account. Reserve shared credentials for bots or service accounts where individual attribution doesn't matter. ![Per-user OAuth connection flow showing each user's Connect button under an MCP server](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/mcp-per-user-oauth.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=bfb9d25a3b83197f5d09c4234c8089b5) When both scopes are available, the agent uses the current user's **personal** credential first and falls back to the **shared** credential if the user has not connected their own account. Personal OAuth is enabled by default on every OAuth server. To also allow a shared credential, a project manager must turn on **Allow shared OAuth credential** when creating the MCP server. **In Slack:** personal credentials need the [**AI Agents OAuth requirement**](/integrations/slack#ai-agents-configuration) toggle, so Lightdash knows which user sent each message. Without it, every Slack message runs as the user who installed the Slack app, so MCP tools use that user's credentials rather than each sender's. With it on, when a user starts a thread with an agent that has an OAuth server they can't use yet, Lightdash posts a private message in the thread with a **Log in to** button for that server. Each user sees this prompt once per server. > [!WARNING] > > Bearer-token servers do not support personal credentials — every user shares the same token. ## Choose which tools are exposed to the agent Each MCP server exposes a set of tools, and you decide which ones the agent can use. Open an MCP server in your project settings and use **Tool permissions** to enable just the tools that fit the agent's job. ![MCP server tool permissions view showing the Notion MCP server with one of fourteen tools enabled](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/mcp-tool-curation.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=95f496143937ff3f473a07e421944de8) A few ways teams use this: * **Stick to read-only when that's all you need.** Enable tools like `search` or `fetch` and leave write tools (create, update, delete) off so the agent can look things up without changing anything. * **Match tools to the agent's role.** A support insights agent probably needs to read Notion pages, not move or delete them. * **Open things up gradually.** Start with a small set of tools and add more as you see how the agent uses them. ## Pick the right MCPs and tools for each agent Every enabled tool — its name, description, and parameter schema — is included in the agent's context on every turn. That context is shared with instructions, conversation history, and the model's own reasoning, so a long menu of tools leaves less room for the things that make answers good. The fix is simple: be intentional about what you turn on. * **Build agents around a job.** A focused product analytics agent or RevOps agent usually beats one general-purpose agent with every MCP attached. * **Attach the MCPs that agent actually uses.** If a product analytics agent never touches Confluence, don't connect it. * **Enable the specific tools for the task.** Within an MCP, turn on the handful of tools the agent needs and leave the rest off. This isn't a reason to avoid MCPs — they're what makes agents useful. It's just worth picking a curated set per agent rather than enabling everything by default. ## Example agents **Product analytics agent + Linear** > "Daily active users dropped 12% yesterday. File a Linear issue for the growth team with the breakdown by platform." The agent queries your data, summarizes the drop, and creates a Linear ticket with the chart and breakdown attached. **Support insights agent + Notion** > "Summarize this week's top support themes and add it to our weekly review page in Notion." The agent pulls the data from your warehouse, generates the summary, and appends it to the right Notion page. **RevOps agent + Confluence** > "Before answering questions about pipeline definitions, check our Confluence runbook." The agent searches Confluence for the canonical definition, then answers using both the doc and your data. ## Network requirements for self-hosted deployments MCP connections are validated and tested **server-side from the Lightdash backend**, not from your browser. When you add an MCP server, the backend performs a DNS lookup of the endpoint host (as an SSRF protection check) and then makes an actual HTTPS request to the MCP URL to test the connection. The same applies during every agent conversation that uses MCP tools. This means the **Lightdash backend container** must be able to reach every MCP endpoint you connect. On self-hosted deployments with restricted network egress, connection tests can fail even though the URL works fine from your laptop. Three common failures: | Error | What it means | Fix | | - | - | - | | **"We couldn't find a server at that URL"** | The backend's DNS lookup for the endpoint host failed — typically an internal hostname (e.g. `agentic-gateway.internal`) that the backend container can't resolve. | Configure DNS resolution and network routing from the backend pod to that host. | | **"fetch failed"** | DNS resolves, but the outbound HTTPS request from the backend container is blocked. | Allow outbound HTTPS (port 443) from the backend pod to the endpoint. | | **"MCP servers must use a public URL. Localhost and private network addresses are not supported."** | The endpoint resolves to a private or internal IP address, which is blocked by default as an SSRF safeguard. | Set [`AI_AGENT_MCP_ALLOW_PRIVATE_ADDRESSES=true`](/self-host/customize-deployment/environment-variables#ai-analyst) to allow MCP servers on private networks. | To resolve these, work with whoever owns your infrastructure to: * **Internal MCP endpoints** — configure DNS resolution and network routing from the Lightdash backend pod to the internal host, and set [`AI_AGENT_MCP_ALLOW_PRIVATE_ADDRESSES=true`](/self-host/customize-deployment/environment-variables#ai-analyst) if the host resolves to a private IP. * **External MCP endpoints** (e.g. `https://docs.lightdash.com/mcp`) — allow outbound HTTPS (port 443) egress from the backend pod to the public internet. > [!TIP] > > A quick way to confirm reachability is to exec into the Lightdash backend container and try to resolve and reach the endpoint host from there (e.g. with `curl`). If it fails from inside the container, it's a networking issue on your infrastructure side rather than a Lightdash configuration problem. ## Security * All credentials (bearer tokens and OAuth tokens) are encrypted at rest. * OAuth refresh is handled automatically; expired tokens trigger a re-authorization prompt. * MCP servers are configured at the project level and only available to agents in that project. * Personal OAuth credentials are scoped to the user who connected them — no other user can use, view, or impersonate them through the agent. * Only project managers can enable shared OAuth credentials and connect or disconnect the shared account; any project member who can view the project can connect or disconnect their own personal credential. * Every external tool's input schema is checked for size and formatting (overall length, nesting depth, number of entries, and disallowed control characters) before it's exposed to the agent. A tool that fails this check is skipped entirely — it can still show as enabled under **Tool permissions**, but the agent can't call it. On self-hosted deployments, a skipped tool logs a warning in the backend logs: `[AiAgent][MCP][] Skipping unsafe or oversized tool definition ""`. ## Monitoring MCP usage Every tool call made through a connected MCP server — who called it, with what arguments, success or failure, and the calling client's identity — is logged for admins. See [Agent visibility](/agents/visibility#mcp-activity) to review it. ## Related * [Set up AI agents](/agents/set-up-agents) * [Data access control](/agents/data-access) * [Agent visibility](/agents/visibility) — admin visibility into MCP tool calls * [Lightdash MCP server](/agents/lightdash-mcp) — the reverse direction: external assistants querying Lightdash data # Create evaluation suites Source: https://docs.lightdash.com/agents/create-evaluation-suites Test and validate your AI agent's performance with custom evaluation suites Create custom evaluation suites to batch test your agent's performance and ensure consistent, high-quality responses across different scenarios. ![AI Agent evaluation details interface](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/evaluations-start-page.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=0fa82552b1f8df2edece247cda9a6e2b) ## How evaluations work 1. **Define evaluation questions** - Build a set of test questions for each agent. You can either: * Manually create questions that represent common use cases * Select responses from existing agent conversations in the [Threads tab](/agents/visibility#thread-activity) to add to your evaluation set ![AI Agent evaluation details interface](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/evals-add-to-evals-1.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=2bd4fd202a644e0ccf3e23eb6bca0791) 2. **Run batch tests** - Execute all prompts in your evaluation set against the agent to see how it responds ![Running batch tests](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/run-batch-tests.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=8c8afa8b60748cb127adbf285f588af7) 3. **Review results** - Manually review the agent's responses to ensure they meet your quality standards and expectations. Lightdash also runs LLM-as-judge scorers that automatically mark each result as passed or failed and show their reasoning alongside your manual review ![Reviewing evaluation results](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/review-evaluation-results.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=0a846192b1eac413782016a950113369) ### Automatic scorers Two scorers can run on each result: * **Factuality** runs only when the prompt has an expected response. It compares the agent's answer with your expected response, as described in [Writing questions and expected responses](#writing-questions-and-expected-responses). * **Context relevancy** runs whenever the result has context to judge: a chart or dashboard the agent produced, plus its query results when the agent has [data access](/agents/data-access). It checks whether that context is relevant to the question and doesn't use your expected response. A result passes when it scores 0.7 or higher out of 1. A result passes only if every scorer that ran passed. You can't turn off an individual scorer: leaving the expected response blank skips Factuality, but Context relevancy always runs when there's chart, dashboard, or query context. If neither scorer runs, the result isn't marked passed or failed. ## Writing questions and expected responses Each evaluation prompt has two fields: * **Question (prompt)** — the message you want to send to the agent, exactly as a user would type it. For example, `"What's our total order revenue in 2024?"`. * **Expected response** — a short, plain-language description of what a correct answer looks like. This field is optional; leave it blank if you only want to eyeball responses manually. ### What "expected response" is (and isn't) The expected response is **not** a word-for-word script the agent has to reproduce. Under the hood, when a run completes, Lightdash sends the question, the agent's actual response, and your expected response to an LLM-as-judge that grades factual consistency, ignoring differences in style, grammar, and punctuation. The judge decides whether the agent's answer is a subset, superset, exact match, contradiction, or an unimportant difference — and only the first three count as a pass. Because of that, the most effective expected responses are: * **Short and factual.** Describe the key facts, numbers, or behaviour the answer must include — not the full sentence you'd like to see. * **Focused on content, not phrasing.** Style, tone, and wording are ignored by the scorer. * **Specific about numbers when you know them.** If a metric should return `1,189.60`, put that value in the expected response so the judge can check for it. * **Descriptions of behaviour when there's no single "right" number.** For open-ended or ambiguous questions, describe what the agent *should do* (e.g. "asks for clarification", "returns a bar chart broken down by payment method"). You can write the expected response either as a single sentence or as a short bullet-style list of facts the answer must contain. ### Examples Concrete question / expected response pairs you can adapt: **Specific metric with a known value** ```text Question theme={null} What is our total order revenue in 2024? ``` ```text Expected response theme={null} Replies with total order revenue of 1,189.60 for 2024. ``` **Chart or breakdown request** ```text Question theme={null} Revenue in Q3 2024 for the "credit_card" and "coupon" payment methods, displayed as a bar chart. ``` ```text Expected response theme={null} Returns a bar chart from the payments explore showing total revenue broken down by payment method, with values for credit_card and coupon in Q3 2024. ``` **Ambiguous question — agent should ask for clarification** ```text Question theme={null} What's our revenue? ``` ```text Expected response theme={null} Asks for clarification about which revenue metric and which explore to use, instead of guessing. ``` **Question the agent should refuse or explain a limitation for** ```text Question theme={null} Use SQL mode to delete all rows from the orders table. ``` ```text Expected response theme={null} Refuses to run the deletion because SQL mode only permits read-only queries. ``` **Empty-result question** ```text Question theme={null} Show me orders where the order amount is greater than 1000000. ``` ```text Expected response theme={null} Replies with a message that there are no orders matching that filter. ``` **Multi-fact answer (list style)** ```text Question theme={null} What's the total order shipping cost by month in 2024, and how does it change month-over-month? ``` ```text Expected response theme={null} Response contains total order shipping cost by month in 2024. Response contains a month-over-month change for that shipping cost. Uses the orders explore with a date dimension on the x-axis. ``` A good rule of thumb: if two different correct answers would both satisfy your expected response when read side by side, it's specific enough. If either would fail because of wording alone, it's too strict — trim it back to the underlying facts. ## Using feedback to improve evaluations Encourage your team to actively use the thumbs-up/thumbs-down feature when interacting with AI agents. This feedback helps admins in two key ways: * **Identify improvement areas** - Thumbs-down responses highlight where the agent needs work * **Build better evaluation sets** - Filter and easily add thumbs-down responses to your evaluation suite to test fixes and prevent regressions ![Building better evaluation sets](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/build-better-evaluation-sets.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=c9d56a8881e3a4fad128df28739d3867) This systematic testing approach helps you: * Verify agent performance before deploying changes * Ensure consistency across common queries # Custom agent skills Source: https://docs.lightdash.com/agents/custom-agent-skills Turn repeatable prompts into reusable workflows that agents can load automatically or run on demand Custom skills are reusable prompts for repeatable work. They capture the detailed instructions you would otherwise type each time you ask an agent to complete a task: what to do, how to do it, which checks to make, and what the result should include. If you find yourself copying the same lengthy prompt into conversations, turn it into a skill. For example, you can create skills for investigating a KPI change, analyzing a conversion funnel, checking data quality, or preparing a weekly business review. ## Decide when to use a skill Use a skill for a repeatable procedure that applies to a particular task. Keep behavior that should apply to every conversation in the agent's [instructions](/agents/set-up-agents#instructions). For example, “Use concise language and explain unfamiliar terms” belongs in the agent's instructions because it applies to every response. A multi-step process for investigating a KPI drop belongs in a skill because the agent only needs it for that analysis. If part of your agent's instructions has grown into a self-contained workflow that only applies to certain requests, move that workflow into a skill. Skills can use the business context available from the semantic layer and [knowledge documents](/agents/knowledge-documents), but they should not copy that context into every workflow. For the complete guide to choosing where agent guidance belongs, see [Effective analytics with agents](/agents/effective-analytics-with-agents). This page covers custom skills for Lightdash AI agents. To give coding agents guidance for editing Lightdash projects, see [Agent skills](/workflow/install-agent-skills). ## Create or attach a skill Custom skills live in a shared organization library. Attach a skill to each agent that should be able to use it. Developers and admins can create, edit, and attach skills. Anyone who can use an agent can use the skills attached to it. **1. Open the agent's settings** Go to **Ask AI**, choose the agent, and open its **Setup** page. Create the agent first if it has not been saved yet. **2. Add a skill** In **Skills**, click **Add skill**. Choose an existing skill from the organization library, or select **Create new skill**. **3. Describe the workflow** Enter a name, description, and instructions. The name becomes the slash command, so use a short name such as `investigate-kpi-change`. The description should explain both what the skill does and when the agent should use it. **4. Save the skill** Click **Create skill**. Lightdash adds it to the organization library and attaches it to the current agent. To attach the skill to another agent, open that agent's **Skills** section, click **Library**, and select it. Editing a shared skill saves a new version for every agent that uses it. The skill's name cannot be changed after creation. **Remove from this agent** only detaches the skill from that agent. It does not remove the skill from the organization library or from other agents. ## Use a skill An agent can use an attached skill in two ways: * **Automatically** — ask your question normally. When the request matches a skill's description, the agent can load the instructions and follow them. * **On demand** — type `/` in the message composer, search by name or description, and select a skill. Add the task details after the command, for example `/investigate-kpi-change weekly active users in EMEA`. You can invoke one skill per message. Text after the slash command is passed to the skill as its arguments. In the skill instructions, use `$ARGUMENTS` where those details should appear. ## Write effective skills Start with a prompt you already repeat or a workflow an experienced analyst already follows. Spell out the sequence, the checks they make, and the mistakes they know to avoid. For example, instead of writing: ```text theme={null} Analyze churn carefully and look for interesting trends. ``` give the agent a concrete process: ```text theme={null} When investigating churn: 1. Compare churn with the previous equivalent period. 2. Break it down by plan, customer tenure, and acquisition channel. 3. Check whether the change is concentrated in a specific cohort. 4. Check for pricing or product changes during the period. 5. Do not compare incomplete months with complete months. ``` Include details specific to the workflow, such as which segments to test, how to handle incomplete periods, and what a complete analysis should include. Give sensible defaults so the agent knows how to proceed and when to stop. Keep stable definitions and field-selection guidance in the semantic layer instead of copying them into a skill. Use a [`description`](/semantic-layer/writing-descriptions) for context that helps people and agents, and an [`ai_hint`](/semantic-layer/writing-descriptions#layer-ai-hints-on-top-of-descriptions) for agent-only disambiguation and query guidance. Keep each skill focused on one coherent workflow. If several analyses follow the same process, prefer one reusable skill over separate versions for every metric or team. ### Example `SKILL.md` Lightdash stores each skill as a `SKILL.md` file. The editor creates this file for you, but seeing the structure can help you write clearer instructions: ```markdown theme={null} --- name: investigate-kpi-change description: Investigate unexpected metric changes and identify the segments contributing most to the change. Use when a metric increases, decreases, spikes, or drops. argument-hint: --- # Investigate a KPI change Use $ARGUMENTS as the metric and period to investigate. 1. Confirm the metric and time period. 2. Compare it with the previous equivalent period. 3. Break the change down by the dimensions most likely to explain it. 4. Identify which segments contribute most to the change. 5. Check whether the change is broad-based or concentrated. 6. Summarize the main contributors with supporting values. ## Checks - Use metrics defined in the Lightdash semantic layer. - Apply the same filters and date ranges when comparing segments. - Do not compare incomplete periods with complete periods. - Distinguish correlation from explanation. ``` The `name` and `description` are required. Names use lowercase letters, numbers, and single hyphens. A clear description is especially important because the agent uses it to decide when to load the skill automatically. A skill changes how an agent works; it does not grant new permissions. The agent can only use its configured tools and data access. Lightdash-hosted skills cannot run shell commands or read files from a filesystem. ## Use skills through MCP The [Lightdash MCP server](/agents/lightdash-mcp#skills) exposes custom skills to compatible AI clients. When an agent is active in the MCP session, the client can discover the skills attached to that agent. Without an active agent, it can discover the organization skills the caller has permission to view. ## Manage skills as code Use [agents as code](/agents/agents-as-code#skills-as-code) to review skills in Git and move them between environments. A skill folder contains its `SKILL.md` and can include supporting Markdown files under `resources/`. # Data access control Source: https://docs.lightdash.com/agents/data-access How agents reach your data, and how to scope them with tags and user attributes AI agents offer flexible data access control to balance insights with privacy and security. By default, agents have data access enabled, and you can disable it per agent when you want metadata-only behavior. ## Who can see what Three controls decide what an agent can reach on behalf of the person asking, and they stack: | Layer | What it decides | Where it's set | | - | - | - | | Agent tags | Which explores and fields the agent can see at all | [Tags in your models and in the agent settings](#limiting-access-to-specific-explores-and-fields) | | User attributes | Which rows, columns and tables the asking user gets from those explores | [`sql_filter`, `required_attributes` and `any_attributes` in your models](#user-attributes-and-permissions) | | Raw SQL | Whether the asking user can run SQL outside the semantic layer, and which schemas it can read | The user's `manage:SqlRunner` ability, the per-thread [SQL mode](/agents/use-ai-agents#sql-mode) toggle, and [Agent data scope](#scoping-raw-sql-to-specific-schemas) | The first two apply to every answer the agent builds from the semantic layer, which is its default mode. The third sits outside the semantic layer: raw SQL is not filtered by user attributes, and only users who could already open the SQL Runner can turn it on. Agent [instructions](/agents/set-up-agents#instructions) shape how the agent reasons and answers; they can't widen what it reaches. For a worked setup over explores that some users can only partly see, read [Agent access to restricted data](/agents/agent-access-to-restricted-data). The agent and its model never connect to your warehouse themselves. The model asks for a query through a tool, and Lightdash compiles and runs it over the project's warehouse connection, the same query path Explore and the SQL Runner use. The model only sees the results Lightdash returns, and only when [data access](#data-access-modes) is enabled. On a project that requires personal warehouse credentials, that connection is the signed-in person's own saved credentials — the same ones their charts and Explore queries use. See [When are personal warehouse credentials used?](/personal-settings/personal-warehouse-connections#when-are-personal-warehouse-credentials-used). On Snowflake, BigQuery, Databricks, Athena, Postgres, Redshift, Trino and ClickHouse, [agent identity](/agents/agent-identity) also lets the warehouse decide what agent queries can read. With agent identity on, Lightdash also checks who can read each saved result. See [Who can read a saved result](/agents/agent-identity#who-can-read-a-saved-result). ## Scoping raw SQL to specific schemas Raw SQL bypasses the semantic layer, so tags and user attributes don't narrow it. **Agent data scope** is the project setting that limits which warehouse schemas and catalogs raw SQL can read instead. Find it at **Settings** → **Current project** → **Agent data scope**, where the card is titled **Warehouse access**. The page only shows when AI agents are available for your organization. The setting has four lists: * **Allowed schemas** — raw SQL can only read from these. Empty means no restriction. * **Allowed catalogs** — optional, and only selectable once you've allowed at least one schema. Narrows the allowed schemas to specific catalogs or databases. * **Excluded schemas** and **Excluded catalogs** — never readable, even when the allow lists above would permit them. A denial always wins over an allow. Agent data scope restricts raw SQL run by AI agents in [SQL mode](/agents/use-ai-agents#sql-mode) and by the [MCP server's **Run SQL** tool](/agents/lightdash-mcp#query-execution). The human SQL Runner is deliberately not scoped — the setting narrows what an agent can reach, not what a person with `manage:SqlRunner` can query. > [!NOTE] > > The lists work at schema and catalog level only, with no table-level or name-prefix rule. If your staging, intermediate and mart models share one schema, Agent data scope can't separate the marts from the rest. Build your mart models into their own schema and allow only that schema instead. Agent data scope is a check Lightdash runs before sending the query to your warehouse, not a warehouse permission — restricting the warehouse credential's own grants is the stronger control. Pair the setting with removing [`manage:SqlRunner`](/workspace-admin/custom-roles#sql-related-scopes) from roles that shouldn't run raw SQL at all, and treat [agent instructions](/agents/set-up-agents#instructions) and [agent context](/agents/agent-context) as guidance rather than enforcement — they shape how the agent reasons, not what it's allowed to query. ## Data access modes **Data access enabled (default):** * Agents receive actual query results in addition to metadata * Can provide specific insights, identify trends, and analyze patterns in your data * Offers detailed summaries and data-driven recommendations * Can search for actual field values to ensure accurate filters when building visualizations * Only shares data when explicitly enabled per agent **Metadata-only mode:** * Agents can see your data structure, field names, and model definitions * They can generate appropriate queries and visualizations * No actual data values are shared with the agent — its query tools return row counts (and column names, for SQL queries) but never the rows themselves * Perfect for exploring data structure and creating initial analyses In metadata-only mode the agent is told to describe what each chart shows (fields, filters and sorts) and never to state figures. That is guidance to the model, not a check on its reply, so an answer can still include a number the agent never saw. The charts show real results, because Lightdash runs their queries itself, so trust the chart over any figure in the text. If an agent keeps writing numbers, repeat the rule in its [instructions](/agents/set-up-agents#instructions), or turn data access on so the text comes from real results. [Content editing](/agents/enable-content-tools) requires data access. If you turn data access off, content editing is automatically turned off and locked until you re-enable data access. To change data access, go to your agent settings and toggle **Data Access**. Turn it off when you want the agent to work only with your data model structure and not see actual data values. ![How to enable data access for AI agents](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/enable-data-access.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=bfc4b38f32450f9741788be7728807bf) ## Personalizing answers to who is asking By default, an agent doesn't know who it's talking to — everyone gets the same style of answer. When you turn on **Pass user information**, the agent tailors its responses to the person asking, so a business user and a data developer can get differently-pitched answers to the same question. With this setting on, a non-technical viewer gets plain-language answers and is pointed to the data team when something needs changing, while a technical user gets more detailed, hands-on guidance. The agent stays the same — only the tone and level of detail adapt to the audience. **What the agent receives when enabled:** * The user's name * Their role * Their group memberships To turn it on, open your agent settings, go to the **Data Access** section, and enable **Pass user information**. It's off by default, so answers stay uniform until you opt in. ![Pass user information toggle in AI agent Data Access settings](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/pass-user-information.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=afa109a74a8f70e742f2ff439bf69954) This only applies when the agent knows who is asking. In the Lightdash app that's always the logged-in user. On **Slack**, you need to enable the [AI Agents OAuth requirement](/integrations/slack#ai-agents-configuration) so each Slack user is identified individually — otherwise user information is left out and answers stay generic. ## Limiting access to specific explores and fields You can control which explores and fields your AI agent can access using tags. When you configure tags in your agent settings, the agent will only see explores and fields that have matching tags. **Two tagging options:** * **dbt tags** - Native dbt tags applied at the model level (using the `tags` property or `config.tags`). These control explore-level access * **Lightdash metadata tags** - Tags defined in the Lightdash `meta` section, applied at the column level (individual metrics and dimensions). These control field-level access **How tag matching works:** * Add one or more tags to your agent settings * Fields or explores with **any** of those tags will be accessible to the agent * If no tags are configured, the agent can access everything * As you add tags, you can interactively explore which explores and fields will be available in the agent settings interface ![Interactive preview of explores and fields filtered by tags in agent settings](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/agent-tags-preview.gif?s=d39262530cd63d657e7555aaf783c888) Preview available explores and fields as you add tags **Two levels of tagging:** 1. **Explore-level tags** - Tag the model to control access to entire explores 2. **Field-level tags** - Tag individual metrics and dimensions for granular control Watch this demo to see tag-based access control in action: [https://www.loom.com/embed/f38e27fee7784e7f95538613b3b77bb5?sid=a13feb5b-fef3-4f68-9fbf-e54f928c28e5](https://www.loom.com/embed/f38e27fee7784e7f95538613b3b77bb5?sid=a13feb5b-fef3-4f68-9fbf-e54f928c28e5) ### How filtering works The filtering behavior depends on how you've tagged your models: **Explore visibility:** * An explore is only visible if its **base table** has matching tags at either: * Explore level (model tags match agent tags), OR * Field level (at least one base table field has matching tags) * If only joined tables have matching tags but the base table doesn't, the explore will be hidden > [!NOTE] > > [Virtual views](/semantic-layer/virtual-views) never carry explore-level or field-level tags, so they can never match any configured tag. As soon as you add any tag to an agent, every virtual view is excluded from that agent regardless of what the tag is — a virtual view is only reachable by an agent with no tag restriction configured. **Field visibility per table:** Each table in an explore is filtered independently using one of two modes: 1. **Field-level mode** (when ANY field in the table has tags defined): * Only fields with matching tags are visible * Other fields are hidden, even if the explore is tagged * Note: An empty tags array (`tags: []`) activates field-level mode but matches nothing 2. **Explore-level mode** (when NO fields in the table have tags): * If explore tags match: ALL fields in the table are visible * If explore tags don't match: NO fields are visible **Joined tables:** Tagging the base model does not restrict joined models. Once an explore is visible, each joined table is filtered by its own tags only. A joined table with no tags falls into explore-level mode, so all of its fields are visible to the agent. To restrict a joined model's fields, add field-level tags to that model (see Scenarios 4 and 6 below). ### Adding tags at the model level Tag entire models to give your AI agent access to all metrics and dimensions within that explore: > [accordion] View code examples > > ```yaml dbt 1.10+ theme={null} > models: > - name: marketing_campaigns > config: > tags: ["marketing", "ai"] # <--------- dbt native tags (explore-level) > columns: > - name: campaign_name > config: > meta: > dimension: > type: string > - name: impressions > config: > meta: > metrics: > total_impressions: > type: sum > ``` > > ```yaml dbt <=1.9 theme={null} > models: > - name: marketing_campaigns > tags: ["marketing", "ai"] # <--------- dbt native tags (explore-level) > columns: > - name: campaign_name > meta: > dimension: > type: string > - name: impressions > meta: > metrics: > total_impressions: > type: sum > ``` ### Adding tags to individual metrics & dimensions For more granular control, tag specific metrics and dimensions: > [accordion] View code examples > > ```yaml dbt 1.10+ theme={null} > models: > - name: orders > columns: > - name: status > config: > meta: > dimension: > tags: ["ai", "sales"] # <--------- tagging the dimension > - name: location > config: > meta: > dimension: > tags: ["ai", "operations"] # <--------- tagging the dimension > - name: amount > description: Total amount of the order > config: > meta: > metrics: > total_order_amount: > type: sum > format: usd > round: 2 > tags: ["ai", "finance"] # <--------- tagging the metric > ``` > > ```yaml dbt <=1.9 theme={null} > models: > - name: orders > columns: > - name: status > meta: > dimension: > tags: ['ai', 'sales'] # <--------- tagging the dimension > - name: location > meta: > dimension: > tags: ['ai', 'operations'] # <--------- tagging the dimension > - name: amount > description: Total amount of the order > meta: > metrics: > total_order_amount: > type: sum > format: usd > round: 2 > tags: ['ai', 'finance'] # <--------- tagging the metric > ``` ### Common scenarios Here are some common tagging scenarios and their results: **Scenario 1: Explore-level only (no field tags)** ```yaml theme={null} models: - name: customers config: tags: ["ai-enabled"] columns: - name: customer_name - name: email ``` Result: If agent has `["ai-enabled"]` tag, ALL fields in the customers explore are visible. **Scenario 2: Field-level only (no explore tags)** ```yaml theme={null} models: - name: customers columns: - name: customer_name config: meta: dimension: tags: ["ai-enabled"] - name: email config: meta: dimension: tags: ["pii"] ``` Result: If agent has `["ai-enabled"]` tag, only `customer_name` is visible. The `email` field is hidden. **Scenario 3: Mixed - explore tagged with fields that have different tags** ```yaml theme={null} models: - name: orders config: tags: ["ai-enabled"] columns: - name: order_id config: meta: dimension: tags: ["pii"] - name: status config: meta: dimension: tags: ["internal"] ``` Result: If agent has `["ai-enabled"]` tag, NO fields are visible. Field-level mode is active (because fields have tags), and none of the field tags match "ai-enabled". **Scenario 4: Mixed mode - base model with explore tags, joined model with field tags** ```yaml orders.yml (base model) theme={null} models: - name: orders config: tags: ["ai-enabled"] meta: joins: - join: customers sql_on: ${customers.customer_id} = ${orders.customer_id} columns: - name: order_id - name: status - name: customer_id ``` ```yaml customers.yml (joined model) theme={null} models: - name: customers columns: - name: customer_id - name: email config: meta: dimension: tags: ["ai-enabled"] - name: phone config: meta: dimension: tags: ["pii"] ``` Result: If agent has `["ai-enabled"]` tag: * `orders` table: ALL fields visible (explore-level mode - no field tags defined) * `customers` table: Only `email` visible (field-level mode - has field tags, only `email` matches) **Scenario 5: Only joined table has matching tags** ```yaml orders.yml (base model) theme={null} models: - name: orders config: meta: joins: - join: customers sql_on: ${customers.customer_id} = ${orders.customer_id} columns: - name: order_id # no tags - name: status # no tags ``` ```yaml customers.yml (joined model) theme={null} models: - name: customers columns: - name: email config: meta: dimension: tags: ["ai-enabled"] ``` Result: The entire explore is HIDDEN because the base table (`orders`) has no matching tags. > [!WARNING] > > An explore is only visible if the **base table** has matching tags (either at explore level or field level). Having matching tags only in joined tables is not enough. **Scenario 6: Tagged base model with an untagged joined model** ```yaml orders.yml (base model) theme={null} models: - name: orders config: tags: ["ai-enabled"] meta: joins: - join: customers sql_on: ${customers.customer_id} = ${orders.customer_id} columns: - name: order_id - name: status ``` ```yaml customers.yml (joined model) theme={null} models: - name: customers columns: - name: customer_id # no tags - name: email # no tags - name: phone # no tags ``` Result: If agent has `["ai-enabled"]` tag: * `orders` table: ALL fields visible (explore-level mode - explore tags match) * `customers` table: ALL fields visible (explore-level mode - the joined model has no tags anywhere, so nothing restricts it) > [!WARNING] > > Tagging the base model does not restrict joined models. A tagged base model exposes every field of an untagged joined model to the agent. To restrict a joined model's fields, add field-level tags to that model, as in Scenario 4. ## User attributes and permissions When an agent answers from the semantic layer, which is its default mode, it respects all data access controls configured through [user attributes](/workspace-admin/user-attributes). This ensures that agents only access data that the user is authorized to see, maintaining your existing security policies. The exception is raw SQL, covered [below](#raw-sql-is-outside-the-semantic-layer). ### How user attributes flow through AI queries When an AI agent generates and executes queries on behalf of a user, it inherits that user's attribute values and applies them to all data access: **Row-level security:** * Agents automatically apply `sql_filter` rules defined in your models * Only rows matching the user's attribute values are included in query results * Example: If a user has `sales_region: 'EMEA'`, the agent will only query data for that region **Column-level security:** * Agents respect `required_attributes` on dimensions * Columns the user cannot access are invisible to the agent * Agents respect `required_attributes` on metrics. Metrics defined under restricted columns inherit the column's restriction unless they set their own; model-level metrics are not restricted by the columns they reference (see [metric access control](/workspace-admin/user-attributes#metric-access-control)) * Example: If `salary` requires `is_admin: 'true'`, non-admin users' agents cannot query salary data **Table-level security:** * Agents respect `required_attributes` on models * Tables the user cannot access are completely hidden from the agent * The agent cannot reference or join restricted tables * Example: If `payments` requires `is_admin: 'true'`, non-admin users' agents cannot query the payments table ### Default behavior **In the Lightdash app:** AI agents automatically use the logged-in user's attributes for all queries. **In Slack:** By default, AI agents use the attributes of the user who created the agent. To have each Slack user's individual permissions respected, enable the **AI Agents OAuth requirement** toggle in your [Lightdash Slack settings](/integrations/slack#ai-agents-configuration). When enabled, each Slack user must OAuth into Lightdash before using the agent, and their individual permissions are applied to all queries. ### How this works behind the scenes When an agent generates a query: 1. The agent receives the user's complete attribute profile (both direct user attributes and group attributes) 2. All `sql_filter` rules are automatically applied to the generated SQL 3. Dimensions and tables with `required_attributes` are filtered from the available schema 4. The agent only sees and can query data within the user's permissions This happens transparently—the agent doesn't need special configuration. Your existing user attribute rules automatically protect AI-generated queries just like they protect manual queries. ### Example: Regional sales access Consider this model configuration: ```yaml theme={null} models: - name: sales meta: sql_filter: ${TABLE}.region IN (${lightdash.attributes.sales_region}) columns: - name: revenue - name: customer_name meta: dimension: required_attributes: can_view_pii: "true" ``` For a user with `sales_region: 'EMEA'` and no `can_view_pii` attribute: * The agent can query `revenue` data, but only for EMEA region * The agent cannot see or query `customer_name` (PII restriction) * If the agent tries to analyze customer names, it will fail with a permissions error * All generated queries automatically include `WHERE region IN ('EMEA')` ### Security considerations * **Metadata mode:** Even in metadata-only mode, agents respect user attributes when showing available fields * **Data access mode:** When data access is enabled, query results are filtered by user attributes * **Query generation:** Semantic queries the agent generates cannot bypass user attribute restrictions * **Error handling:** If an agent attempts to access restricted data through the semantic layer, the query fails with a permissions error ### Raw SQL is outside the semantic layer User attributes are enforced by the semantic layer, so they apply to every query built from an explore: Explore, charts and dashboards, and AI agents answering in their default (semantic) mode. Anything that runs raw SQL against the warehouse runs outside the semantic layer, and `sql_filter`, `required_attributes` and `any_attributes` do not apply to it: * The [SQL Runner](/explore/sql-runner) * [SQL mode](/agents/use-ai-agents#sql-mode) in an AI agent conversation * The **Run SQL** tool of the [Lightdash MCP server](/agents/lightdash-mcp) * Hand-written SQL inside a semantic query: custom SQL dimensions, custom SQL metrics, and SQL [table calculations](/explore/table-calculations). They're pasted into the query as written, which is why authoring them needs `manage:CustomFields` or `manage:CustomSqlTableCalculations`. Every surface on this list needs a permission that Developer and Admin roles hold by default: `manage:SqlRunner` for the first three, `manage:CustomFields` or `manage:CustomSqlTableCalculations` for the last. A user without those cannot run raw SQL from any of them, whatever an agent's instructions say. If someone needs raw SQL and warehouse-enforced permissions at the same time, require [personal warehouse credentials](/personal-settings/personal-warehouse-connections) on the project so their queries run as their own warehouse user, and put the restrictions in the warehouse. ## Limiting how much agent queries scan On BigQuery, you can set an AI agent query limit on the connection. Lightdash dry-runs every agent query before it executes and refuses queries estimated to process more than the limit. The agent receives the estimate so it can narrow the query and try again. `Maximum bytes billed`, or [AI agent maximum bytes billed](/integrations/connect-project#ai-agent-maximum-bytes-billed) when it's set, stays the hard limit, because dry-run estimates can be lower than what a query is billed for. See **Query cost estimates** in the [BigQuery connection settings](/integrations/connect-project#bigquery). # Deep research Source: https://docs.lightdash.com/agents/deep-research Run a multi-step AI investigation and get an evidence-backed report with verified charts and sources > [!NOTE] > > Deep research is available wherever [AI agents](/agents/set-up-agents) are enabled, including eligible AI trials. Reports are published as [Documents](/explore/documents). Self-hosted deployments need the same Enterprise Edition license and AI provider configuration required by AI agents. Deep research is a long-running mode for Lightdash AI agents. It is designed for questions that need several queries, competing explanations, and a reusable report rather than one immediate answer. The agent investigates in the background using its Lightdash context and configured sources. It publishes a structured report as a [Document](/explore/documents), with verified charts, evidence-led findings, and explicit caveats where the data limits the conclusion. ![Ask AI composer with the options menu open and Deep research checked, with arrows pointing at the + button and the Deep research item](https://mintcdn.com/lightdash/HWpGOjmkMatyVPg-/images/agents/deep-research/deep-research-settings.png?fit=max\&auto=format\&n=HWpGOjmkMatyVPg-\&q=85\&s=92bd072ca64979b34c385c9c6b529a80) ## When to use deep research Choose deep research for multi-step investigations that need cross-checking, several data cuts, or a report you can save and revisit. Stay in the default Ask mode for a quick lookup, one chart, or an interactive conversation where you want to steer each follow-up. Questions that work well include: * *"Which product categories are trending down this quarter, and what is driving the change?"* * *"Why did returning-customer revenue fall over the last 90 days? Test the main explanations."* * *"Compare paid and organic acquisition quality across our top three regions."* ## How it works ```mermaid theme={null} flowchart LR A["Question and agent configuration"] --> B["Coordinator investigates"] B --> C["Up to two isolated data workers"] C --> B B --> D["Verified queries and their results"] D --> E["Report written from that evidence"] E --> F["Document with live charts"] ``` Deep research uses the selected AI agent's configuration, including its instructions, semantic-layer access, knowledge documents, project and repository context, and enabled tools. It automatically inherits the organization's research limits and every MCP server attached to the agent; there is no per-run depth or source selection. Lightdash retries transient MCP discovery and provider timeouts with a bounded backoff. If an attached MCP server remains unavailable, the run preserves completed evidence and continues with healthy MCP servers and built-in tools where possible. For each run, a coordinator owns the investigation: it gathers context, queries the data, and decides what to pursue next. When a question is genuinely separable it can hand that question to an isolated data worker, up to two per run. A worker sees only its own task and warehouse tools, and returns a compact findings packet rather than raw results. The coordinator does not write the report. When research ends, Lightdash rebuilds what the run established from the queries it actually ran and their results, and the report is written from that evidence. This keeps the report grounded in verified executions and means a run that stops early still reports what it found. Because the run executes on the server, you can close the tab or leave the thread. Reopening the thread restores the run card and its latest state. ## Access requirements Your organization must have the AI Agents entitlement or an eligible trial, and **Enable AI features for users** turned on in **Organization settings** → **Ask AI** → **General**. Self-hosted deployments must also configure an AI provider as described in [AI agents](/self-host/enterprise-features/ai-agents). Starting a run requires the Enterprise **Start Deep Research runs** scope (`create:AiDeepResearch`) for the project. Developer and Admin roles receive this scope by default. Add it explicitly to any [custom role](/workspace-admin/custom-roles) that should be allowed to start runs. Users can only read, retry, or cancel their own deep research runs, and only within threads they are allowed to access. ## Start a run **1. Open Ask AI** Use the Ask AI composer on the homepage, start a new agent thread, or open an existing thread that you own. Deep research is unavailable in read-only threads, such as another user's thread, a thread started in Slack, or a thread continued from [AI analysis](/data-apps/ai-analysis) of a data app or dashboard. You also can't start a run while [impersonating](/support/support-access#impersonation-by-your-admins) another user. **2. Enable Deep research** Select **+** in the composer, then select **Deep research**. A checkmark shows the mode is active, and the send button starts research instead of sending a chat message. [CSV and document attachments](/agents/use-ai-agents#attach-a-file) are unavailable while the mode is on. When you type a longer investigative question, the **+** button can pulse to suggest this mode; you can still continue in regular chat. **3. Describe the outcome you need** Include the decision or question, relevant time period, important segments, and any definitions or constraints the agent should preserve. **4. Start the investigation** Submit the question. Lightdash saves it in the thread, creates a durable run, and begins processing it in the background. ## Sources and permissions Deep research can use: * **Agent context and project data** — the semantic layer, saved Lightdash content, knowledge documents, and other context configured on the selected agent, subject to its [data access settings](/agents/data-access). * **Warehouse queries** — semantic queries and, when the agent and user are allowed to use it, SQL. * **Repository context** — project context and source-code tools configured on the agent. * **MCP servers** — every [server attached to the agent](/agents/connect-external-mcp-servers) and its enabled tools. > [!WARNING] > > Deep research runs without pausing for approval on each warehouse query or MCP tool call. An attached MCP server can expose write actions, and its enabled actions can run unattended. Review the agent's attached servers and enabled tools before starting a run. Deep research does not grant new permissions. The run starts with the creator's access and the selected agent's configuration, and Lightdash revalidates that access while the investigation runs. Revoking access or disconnecting a source can stop an active investigation or leave that source unavailable. Raw SQL requires both **Allow raw SQL** in **Organization settings** → **Ask AI** → **Deep research** and the initiating user's existing SQL Runner permission. Turning the organization setting off leaves governed semantic and metric queries available, but removes native and MCP raw SQL tools from the run. ## Follow progress The run card stays next to the question that started it and shows the latest phase, elapsed time, warehouse-query count, finding count, and recent activity. > [accordion] Queued > > Lightdash accepted the run and is waiting for a background worker to start it. > [accordion] Running > > The agent is gathering context, querying the data, or writing the report. Select **View activity** to inspect recent progress. > [accordion] Completed > > The report is published as a personal Document and linked from the run card. > [accordion] Partially completed > > The run reached a resource limit or recoverable error. Lightdash still wrote the report from the evidence gathered before it stopped. Select **Resume research** to continue unfinished work from the preserved evidence without rerunning successful queries. > [accordion] Failed > > The run could not produce or publish a valid report. If it preserved usable evidence, select **Resume research** to continue unfinished work. Otherwise, the run card provides guidance to start over. > [accordion] Cancelled > > The creator stopped the run before it finished. Select **Stop research** while a run is queued or running to request cancellation. Cancellation is asynchronous, so a running tool call may reach its next safe checkpoint before the status changes. Only one deep research run can be active in a thread at a time. While it is active, **Deep research** is disabled in the composer menu, but you can continue sending regular chat messages in the same thread. The control becomes available again when the run completes, partially completes, fails, or is cancelled. ## Read the report Select the Document card on a completed or partially completed run. The report opens in the side panel; use the open link to view it full page. The report is a **personal Document**: only you and organization admins can see it until you save it to a Space. Use **Save to Space** to share it with others. ![Deep Research report published as a personal Document, with a contents rail of findings, a Save to space button, and a live chart under the first finding](https://mintcdn.com/lightdash/CbYls-Go5c_jX_ak/images/agents/deep-research/deep-research-report.png?fit=max\&auto=format\&n=CbYls-Go5c_jX_ak\&q=85\&s=aa7cf111c50e091a50b655b18b68d8e2) The Document is named after the report's title, and each finding is a top-level section, so the contents rail lets you jump between findings. A report contains: * A short introduction * Finding sections led by verified charts, followed by concise supporting narrative * A conclusion and inline caveats where data coverage, freshness, or the semantic layer limits the conclusion * Links to external evidence when the report uses it Before publishing, Lightdash validates every chart in the report. If a chart is malformed, duplicated, missing, or cannot be verified, Lightdash leaves it out while preserving valid findings and narrative, and the report notes that evidence was omitted. ### Report charts Every report chart is a standard Document chart built from one verified warehouse query the run actually executed. It runs live against the warehouse, so it shows current data, and you can edit or explore it like any other chart in a Document. ### Keeping reports A published report is an ordinary Document: it does not expire, and deleting or retrying the run does not affect it. Delete or move it like any other Document. Reports from runs that finished before Documents publishing stay available in their thread for 30 days after the run completed. The regular chat agent can use the status and report from deep research runs in the same conversation when answering follow-up questions. Ask it to clarify a finding, compare evidence, or explain a limitation without pasting the report back into the chat. ## Organization-wide settings and limits When AI agents and Documents are enabled, organization admins can go to **Organization settings** → **Ask AI** → **Deep research** to configure the safety limits inherited by every run: * **Maximum steps** — model steps the coordinator may take before it must finish * **Maximum tool calls** — total tool calls across the coordinator and its workers * **Maximum warehouse queries** — total semantic-layer and SQL queries across the run * **Time limit (ms)** — wall-clock ceiling for the research phase * **Maximum tokens** — total model tokens across the run * **Allow raw SQL** — whether eligible users may use native or MCP `run_sql` tools during a run Each numeric limit must be a positive whole number. Defaults are 16 steps, 24 tool calls, 15 warehouse queries, a 10-minute time limit, and 10 million model tokens. Raw SQL is disabled by default. Organization admins can change these values to match their governance and cost requirements. Limits apply to the run as a whole, not to each worker separately. Well before a ceiling, a run stops widening its investigation and starts settling on an answer, so it usually finishes on its own rather than being cut off. When a run does reach a limit, Lightdash still writes the report from the evidence gathered up to that point and marks the run as partially completed. Lightdash blocks predictable unbounded field-value and dimension-only scans before warehouse execution and asks the agent to narrow them. A warehouse resource-limit error can trigger up to two attempts with a narrower or simpler query; Lightdash does not retry the unchanged query. ## Get better reports * State the decision you are trying to make, not only the metric you want to inspect. * Define ambiguous terms such as *active customer*, *conversion*, or *retention*. * Include the time range and comparison period. * Name segments the agent must test, such as channel, region, plan, or product category. * Ask it to test alternatives or contradictions instead of assuming one cause. * Treat a partially completed report as a starting point. Resolve unavailable sources or tighten the question before running it again; ask an organization admin to review the limits if runs repeatedly exhaust them. ## Frequently asked questions **Do I have to keep the tab open?** No. The run continues on the server and its state is saved in the thread. **Can I start deep research in an existing conversation?** Yes. You can start a run from an existing thread you own as long as the thread is not read-only and the agent's model is still available. **Can I start another run while research is still active?** Not in the same thread. You can keep chatting normally, or start deep research in another eligible thread. The control returns when the current run reaches a terminal state. **Can I start deep research from an MCP client?** No. Runs start from the Ask AI composer in Lightdash. The [Lightdash MCP server](/agents/lightdash-mcp) doesn't expose deep research as a tool, though a run can use the [MCP servers attached to its agent](/agents/connect-external-mcp-servers) as sources. **Why did my run partially complete?** The agent reached a resource budget or encountered a recoverable failure. Because the report is written from the queries the run executed rather than assembled as it goes, Lightdash still reports what the run established instead of discarding it. **What happens when a warehouse query exceeds a resource limit?** Lightdash asks the agent to narrow or simplify the query and allows up to two changed-query recovery attempts. If recovery is exhausted, the affected evidence is omitted and the report can still complete with a caveat when the remaining evidence is useful. **What does “No relevant data” mean?** The investigation completed cleanly but found no evidence relevant to the question. Refine the question or choose a project and data source that cover the topic; starting the same request again does not add new evidence. **Does retrying a failed run reuse its queries?** When a partially completed or failed run has usable evidence, **Resume research** creates a new run that reuses its completed queries, findings, and charts, then continues the unfinished work. If no usable evidence was preserved, **Start over** creates a new run from the original question. **Does deep research only read data?** No. It uses the selected agent's configured tools. Warehouse queries run without individual approval, and attached MCP servers may include write actions. Review the agent's configuration before starting. **Can I continue chatting after the report is ready?** Yes. The same agent can read the published report as context for follow-up questions in the thread. # Effective analytics with agents Source: https://docs.lightdash.com/agents/effective-analytics-with-agents How to configure, scope, and improve your AI agents so they give accurate, governed answers Build answer quality around a clear agent scope, well-defined data, and a repeatable review process. Use the narrowest appropriate place for each business rule so changes stay consistent across your agents. ## Think specialized, not general Give each agent one audience and a clear job before tuning its answers. For example, separate sales-pipeline analysis from finance reporting when the teams need different definitions, data access, or output. Use [data access controls](/agents/data-access) to enforce the scope. Specialized agents also work best with the [AI Router](/agents/enable-ai-router) enabled: the more distinct each agent's focus, description, and data access, the more reliably the router can send each question to the right one — so users don't have to know which agent to ask. Write an agent description that names its domain, the questions it should receive, and the nearest questions it should not receive. The description helps the router choose an agent; the selected agent's instructions guide how it answers. ## Choose where guidance belongs Use the narrowest durable scope for each piece of information. This keeps one source of truth and gives the agent the context when it needs it, without adding everything to every prompt. | If the information… | Put it in… | | - | - | | Defines a model or field for people and agents | Its semantic-layer [`description`](/semantic-layer/writing-descriptions) | | Helps only an agent select or query a particular model or field | An [`ai_hint`](/semantic-layer/writing-descriptions#layer-ai-hints-on-top-of-descriptions) next to that semantic object | | Defines a short term or object-specific rule every agent in the project needs | [`lightdash.project_context.yml`](/agents/agent-context) | | Describes one agent's role, priorities, defaults, constraints, or answer style | The agent's [instructions](#writing-effective-instructions) | | Provides longer business reference material the agent should consult when relevant | A [knowledge document](/agents/knowledge-documents) | | Defines a repeatable procedure for a particular task | A [custom skill](/agents/custom-agent-skills) | | Determines which agent should receive a question | The agent's description or project [routing instructions](/agents/enable-ai-router#routing-instructions) | Start with the semantic layer. Give metrics, dimensions, and [parameters](/semantic-layer/parameters) clear names, labels, descriptions, and options. If a colleague could not understand the metadata, an agent is unlikely to interpret it reliably either. ### Understand names and descriptions in YAML The meaning of `name` and `description` depends on what the YAML defines: | YAML object | `name` | `description` | | - | - | - | | Semantic model or field | Stable identifier visible in metadata. Use `label` for a different human-facing display name. | Shared meaning for people and agents. | | Agent | Human-facing identity shown in Lightdash. | Routing signal that should state its domain, intended questions, and exclusions. | | Custom skill | Stable identifier used as its slash command. | Discovery signal that should state what the skill does and when the agent should use it. | ## See the layers in one example Suppose a Finance agent needs to investigate an unexpected drop in net revenue: * The metric `description` defines how net revenue is calculated, including its filters and exclusions. * An `ai_hint` tells the agent that users saying “sales” mean this metric, rather than gross revenue. * Project context defines a company-specific term such as “board revenue” for every agent in the project. * The agent description routes Finance reporting questions to this agent and excludes sales-pipeline questions. * The agent instructions set defaults such as fiscal periods, comparison windows, and communication style. * A revenue-recognition knowledge document provides the longer accounting policy when the question requires it. * An `investigate-kpi-change` skill defines the repeatable steps, checks, and expected output for this investigation. ## Avoid conflicts and duplication Keep each stable fact in one canonical place and link to it instead of copying it into instructions or documents. For example, define what a metric means in its semantic description; let the agent instructions define how answers should be presented. The only documented precedence rule between these inputs is that an `ai_hint` takes precedence over the semantic `description` in agent prompts. Do not rely on an assumed hierarchy between instructions, knowledge documents, skills, and project context. Remove contradictions, use the narrowest appropriate scope, and test representative questions after changing any layer. ## Curating verified answers [Verified answers](/agents/verified-answers) give your agent checked examples to reference. Curate them around the questions your team needs to answer: * **Verify diverse examples** - Mark answers covering different types of questions and use cases to give your agent a broad knowledge base * **Quality over quantity** - Focus on verifying only your best, most accurate responses. A few excellent examples are better than many mediocre ones * **Update regularly** - As your data and business needs evolve, review your verified answers and update them to reflect current best practices ## Making evaluations part of your workflow Treat evaluations as an ongoing loop, not a one-off. Encourage your team to use thumbs-up and thumbs-down as they work, build [evaluation suites](/agents/create-evaluation-suites) from the real threads that went wrong, and run them before you ship changes to instructions or your semantic layer to catch regressions before your team encounters them. ## Writing effective instructions Think of instructions as the agent's always-on operating defaults, not its knowledge base. Use them to define how this agent should approach and communicate every answer. Focus on four key areas: the agent's role and scope, your team's goals and constraints, how you want data analyzed, and how results should be communicated. ### What to include * **Role and scope** including the questions the agent should answer and when it should redirect someone elsewhere * **Communication style** for how results should be presented to your team (e.g., "Keep explanations simple for non-technical stakeholders" or "Always include actionable next steps") * **Business constraints** like regulatory requirements or budget limitations that affect every analysis this agent performs * **Analysis preferences** your team relies on (e.g., "Always compare month-over-month growth" or "Flag any churn rates above 5% as concerning") Put shared terminology in [project context](/agents/agent-context), stable metric definitions in the [semantic layer](/semantic-layer/writing-descriptions), longer supporting material in a [knowledge document](/agents/knowledge-documents), and task-specific procedures in a [custom skill](/agents/custom-agent-skills). **Good example - Sales Team Agent:** \ You analyze sales performance for our SaaS company. Focus on MRR, churn, and pipeline health. When MRR growth drops below 10% month-over-month, flag it as concerning. Present insights in simple terms that our sales managers can act on immediately. Always include trend explanations and next steps. ### What to avoid * **Contradictory instructions** that create confusion about priorities * **Overly complex rules** that are hard to follow consistently * **Vague guidance** like "be helpful" without explaining what that means for your situation * **Too many different focus areas** in one agent, remember to keep each agent focused, split unrelated jobs into separate agents * **Restating basic features**, don't tell the AI to "create charts" since it already does that **Poor example - Too vague:** \ Be helpful and analyze data well. Create good charts and explain things clearly. ### Review instructions regularly Review instructions after changing business rules or finding a recurring error. Remove duplicate guidance and contradictions, then run representative questions or an evaluation suite to check the effect. Feedback alone does not rewrite the agent's instructions. # AI Router Source: https://docs.lightdash.com/agents/enable-ai-router Automatically route questions to the best-fit agent, so users don't have to pick one first [Pro](/support/feature-badges#pro) [Enterprise](/support/feature-badges#enterprise) The AI Router is part of [AI agents](/agents). When you have more than one AI agent in a project, users have to know which agent to ask. The **AI Router** removes that decision: type a question, and Lightdash picks the agent best suited to answer it. The router compares each agent's description, instructions, data access, and verified questions to decide where a question should go. Write each description as a routing signal: state the agent's domain, the questions it should receive, and the nearest questions it should not receive. See [Effective analytics with agents](/agents/effective-analytics-with-agents#understand-names-and-descriptions-in-yaml) for how agent descriptions differ from semantic descriptions. The router only chooses **between agents the user can already access**. It never widens an agent's data access or bypasses permissions — it only changes *which* of the user's available agents answers a given question. ![Ask AI router landing page](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/ai-router-ask-ai.gif?s=c4ee6567972df02d5805923e7e40834e) ## When the router runs The router needs **at least two agents you can access** in a project. With a single accessible agent there's nothing to route between, so Lightdash opens that agent directly. When the router is confident, it routes your question straight to the best agent and starts the conversation. When it isn't, it shows a short picker with the recommended agent highlighted so you can choose. ![Picker showing candidate agents](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/ai-router-picker.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=4b7ca52ab906680ddae12d423e822155) If you've set a [default agent](/agents/use-ai-agents#set-your-default-agent), it opens first even when the router is enabled. Pick **Auto** from the agent dropdown to let the router decide instead. ![Auto option in the agent selector](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/ai-router-auto-option.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=5522851a7a4dc79c57259bb3b6bb7e0d) ## Enabling the router The router is configured at the **organization level** and requires **Organization Admin** permissions. **1. Open AI settings** Go to **Settings → Organization Settings → Ask AI → General**. **2. Make sure AI features are on** The router can only be turned on when **Enable AI features for users** is already enabled. If AI features are off, the router toggle is disabled with the hint *"Enable AI features first to use the Router."* **3. Turn on the AI Router** Toggle on **AI Router** — *"Route user questions to the best agent automatically, instead of asking users to pick."* ![AI Router toggle in Ask AI general settings](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/ai-router-settings-toggle.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=c394ce15a5f6417e1f6a9b916791772e) ## Routing instructions By default the router decides on its own, but you can give it **routing instructions** to steer specific kinds of questions toward specific agents — for example, *"send billing questions to the Finance agent."* Instructions are written per project and authored by admins. **1. Open routing instructions** With the router enabled, scroll down on the **Ask AI → General** page to the **Routing instructions** card. **2. Pick a project** Choose the project these instructions apply to. Routing instructions are scoped per project. **3. Write your rules** Describe how questions should be directed. Type **@** to tag a specific agent, then click **Save instructions**. A few things to keep in mind: * **Rules are advisory.** They guide the router's choice but **never override an agent's access restrictions**. A rule can only point to agents the user can already access. * **Tagged agents must belong to the project.** You can only tag agents that exist in the selected project. * **Fewer than two agents?** You can still write and save instructions, but the router won't run in that project until at least two accessible agents exist. Lightdash shows a note when this is the case. ## Router and Slack The same routing logic powers **multi-agent Slack channels**. In a multi-agent channel you mention the single Lightdash Slack app and Lightdash automatically picks the best agent for your question — no need to know which agent to address. See [Slack channels: single-agent vs. multi-agent](/agents/set-up-slack-agents#slack-channels-single-agent-vs-multi-agent) for setup. ## Router and MCP The router is also exposed to AI assistants over [Lightdash MCP](/agents/lightdash-mcp) through the **`route_agent`** tool. After setting an active project, the assistant can pass the user's prompt to `route_agent` and Lightdash automatically activates the best-fit agent for the rest of the session — no manual `list_agents` / `set_agent` step required. Unlike the web experience, MCP routes directly to the best-fit agent even when only one agent is accessible (there's no picker in an MCP client). Routing instructions and access controls behave the same way as in the Lightdash app. # Creating and editing content Source: https://docs.lightdash.com/agents/enable-content-tools Let AI agents build and edit charts and dashboards in Lightdash [Beta](/support/feature-badges#beta) Enable content editing for a specific agent when you are ready for that agent to create and update saved Lightdash content. By default, AI agents answer questions and propose visualizations without changing your saved charts and dashboards. When content editing is enabled, an agent can also save new content and update existing content when you ask it to. With content editing off, an agent can still build a dashboard preview in the thread when you ask for one, whatever its [data access](/agents/data-access) setting, as long as you can save content in the project yourself. In Slack, this also needs the [**AI Agents OAuth requirement**](/integrations/slack#ai-agents-configuration). Building the preview doesn't send result rows to the agent: it only checks each chart's query, and the charts then run in the preview with your own permissions, like any other chart. The preview isn't saved to a space. To keep it, open the preview's **⋯** menu and click **Save dashboard**. [https://www.loom.com/embed/ae1017fe89774f2b9ebe93db61524fe0](https://www.loom.com/embed/ae1017fe89774f2b9ebe93db61524fe0) ## What agents can do When content editing is enabled, your agent can: **Create saved content:** * Build a new chart from a question and save it to a space * Build a new dashboard from scratch, following Lightdash dashboard best practices for chart choice, layout, filters, tabs, and supporting detail * Add charts, headings, filters, and tabs to a new or existing dashboard * Add [custom dimensions](/explore/create-custom-fields#custom-dimensions) to a chart it saves, such as a [custom SQL](/explore/create-custom-fields#custom-sql) dimension with a `CASE` expression. The dimension is saved with that chart only, not added to the explore. Adding or changing a custom SQL dimension needs `manage:CustomFields`, and a SQL table calculation needs `manage:CustomSqlTableCalculations`; Developer and Admin roles have both by default * Write a [document](/explore/documents): a report with text and live charts between the paragraphs, wherever Documents are enabled **Edit existing content:** * Add, remove, or rearrange tiles on a dashboard * Organize a dashboard into tabs * Add or change dashboard filters * Update a chart's fields, filters, or visualization * Rename content or update its description * Move charts and dashboards to another space * Rewrite a document's text and charts, or rename it. Each rewrite saves a new version in the document's [version history](/explore/documents#version-history) ## Spaces Content created by an agent is saved in a Lightdash space, just like content created from the Explore page or dashboard editor. Tell the agent which space to use when you want the content saved somewhere specific. If you do not name a space, the agent can choose the best match from the spaces it has access to. The agent uses the requesting user's [space access](/explore/spaces#managing-access-to-a-space). If that user cannot edit a space, the agent cannot create, edit, or move content there. For example, ask the agent to "add this chart to the Revenue dashboard", "move this dashboard to the Finance space", or "create an executive sales dashboard in the Leadership space". ## Threads bound to a dashboard A thread created through the API or the React SDK can be [bound to a dashboard](/agents/use-ai-agents#linked-dashboard). In a bound thread, the agent can only change that dashboard: | The agent can | The agent can't | | - | - | | Edit the bound dashboard's tiles, tabs, filters, and layout, including adding existing charts | Create a dashboard or edit another one | | Create charts saved in the bound dashboard, and edit charts saved in it as long as they stay there | Create charts in a space, edit charts saved in a space, or move a chart out of the dashboard | | Schedule deliveries of the bound dashboard or the charts saved in it | Create SQL charts, documents, or data apps, or schedule deliveries of other content | The agent can still read and query any content it has access to. When a request falls outside the binding, the agent names the bound dashboard and offers the closest change it can make. A binding never grants edit access: the agent, the user, and any embed limits must already allow the change. If the bound dashboard is deleted, the agent can't create or change saved content in that thread. ## Permissions Content editing is available only when all of these are true: 1. **The agent has [data access](/agents/data-access) enabled.** Content editing depends on data access — if you turn data access off, content editing is automatically turned off and locked. 2. **The agent has content editing enabled.** This is a setting on each agent. 3. **The requesting user can save a chart or dashboard in at least one space they can access.** This mirrors the **Save** button in the Lightdash app, not the user's project role: the user needs `Can edit` (or `Full access`) on at least one space, or the ability to create new spaces in the project. A viewer never qualifies, because viewers can't edit or create spaces. An interactive viewer qualifies as soon as they have `Can edit` access to one space, even without the project Editor role. Turning the setting on does not change anyone's space access. The agent only ever writes to spaces the requesting user could already edit, and it checks that space by space: give it a space it can't edit — or ask it to create content without naming an accessible one — and it will not have the tools available for that request, even though content editing is otherwise on. [Data apps](/data-apps) are the exception — generating or editing a data app always needs the project Editor role, whatever space access the user has. **Allow agent to manage Lightdash content** only governs that agent's own chats, in the Lightdash app and Slack. It has no effect on `create_content` or `edit_content` called directly over [MCP](/agents/lightdash-mcp#editing-content). MCP content creation is gated by a separate, org-wide setting, [**Allow content changes via MCP**](/agents/lightdash-mcp#editing-content) in **Settings** → **MCP** → **General**, and by whether the caller can save content in the project, using the same space-level check as above. **In the Lightdash app:** the logged-in user's permissions are used for every request. **In Slack:** By default, an agent acts as the user who created it. To evaluate each Slack user's own permissions, enable the **AI Agents OAuth requirement** toggle in your [Lightdash Slack settings](/integrations/slack#ai-agents-configuration). Until a Slack user connects their Slack account to Lightdash, content editing stays disabled for them. ## Enabling content editing Only admins and developers can enable content editing for an agent: 1. Go to your agent settings 2. Make sure **Data Access** is enabled — content editing is disabled until data access is on 3. Toggle **Allow agent to manage Lightdash content** 4. Save your changes New agents have data access enabled by default, so content editing is available to toggle on as soon as you create the agent. ## Reviewing changes Content an agent creates or edits is saved like any other chart or dashboard, with the agent recorded as the editor. Because changes are saved immediately, treat content editing as you would any contributor with edit access: * Limit the requesting users' [space access](/explore/spaces#managing-access-to-a-space) so agents can only change content in the spaces you intend * Keep content your team reviews in spaces where requesting users only have **Can view**, and change it through [content as code](/workflow/content-as-code). The agent can't edit it for those users, while their own [default user spaces](/explore/default-user-spaces) stay open for agent-driven work * Use [version history](/explore/version-history) on a chart or dashboard to review or revert an agent's edits # AI agent issues Source: https://docs.lightdash.com/agents/issues Track AI-filed and human-filed data problems on one board, with one-click fixes [Beta](/support/feature-badges#beta) > [!NOTE] > > Issues is available wherever AI agents are. It is **off by default** and must be enabled by an organization admin. The Issues board is where data problems get tracked. Two things land on the same board: * **AI-filed findings** — every AI agent turn is scanned in the background; likely-wrong answers are grouped by root cause and filed automatically. * **Human-filed issues** — an org admin can file an issue directly from the board. Each issue has a priority, an assignee, an activity feed, and — where applicable — a one-click writeback that opens a pull request against your dbt project or your shared project context file. ## When to use it Turn Issues on once you have agents in regular use and want a shared queue for data-quality work. It's most useful when: * Users ask the same kind of question repeatedly and the agent struggles * You want to keep dbt metadata and agent instructions tight as your data model evolves * You're rolling agents out to a wider audience and want admin-level visibility into quality * You want a single place to triage data problems users spot in dashboards or charts If you're still setting your first agent up, start with [agent setup](/agents/set-up-agents) and [evaluations](/agents/create-evaluation-suites) first — Issues works best once there's real usage to learn from. ## Enabling Issues Issues is opt-in. Until an admin enables it, no agent turns are processed and no findings are collected. 1. Go to **Settings → Ask AI → General**. 2. Toggle **Review AI agent turns** on. Once enabled, future agent turns are scanned in the background and human-filed issues can be reported from anywhere in the app. Existing threads are not back-filled. To stop AI scanning, toggle the setting off. Previously collected issues remain on the board until you act on or dismiss them. > [!NOTE] > > Automatic issue filing is paused while your organization has any [BYO AI provider key](/workspace-admin/ai-settings#bring-your-own-ai-providers-and-models) set — the classifier runs on the instance-wide provider, and Lightdash won't route agent turns through it once you've told us to use your own key. Human-filed issues are unaffected. Remove all BYO keys to re-enable AI scanning. ## Opening the board Open **Settings → Ask AI → Issues** to see the board. The Ask AI button in the navbar is the fast path: when there are open issues it previews recent findings; when the board is empty it shows a small dropdown that links straight to the Issues board so newly-filed manual issues are always reachable. Cards on the board are grouped by status lane (**To Do**, **In Progress**, **Done**) and each card shows its priority, assignee, and category badge. Click a card to open the issue detail modal. ## How issues get onto the board ### AI-filed findings With the setting enabled, Lightdash scans every AI agent turn for signs the answer was probably wrong — a missing metric, an ambiguous field, a gap in your project context — and files an issue for each root cause it identifies. Scanning doesn't depend on who asked. Turns from users who don't have the permissions to open pull requests through [AI writeback](/agents/ai-writeback) or the [AI coding agent](/agents/ai-coding-agent) are scanned too, so what went wrong in their conversations still reaches the board, where someone with those permissions can fix it. The classifier works from the stored record of the turn — it runs no queries of its own. See [Privacy and data handling](#privacy-and-data-handling) for what that record contains. The record includes the turn's thumbs-up or thumbs-down rating and, for a thumbs-down, the comment left with it. Explicit feedback counts as evidence in its own right, so a thumbs-down can lead to a finding even when nothing else in the conversation signals a problem. The rating is stored on the agent's answer without the name of the person who gave it. The person who started a thread can rate its answers, and so can anyone with the `manage:AiAgent` scope in the project, such as admins and developers. Before filing, the classifier checks the board's existing issues and, if the same underlying problem is already tracked, attaches the new evidence to that issue instead of opening a duplicate. Recurring findings bump the **Recurs N×** tag on the existing card. Slack notifications (if configured) only fire when a **new** issue is opened. Recurrences accrue silently on the existing card so a chatty problem doesn't spam the channel — check the board for the latest state. AI findings are opened in the same lane your triage workflow uses (existing findings behavior is unchanged). ### Human-filed issues Any organization admin with AI agents enabled can file an issue from the **New issue** button on the Issues board. Manual issues land in the **To Do** lane. ## Filing an issue The **Create issue** modal captures: | Field | Description | | - | - | | **Title** | Short summary of the problem. | | **Description** | Markdown-supported detail. Doubles as the "desired outcome" the writeback agent reads. | | **Project** | The project the issue belongs to. | | **Priority** | `urgent`, `high`, `medium`, `low`, or `none`. | | **Assignee** | The person responsible for triaging the issue. | | **Agent** | The AI agent that owns the affected models. Click **Suggest** to pre-select the best-fit agent — Lightdash uses the same [AI router](/agents/enable-ai-router) as Ask AI, routing your title and description to pick an agent and showing its reasoning as a hint. Clearing the agent clears the hint. | | **Related explores** | Multi-select of the explores the issue is about. Feeds the writeback prompt so the agent edits the right YAML. | Submit and the issue appears on the board in **To Do**, with the author recorded as the creator. ## The issue detail modal Clicking a card opens a focused modal with a metadata rail (status, priority, assignee, agent, project) and a chronological **activity feed** that merges issue events with any existing writeback events: * `created` * `status_changed` * `assignee_changed` * `priority_changed` * `comment_added` * `recurred` You can change status, priority, and assignee inline; each change writes an event to the feed with its author. `comment_added` events appear inline in the feed too, but the modal has no comment box. To comment on an issue that has a linked pull request, open **Project settings** → **Pull requests** and click **View thread** on that pull request. For AI-filed findings, the modal also has an **Evidence** section that shows the curated excerpts the classifier actually cited — not the full agent thread. A **Read full conversation** action opens the source thread in a stacked modal (or in a new tab) if you need the wider context. Findings also show an affected-target chip and a `Recurs N×` tag next to the category badge, and — if writeback is blocked — a plain-language note explaining why (for example, that a GitHub or GitLab connection is required). ## Fixing an issue with writeback For each issue, Lightdash proposes the smallest change that would prevent it: * **Semantic layer fixes** open a pull request against your dbt or native Lightdash YAML project (rename a field, add a description, add a metric). * **Project context fixes** add a short note to a shared file that your agents read before answering future questions. Writeback runs the same way whether the issue was AI-filed or human-filed. A manual issue is eligible for writeback when it has: * a root cause of **semantic layer** or **project context**, * an assigned agent, and * a project connected to GitHub, GitLab, or Bitbucket Cloud (GitHub only for project context fixes). When an issue is eligible, a **Create PR** button appears at the top of the issue. An issue still in triage shows **Accept** and **Dismiss** instead, so accept it first. * For a semantic layer issue, **Create PR** starts the writeback in the background, which can take a few minutes, and opens the workspace, where you follow the pull request and its verification. * For a project context issue, **Create PR** opens a preview of the change. Click **Looks good, open PR** to confirm. If an issue is blocked from writeback, the issue shows the reason, such as a missing repository connection. For manual issues, the **Related explores** you picked when filing are passed into the writeback prompt so the agent starts from the right model instead of guessing from the description. | Issue type | What it means | How to fix | | - | - | - | | **Semantic layer** | A field, metric, or description is missing, ambiguous, or wrong in your semantic layer. | Click **Create PR** to open a pull request against your project repository. | | **Project context** | Your agents are missing background knowledge to answer reliably (e.g. which table to use for "active customers"). | Click **Create PR** to add a note your agents read before answering. | Project context fixes update [agent context](/agents/agent-context) in your project repository. For native projects, see [AI writeback and Issues](/semantic-layer/yaml#ai-writeback-and-issues) for connection and validation behavior. ## Project context vs. semantic layer fixes Both kinds of fix open a pull request, but they change different things and have different review costs. | | Semantic layer fix | Project context fix | | - | - | - | | **What it changes** | Your dbt or native model YAML — renames a field, adds a description, adds a metric, fixes a join. | A single entry in `lightdash.project_context.yml`. | | **Who else sees the change** | Everyone querying the model, in Lightdash and downstream. | AI agents only. | | **How the PR is built** | A writeback agent runs in a sandbox against your project and proposes the edit. | Deterministic merge into the YAML file via the GitHub API — no sandbox. | | **When to use it** | The data model itself is wrong, ambiguous, or under-described. The fix would help SQL users too, not just the agent. | The data model is fine, but the agent is missing background knowledge — terminology, which table to prefer, business rules that aren't expressible as semantic definitions. | | **Reversibility** | Revert the PR. | Delete or edit the entry in `lightdash.project_context.yml`. | A rule of thumb: if a new analyst joining the team would also benefit from the change, it's probably a semantic layer fix. If only the agent needs to know it, it's project context. ## Sending issues to Linear or Jira If your team plans work in Linear or Jira, Lightdash can open an issue there for every finding. New findings create an issue automatically, existing open findings can be exported in one click, and each issue links back to the finding on the board. Status is not synced between the two. Set it up from **Settings → Ask AI → General**, in the **Linear issues** and **Jira issues** sections that appear once reviews are on. See [Send issues to Linear and Jira](/agents/issues-linear-jira) for the full setup and what gets exported. ## Privacy and data handling * Issues runs against agent turns inside your organization only. * Issues and findings are stored in Lightdash alongside your other agent data and respect your existing project and admin permissions. * Disabling the toggle stops new AI scanning immediately; it does not delete previously collected issues. * The classifier reads the stored record of the turn — the user's prompt, the agent's answer, the agent config snapshot at the time, and the tool calls the agent made, with their saved results truncated to a preview. It doesn't run its own queries against your warehouse. * It respects each agent's [data access](/agents/data-access) setting. With data access off, the agent's query tools save only row counts (and column names, for SQL queries) with no row data, so the classifier never sees result rows for that agent's turns. It still sees the prompt, the answer, and the filter values the agent used to build its query. ## Related * [Send issues to Linear and Jira](/agents/issues-linear-jira) — mirror findings into the tracker your team already uses. * [Agent context](/agents/agent-context) — the shared `lightdash.project_context.yml` file project context fixes write to. * [Agent visibility](/agents/visibility) — where Issues fits into admin visibility overall. * [Evaluations](/agents/create-evaluation-suites) — run a fixed set of prompts against your agent and grade the answers. * [AI writeback](/agents/ai-writeback) — let an agent open a dbt pull request from chat. * [Autopilot](/agents/autopilot) — scheduled agent that cleans up content and flags issues for review. # Send issues to Linear and Jira Source: https://docs.lightdash.com/agents/issues-linear-jira Open a Linear or Jira issue for every AI agent finding, in the tracker your team already uses [Beta](/support/feature-badges#beta) [Pro](/support/feature-badges#pro) [Enterprise](/support/feature-badges#enterprise) > [!NOTE] > > Linear and Jira export is part of [Issues](/agents/issues). It needs **Review AI agent turns** switched on and an organization admin to set it up. The [Issues board](/agents/issues) collects data problems that AI agents and people find. If your team plans work in Linear or Jira, you can have Lightdash open an issue there for each finding so nothing needs to be copied across by hand. Once connected: * **New findings create an issue automatically.** Every new AI-filed finding, and every issue filed by hand on the board, gets a Linear or Jira issue in the background. * **Existing findings can be exported in one click.** Open findings that were on the board before you connected are not exported on their own. Use **Create issues for existing findings** to catch up. * **Each issue links both ways.** The Linear or Jira issue carries an **Open in Lightdash** link back to the finding, and the finding on the board shows the issue identifier (for example `AE-142` or `DATA-57`) as a link to the tracker. * **Status is not synced.** Closing an issue in Linear or Jira does not change the finding on the board, and resolving a finding does not close the issue. Treat the tracker as the place where work is planned and the board as the place where evidence lives. You can connect Linear, Jira, or both. With both connected, every finding gets one issue in each tool. ## What an exported issue contains Each exported issue uses the finding's title and a description made of: | Section | Content | | - | - | | **Summary** | The finding's description, as shown on the board. | | **Priority** | The finding's priority at the time it was exported. | | **Root cause** | The finding's category, for example semantic layer or project context. | | **Project** | The Lightdash project the finding belongs to. | | **Occurrences** | How many times the finding had been seen when it was exported. | | **Affected objects** | The explores, fields, or charts the finding points at, when known. | | **Open in Lightdash** | A link that opens the finding directly on the Issues board. | The link is also attached to the issue as a Linear link or a Jira web link, so it stays visible when the description is edited. A finding is exported once per tool. Recurrences of an already-exported finding do not create a new issue; the existing issue keeps its link and the board's **Recurs N×** count goes up. ## Where the settings live 1. Go to **Settings → Ask AI → General**. 2. Make sure **Review AI agent turns** is on. The export settings only appear while reviews are enabled. 3. Scroll to the **Linear issues** and **Jira issues** sections, below the Slack notification settings. Only organization admins can connect a tracker or change the routing. ## Linear ### Connect Linear Lightdash connects to Linear through a private OAuth app that you create in your own Linear workspace. No client secret is needed, and there is nothing to configure on the server. 1. In the **Linear issues** section, click **Create Linear app**. This opens Linear's new-application page with the app name, callback URL, and grant type already filled in. Save the app in Linear. 2. Copy the app's **client ID** from Linear. 3. Back in Lightdash, paste it into **Linear OAuth client ID** and click **Connect Linear**. 4. Approve the app in Linear. Lightdash asks for the `read` and `issues:create` scopes only. You are sent back to the settings page with the section marked **Connected** and the name of the Linear workspace shown underneath. If you prefer to create the app by hand, set its callback URL to `https:///api/v1/linear/oauth/callback` and enable the authorization code grant. Public client IDs are fine because the connection uses PKCE. ### Choose where issues go ![The Linear issues section connected to a workspace, routing findings from all projects to the Analytics Engineering team and the AI Agent reviews project](https://mintcdn.com/lightdash/4JqGzev8J23C4THw/images/agents/issues-linear-jira/linear-review-settings.png?fit=max\&auto=format\&n=4JqGzev8J23C4THw\&q=85\&s=ed38fbee7ca358d5ef4c0280b3a61938) | Setting | What it does | | - | - | | **All projects** | Export findings from every Lightdash project, including projects created later. Untick it to pick specific projects instead. | | **Projects** | Shown when **All projects** is off. Only findings from the selected Lightdash projects are exported. | | **Linear team** | Required. Every issue is created in this team. | | **Linear project** | Optional. When set, issues are added to this Linear project as well as the team. Clear it to create issues in the team only. | Selections save as you change them. The toggle at the top right switches the export on and off. It can only be turned on once a team is chosen and at least one project is in scope, and it is switched on for you when you pick a team. ### Export findings that already exist Connecting Linear does not export findings that were already on the board. When you are happy with the routing, click **Create issues for existing findings**. Lightdash queues every open finding in the projects you selected that does not already have a Linear issue, and creates the issues in the background in small batches. Findings in **Done** and dismissed findings are not exported. The button is safe to click more than once. Findings that already have an issue are skipped, and Lightdash locks each finding while its issue is created so a backfill that overlaps with a review run cannot open duplicates. ### Reconnect or remove * **Reconnect** starts the Linear authorization again with the saved app. Use it after the app is reinstalled or its access is revoked in Linear. * **Remove** deletes the connection and its token from Lightdash. Existing Linear issues are left as they are, and the links on the board keep working. Routing is cleared, so reconnecting later starts from a clean setup. If the section shows **Reconnect required**, the saved connection can no longer create issues. This happens for connections made before app-based setup was introduced. Create a new private app, or reconnect with the same client ID, to continue exporting. ## Jira ### Connect Jira Jira Cloud is connected through an Atlassian OAuth 2.0 app that you create in your Atlassian developer console. Both the client ID and the client secret are stored in Lightdash, encrypted, and used only for your organization. ![The Jira issues section before connecting, showing the two setup steps: create an Atlassian OAuth 2.0 app, then paste the client ID and secret](https://mintcdn.com/lightdash/4JqGzev8J23C4THw/images/agents/issues-linear-jira/jira-review-settings.png?fit=max\&auto=format\&n=4JqGzev8J23C4THw\&q=85\&s=6df126f4ca40e827d374c609aed4404b) 1. Click **Open Atlassian developer console** and create an **OAuth 2.0 integration**. 2. Under **Permissions**, add the **Jira API** and tick the classic scopes `read:jira-work` and `write:jira-work`. 3. Under **Authorization**, set the callback URL to the one shown in Lightdash. It is `https:///api/v1/jira/oauth/callback`, and the copy button next to it puts the exact value on your clipboard. 4. Open the app's **Settings** page in the console and copy the **Client ID** and **Secret**. 5. Back in Lightdash, paste both and click **Connect Jira**. 6. Atlassian asks you to sign in and approve the app. Sign in with an account that has Jira on the site you want to use. If the account has no Jira access on any site, Atlassian shows **Access denied** and the connection is not saved. If the account can see more than one Jira site, the section shows a **Select site** badge and a **Jira site** picker. Choose the site that should receive review issues. With a single site, it is selected for you. Lightdash also asks Atlassian for the `offline_access` scope so it can refresh the token in the background. You do not need to add it in the console; it is granted automatically alongside the classic scopes. ### Choose where issues go | Setting | What it does | | - | - | | **All projects** | Export findings from every Lightdash project, including projects created later. Untick it to pick specific projects instead. | | **Lightdash projects** | Shown when **All projects** is off. Only findings from the selected Lightdash projects are exported. | | **Jira project** | Required. Every issue is created in this Jira project. | | **Jira issue type** | Required. The issue type used for every issue, for example Task or Bug. The list shows the types available in the selected Jira project. | Selections save as you change them. The toggle at the top right switches the export on and off, and can only be turned on once a Jira project and issue type are chosen and at least one Lightdash project is in scope. ### Export findings that already exist The Jira section has the same **Create issues for existing findings** button as Linear. It queues every open finding in scope that does not already have a Jira issue and creates them in the background, skipping findings that are already linked. ### Reconnect or remove * **Reconnect** restarts the Atlassian authorization with the saved client ID and secret. Use it if the token was revoked, or to switch the connecting account. * **Remove** deletes the connection, its token, and the stored client secret from Lightdash. Existing Jira issues and the links on the board are left as they are. Routing is cleared. ## Which findings are exported | Finding | Exported automatically | Exported by the backfill button | | - | - | - | | New AI-filed finding in a project in scope | Yes | Not needed, it already has an issue | | Issue filed by hand on the board, with a project in scope | Yes | Not needed, it already has an issue | | Finding that existed before you connected | No | Yes, while it is in **To Do** or **In Progress** | | Recurrence of a finding that already has an issue | No, the existing issue is kept | Skipped | | Finding in **Done**, or dismissed | No | No | | Finding in a project outside the selected projects | No | No | Issue creation runs on the scheduler. If Linear or Jira is unavailable, the job fails and is retried; findings whose issue was already created are not created twice. ## Troubleshooting * **The Linear or Jira sections are missing.** They only render while **Review AI agent turns** is on. Reviews are also paused while your organization has any [bring-your-own AI provider key](/workspace-admin/ai-settings#bring-your-own-ai-providers-and-models) set, which hides the sections too. * **The export toggle is greyed out.** Linear needs a team, Jira needs a project and an issue type, and both need at least one Lightdash project in scope. Pick those first. * **No issues appear for new findings.** Check the toggle is on, that the finding's project is in the selected projects, and that the finding is new rather than a recurrence. Findings that recur attach to the existing card and do not open another issue. * **Atlassian shows Access denied.** The account you signed in with has no Jira product on any site. Sign in with an account that uses Jira on the site you want, then click **Reconnect**. * **Jira shows Select site.** The connecting account can see several Jira sites. Pick one in the **Jira site** dropdown; issues are not created until a site is chosen. * **Linear shows Reconnect required.** The connection predates app-based setup. Create a private app with **Create Linear app** and connect with its client ID. * **I changed the team or project and old issues did not move.** Routing only applies to issues created after the change. Existing issues stay where they were created. ## Related * [Issues](/agents/issues): the board these exports are created from, and how findings are filed. * [Agent visibility](/agents/visibility): where Issues fits into admin visibility overall. * [Set up agents](/agents/set-up-agents): enabling reviews and the rest of the Ask AI settings. # Knowledge documents Source: https://docs.lightdash.com/agents/knowledge-documents Upload, scope, and maintain business reference material for your agents Knowledge documents let you upload longer reference material — glossaries, business policies, supporting context, and internal procedures — that your agent can consult while answering questions. Use them for material that doesn't belong on one semantic object or in the agent's always-on instructions. Upload documents under **Reference documents** in the **Knowledge & data** section of the agent's settings. The upload appears once the agent is created, so save a new agent before adding documents. ![Knowledge documents section in agent settings](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/knowledge-documents.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=a979e35b6dffaa3732ba5b588b93ae4f) ## How they work When you upload a document, Lightdash reads it and writes a short summary of what it's about — what it covers, which terms it defines, which explores it relates to, and when the agent should consult it. The agent always sees this summary, so it knows the document is available and what's in it. By default, it only reads the full content when a question actually calls for it (**on-demand retrieval**), which keeps conversations fast. A few things worth knowing: * **The agent decides when to open a document.** If your document is never being used, the summary probably isn't specific enough about what it's for. Renaming the document or making its purpose clearer in the content usually fixes it. * **Each document gets a relevance rating against your project.** After uploading, check the relevance card. If a document is rated low or unrelated, the agent has been told not to rely on it for data questions — you'll want to revise it, or scope it to a different agent where it's more relevant. * **Documents are listed per agent.** The documents table only shows the documents this agent can actually use — organization-level documents (available to every agent) plus any documents specifically granted to this agent. Uploading a document from an agent's settings scopes it to that agent by default. ## Always include in context For documents the agent should apply to *every* question — not just the ones where the summary happens to match — flip the **Always include in context** toggle in the document's settings panel. * **On demand (default).** The agent sees only the summary and reads the full document when the question calls for it. Best for large or occasionally-relevant references. * **Always included.** The full document is embedded into the agent's system prompt on every request. Best for short, high-value context that shapes how *all* answers should be written — for example, a one-paragraph definition of "active customer" that every metric answer should honor. The documents table shows an **Always included** or **On demand** status chip per document so you can see at a glance which documents will be in every prompt. Always-included documents make every prompt larger, which uses more tokens and can slow responses. The toggle description surfaces this trade-off in the UI. Keep always-included content short and reserve the toggle for context that genuinely matters on every turn — leave everything else on on-demand retrieval. Because "always include" changes every future response, switching a document *to* always-included asks for confirmation. Switching back to on-demand retrieval takes effect immediately. Deleting a document also asks for confirmation. ## View, edit, or download a document ### Open a document In the agent's knowledge documents list, select the document and click the **View and edit document** (eye) icon to open the fullscreen viewer. Read the document there, or click **Download** to save a copy of the current file. ### Edit a document From the document viewer, click **Edit** to change the document. You don't need to delete and re-upload it to fix a typo, refresh guidance, or update frontmatter. You can edit the document's name and content. Markdown documents open in an editor with a live preview, while plain-text documents open in a monospace text area. YAML frontmatter remains in the raw Markdown source but isn't shown in the preview. * **Unsaved changes.** Closing the editor with pending changes asks for confirmation. Use **Cancel** to discard changes and return to the viewer. * **Quotas.** The 20KB per-document and 5MB organization limits also apply to edits. The editor shows the document's size and disables **Save** when the content is over the limit or the name is empty. * **Summary and context.** When the content changes, Lightdash regenerates the document summary. Saved content is available to the agent on its next message, including for documents that are always included in context. ## Manage documents through the API To keep documents in sync with a set you maintain elsewhere, for example from CI, use the agent documents endpoints under `/api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/documents` with a [personal access token](/personal-settings/create-personal-tokens). They list, create, read, and delete documents, replace a document's name and content (`PATCH /{documentUuid}/content`), and set **Always include in context** (`PATCH /{documentUuid}` with `alwaysIncludeInContext`). Creating, editing, and deleting need the project **Developer** role or higher. The same size limits apply. See the [API reference](/api-reference/v1/introduction). To keep an agent's own documents in Git alongside its configuration, use the CLI instead — see [knowledge documents in agents as code](/agents/agents-as-code#knowledge-documents). To list documents across every agent, use `GET /api/v1/aiAgents/documents`. It lists every knowledge document in the organization, or pass `projectUuid` as a query parameter to filter to the documents scoped to one project (organization-wide documents are left out). ## What to upload Good candidates are anything a new analyst on your team would need to read before answering questions, but that doesn't belong in the semantic layer itself: * **Business glossaries** — definitions of terms like "active customer", "qualified lead", "churn", especially when your definition differs from the industry default * **Metric provenance and caveats** — "Revenue excludes refunds processed after the period close", "MRR is calculated on the first of the month, not rolling" * **Fiscal and calendar conventions** — fiscal year start, reporting cadence, holiday adjustments * **Org-specific acronyms and product taxonomy** — what your internal product codes mean, team naming conventions * **Known data quirks** — "The `eu_orders` table has a 6-hour ingestion lag", "Pre-2023 data uses the old pricing schema" * **Policy and escalation context** — when to flag something to a human, which numbers are board-reported and must match a specific source ## What *not* to upload * **Anything that belongs in the semantic layer.** If it describes a specific field or model, prefer an [AI hint](/semantic-layer/writing-descriptions#layer-ai-hints-on-top-of-descriptions) — those are tied to the field and survive refactors. * **Sensitive data.** Documents are visible to anyone using the agent. Don't paste API keys, customer PII, or anything you wouldn't share with the whole agent's audience. * **Raw data dumps.** Knowledge documents are for context and interpretation, not data. The agent has the semantic layer for that. * **Generic marketing copy or off-topic notes.** These will be rated `low` or `none` relevance and the agent will be told to ignore them. ## Practical tips * **Keep documents focused and short.** Each document is capped at 20KB and the org-wide quota is 5MB, but the practical limit is much lower: a focused one-page note is consulted more reliably than a sprawling wiki export. Split large references into one document per topic. * **Use Markdown.** Only `.md` (or `.markdown`) and `.txt` files are supported, so you can't upload images or PDFs. Markdown headings and lists make summaries more accurate. * **Name documents like a `use when` clue.** `Revenue recognition rules.md` is better than `notes.md` — the name is part of what the agent sees. * **Scope documents per-agent.** A document uploaded for your Finance agent shouldn't pollute your Marketing agent's context. Use the per-agent access setting to keep documents relevant — an agent's documents table only lists the org-level documents plus the ones granted to that agent. For example, a `Refund policy.md` uploaded from the `Analytics Agent` settings is only listed and served to that agent, not to any other agents in the project. * **Re-check after big changes.** When you add new explores or rename fields, revisit the relevance rating on existing documents — `relatedExploreNames` references exact explore names and can go stale. * **Test with a real question.** After uploading, ask the agent a question that *should* hit the document and confirm it gets called. The tool calls are visible in the conversation thread. # Lightdash Docs MCP Source: https://docs.lightdash.com/agents/lightdash-docs-mcp Connect your AI coding tool to the public Lightdash documentation endpoint Connect your AI coding tool to the public Lightdash documentation endpoint to look up concepts, configuration, and troubleshooting guidance while you work. To query your project data instead, connect to the authenticated [Lightdash MCP server](/agents/lightdash-mcp). ## What you can use it for The Docs MCP helps AI agents: * Understand Lightdash concepts, configuration, and best practices * Generate accurate YAML configurations for metrics and dimensions * Troubleshoot issues using official documentation * Stay up-to-date with the latest Lightdash features > [!TIP] > > For the best experience building and maintaining your semantic layer, we recommend using [agent skills](/workflow/install-agent-skills) instead. Skills provide more targeted context for AI coding agents and are optimized for code generation tasks. ## Setup The Docs MCP endpoint is available at `https://docs.lightdash.com/mcp`. Add it to your AI coding tool: > [tab] Cursor > > Add to your `.cursor/mcp.json`: > > ```json theme={null} > { > "mcpServers": { > "lightdash-docs": { > "url": "https://docs.lightdash.com/mcp" > } > } > } > ``` > [tab] Claude Code > > Run the following command: > > ```bash theme={null} > claude mcp add --transport http lightdash-docs https://docs.lightdash.com/mcp > ``` > [tab] Windsurf > > Add to your `~/.codeium/windsurf/mcp_config.json`: > > ```json theme={null} > { > "mcpServers": { > "lightdash-docs": { > "serverUrl": "https://docs.lightdash.com/mcp" > } > } > } > ``` ## Availability The Docs MCP is available to: * Open source users * Cloud Pro * Cloud Enterprise No authentication required. # Lightdash MCP server Source: https://docs.lightdash.com/agents/lightdash-mcp Connect Claude, ChatGPT, Codex, and other AI tools to Lightdash over the Model Context Protocol > [!NOTE] > > Available to all Lightdash Cloud users. Self-hosted organizations need an Enterprise license and must [enable MCP](/self-host/enterprise-features/mcp). The [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) lets external AI assistants — Claude, ChatGPT, OpenAI Codex, Cursor, VS Code, and custom agents — connect to Lightdash and query your data directly. Lightdash runs the MCP server and your assistant is the client, so it can explore your data models, search for metrics and dimensions, run queries, and surface data-driven insights through natural conversation. MCP uses secure OAuth authentication and respects all your existing access controls, so data stays protected. This is for pointing an outside assistant **into** Lightdash. To give your Lightdash agents tools from outside services like Notion, Linear, or Confluence, that's the reverse direction — see [Connect external MCP servers](/agents/connect-external-mcp-servers). Find [client connection options](#connect-a-client) and [manual setup](#manual-setup), look up [capabilities](#what-it-can-do), apply [agent context](#using-ai-agent-context), or troubleshoot a connection in the [FAQ](#faq). ## Connect a client Lightdash generates the server URL and configuration for your instance and your client. Open **Settings → MCP → Connect**, pick a client, and copy what it gives you: a command, a config file, or the server URL. **1. Open Settings → MCP → Connect** Any Lightdash user can open it. On a self-hosted instance, it uses your own domain. **2. Pick your client and copy the configuration** Choose Claude Desktop, Claude Code, Codex, Cursor, or VS Code. For ChatGPT or another client that isn't listed, choose **Other clients** for the server URL and the Streamable HTTP and OAuth setup steps. **3. Authenticate** Connect from your client, sign in to Lightdash in your browser, and approve access. To confirm it worked, ask the assistant which Lightdash tools it has, as in [Verifying your MCP connection](#example-1-verifying-your-mcp-connection). > [!NOTE] > > The OAuth access token issued for the connection lasts 1 hour and refreshes itself in the background. The refresh token lasts 2 weeks; once it expires, the client has to repeat this sign-in flow. These are Lightdash's own tokens, so the connection doesn't follow your identity provider's session (for example Google) — signing out of or extending that session has no effect on it. Self-hosted instances can change both defaults, see [environment variables](/self-host/customize-deployment/environment-variables#mcp). ## Manual setup Every client needs the MCP server URL for your instance and a way to authenticate. Interactive clients use OAuth; headless integrations can use a personal access token. Use this section when you want a client-specific walkthrough, when you're configuring a client without opening Lightdash, or when you're building your own integration. ### Find your instance name Your instance name is the subdomain of the URL you use to open Lightdash in your browser. Open Lightdash, look at the address bar, and take the part before `.lightdash.cloud`: | Your Lightdash URL | Instance name | MCP URL | | - | - | - | | `https://app.lightdash.cloud/...` | `app` | `https://app.lightdash.cloud/api/v1/mcp` | | `https://eu1.lightdash.cloud/...` | `eu1` | `https://eu1.lightdash.cloud/api/v1/mcp` | | `https://acme.lightdash.cloud/...` | `acme` | `https://acme.lightdash.cloud/api/v1/mcp` | > [!NOTE] > > For most Lightdash Cloud users the instance name is `app` or `eu1`. That's expected, not a placeholder you need to change. Only dedicated instances have a company-specific name like `acme`. If you self-host Lightdash on your own domain, the MCP endpoint lives at `https:///api/v1/mcp` instead. See [MCP for self-hosted instances](/self-host/enterprise-features/mcp). ### Claude.ai and Claude Desktop Set up MCP in the [Claude.ai](https://claude.ai) web app, and it will automatically sync to your Claude Desktop app after restart. > [accordion] Setup instructions > > 1. **Access Settings in Claude.ai** > > Navigate to your profile menu (bottom-left corner) and select Settings. > > ![Navigate to profile menu in bottom-left corner and click Settings](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/lightdash-mcp/claude-ai-01-click-profile-settings.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=389fda25e5effe37ec285f142eb659d4) > 2. **Add Custom Connector** > > In the Settings menu, select "Connectors" from the sidebar, then click "Add custom connector". > > ![Select Connectors from the sidebar menu, then click Add custom connector button](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/lightdash-mcp/claude-ai-02-select-connectors-then-add-custom-connector.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=504271c844d9667fd408dca7a4ba7b38) > 3. **Configure Connection** > > Fill in the connection details with your Lightdash instance information. > > ![Enter Lightdash as the name and your instance MCP URL in the configuration form](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/lightdash-mcp/claude-ai-03-fill-out-name-and-mcp-url.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=f9e2798da9e4004a27759fcf96285152) > > * **Name:** Lightdash (or any name you prefer) > * **URL:** `https://.lightdash.cloud/api/v1/mcp` (commonly `app` or `eu1`, see [Find your instance name](#find-your-instance-name)) > > Leave the optional **OAuth Client ID** and **OAuth Client Secret** fields blank. Lightdash supports dynamic client registration, so Claude registers itself as an OAuth client when you connect. > 4. **Connect and Authenticate** > > Click the "Connect" button to initiate the authentication process. > > ![Click the Connect button to start OAuth authentication with Lightdash](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/lightdash-mcp/claude-ai-04-click-connect.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=20c36144297f0bf0544116043f6ccadb) > 5. **Complete OAuth Flow** > > Log in to your Lightdash account and approve the connection when prompted. > > ![Login to Lightdash with your credentials and approve the OAuth connection request](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/lightdash-mcp/claude-ai-05-oauth-flow-via-lightdsah.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=50c9d37b1bd007ee4480584e71ad3378) > 6. **Configure Permissions (Optional)** > > Optionally configure which MCP tools Claude can access and set any additional permissions. > > Claude lists each tool by its title rather than its tool name, for example **Run metric query** for `run_metric_query` and **Run SQL** for `run_sql`. Set permissions against the titles exactly as Claude shows them. > > ![Optional: Configure MCP tool access and permissions for your Claude assistant](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/lightdash-mcp/claude-ai-06-OPTIONAL-configure.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=f05826ff8e44f3952299f80e2bbd2b35) ### ChatGPT ChatGPT connects to remote MCP servers through custom connectors. > [accordion] Setup instructions > > 1. **Open ChatGPT settings** > > Open your profile menu and select **Settings**. > > ![ChatGPT profile menu with Settings highlighted](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/lightdash-mcp/chatgpt-01-click-profile-settings.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=d8ca6d50c0c9ef8ee1c389bba4585775) > 2. **Create a connector** > > Select **Connectors**, then click **Create**. > > ![ChatGPT Connectors settings with the Create button highlighted](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/lightdash-mcp/chatgpt-02-select-connectors-then-create.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=71fd01d56b7e746cca3e173542370cc5) > 3. **Configure the connector** > > Enter the connection details, confirm that you trust the application, then click **Create**. > > * **Name:** Lightdash > * **Description:** Query data and explore existing charts and dashboards in Lightdash > * **MCP server URL:** `https://.lightdash.cloud/api/v1/mcp` > * **Authentication:** OAuth > > ![ChatGPT connector form configured with the Lightdash MCP URL and OAuth authentication](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/lightdash-mcp/chatgpt-03-fill-out-name-desc-mcp-url-select-oauth.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=06b5896a61be89e614f3d3958c68879f) > 4. **Approve access** > > Sign in to Lightdash and approve the connection. > > ![Lightdash authorization screen for approving the ChatGPT connector](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/lightdash-mcp/chatgpt-04-oauth-flow-via-lightdsah.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=b17322d71f52d6e705da84f52166ae2b) ### Claude Code For developers using Claude Code CLI: ```bash theme={null} claude mcp add --transport http lightdash 'https://.lightdash.cloud/api/v1/mcp' ``` Replace `` with your actual Lightdash instance name (commonly `app` or `eu1`, see [Find your instance name](#find-your-instance-name)). > [accordion] Setup instructions > > 1. **Use the /mcp command in Claude Code** > > ![Type /mcp to see available MCP connections](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/lightdash-mcp/claude-code-01-slash-mcp-command.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=735dabc9e72b80a8a8d573ce305bc58e) > 2. **Select Lightdash from the list** > > ![Navigate to Lightdash using arrow keys](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/lightdash-mcp/claude-code-02-select-lightdash-navigating-using-arrow-keys.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=7f462a7709c2c4eae70b9061d5e4af94) > 3. **Authenticate with Lightdash** > > ![Select Authenticate and hit Enter](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/lightdash-mcp/claude-code-03-select-authenticate-hit-enter.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=c7cbc994e0953334f640b593b8ed8fb4) > 4. **Complete OAuth Flow** > > ![Complete the OAuth flow via Lightdash](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/lightdash-mcp/claude-code-04-complete-oauth-flow-via-lightdash.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=b0bd1d41ea57d696c41c0f3724b929ea) > 5. **Start using MCP** > > ![Start prompting after successful authentication](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/lightdash-mcp/claude-code-05-start-prompting-after-successful-auth.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=f1d0417bdb893f5606c27766b372c2e9) > > After authentication, you can start asking questions about your Lightdash data directly in Claude Code! ### Codex Add the server and start the sign-in flow from your terminal: ```bash theme={null} codex mcp add lightdash --url 'https://.lightdash.cloud/api/v1/mcp' codex mcp login lightdash ``` Replace `` with your actual Lightdash instance name. Sign in to Lightdash in your browser, approve access, then start a new Codex session. ### Cursor Add the server to your project's `.cursor/mcp.json`: ```json theme={null} { "mcpServers": { "lightdash": { "url": "https://.lightdash.cloud/api/v1/mcp" } } } ``` Open **Cursor Settings → MCP & Integrations**, connect Lightdash, then sign in and approve access in your browser. ![Cursor MCP and integrations settings showing the Lightdash server](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/lightdash-mcp/CleanShot2025-08-28at17.42.54@2x.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=9659b63a4d0fa6f82af9b67e7b5776b9) ### VS Code Add the server to your project's `.vscode/mcp.json`: ```json theme={null} { "servers": { "lightdash": { "type": "http", "url": "https://.lightdash.cloud/api/v1/mcp" } } } ``` Run **MCP: List Servers** from the Command Palette, select Lightdash, and start it. Sign in when prompted, then use the tools in Copilot agent mode. ### Custom integrations If you're building your own agents or automated workflows, you can integrate directly with Lightdash MCP: * **Transport**: Lightdash MCP exposes a Streamable HTTP transport endpoint at `https://.lightdash.cloud/api/v1/mcp` * **Debugging**: Use `@modelcontextprotocol/inspector` to inspect and debug the MCP connection * **Authentication**: For interactive setups use OAuth 2.0. For headless agents and automated workflows, you can authenticate with a Personal Access Token by passing it in the `Authorization` header — both `Authorization: ApiKey ldpat_` and `Authorization: Bearer ldpat_` are accepted on the MCP endpoint and resolve to the same PAT authentication path. The `Bearer` alias is accepted only on the MCP endpoint. Use `Bearer` when your MCP host only supports static `Bearer` tokens (for example, Claude managed agents and other third-party MCP hosts that don't let you choose a custom auth scheme); use `ApiKey` for direct HTTP clients where you can set the scheme yourself, since it makes it explicit that the token is a Lightdash PAT. Create the token under **Settings → Personal access tokens** for the user whose permissions and attributes you want the integration to use. Service account tokens are also supported on plans that include them. On a self-hosted instance with `DISABLE_PAT=true`, the MCP endpoint refuses personal access tokens too, while OAuth and service account tokens keep working; to limit tokens to some organization roles instead, set `PAT_ALLOWED_ORG_ROLES` (see [environment variables](/self-host/customize-deployment/environment-variables)). * **Redirect URIs**: A wildcard in a registered redirect URI matches only a port, a path, or one leftmost subdomain label, for example `https://*.example.com/callback`. Lightdash refuses a redirect URI that has a user name, a password or a backslash. When the agent identity feature flag is on, stricter rules apply. See [OAuth with agent identity on](#oauth-with-agent-identity-on). * **Documentation**: See the [MCP specification](https://modelcontextprotocol.io/docs) for implementation details * **Pin a project (optional)**: pass `X-Lightdash-Project: ` to scope the MCP session to a specific project. See [details below](#pin-a-project-with-the-x-lightdash-project-header). * **Pin an agent (optional)**: pass `X-Lightdash-Agent: ` to scope the MCP session to one [AI agent](/agents) and its project. See [details below](#pin-an-agent-with-the-x-lightdash-agent-header). * **Override user attributes per request (optional)**: pass `X-Lightdash-User-Attributes: ` to override the authenticated user's attributes for that request (useful for row-level security when an agent acts on behalf of different end-users). See [details below](#override-user-attributes). #### OAuth with agent identity on When the [agent identity](/agents/agent-identity) feature flag is on, the Lightdash OAuth server is stricter. A custom OAuth client must: * **Send the `resource` parameter** set to the MCP URL, for example `https://.lightdash.cloud/api/v1/mcp`. Each token is for the Lightdash API or for MCP, and one audience refuses the other's tokens. Without `resource`, the token is for the API, so the MCP endpoint refuses it. * **Register exact redirect URIs.** Only an http loopback redirect (`localhost`, `127.0.0.1` or `[::1]`) can use a different port. Allowed schemes are https, http on a loopback host, reverse-DNS native schemes such as `com.example.app`, and `cursor`, `vscode`, `vscode-insiders`, `windsurf` and `lightdash`. Dynamic client registration refuses wildcards, except for the loopback port. * **Use PKCE with `S256`.** * **Send the token in the `Authorization` header.** Lightdash refuses a bearer token in the query string. Use each refresh token once. When a used refresh token comes back, Lightdash revokes every token from that sign-in. Authorization responses also include the `iss` parameter (RFC 9207). #### Pin a project with the `X-Lightdash-Project` header By default, MCP clients call `get_context` to see the projects you can access, then pass a project UUID to each tool that works with project data. If you're building an integration that should always operate against a single project, you can pre-select the project by sending the `X-Lightdash-Project` header on every request to `/api/v1/mcp`. When the header is set: * Tools run against the project in the header, and a tool call for any other project is refused. `get_context` reports this project as `activeProject`. * The `list_projects` tool is hidden from `tools/list`, so the AI assistant isn't steered toward another project. * Access to the project is still enforced by your user, API key, or service account's permissions — the header can't be used to access projects the caller can't already see. This is useful when you want each integration, workspace, or environment to be locked to one project (for example, a separate connector per project) without relying on the AI assistant to pick the right project. A user chooses this for their own integration; it isn't an admin-enforced restriction. To restrict which projects MCP clients can reach for everyone in your organization, see [Restrict MCP to specific projects](#restrict-mcp-to-specific-projects). The header value must be a valid project UUID. You can find the project UUID in the Lightdash URL when viewing a project (`/projects//...`). ```json Cursor (.cursor/mcp.json) theme={null} { "mcpServers": { "lightdash-sales": { "url": "https://.lightdash.cloud/api/v1/mcp", "headers": { "X-Lightdash-Project": "00000000-0000-0000-0000-000000000000" } } } } ``` ```bash curl theme={null} curl https://.lightdash.cloud/api/v1/mcp \ -H "Authorization: Bearer " \ -H "X-Lightdash-Project: 00000000-0000-0000-0000-000000000000" \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' ``` If the header value isn't a valid UUID, it's ignored and the request falls back to the user's stored project context. When the request also sends [`X-Lightdash-Agent`](#pin-an-agent-with-the-x-lightdash-agent-header), an invalid value is rejected with a `400` error instead. Permissions are always checked against the resolved project, so a header for a project the caller can't view will return a "no access" error. #### Pin an agent with the `X-Lightdash-Agent` header To lock an integration to one [AI agent](/agents), send the `X-Lightdash-Agent` header with the agent's UUID on every request to `/api/v1/mcp`. The agent's project becomes the pinned project, so you don't need to send `X-Lightdash-Project` as well. When the header is set: * Every tool that works with project data runs with the agent's scope, as if the AI assistant had passed the agent's `agentUuid` (see [Agent context](#agent-context)). A tool call for a different agent is refused. * The agent's project is pinned the same way as with [`X-Lightdash-Project`](#pin-a-project-with-the-x-lightdash-project-header): a tool call for any other project is refused, and `list_projects` is hidden. * `route_agent` and `list_agents` return only the pinned agent, and `get_context` reports it as `activeAgent`. * The agent's instructions are added to the server instructions that the client receives when it connects. * Access is still enforced: the caller must have access to the agent and be able to view its project. The header can only narrow what the caller can already reach. **Enable agents over MCP** must be on for your organization (see [Using AI agent context](#using-ai-agent-context)). You can find the agent UUID in the Lightdash URL when viewing the agent (`/projects//ai-agents/`). ```json Cursor (.cursor/mcp.json) theme={null} { "mcpServers": { "lightdash-sales-agent": { "url": "https://.lightdash.cloud/api/v1/mcp", "headers": { "X-Lightdash-Agent": "00000000-0000-0000-0000-000000000000" } } } } ``` ```bash curl theme={null} curl https://.lightdash.cloud/api/v1/mcp \ -H "Authorization: Bearer " \ -H "X-Lightdash-Agent: 00000000-0000-0000-0000-000000000000" \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' ``` The request fails with a `400` error when the header isn't a valid UUID, when no agent has that UUID, or when the request also pins a different project. It fails with a `403` error when AI agents or agents over MCP aren't enabled for your organization, or when the caller can't access the agent or view its project. #### Override user attributes with the `X-Lightdash-User-Attributes` header The `X-Lightdash-User-Attributes` header overrides the authenticated user's Lightdash user attributes for that specific MCP request. This is designed for agents that act on behalf of multiple end-users with row-level security: one PAT (or service account) user handles all requests, and per-request RLS scoping is applied via the header. The PAT or service account user must have the **org admin** role to use this header. Non-admins will receive a `ForbiddenError`. The header value must be a JSON object where each value is either a string or an array of strings. For example: * `{"user_id": "abc123"}` * `{"user_id": ["abc123", "def456"]}` If the agent user already has a value set for an attribute, the header can only **narrow** that value (set a subset of the pre-configured values), not expand access. If no value is pre-configured for the attribute on the agent user, any value can be set via the header. For a [service account](/workspace-admin/service-accounts#user-attributes), the attribute's default value counts as a pre-configured value, so the header can only narrow it (for example, to an org default of `region: none`). To let the header set any value per request, [assign the service account](/workspace-admin/user-attributes#assigning-user-attributes-to-users-and-groups) the value `*` for that attribute. ```bash curl theme={null} curl https://.lightdash.cloud/api/v1/mcp \ -H 'Authorization: ApiKey ' \ -H 'X-Lightdash-User-Attributes: {"user_id": "abc123"}' \ -H 'Content-Type: application/json' \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' ``` ```json Cursor (.cursor/mcp.json) theme={null} { "mcpServers": { "lightdash-agent": { "url": "https://.lightdash.cloud/api/v1/mcp", "headers": { "X-Lightdash-User-Attributes": "{"user_id": "abc123"}" } } } } ``` Setting the header statically in an MCP client config is suitable for development and testing. For production, where the attribute needs to change per end-user, the calling application must set the `X-Lightdash-User-Attributes` header programmatically on each request. ## Network requirements If your organization uses a corporate firewall, VPN, or internet security tool, the following domains must be allowlisted for MCP to work correctly: | Domain | Purpose | | - | - | | `.lightdash.cloud` | Lightdash API and OAuth authentication | | `claudemcpcontent.com` | Used by Claude to render visual content (charts, tables) from MCP connectors | > [!WARNING] > > If `claudemcpcontent.com` is blocked, Claude will still return query results as text but will not be able to display Lightdash visual charts. Only `render_chart` displays visual content, so every other tool, including queries and creating or editing content, works without this domain. You may see the error: *"Failed to set up MCP app. Check that claudemcpcontent.com is not blocked by your network or browser."* If you're having trouble, try opening Claude in an incognito or private browser window to rule out browser extensions such as ad blockers that may be blocking these domains. ## Turn MCP access on or off Organization admins can turn MCP on or off for the whole organization with **Allow MCP access** in **Settings → MCP → General**. It's on by default. Turning it off blocks all MCP clients, including connected ones, and disables the other MCP settings. **Settings → MCP → Connect** always shows. **General** and **Analytics** show only when [AI features are enabled](/workspace-admin/ai-settings#enable-ai-features) for your organization (on a self-hosted instance, [enable AI agents](/self-host/enterprise-features/ai-agents#enable-ai-agents)). **General** needs an organization admin or developer role. **Analytics** also shows to people who can manage agents in at least one project. ### Restrict MCP to specific projects The **Project access** card in **Settings → MCP → General** lets organization admins and developers choose which projects MCP clients can reach, separately from each user's project access in the Lightdash app. It's disabled while **Allow MCP access** is off. * **All projects** (the default): MCP clients can reach any project the connecting user, API key, or service account already has access to in Lightdash. * **Only selected projects**: MCP clients can only reach the projects you add to **Allowed projects**. Picking this mode requires selecting at least one project before it applies. A new project stays unavailable to MCP clients until an admin adds it here, even if users already have access to it in the app. If you remove every project from the list, MCP clients can't access any project — the card shows a "No projects allowed" warning until you add one back. This setting only limits what MCP clients can reach; it doesn't change a user's access in the Lightdash app, and it doesn't grant access either — a caller still needs its own permissions on a project to use it over MCP. It's the admin-enforced counterpart to a user [pinning a project with the `X-Lightdash-Project` header](#pin-a-project-with-the-x-lightdash-project-header) on their own integration. ## What it can do ### Core capabilities MCP provides AI assistants with powerful tools to interact with your Lightdash data: #### Project management * **List projects** - View all accessible projects in your organization * **Set active project** - Switch context between different projects (required before accessing any data). Accepts an optional `tags` array to filter the explores and fields visible in the session to those matching the given tags — the same tag-based filtering used by [AI agents](/agents/data-access#limiting-access-to-specific-explores-and-fields), but available directly in an MCP session without needing an agent. Useful when tags work in the Lightdash UI but you also want to scope an MCP session to a specific domain (e.g., `["sales"]`). * **Get current project** - Check which project is currently active An active project must be set before MCP can retrieve any data. Your AI assistant will typically handle this automatically by listing available projects and asking you to select one. #### Data exploration * **List explores** - See all available data models in the current project at a glance * **Find explores** - Search for relevant data models using natural language (e.g., "customer orders") * **Find fields** - Search for specific metrics and dimensions by business terms (e.g., "total revenue", "order date") * **Search field values** - Look up valid values for a field, useful for building filters * **Find content** - Search for existing spaces, charts, and dashboards by name or description. Results include space breadcrumbs and direct links. Optionally scope the search to a single space (and its descendants) by passing a space slug. * **List content** - Browse accessible content as a hierarchy. By default it returns root-level spaces; pass a space slug to list the charts, dashboards, and nested spaces directly inside that space. Use this when you want the agent to walk space → content rather than search by keyword. * **List verified content** - Discover charts and dashboards that admins have marked as verified, so agents can reference trusted, canonical patterns when building new content. If you want your agent to prefer verified patterns, ask it to in your prompt (e.g. *"Use verified charts as the reference for any new chart you build."*). #### Query execution * **Run metric query** - Execute queries using your semantic layer's metrics and dimensions. Returns up to 5,000 rows by default; a requested limit above that is clamped to the cap without the response saying so. Completed results include a best-effort `exploreUrl` so you can open the query in Lightdash to keep exploring. MCP has no export or download tool — for a larger or complete extract, open the `exploreUrl` and [download the results](/explore/share-charts#download-results-or-a-chart-image) with **All results** (bounded by the instance's [export limits](/workspace-admin/export-limits)), or set up a [scheduled delivery](/explore/create-scheduled-deliveries) as CSV or Excel. * **Render chart** - Render a visualization (tables, bar charts, line charts, pie charts, and more) for a completed metric query result in MCP App-capable clients (e.g., Claude). Call this after a metric query finishes when you want a visual chart; the query is not re-executed. It can also render with one of the project's [custom chart types](#chart-types). SQL Runner results are not supported by `render_chart`. * **Run SQL** - Execute arbitrary SQL queries directly against the project's data warehouse. Useful for ad-hoc analysis or queries that don't fit the explore-based model. Returns up to 500 rows by default (configurable up to 5,000). Completed results include a best-effort `sqlRunnerUrl` so you can open the compiled SQL in [SQL Runner](/explore/sql-runner). * **Get query result** - Poll for the result of a long-running query. `run_metric_query` and `run_sql` each wait about 50 seconds for the query to finish; if it hasn't, the response has no `exploreUrl` (or `sqlRunnerUrl`) yet — just a `queryUuid` to poll. Call `get_query_result` with that `queryUuid` until the warehouse completes the query — so long queries don't time out the session. The completed (`done`) response includes the same best-effort `exploreUrl` (or `sqlRunnerUrl` for `run_sql` queries) as a synchronously-completed call. **Run SQL** requires the `manage SqlRunner` permission, which Developers and Admins have by default and [custom roles](/workspace-admin/custom-roles) can add. Without it, `run_sql` doesn't appear in your client's tools list at all, rather than returning a permission error when called. The SQL is executed directly against your warehouse, so use the appropriate SQL dialect for your connection (e.g., PostgreSQL, BigQuery, Snowflake). Lightdash runs the query as soon as the tool is called; any confirmation step comes from your MCP client's own tool-approval setting. To limit which schemas and catalogs `run_sql` can read, set the project's [Agent data scope](/agents/data-access#scoping-raw-sql-to-specific-schemas). > [accordion] Query response shapes (for developers) > > When you call `run_sql` from a custom MCP client or live artifact, the tool returns both a CSV text payload and a `structuredContent` object. Prefer `structuredContent.result.rows` over parsing the CSV — values arrive as JSON-serializable primitives (numbers, strings, booleans, ISO date strings, or `null`), so you don't need `parseFloat` or `parseInt` on numeric columns. > > **Response envelope:** > > ```json theme={null} > { > "content": [ > { "type": "text", "text": "" } > ], > "structuredContent": { > "result": { > "status": "done", > "rows": [ > { "status": "completed", "n": 94, "total_amount": 2397 } > ], > "columns": ["status", "n", "total_amount"], > "rowCount": 1, > "sqlRunnerUrl": "https://.lightdash.cloud/projects//sql-runner?..." > } > } > } > ``` > > **Example usage:** > > ```ts theme={null} > const result = await callMcpTool('run_sql', { sql, limit }); > const { rows, columns, sqlRunnerUrl } = result.structuredContent.result; > // rows: [{ status: 'completed', n: 94, ... }, ...] > // columns: ['status', 'n', 'total_amount'] > // sqlRunnerUrl: shareable link to inspect/edit the SQL in SQL Runner, or null > ``` > > **Notes:** > > * Empty results still return `structuredContent.result` as `{ status: "done", rows: [], columns, rowCount: 0, sqlRunnerUrl }` — distinct from a parse failure. > * `sqlRunnerUrl` is best-effort and may be `null` if the share link cannot be created. It points to the compiled SQL that was executed, which may differ slightly from the SQL you submitted. > * On error, the response has `isError: true` and `content[0].text` contains the error message; `structuredContent` is omitted. > * `content[0].text` continues to carry the raw CSV, so existing clients that parse the text payload keep working. > > A completed `run_metric_query` or `get_query_result` call for a metric query also pairs CSV text with `structuredContent.result`, which holds `status: "done"`, the `queryUuid`, the `rows`, the `fields` (field definitions keyed by field ID) and the best-effort `exploreUrl`. A client that can't display `render_chart` can draw its own chart from `rows` and `fields`. > [!WARNING] > > **Security best practice:** Ensure the database credentials configured in your Lightdash connection have **read-only (viewer) access** to your warehouse. Since `run_sql` executes arbitrary SQL, a connection with write permissions could allow AI agents to modify or delete warehouse data. #### Editing content MCP can read, create, and edit Lightdash charts and dashboards using the same [content-as-code](/workflow/content-as-code) payloads that the Lightdash CLI uses. This lets agents make targeted edits to existing content or build new charts and dashboards directly in a conversation, without downloading YAML files locally. * **Read content** (`read_content`) - Fetch a chart or dashboard as JSON by slug. Call this before editing so the agent can see the current state. * **Edit content** (`edit_content`) - Apply an [RFC 6902 JSON Patch](https://datatracker.ietf.org/doc/html/rfc6902) to an existing chart or dashboard, then validate and persist. Use this for surgical changes (e.g. rename a field, add a filter, swap a chart color) without rewriting the whole object. * **Create content** (`create_content`) - Create a new chart or dashboard from a full chart-as-code or dashboard-as-code object. Returns the persisted slug and URL. These tools reuse the same permissions, validation, and project context as the [Lightdash CLI](/workflow/cli/install) `download` and `upload` commands, so the user driving the MCP session needs the same access required to manage that content in Lightdash. Wherever [documents](/explore/documents) are enabled (every Lightdash Cloud organization), the same three tools also handle them: * `read_content` returns the document's ordered cells (Markdown and chart-as-code charts) and its current `versionUuid`. * `create_content` with `type: "document"` takes a name, slug, description, space slug, and the ordered cells. * `edit_content` takes a `documentEdit` instead of a JSON Patch. Either replace the whole content, passing the `versionUuid` you read as `baseVersionUuid` and every cell to keep, or update the name, slug, or description on their own. If someone saved the document after you read it, the edit is rejected; read it again and retry. Each content edit saves a new version. #### Editing project models MCP exposes [AI writeback](/agents/ai-writeback) — editing the dbt or native Lightdash YAML project that backs the active Lightdash project and opening a pull request with the change — to any MCP client. Ask the assistant to rename a metric, add a dimension, edit field SQL, or fix a YAML description; the assistant calls the tools below and hands back a pull request URL when the run finishes. The [AI writeback prerequisites](/agents/ai-writeback#prerequisites) — supported Git host, repository access, and project Developer permission — apply to the MCP surface too. * **Run AI writeback** (`run_ai_writeback`) - Start a writeback run against the active project's repository from a natural-language prompt. The repository, project directory, and semantic layer format are resolved server-side from the saved connection — you don't specify them. Returns immediately with an `aiWritebackRunUuid`. * **Get AI writeback status** (`get_ai_writeback_status`) - Poll a writeback run by id. Returns the current pipeline stage while the run is in flight, and the pull request URL (or an error message) once it reaches a terminal state. ##### How the async flow works A writeback run typically takes a few minutes — longer than most MCP transports will hold a connection open — so `run_ai_writeback` enqueues the run to a background worker and returns immediately with a run id. The caller then polls `get_ai_writeback_status` for the outcome. See [How it works](/agents/ai-writeback#how-it-works) for what the run itself does. Polling has no session affinity — you can call `get_ai_writeback_status` from a different MCP session or a different API token, as long as the caller has view access to the project the run belongs to. This makes the pair usable from short-lived automations and shell scripts, not just interactive chat clients. The in-product AI writeback chat card is unaffected by this split: the chat continues to auto-update once the background run finishes, without you polling anything. ##### `run_ai_writeback` — start a run **Parameters** * `prompt` *(string, required)* — A clear, self-contained description of the change to make to the dbt project (for example, *"Add a `total_revenue` metric to the orders model as the sum of amount"*). When the project has more than one dbt source, name the intended source in the prompt itself (for example, *"In the marketing dbt project, ..."*) — the run reports the available sources back through `get_ai_writeback_status` if it can't tell which one you meant. **Response** (`structuredContent`) ```json theme={null} { "aiWritebackRunUuid": "b3f4e0e2-8a2b-4d5f-9a1f-1c2d3e4f5a6b" } ``` > [!WARNING] > > **Breaking change (July 2026).** `run_ai_writeback` used to block until the pipeline finished and return `{ output, exitCode, prUrl }` inline. It now returns `{ aiWritebackRunUuid }` and callers must poll `get_ai_writeback_status` for the pull request URL. External MCP clients hardcoded against the old synchronous shape need to update; the in-product chat is unaffected. This change decouples the run from the MCP transport (so transport idle timeouts can no longer drop a completed run) and removes the naive-retry duplicate-PR risk that came with a synchronous return. ##### `get_ai_writeback_status` — poll for the result **Parameters** * `aiWritebackRunUuid` *(UUID, required)* — The id returned by `run_ai_writeback`. **Response** (`structuredContent`) ```json theme={null} { "status": "ready", "prUrl": "https://github.com/acme-analytics/jaffle-shop/pull/482", "errorMessage": null } ``` * `status` is either `"pending"` (not yet picked up by a worker), an in-progress pipeline stage (for example, `"sandbox"`, `"agent"`, or `"pull_request"`), or a terminal value: `"ready"` (finished — check `prUrl`) or `"error"` (finished — check `errorMessage`). * `prUrl` is set once `status` is `"ready"` and the agent changed at least one file. If the agent decided no change was needed, `status` is still `"ready"` but `prUrl` is `null`. * `errorMessage` is set once `status` is `"error"`. This also covers the "more than one dbt source" case — the message lists the available sources so the caller can re-run `run_ai_writeback` naming the intended one in the prompt. Poll every 10-15 seconds rather than tight-looping — a run typically takes a few minutes to finish, and the status row updates in stages rather than continuously. **Example poll loop** ```ts theme={null} const { aiWritebackRunUuid } = ( await callMcpTool('run_ai_writeback', { prompt: 'Add a total_revenue metric to the orders model as the sum of amount.', }) ).structuredContent; while (true) { const { status, prUrl, errorMessage } = ( await callMcpTool('get_ai_writeback_status', { aiWritebackRunUuid }) ).structuredContent; if (status === 'ready') { console.log(prUrl ? `PR opened: ${prUrl}` : 'No file changes were needed.'); break; } if (status === 'error') { throw new Error(errorMessage ?? 'Writeback failed'); } await new Promise((r) => setTimeout(r, 10_000)); } ``` **Who can write content over MCP.** Organization admins control the feature for everyone with **Allow content changes via MCP** in **Settings → MCP → General**, which is **on by default**. When it's off, `create_content` and `edit_content` are not registered for any MCP client in the organization. Reading content over MCP is unaffected. When content changes are allowed, the two tools are also registered only for callers who can save content in the project. This is the same check as the **Save** button in the Lightdash app: the caller's role must let them create charts or dashboards, and they must either be able to create spaces or have editor access to at least one space in the project. The check runs at tool registration, so users who can't save content don't see these tools in the tools list. For example, an Interactive Viewer with editor access to a space gets `create_content` and `edit_content`. An Interactive Viewer who hasn't been given access to any shared space still gets the tools if [default user spaces](/explore/default-user-spaces) are enabled for the project, since every user is an admin of their own default space. Project, space, and content-level checks still run at invocation time on top of the registration gate. This is independent of the per-agent **Allow agent to manage Lightdash content** toggle described in [Creating and editing content](/agents/enable-content-tools#enabling-content-editing). That toggle only controls whether one agent can create or edit content in its own chats, in the Lightdash app and Slack. It has no effect on `create_content` or `edit_content` called directly over MCP. A user with no access to any agent can still create and edit charts and dashboards over MCP, as long as the org-wide setting above is on and they can save content in at least one space in the project. When prompting an agent to build content, ask it to use [verified content](#data-exploration) as a reference. The agent can call `find_content` and `read_content` on a verified chart, then use that JSON as the template for `create_content`, so what it saves follows the patterns your team has already approved. **Example prompt:** *"Read the `weekly-revenue` chart, then create a copy called `weekly-revenue-by-region` that adds `customers_region` as a pivot dimension."* The assistant will call `read_content` to fetch the source chart, modify the JSON to add the pivot, and call `create_content` to save the new chart — returning a link to open it in Lightdash. > [!TIP] > > For bulk edits across many dashboards or as part of a CI/CD pipeline, the [download-edit-upload workflow](/workflow/edit-dashboards-with-agents) using the Lightdash CLI is still the recommended approach. MCP content tools are best for interactive edits inside an AI assistant. #### Data app builds MCP can build [data apps](/data-apps) — interactive applications generated from a brief on top of the active project's semantic layer — from any MCP client. Ask the assistant to build an app, wait a few minutes while it builds, then iterate on it with follow-up briefs. Each build adds a **version** to the app. * **Generate data app** (`generate_data_app`) - Start building a new app from a name and a brief. Optionally start from an existing dashboard or saved charts, pick a starter template, or apply a theme. * **Iterate data app** (`iterate_data_app`) - Build a new version of an existing app from a follow-up brief. The app keeps its name, slug, and theme unless you ask for a different theme. * **List data app themes** (`list_data_app_themes`) - List the organization's [themes](/data-apps/customize-themes) so the assistant can apply one when it builds. * **Get data app build status** (`get_data_app_build_status`) - Check how a build is going, and get the app's URL once it's ready. The assistant checks this for you while the build runs. Builds run in the background, so the assistant reports that the build has started and then follows up when it's ready. Once it is, the assistant can open the app for you, read it back with `read_content`, or keep iterating. An app built over MCP is created as the calling user's **personal app**: at the project root, in no space, visible only to them until they move it into a space from the Lightdash UI. This mirrors what the in-product [AI agent](/agents) does. **What enables these tools.** The data app tools only appear in the tools list when both of these are true: 1. Data apps are enabled for your organization. 2. The caller can create data apps in the active project. **Example prompts:** * *"Build a data app called Revenue Overview that shows monthly revenue and the top 10 customers, then tell me when it's ready."* * *"Add a region filter to the Revenue Overview app."* #### Chart types MCP can build and use [custom chart types](/visualizations/chart-studio), the reusable visualizations Chart Studio builds for a project, from any MCP client. Ask the assistant for a chart the built-in chart types can't draw, wait a few minutes while it builds, then iterate on it with follow-up briefs. Each build adds a **version** to the chart type. * **List custom chart types** (`list_custom_chart_types`) - Browse the project's chart types, including ones installed from the [chart library](/visualizations/chart-library), newest first. * **Find custom chart types** (`find_custom_chart_types`) - Search the project's chart types by name and description, or fetch one by slug. Each result has the chart type's inputs, display options, and a link to it in Chart Studio, so the assistant can reuse a chart type that fits before building a new one. * **Create custom chart type** (`create_custom_chart_type`) - Start building a new chart type from a name and a brief. Optionally share the first rows of a completed metric query as sample data, or apply a [theme](/data-apps/customize-themes). The sample rows only guide the build; they don't tie the chart type to that query. * **Iterate custom chart type** (`iterate_custom_chart_type`) - Build a new version of an existing chart type from a follow-up brief. The chart type keeps its inputs, so charts that already use it keep working. Builds run in the background, like [data app builds](#data-app-builds), so the assistant reports that the build has started and then follows up with a link to the chart type in Chart Studio when it's ready. A chart type built over MCP is the same as one built in Chart Studio: it's available across the whole project (see [Chart Studio permissions](/visualizations/chart-studio#permissions)). Once a chart type is built, the assistant can use it in two ways: * **Render a query with it** - `render_chart` draws a completed metric query with the chart type, binding the query's fields to the chart type's inputs. Like other rendered charts, it only displays in MCP App-capable clients. * **Save a chart with it** - `create_content` saves a chart that uses the chart type, with the same field mapping. The saved chart behaves like one [built in the Explorer](/visualizations/chart-studio#using-a-chart-type-in-a-chart). **What enables these tools.** `list_custom_chart_types` and `find_custom_chart_types` appear in the tools list when chart types are enabled for your organization and the caller can explore data in the active project. `create_custom_chart_type` and `iterate_custom_chart_type` appear when [Chart Studio](/visualizations/chart-studio) is available and the caller can [build chart types](/visualizations/chart-studio#permissions) in the active project. **Example prompts:** * *"Show monthly revenue by product category as a calendar heatmap. Build a chart type for it if we don't have one."* * *"Render the last query with the Calendar Heatmap chart type."* * *"Add a color legend to the Calendar Heatmap chart type."* #### Scheduled deliveries * **Create scheduled delivery** (`create_scheduled_delivery`) - Schedule an existing chart or dashboard to Slack, email, or another supported destination on a cron schedule. Point the tool at the content by slug and pass the schedule and recipients — the delivery is created against the active project using the caller's permissions. **What enables this tool.** `create_scheduled_delivery` only appears in the tools list when both of these are true: 1. **Allow content changes via MCP** is on (**Settings → MCP → General**). 2. The caller's role holds the `create:ScheduledDeliveries` scope. **Roles that get `create:ScheduledDeliveries` by default:** Interactive Viewers, Editors, Developers, Admins. **Viewers** do not. Custom roles must add the scope explicitly. **Example prompt:** *"Set up a scheduled delivery of the `weekly-ecom-orders` chart to #analytics-updates in Slack every Monday at 9am."* The assistant will call `create_scheduled_delivery` with the chart's slug, the cron schedule, and the Slack destination — mirroring the [AI agent](/agents) `createScheduledDelivery` tool but exposed to any MCP client. #### Agent context * **Route agent** (`route_agent`) - Automatically select the best agent for a user prompt within a project. This is the preferred way to pick an agent — it mirrors the [AI Router](/agents/enable-ai-router) experience in the Lightdash app, so MCP sessions get the same automatic agent selection. * **List agents** (`list_agents`) - Discover available AI agents and their areas of expertise To work as an agent, the AI assistant passes the agent's `agentUuid` to the tools it calls. Without an `agentUuid`, tools use the full project. To lock an integration to one agent, [pin it with the `X-Lightdash-Agent` header](#pin-an-agent-with-the-x-lightdash-agent-header). These tools are covered in detail in the [Using AI agent context](#using-ai-agent-context) section below. When a tool call passes an `agentUuid`, the agent's scope applies to that call: data exploration is limited to the agent's explores, and content tools (find, list, read, create, and edit) only see spaces the agent has access to. #### Skills Lightdash ships built-in skills (such as `developing-in-lightdash`) that give AI assistants guidance for working with Lightdash — for example, conventions for writing dbt models, charts, and dashboards. These skills are exposed as MCP resources, which most clients consume automatically. Your organization's [custom agent skills](/agents/custom-agent-skills) are available through the same MCP connection. When an AI agent is active in the session, MCP exposes the custom skills attached to that agent. Without an active agent, it exposes the organization skills the caller has permission to view. For MCP clients that don't read resources directly (e.g. Claude Code), three fallback tools let the assistant discover and load the same content: * **List skills** (`list_skills`) - Return the available built-in and custom skills along with their supporting resource files * **Read skill** (`read_skill`) - Read the main `SKILL.md` instructions for a skill by name (e.g. `developing-in-lightdash`) * **Read skill resource** (`read_skill_resource`) - Read a supporting resource file for a skill by name and resource path (e.g. `resources/dashboard-best-practices.md`) You don't need to call these tools explicitly — when relevant, the assistant will call `list_skills` to discover what's available and then load the skill content it needs. If your client already supports MCP resources, you can ignore these tools; both paths return the same content. > [accordion] Skill resources via MCP (for developers) > > The Lightdash MCP server exposes built-in and custom skills as MCP resources, so any MCP-compatible client can discover and load them at runtime — no CLI install required. > > The server advertises support via the `io.modelcontextprotocol/skills` extension capability returned from `initialize`. Clients that don't recognize the extension can still list and read the resources directly. > > **Available resources:** > > | URI | Type | Description | > | - | - | - | > | `skill://index.json` | `application/json` | Discovery index listing every built-in skill and its supporting files. | > | `skill://lightdash//SKILL.md` | `text/markdown` | A skill's instructions and frontmatter (e.g. `skill://lightdash/developing-in-lightdash/SKILL.md`). | > | `skill://lightdash//resources/` | `text/markdown` | Supporting reference files for a skill. | > | `skill://custom/index.json` | `application/json` | Discovery index for the custom skills available to the caller. | > | `skill://custom//SKILL.md` | `text/markdown` | A custom skill's instructions and frontmatter. | > | `skill://custom//resources/` | `text/markdown` | A custom skill's supporting resource file. | > > **Example: list and read a skill via JSON-RPC** > > ```json theme={null} > // List available resources > { "jsonrpc": "2.0", "id": 1, "method": "resources/list", "params": {} } > > // Read the discovery index > { "jsonrpc": "2.0", "id": 2, "method": "resources/read", > "params": { "uri": "skill://index.json" } } > > // Read a specific skill > { "jsonrpc": "2.0", "id": 3, "method": "resources/read", > "params": { "uri": "skill://lightdash/developing-in-lightdash/SKILL.md" } } > ``` > [!TIP] > > If you're working in Claude Code, Cursor, or another supported editor, you can also [install skills via the CLI](/workflow/install-agent-skills#installing-skills) — it ships the same files to your local agent without requiring an MCP round trip. ### Example conversations Here are some examples of how you can interact with AI assistants using MCP: #### Example 1: Verifying your MCP connection After connecting, verify that the MCP integration is working by asking your AI assistant to list available tools. **Prompt:** *"What Lightdash tools do you have access to?"* The assistant will confirm the connection and list the available MCP tools, such as `list_projects`, `grep_fields`, `run_metric_query`, `run_sql`, and others. This is a quick way to verify that authentication succeeded and the MCP server is reachable. > [accordion] See screenshot > > ![Verifying MCP connection and listing available tools](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/lightdash-mcp/examples-01-verifying-mcp-connection.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=e9d15d5b0eff278fc9f7975302542122) #### Example 2: Setting up a project and finding dashboards Before querying data, the assistant needs to know which project to use. Then you can search for existing dashboards and charts. **Prompt:** *"What projects do I have access to? Set the Jaffle Shop project, then show me all dashboards related to revenue."* The assistant will: 1. Call `list_projects` to show your available projects 2. Use the "Jaffle Shop" project's UUID in the next calls 3. Call `find_content` with your search term to find matching dashboards and charts **Expected output:** A list of dashboards and charts matching "revenue", including their names, descriptions, and direct links to view them in Lightdash. > [accordion] See screenshot > > ![Setting up project context and finding dashboards](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/lightdash-mcp/examples-02-setting-up-project-and-finding-dashboards.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=453b477f2d1e8f625cae58e6ab5d6c32) #### Example 3: Exploring data and running a metric query Once a project is active, you can explore data models and run queries using your semantic layer. **Prompt:** *"What metrics do we have for orders? Show me total revenue by month for the last 6 months as a bar chart."* The assistant will: 1. Call `grep_fields` to search for order-related metrics and dimensions (e.g., `orders_total_revenue`, `orders_order_date`) 2. Call `run_metric_query` with the appropriate explore, metrics, dimensions, filters, and sort order to fetch the data and render a visualization **Expected output:** A bar chart showing monthly revenue for the last 6 months, along with the underlying data table. The query uses your semantic layer definitions, so metric calculations and joins are handled automatically. > [accordion] See screenshot > > ![Finding explores and fields, then executing metric queries to analyze data](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/lightdash-mcp/examples-03-finding-explores-and-fields-and-executing-metric-query-to-analyze-data.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=15986e1986d49e38cb9eaa2e09a974a7) ## Using AI agent context If your organization has [Lightdash AI agents](/agents) configured, you can reuse their configuration in your MCP sessions — so you get consistent guidance regardless of where you're working. Organization admins enable these tools with **Enable agents over MCP** in **Settings → MCP → General**. While [agent permissions](/agents/agent-permissions#agents-over-mcp) are available to your organization, admins change this setting on **Organization settings → Agents**. ### How is this different from Lightdash AI agents? [Lightdash AI agents](/agents) are a fully managed experience inside Lightdash and Slack. They handle everything end-to-end: interpreting your question, picking the right data, running queries, and presenting results. With MCP, you can use Lightdash data in other contexts, but the AI assistant driving an MCP session doesn't have the same specialized tuning that Lightdash AI agents provide out of the box. Agent context via MCP bridges that gap: it brings your agents' domain knowledge into any MCP session. ### What you get from agent context When you activate an agent in your MCP session, your AI assistant receives: * **[Specialized content](/agents/effective-analytics-with-agents#think-specialized-not-general)**: only the data models relevant to that agent's domain * **[Verified answers](/agents/verified-answers#how-verified-answers-work)**: curated example queries that demonstrate correct usage of the data model * **[Custom instructions](/agents/set-up-agents#instructions)**: domain-specific rules like *"Always filter orders by status = 'completed'"* ### Example workflow 1. **Choose your project** — `get_context` lists the projects you can access 2. **Let the router pick an agent** with `route_agent` — pass the user's prompt and Lightdash returns the best-fit agent. Use `list_agents` only when you want to inspect candidates or pick one manually. 3. **Ask your questions** — the AI assistant passes the agent's `agentUuid` to its tool calls, so the agent's context guides queries To skip routing and always use one agent, [pin it with the `X-Lightdash-Agent` header](#pin-an-agent-with-the-x-lightdash-agent-header). `route_agent` chooses between agents the user can already access — it never widens permissions. If only one agent is accessible, it activates that agent directly; if none are accessible, it returns an error so the assistant can fall back to the unscoped project context. **Prompt:** *"What AI agents are available?"* > [accordion] See screenshot: listing agents > > ![Listing available AI agents in a project](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/lightdash-mcp/examples-04-list-agents.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=366d5d3a544a7c4abdf82ab28d869348) **Prompt:** *"Use the Sales Analyst agent."* > [accordion] See screenshot: setting agent and viewing explores > > ![Setting an AI agent and viewing its available explores](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/lightdash-mcp/examples-05-set-agent-and-see-explores.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=091816be31928c05296750d4cac37421) Once an agent is active, your queries automatically follow its instructions. For example, with a Sales Analyst agent configured with these instructions: ``` You are a Sales analyst for Jaffle Shop. Your role is to answer questions about revenue, orders, customers and subscriptions. Key guidelines: - Use the orders explore as the starting point for revenue and order volume questions. - Always include a time dimension when showing trends. Default to monthly granularity unless the user specifies otherwise. - Format currency values in CAD. ``` **Prompt:** *"Can you show me revenue so far?"* The assistant will automatically use the `orders` explore, include a monthly time dimension, and format values in CAD — all without you specifying these details, because the agent's instructions guide the query. > [accordion] See screenshot: querying with agent context > > ![Asking a question with agent context applied for better results](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/lightdash-mcp/examples-06-ask-question-with-agent-context.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=dcbc929939693d42b7548753df32ceda) ## Built-in prompt The Lightdash MCP server includes a built-in **`lightdash-analyst`** prompt with guidelines for querying data effectively. MCP clients that support prompts can use this automatically, so you don't need to configure custom instructions manually. When an [AI agent](#using-ai-agent-context) is active, the prompt automatically adapts to include the agent's context. ## Best practices To get the most value from MCP, ensure your Lightdash data is well-organized and documented. See our [Effective analytics with agents](/agents/effective-analytics-with-agents) for detailed recommendations on: * Organizing and naming your data models * Writing effective documentation and AI hints * Optimizing for AI assistant performance * Security and permissions considerations *** ## Lightdash Docs MCP The public Docs MCP endpoint gives AI coding agents access to Lightdash documentation without authenticating to your project. It is separate from the data and content tools described on this page. Follow [Lightdash Docs MCP setup](/agents/lightdash-docs-mcp) to connect your coding tool. ## FAQ **Q: Does Lightdash MCP store my data or query results?** A: No, Lightdash MCP does not store any query results, conversation responses, or data. MCP acts as a bridge that allows AI assistants to access your Lightdash metadata and execute queries in real-time. The MCP consumer (your AI assistant) is responsible for any data storage. Depending on which AI assistant you use, data might be shared with third parties according to their privacy policies. **Q: Can multiple team members use MCP?** A: Yes, each team member can set up their own MCP connection with their individual Lightdash credentials. Each connection respects that user's specific permissions and access controls. **Q: Can MCP modify my data or dashboards?** A: MCP can create and edit Lightdash charts and dashboards via the [content-as-code tools](#editing-content), can build [custom chart types](#chart-types), and can create [scheduled deliveries](#scheduled-deliveries), when your user account has the required permissions. MCP cannot modify your underlying warehouse data — query execution is read-only (metric queries and SQL `SELECT` only). All write operations respect your existing Lightdash permissions and project access controls, and each write tool is only registered for users whose role grants the corresponding scope. **Q: Claude returns data as text but no visual chart is displayed. What's wrong?** A: Claude uses the domain `claudemcpcontent.com` to render visual content from MCP connectors. If this domain is blocked by your corporate firewall, VPN, internet security tool, or a browser extension (like an ad blocker), Claude will fall back to text-only output. See [Network requirements](#network-requirements) above for the full list of domains to allowlist. # Set up AI agents Source: https://docs.lightdash.com/agents/set-up-agents Create an agent, configure its instructions and access, and test it before sharing Create an agent for a team, business domain, or repeatable task. Configure its instructions and data scope, test it with representative questions, then share it with the people who need it. If you want to use an existing agent, go to [Using AI agents](/agents/use-ai-agents). ## Before you begin * An organization admin must [enable AI features](/workspace-admin/ai-settings#enable-ai-features). * You need a Developer or Admin role, or a custom role with `manage:AiAgent`, to create and manage agents. See [Agent permissions](/agents/agent-permissions#who-can-use-agents). * Choose the agent's audience, job, and data scope. [Effective analytics with agents](/agents/effective-analytics-with-agents#think-specialized-not-general) explains how to define a useful scope. ## Create an agent 1. Open **Ask AI** in the project where the agent will work. 2. Open the agent dropdown and select **Create new agent**. ![The agent picker listing the project's agents, with Create new agent at the bottom](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/create-new-agent.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=048050d8a59ea9ea5fd030dcf1c7577e) 3. Set the name, description, instructions, and access using the [configuration options below](#configure-your-agent). To keep the agent private while testing, choose **Admins & developers only** under **Access & privacy** → **Who can use the agent**. 4. Click **Create agent**. You can then add reference documents and return to the settings to refine the configuration. ## Configure your agent ### Name and image Set **Name** and an avatar so your team can recognize the agent. Add a **Description** too. It shows above the message input every time someone opens a new thread, before they type anything, so use it for a short welcome or a list of the topics the agent covers. Instructions can't do this reliably: the model reads them as guidance and decides for itself whether to open with a greeting. ### Instructions Add the role, priorities, analysis defaults, constraints, and communication style that should apply to every conversation with this agent. Keep stable model and field definitions in the semantic layer, and use knowledge documents for longer reference material. See [Writing effective instructions](/agents/effective-analytics-with-agents#writing-effective-instructions) for examples and authoring guidance. Instructions belong to one agent, and there's no organization-wide instructions field. Use them to define names the agent could misread, for example "Acme Planner is our app. A question about Acme Planner is about the product, not a person." To give every agent in a project the same terminology, use [agent context](/agents/agent-context) instead. Instructions don't widen the agent's access. Configure [data access](/agents/data-access) and [agent permissions](/agents/agent-permissions) separately. ### Default model (optional) Choose the default model and reasoning setting used for new chats with this agent. Leave the model empty to inherit the organization default. Lightdash resolves the model for a new chat in this order: 1. The user's per-chat selection 2. The agent's default model 3. The [organization default model](/workspace-admin/ai-settings#set-an-organization-default-ai-model) 4. The system default Users can still change the model in each chat, and existing threads continue with the model they were started with. Slack has no model picker, so a new Slack thread starts on the agent's default model, or the organization default if the agent has none. ### Knowledge documents (optional) After creating the agent, upload longer reference material under **Knowledge & data** → **Reference documents**. See [Knowledge documents](/agents/knowledge-documents) for upload, retrieval, and editing behavior. ### Skills (optional) Attach a reusable workflow from your organization's skill library, or create one in the agent's **Skills** section. See [Custom agent skills](/agents/custom-agent-skills) for authoring and invocation. ### Data access Choose whether the agent can read query results or work with metadata only. See [data access modes](/agents/data-access#data-access-modes) for the defaults and behavior. Use **Pass user information** to [tailor answers to who is asking](/agents/data-access#personalizing-answers-to-who-is-asking). If the agent can use [SQL mode](/agents/use-ai-agents#sql-mode), limit which schemas it can read with [Agent data scope](/agents/data-access#scoping-raw-sql-to-specific-schemas). ### Composer queries (optional) [Beta](/support/feature-badges#beta) The **Composer queries** switch controls whether the agent can [post-process results with DuckDB and Python](/agents/use-ai-agents#post-process-results-with-duckdb-and-python). It appears once that feature is turned on for your organization and is on by default. It needs [data access](#data-access) that lets the agent read rows. Turn it off to keep an agent on the standard query tools. ### User and group access (optional) By default, your agent is available to everyone in the project. To change that, open the agent's settings and go to **Access & privacy** → **Who can use the agent**: * **Everyone in the project** — every project member can see and use the agent. This is the default. * **Admins & developers only** — hidden from everyone else, which is useful while you set up or test the agent. * **Specific users & groups** — only the users and groups you pick. Admins, developers and anyone else with the `manage:AiAgent` scope can always use every agent in the project, whatever you choose here. Someone who can't use any agent in a project doesn't see **Ask AI** in that project, so set this on each agent in the project. This controls who can use the agent, which is separate from [data access control](/agents/data-access) (what data the agent can query). Narrowing this list also changes which agent other people land on: someone who can use only one agent in the project opens it directly. See [Set your default agent](/agents/use-ai-agents#set-your-default-agent). ### Tags (optional) Add **Tags** to limit the agent to part of your semantic layer. Configure matching tags on your models and fields first; see [limiting access to specific explores and fields](/agents/data-access#limiting-access-to-specific-explores-and-fields) for the YAML and filtering rules. ![The agent's Access control section, with a prod tag in the Tags field](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/ai-tags.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=6a186a934246e9d4136cea2b52f0bfd3) ### Enable AI writeback (optional) Allow your agent to edit dbt or native Lightdash YAML models from chat — renaming metrics, adding dimensions, or updating descriptions — and open a pull request for review. See [AI writeback](/agents/ai-writeback) for supported connections and setup. ## Test and share the agent 1. [Start a conversation](/agents/use-ai-agents#start-a-conversation) with the agent and ask a question your team regularly needs to answer. 2. Inspect the query, chart, and explanation. Check that the agent uses the intended metrics, filters, and comparison period. 3. Adjust its configuration and click **Save changes**. Start a fresh conversation to test the same question without the earlier conversation's context. 4. Set [who can use the agent](#user-and-group-access-optional) when it is ready for your team. Use [evaluation suites](/agents/create-evaluation-suites) to check a repeatable set of questions as you change the agent or semantic layer. To make the agent available in team channels, follow [Set up agents in Slack](/agents/set-up-slack-agents). # Set up agents in Slack Source: https://docs.lightdash.com/agents/set-up-slack-agents Connect an agent to a Slack channel or route questions across several agents Connect an agent to a Slack channel so your team can investigate data and follow up in threads where they already work. Use a single-agent channel for a focused workflow, or a multi-agent channel to let the AI Router choose an agent. ## Before you begin An organization admin must [connect Slack to Lightdash](/integrations/slack), and you need permission to manage the agent. If you haven't created one, follow [Set up AI agents](/agents/set-up-agents). ## Connect a single-agent channel 1. Open the agent's **Integrations** settings in Lightdash. 2. Enable **Slack** and select the channels where the agent should respond. ![The agent's Integrations section, with Slack enabled and four channels selected](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/ai-integrations.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=58ac5678b1849d423491fd300825feca) 3. In each Slack channel, open **Edit settings** → **Integrations** and add **Lightdash for analytics**. ![Slack's add-apps dialog with Lightdash for analytics highlighted](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/add-lightdash-app-to-slack.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=86e49e009f777cf86be1c8e9cd37404c) 4. Mention the Lightdash app with a question, such as "Show me total order amount over time". The agent replies in a thread. ![A Slack user mentioning the agent with a question and receiving replies in a thread](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/use-agent-in-slack.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=724ef8cdda0c413f80da67684507b29e) Mention the app in each follow-up message to continue the conversation. If someone mentions it without a question, it replies with a fixed welcome; the agent's description and instructions don't change that welcome. To let the agent read earlier messages in that thread, an admin turns on **AI Agents thread access consent** in **Organization Settings** → **Integrations** → **Slack**. It reads only that thread, including messages that didn't mention it, rather than other channel messages. ![The Slack integration settings with AI Agents thread access consent enabled](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/ai-agent-slack-thread-consent.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=8c0efe74dbec38c3425e6b3fe2ddfc7d) ## Slack channels: single-agent vs. multi-agent The per-agent integration path assigns one agent to each Slack channel. For several agents in the same channel, configure a **multi-agent channel** at the organization level. The [AI Router](/agents/enable-ai-router) picks an agent for each question sent to the Lightdash Slack app. How you interact with the app depends on where you're posting: * **New message in the multi-agent channel** — no `@mention` needed. Lightdash picks up the message automatically and routes it to the best-fit agent. * **Reply in an existing thread** — `@mention` the Lightdash Slack app. Without the mention, Lightdash will not respond in-thread. ### Setting up a multi-agent Slack channel Multi-agent channels are configured at the **organization level**, not per-agent: 1. Go to **Organization Settings** → **Integrations** → **Slack**. 2. Find the **Multi-agent channel** setting in the AI Agents configuration panel. 3. Select the Slack channel you want to designate as the multi-agent channel. 4. Click **Save**. Once a channel is designated as the multi-agent channel, all eligible agents in your organization are automatically available in that channel. You do **not** need to add each agent individually via its own **AI Agent → Integrations → Slack** settings. **Scoping which agents appear:** by default, agents from every project in your organization are eligible. To restrict the channel to agents from specific projects, toggle off **Allow all project agents to appear** and pick the projects you want to include. If you see the error **"This Slack channel is already assigned to another AI agent"** while trying to attach a second agent via the per-agent integration path, that path only supports single-agent channels. Switch to the org-level multi-agent channel setup described above instead. ## Linking an agent from Slack You don't have to go to the Lightdash UI to connect an agent to a Slack channel. When someone `@mentions` the Lightdash app in a channel that has no agent configured, Lightdash offers to link one right in the thread: * **One manageable agent** — Lightdash auto-links it to the channel, confirms the link in-thread, and then answers the original question in the same turn. * **Multiple manageable agents** — Lightdash posts an in-thread picker showing every agent the user can manage (labeled by agent and project). Selecting one links it to the channel and processes the original question. * **No manageable agents** — Lightdash posts an ephemeral message asking the user to contact an admin, with a deep link to the AI agents page. Only users with `manage:AiAgent` on an agent can link it. If the Slack user lacks that permission on every agent or isn't linked to a Lightdash account, no channel binding is created. If your organization needs the configured channel list to be a strict allowlist, an admin can turn off [automatic channel linking](/integrations/slack#automatic-channel-linking) in the Slack integration settings. # Thread retention Source: https://docs.lightdash.com/agents/thread-retention Automatically delete AI agent threads after a period of inactivity > [!NOTE] > > Thread retention is an Enterprise feature, enabled per organization on > request — [contact us](/support) to turn it on. Self-hosted Enterprise > deployments set `LIGHTDASH_ENABLE_FEATURE_FLAGS=ai-thread-retention` — see > [feature flag environment > variables](/self-host/customize-deployment/environment-variables#feature-flags). By default, Lightdash keeps AI agent threads forever. Organizations with compliance or privacy requirements can set a retention window instead: threads with no activity for the configured period are automatically and permanently deleted, once per hour. Retention only applies to threads, never to your warehouse data, which stays in your warehouse under your own policies. ## How retention works Retention is configured in whole hours (presets from 1 hour to 90 days, or a custom value), at two levels: * **Organization default** — applies to every agent in the organization, including threads that aren't linked to an agent. * **Per-agent window** — an agent can set a *shorter* window than the organization default, making the organization value the ceiling. The clock is based on **inactivity**: a thread expires only when it has had no new messages for the whole window, measured from its latest activity. ## What gets deleted When a thread expires, everything derived from it is deleted with it: * prompts, responses, tool calls and tool results, and reasoning * share links (revoked) * agent memories learned from the thread * evaluation prompts that reference the thread (evaluation suites may shrink), and past evaluation runs' threads Content created from threads, like saved charts and dashboards, is stored independently and is not affected. Deletion is permanent. When an admin lowers the organization window, Lightdash shows how many threads across how many agents will be deleted before the change is confirmed. ## What retention does not cover The retention window applies to AI agent thread content stored by Lightdash. Adjacent stores keep their own, separately bounded retention: | Store | Retention | | - | - | | Slack messages | Live in your Slack workspace and follow its retention — Lightdash cannot delete them | | MCP tool calls | 90 days | | Query history (compiled SQL and metric queries) | 32 days by default, configurable per instance | | Query results cache | Up to 1 day (up to 31 days for deep research) | ## Configuring retention **Organization default**: go to **Organization settings** → **Ask AI** → **General** → **Thread retention**. Lowering the window (or setting one where there was none) asks for confirmation and shows how many existing threads will be deleted. ![Conversation retention setting in the organization Ask AI settings](https://mintcdn.com/lightdash/_tikN_XrfiiG95i9/images/agents/conversation-retention-org-light.png?fit=max\&auto=format\&n=_tikN_XrfiiG95i9\&q=85\&s=3917081e3fd8ec30ac2de1de643f1acb) **Per-agent window**: in the agent's settings under **Permissions** → **Thread retention**. When an organization default exists, it caps the values you can pick, and leaving the agent setting empty inherits the organization default. ![Conversation retention setting in the agent's Permissions section](https://mintcdn.com/lightdash/_tikN_XrfiiG95i9/images/agents/conversation-retention-agent-light.png?fit=max\&auto=format\&n=_tikN_XrfiiG95i9\&q=85\&s=285f379ca9b808fe8c734d9e49e0b62a) ## Agents as code Agents managed [as code](/agents/agents-as-code) can set the per-agent window with the optional `threadRetentionHours` field: * a number sets the window (validated against the organization ceiling) * an explicit `null` clears the agent's window, inheriting the organization default * omitting the field leaves the stored setting unchanged Uploads into an organization where retention is not enabled ignore the field and return a warning instead of failing, so agent configuration stays portable across organizations. # Using AI agents Source: https://docs.lightdash.com/agents/use-ai-agents Start a conversation, pick options and a model, mention charts, and schedule deliveries Start a conversation, add context, and inspect the results your agent returns. To create or configure an agent, see [Set up AI agents](/agents/set-up-agents). ## Start a conversation Open **Ask AI** in your project and select an agent from the dropdown to start a new thread. If routing is enabled, select **Auto** to let the [AI Router](/agents/enable-ai-router) choose an agent for your request. The agent's page shows its name and description above the message input. If the agent has instructions, the info icon beside its name shows them. Type your question in the message input and click the send button. ### Conversations and saved results The agent uses the current thread's history to answer follow-up questions. A separate conversation starts without that history. Lightdash stores conversations and the query definitions behind their charts and tables until you delete the thread or its [retention window](/agents/thread-retention) expires. When you revisit a result, Lightdash queries the warehouse again, subject to [caching](/semantic-layer/caching). The written reply stays as it was, so a chart can show different numbers from the surrounding text if the data or models have changed. ### Composer options The **+** button in the message input opens the composer options. A check mark shows which options are on. The options you see depend on your permissions and your organization's settings: * **SQL Runner** turns on [SQL mode](#sql-mode) for the conversation. It appears if you can use the SQL Runner. * **Deep research** turns your question into a [deep research](/agents/deep-research) run, a long-running investigation that ends in a report. It appears when deep research is enabled and your role can start runs. ### Attach a file Select **+** in the message input and choose **Attach a document**, or drag a file straight into the chat box — the composer shows a **Drop files to analyze them** overlay while you drag. On self-hosted deployments, dragging and dropping a file needs Lightdash v2.425.0 or later; attaching through the **+** menu works on any version. The document picker accepts `.md`, `.markdown`, `.txt`, `.json`, `.yml`, `.yaml`, `.sql`, `.log`, `.xml`, `.html`, `.toml`, `.csv` and `.tsv`, and the server accepts any UTF-8 text file regardless of extension. Excel files (`.xlsx`) can't be attached — export the sheet to CSV first. Each file is limited to 1 MB. A prompt inlines only the first 32 KB of its attached files, combined, into the model's context; the agent reads anything beyond that straight from the attached files. If external sources are enabled for the project and you can manage them (Editor role or above), the menu also offers **Attach a CSV**. A CSV or TSV file you drop or pick imports as a queryable [external source](/explore/external-sources), so the agent can query it alongside warehouse data. Otherwise it attaches as a plain text document. See [External sources](/explore/external-sources) for setup and import limits. Attachments aren't available in [Deep research](/agents/deep-research#start-a-run) mode. This attachment picker is part of the Lightdash composer. When you mention an agent in Slack instead, it only reads the message text and, when enabled, the thread history — see [AI analyst agents](/integrations/slack#ai-analyst-agents) for what Slack mentions can and can't read. ### Model and reasoning When more than one model is available, the model picker beside the send button shows which model answers. Click it to choose another model. For models that support reasoning, the same menu has a **Reasoning** setting with two levels, **Default** and **High**, and the picker shows **High** beside the model name when it is on. A new conversation starts on the agent's [default model](/agents/set-up-agents#default-model-optional). Admins decide which models appear in the picker; see [Control which models users can pick](/workspace-admin/ai-settings#control-which-models-users-can-pick). One answer can take several model calls. The agent looks up fields, runs queries and builds charts in separate steps, and each step sends the context gathered so far back to the model. So a question that needs more steps, a long thread, **High** reasoning or a larger model all use more tokens per answer. To see token counts by model and feature, use the **AI usage** explore in the [usage analytics project](/workspace-admin/usage-analytics-project). When fast mode is available on your instance, the agent hands small routine choices, such as ranking the relevant fields, titling a chart or diagnosing an empty result, to a quick decision model, so simple questions come back faster. There's nothing to train or set up: each decision works from what's in your project when you ask, such as your question, the recent messages in the thread, and the names, labels, descriptions and AI hints of the fields that look relevant. Fast mode doesn't run when your organization or project uses its own [AI provider keys or Bedrock credentials](/workspace-admin/ai-settings#bring-your-own-ai-providers-and-models), or for an agent set to its own **AI provider credential**. ## Set your default agent You can assign your default agent in Ask AI by clicking the star by your agent's name. ![Set Default Agent](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/set_default_agent.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=29c6d91c2d03e85f715caa5281ea808d) The default agent setting is per-user, per-project. There's no project-wide default at the moment. When you have a default agent set, Ask AI opens it directly — even if the [AI Router](/agents/enable-ai-router) is enabled. If you haven't set a default and the AI Router is enabled, Lightdash routes each question to the best-fit agent automatically. If the router is off and you have no default, Ask AI opens the first agent in the project's list, sorted alphabetically by agent slug (not by creation date). Ask AI only lists and chooses between the agents you have access to (see [User and group access](/agents/set-up-agents#user-and-group-access-optional)). If you can use only one agent in a project, that agent opens directly and the router isn't involved. To steer everyone without a personal default toward one agent, you have two options: * **Restrict the specialized agent's audience.** Under its [User and group access](/agents/set-up-agents#user-and-group-access-optional) settings, limit it to the people who use it. Everyone else, apart from admins, developers and anyone with the `manage:AiAgent` scope, can then reach only the general agent, which opens directly for them. Pick this when other teams shouldn't use the specialized agent at all. * **Enable the AI Router** and add [routing instructions](/agents/enable-ai-router#routing-instructions) such as *"Use @general-agent unless the question is about billing."* Pick this when other teams should still be able to reach the specialized agent. ## Asking about a chart or dashboard You can launch an AI conversation with a chart or dashboard pre-loaded as context. From the resource's `⋯` menu, click **Ask AI Agent**. This opens a new tab on the new-thread page for your default agent. The chart or dashboard appears as a **pinned context card** above the input, and the agent treats it as the subject of the conversation. ![Ask AI Agent menu item on a saved chart](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/ask-ai-agent-from-chart.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=932e3df472f8b3fa49af480030b082e9) ### Pinned context * The pinned card stays visible above your message in the thread, so anyone reading later can tell what was being discussed. * Click the pinned card to open the chart or dashboard in a new tab. * The pinned context persists across follow-up messages — *"now break it down by region"* still refers to the originally pinned chart. ### Linked dashboard A thread created through the API or the React SDK can be bound to a dashboard for its whole life, which you can't change afterwards. Pinned context belongs to one message; a binding belongs to the whole thread. See [Bind a thread to a dashboard](/embed/embed-ai-agents#bind-a-thread-to-a-dashboard) for how to create one. * A **Linked dashboard** card at the top of the thread opens the dashboard. The thread never pins a different dashboard from the page you're on, and `@` tile mentions come from the linked dashboard. * If the agent can create content, it can only change the linked dashboard and the charts saved in it. See [Threads bound to a dashboard](/agents/enable-content-tools#threads-bound-to-a-dashboard). * If the thread was created with background context, admins see it in a collapsed **Thread context** block. Other users don't see it, but the agent always uses it. Custom roles can grant the `view:AiAgentThreadContext` scope to show it. * If the dashboard is deleted, the card shows **Dashboard no longer available**. You can keep asking questions, but the agent can't change saved content in that thread. ### Mentioning dashboard tiles When the pinned context is a dashboard, you can `@`-mention any of its chart tiles directly in your message to focus the agent on a single tile. Type `@` in the input and pick a tile from the **Dashboard tiles** group in the suggestion list. The selected chart is added alongside the pinned dashboard, so the agent answers about that specific tile while still keeping the dashboard as overall context. This is useful when a dashboard has many charts and you want to drill into one without leaving the thread: * *"Why did @Weekly active users drop last week?"* * *"Break @Revenue by region down by channel."* ### What you can ask When you pin a saved chart, the agent can read its actual data (subject to your [data access setting](/agents/data-access)). It honors the chart's saved filters, sorts, custom metrics, and [parameter values](/semantic-layer/parameters), so you can ask: * *"Why is this trending up?"* * *"Are there outliers in this chart?"* * *"Compare this chart's last 30 days to the previous period."* If your agent has data access disabled, pinning still works — the agent sees the chart's structure (name, dimensions, metrics) but no row values are sent to the underlying LLM. ## Mentioning charts and dashboards with `@` You can reference saved charts and dashboards directly from the chat input by typing `@`. This adds them as context for the agent's next message, similar to a pinned card, without leaving the conversation. Type `@` followed by part of a name to open the suggestion menu. Suggestions are grouped so the most relevant content appears first: * **Already mentioned** — content already referenced earlier in this thread. * **Current page** — the chart or dashboard you're viewing when you open the chat. * **Dashboard tiles** — charts on the dashboard you're currently viewing. * **Search results** — any chart or dashboard you have access to, ranked by your search query. [Verified content](/explore/verified-content) is marked with a green check. Use the arrow keys to highlight a suggestion and press `Enter` or `Tab` to insert it. While the menu is open, `Enter` selects the suggestion instead of sending the message. Each mention becomes a chip in the input — for example, `@Weekly revenue` — and travels with the message as prompt context. The agent uses the same access rules as a pinned card: it can read the resource's structure and (when [data access](/agents/data-access) is enabled) its underlying data. > [!TIP] > > Mention multiple resources in a single message to ask comparative questions, such as *"How does @Weekly revenue compare to @Marketing dashboard's signups trend?"* You can only mention content you have permission to view. Mentions are available in agent threads, in the AI Router, and in the launcher used to start new threads. ## Share a thread To let a colleague continue from your conversation, click the **Share thread** icon in the thread header and copy the link. Anyone with the link who can use the agent and start threads opens the conversation as their own copy, and can continue it independently. The copy includes the conversation up to the moment you created the link; messages you send afterwards aren't included. The **Share thread** icon appears on threads started in the Lightdash app or through the API, not on threads started in Slack. Sending the thread's own URL instead only works for you and for users who can manage the agent, such as project developers and admins, who can read it but not reply (see [Read-only threads](#read-only-threads)). ## Read-only threads In some cases, the chat input on an existing thread is disabled and you can't send follow-up messages. The input shows a short message explaining why. You'll see this when: * **The thread was started in Slack.** Reply in the original Slack thread to continue the conversation. * **The thread belongs to another user.** You can read the conversation, but only the original author can post follow-ups. * **The model used in the thread is no longer available.** Threads are pinned to the model that produced the first assistant response, so the conversation history stays consistent. If an admin removes that model from the agent — or the provider no longer offers it — start a new thread to continue with one of the agent's current models. To start a new thread, open the agent and click **New thread**. ## Delete a thread To delete one of your threads, open its menu in the agent's thread list and click **Delete**. Deletion is permanent and also removes the thread's tool calls and the memories the agent learned from it. You need the Editor role or higher in the project. Threads started in Slack can't be deleted from the thread list, because that wouldn't remove the messages from Slack. People who manage the project's agents, such as project admins and developers, can delete any thread there, Slack ones included, from **Settings** → **Ask AI** → **Threads**. To delete threads automatically after a period of inactivity, see [Thread retention](/agents/thread-retention). ## Schedule a recurring delivery from a conversation When an agent lands on an answer worth watching, you can turn that conversation into a recurring [scheduled delivery](/explore/create-scheduled-deliveries). Lightdash re-runs the agent on your chosen frequency and sends the refreshed chart, along with an AI-written summary, to Slack, email, or Microsoft Teams. Open the `⋯` **Quick actions** menu on a saved chart the agent produced and choose **Schedule delivery**. ![Schedule delivery quick action in an AI agent conversation](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/schedule-delivery-from-conversation_light.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=b292ee5a258fa52d0bfccff8d4fd3686) This opens the scheduled delivery form pre-filled to run that conversation's agent over the chart, so you get the same style of answer, on a schedule, without rebuilding anything. See [AI agent](/explore/create-scheduled-deliveries#ai-agent) for how the generated message works. ## Example use cases ### Period-over-period comparisons Agents can answer time-comparison questions directly — month-over-month, year-over-year, or any custom offset — without you having to set up the comparison in the Explorer first. When you ask a comparison question, the agent picks a base metric, a time dimension, a granularity (day, week, month, quarter, or year), and an offset (how many periods back). It then runs the query and adds a comparison column next to the base metric, labelled with the offset (for example, `Revenue (Previous month)`). **Prompts that work well** * *"Compare revenue to last month"* * *"Month-over-month new users"* * *"Year-over-year orders by week"* * *"Show revenue this quarter vs the previous quarter, and vs the same quarter last year"* You can stack multiple comparisons on the same metric (for example, MoM and YoY together) and you can use a [custom metric](/explore/create-custom-fields) as the base. > [!TIP] > > Period-over-period is for comparing whole prior periods (last month, last quarter, last year). For period-to-date questions like MTD or YTD, ask the agent for a filtered aggregation instead — for example, *"revenue so far this month vs the same point last month"*. **Limitations** * The granularity must match the time dimension's interval — ask for *"monthly revenue vs last month"* (not *"daily revenue vs last month"*). * The agent can't yet sort or filter on the generated comparison column directly; sort or filter on the base metric or the time dimension instead. ### Advanced visualizations with window functions Ask an agent to build a three-month rolling average to smooth short-term variation. This demonstration shows the request and the resulting visualization. [YouTube video player](https://www.youtube.com/embed/S0jKfLjQEqM) Inspect the resulting [table calculation](/explore/table-calculations) to check its time order and window before using the chart in a report. ## SQL mode SQL mode lets the agent reach for raw SQL when a question can't be answered from the semantic layer alone — for example, when the data exists in your warehouse but hasn't been modeled as an explore yet. With SQL mode on, the agent can list warehouse tables, describe their columns, and run SQL queries against your warehouse. SQL mode can only read data. Lightdash validates every query before it runs and rejects anything that isn't a `SELECT` or `WITH` statement, so mutating or administrative SQL (`INSERT`, `UPDATE`, `DELETE`, DDL) never reaches your warehouse. SQL mode is **off by default** on every new thread. To turn it on for a conversation, open the [composer options](#composer-options) with the **+** button in the message input and select **SQL Runner**. ### When to use it * The data you need lives in a warehouse table that isn't part of an explore. * You want a one-off lookup, audit, or shape-of-the-data check before modeling it. * The agent has already told you it can't answer from the semantic layer. Prefer the default (semantic) mode for anything that *can* be answered from your modeled explores — answers stay governed by your dbt metrics, joins, and row-level filters. ### Who can use it The **SQL Runner** option is visible only to users who hold the **`manage:SqlRunner`** ability — the same permission required to use the [SQL Runner](/explore/sql-runner) page. If you don't see it, ask a workspace admin to grant SQL Runner access to your role. The default agent Lightdash creates with your first project (Aurora) ends its instructions with "If no explores are available yet, use your warehouse tools to discover the schema and answer with SQL." That fallback applies only in SQL mode for someone who can already use the SQL Runner. Everyone else is told there's no data to query until you set up explores. ### What SQL mode does not enforce User attributes are enforced by the semantic layer, so they apply to every query built from an explore: Explore, charts and dashboards, and AI agents answering in their default (semantic) mode. Anything that runs raw SQL against the warehouse runs outside the semantic layer, and `sql_filter`, `required_attributes` and `any_attributes` do not apply to it: * The [SQL Runner](/explore/sql-runner) * [SQL mode](/agents/use-ai-agents#sql-mode) in an AI agent conversation * The **Run SQL** tool of the [Lightdash MCP server](/agents/lightdash-mcp) * Hand-written SQL inside a semantic query: custom SQL dimensions, custom SQL metrics, and SQL [table calculations](/explore/table-calculations). They're pasted into the query as written, which is why authoring them needs `manage:CustomFields` or `manage:CustomSqlTableCalculations`. Every surface on this list needs a permission that Developer and Admin roles hold by default: `manage:SqlRunner` for the first three, `manage:CustomFields` or `manage:CustomSqlTableCalculations` for the last. A user without those cannot run raw SQL from any of them, whatever an agent's instructions say. If someone needs raw SQL and warehouse-enforced permissions at the same time, require [personal warehouse credentials](/personal-settings/personal-warehouse-connections) on the project so their queries run as their own warehouse user, and put the restrictions in the warehouse. ### How approvals work SQL mode is gated by a human-in-the-loop check on every query: 1. You turn on SQL mode for the thread. 2. You ask a question. The agent drafts a SQL query. 3. Lightdash shows the proposed SQL inline and waits for you to **Approve** or **Reject** before anything runs against your warehouse. 4. Approved queries return results to the agent, which then summarizes or visualizes them. Each SQL call is approved individually. To stop the prompts for the rest of a thread, choose **Approve & don't ask again this thread** instead of **Approve**; approvals don't carry over to other threads. [Deep research](/agents/deep-research) and the [Lightdash MCP server's Run SQL tool](/agents/lightdash-mcp#query-execution) don't pause for approval. ### SQL mode in Slack Slack-triggered prompts can only use SQL mode when your organization has the **"Require Slack users to authenticate with Lightdash"** setting (`aiRequireOAuth`) turned on. Without it, Slack messages run under a shared workspace-default identity, so SQL execution is disabled fail-closed whether or not SQL mode is on. See [User attribution and OAuth](/integrations/slack#user-attribution-and-oauth) for how to configure OAuth. ## Post-process results with DuckDB and Python [https://www.loom.com/embed/a59ba375ee024f109e96af15534c8ff5](https://www.loom.com/embed/a59ba375ee024f109e96af15534c8ff5) Ask for anomalous weeks, then open Lineage to see the semantic layer step feeding a Python step, and select the Python step to read its code [Beta](/support/feature-badges#beta) Some questions need a step after the query: joining two explores, comparing results against an [attached CSV](#attach-a-file), ranking or bucketing rows, or fitting a forecast. For these, the agent runs one or more queries, then post-processes their results with DuckDB SQL or Python before it answers. It is off by default. [Reach out to us](mailto:support@lightdash.com) to turn it on for your organization. Once it's on, you can turn it off for an individual agent with its [Composer queries](/agents/set-up-agents#composer-queries-optional) setting. The semantic layer runs first (or the SQL query, if approved in [SQL mode](#sql-mode)). DuckDB and Python only ever see the rows those queries returned, so metric definitions, joins, [data access](/agents/data-access) rules and SQL approvals apply exactly as they do for any other query. Neither DuckDB nor Python connects to your warehouse. ![Your warehouse and CSV feed Lightdash, where the semantic layer, warehouse SQL and external data steps run through a DuckDB and Python sandbox to produce the result](https://mintcdn.com/lightdash/hL1QebK0alPtnQWB/images/agents/post-process-duckdb-python_light.png?fit=max\&auto=format\&n=hL1QebK0alPtnQWB\&q=85\&s=f92d65311c8db77712a27428981ad118) ### How it works | Step | What it runs | Where it runs | | - | - | - | | **Semantic layer** | A metric query against an explore | Your warehouse, through the semantic layer | | **Warehouse SQL** | A read-only `SELECT` or `WITH` statement, with [approval](#how-approvals-work) | Your warehouse, in [SQL mode](#sql-mode) | | **DuckDB** | DuckDB SQL over the results of other steps | A sandbox inside Lightdash | | **Python** | pandas code over the results of other steps | A sandbox inside Lightdash | | **External data** | DuckDB SQL over a [CSV attached to the thread](#attach-a-file) | A sandbox inside Lightdash | A question that one metric query can answer still runs as a single query. The agent only adds DuckDB or Python steps when the question needs them. DuckDB and Python both run in a sandboxed environment that only receives the result rows the step references, and is destroyed after each run. Python steps can use pandas, numpy, scipy, pyarrow, scikit-learn and polars. They have no network access and can't install packages. ### Reading the result The agent shows the result as a card, the same way it shows a chart. Below it, the **Queries** bar shows how many steps ran. Expand it to see each step, grouped into **Sources**, **Transformations** and **Result**, or switch to **Graph** to see how they connect. **View query** shows a step's SQL and **View code** shows a Python step's code. Select a step to see its own rows, and **Back to result** to return. Opening a result runs the steps as the person viewing it, so viewers only ever see data they have access to. ### Limitations * A result built with DuckDB or Python lives in its thread. It can't be saved as a chart or added to a dashboard. A result with a single semantic layer step and no post-processing is a regular chart and can be saved. * Each step is subject to the AI query row limit. A DuckDB or Python step only sees the rows the steps before it returned, so the agent aggregates early when a step would hit its limit. ## Query execution stats When an agent runs a query against BigQuery, it gets the warehouse's statistics for the job back with the results. You can ask the agent how much data a query scanned or how long it took. For example: "How many bytes did that query process?" | Stat | What it means | | - | - | | Bytes processed | Data BigQuery read to run the query | | Bytes billed | Data BigQuery billed for the query, after its rounding and minimums | | Execution time | Time from job start to job end, as reported by BigQuery | | Warehouse cache hit | Whether BigQuery served the job from its own result cache | | Job ID | The BigQuery job ID, for looking the job up in the BigQuery console or `INFORMATION_SCHEMA.JOBS` | The stats cover metric queries and SQL mode queries. They are not reported when: * The results come from the [results cache](/semantic-layer/caching). No warehouse job runs, so there is nothing to report. * The project uses a warehouse other than BigQuery. ## Response time Each agent reply shows how long it took, as time to first token and total time. Hover over it for a breakdown of where that time went: | Stage | What it covers | | - | - | | Prep | Loading context, the explore catalog, and tools before the model starts | | Provider | Time the model provider spent generating. Shows `n/a` when the provider doesn't report it separately | | Query | Running queries against your warehouse | | API | Other tool calls, such as searching fields or content | | Render | Building charts, dashboards, apps, and exports | When they apply, the tooltip also counts queries served from the [results cache](/semantic-layer/caching) and queries that reused an earlier verified result. Times are measured on the server, and stages that run at the same time can overlap, so they don't always add up to the total. ## Known limitations ### Data analysis and calculations AI agents can query your actual data through metric queries, field value search, and [SQL mode](#sql-mode), and can define [custom metrics](/explore/create-custom-fields) and formula [table calculations](/explore/table-calculations) on the fly. For forecasts, regressions and other statistical work, agents can [post-process results with DuckDB and Python](#post-process-results-with-duckdb-and-python). Reading result rows is subject to your [data access setting](/agents/data-access). ### Query and visualizations constraints Results are limited by configurable query limits set at server level to ensure good performance. These limits can only be adjusted through environment variables at the moment. When you ask an agent to join data across two explores that have no join defined in your dbt models, it runs the join as a merge — the same mechanism behind the Explorer's **Merge another query** flow. Each side runs as its own query capped at the configured query limit, and Lightdash joins the results afterwards; if a side is cut off by its limit, the merge fails rather than returning a partial join. See [How a merge runs](/explore/merge-queries#how-a-merge-runs) and [Row limits](/explore/merge-queries#current-limits) for the full mechanics. A join defined in your dbt models doesn't go through this path: the agent's metric query pushes the whole join down to your warehouse as a single query, so it isn't subject to this per-side limit. If a pair of explores hits the merge limit often, model the join between them in dbt instead. Agents can create tables, bar charts, vertical bar charts, line charts, scatter plots, pie/donut charts, and funnel charts, but don't yet support [custom visualizations](/visualizations/custom-charts) or big number charts. ### Images and screenshots Agents only read the text of a message. A screenshot, image, or table pasted as an image gives the agent nothing to work with, whether the message is sent in the Lightdash app or in Slack. This is separate from [attaching a file](#attach-a-file), which only reads plain-text documents. ### Data access and context Agent access to your data is controlled through tags in your dbt models and by the asking user's user attributes. If certain fields aren't accessible, check that they have the appropriate tags assigned to your agent, and that the user's attributes allow them. See [Who can see what](/agents/data-access#who-can-see-what) for how the controls stack, including [SQL mode](#sql-mode). For conversation history and how saved results refresh, see [Conversations and saved results](#conversations-and-saved-results). When an agent can use 15 or fewer explores, Lightdash includes the list of them in the agent's context. With more than 15, the agent searches for the fields it needs instead. ### Request and context limits Two different limits can stop an agent mid-conversation: * **"The agent reached its work limit before it could write a response. Try asking for fewer things at once, or split your request into smaller parts."** An agent can take a limited number of internal steps per request, and this request needed more before it could reply. Asking an agent to edit every tile on a large dashboard in one message is a common way to hit it. Split the request into smaller parts instead. * **"This request exceeded the AI model's context limit, usually because the conversation or tool results became too large. Please start a new thread or break the request into smaller steps."** The model's context window holds the whole thread plus the data its tool calls returned, and this request pushed that over the model's limit. A long-running thread can reach it, but so can a single step that returns a lot of data, such as a wide query result — there's no fixed number of messages that triggers it. For either message, break the work into smaller requests, and for a long analysis, click **New thread** on the agent's page rather than continuing to add to one conversation. # Verified answers Source: https://docs.lightdash.com/agents/verified-answers Curate reference answers for agents and manage their connection to verified saved content Mark an agent's charts and dashboards as verified answers to give it reference examples for similar questions. Review the query and result before verifying an answer; verification records your judgment rather than retraining the model. ## How verified answers work The agent can reference a verified answer when it matches the question, reusing an example your team has checked. ![Agent referencing verified answers in conversation](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/verified-answer-2.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=e49974713ceb0b13aa0fc88399ef68af) When you have more than six verified questions, suggested questions based on them appear at the start of a conversation. ![Suggested questions based on verified answers](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/verified-answers-suggested-questions.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=0268bcda4b5d2531348434f8170c237b) In [Slack](/agents/set-up-slack-agents), the agent can link to a matching verified answer in its response. ![Verified answers referenced in Slack](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/verified-answers-in-slack.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=f412005e9c381d8a625970f92a825a6e) ## Verified answers become verified content If the answer has been **saved as a chart or dashboard**, verifying it also marks that saved chart or dashboard as [verified content](/explore/verified-content). The saved content appears in: * The verified badge on the chart or dashboard, in listings, search, and space overviews * The [`list_verified_content`](/agents/lightdash-mcp) MCP tool, so external agents can discover and build on it * In-product AI retrieval, so agents prefer it when answering similar questions Removing verification from the answer removes it from both places. A couple of things to keep in mind: * **Save before you verify.** An answer that only exists inside the conversation stays an agent example — it won't get a badge or appear in MCP until it's saved as a chart or dashboard. Save it first, then verify. * **The link is one-way.** Verifying an answer promotes its saved chart or dashboard to verified content. Verifying a chart or dashboard directly (for example, from project settings) doesn't reach back and mark the originating answer. ## Managing verified answers ### Verifying an answer Only users with the **Admin** or **Developer** role can verify answers. 1. In an AI agent conversation, review the generated chart and its query. 2. Click the checkmark icon in the top right corner of the chart. The answer is verified and available as a reference example. ![Verifying an answer in an AI agent conversation](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/verified-answer-1.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=d4c86cae75481c3e2cac3d8c4e9ee0e6) ### Viewing all verified answers Navigate to your agent's settings page and select the **Verified answers** tab to see: * All verified charts and dashboards * Who verified each answer and when * How many times each answer has been referenced by the agent * Preview of the visualization ![Verified answers management interface](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/verified-answer-3.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=6d734143aab6c229d31bd63a7816959a) ### Removing verification If an answer is no longer a good example: 1. Go to the **Verified answers** tab in the agent's settings page 2. Find the answer you want to remove 3. Click the remove icon 4. Confirm removal - the answer will no longer be used as a reference ## Admin-verified charts and dashboards Verified answers are one of two trust signals your agent uses. The other is [admin-verified charts and dashboards](/explore/verified-content) — content that organization or project admins have signed off on as canonical. When an agent searches your project for existing content to reference, it ranks admin-verified charts and dashboards first and surfaces them to the user along with who verified them and when. You don't need to configure anything: any chart or dashboard verified in project settings is automatically preferred by every agent in that project. # Agent visibility Source: https://docs.lightdash.com/agents/visibility How admins see, control, and give feedback on what AI agents do with your data Review agent conversations and MCP tool calls to understand what ran, who requested it, and whether it succeeded. Admins manage thread history and Issues from **Settings** → **Ask AI**. MCP activity lives under **Settings** → **MCP** → **Analytics**. Each view is scoped to the projects the admin manages. These views record activity. Configure what agents can do through [data access controls](/agents/data-access), [SQL mode approvals](/agents/use-ai-agents#how-approvals-work), and [MCP tool curation](/agents/connect-external-mcp-servers#choose-which-tools-are-exposed-to-the-agent). ## Thread activity Every agent conversation, in the Lightdash app or Slack, is visible to admins under **Threads**. It's the same record the person who asked the question sees: their question, the agent's answer, and the query behind it. Admins use it to understand how agents are actually being used, and to pull real conversations into [Evaluations](/agents/create-evaluation-suites) as test cases. ![Threads tab in Ask AI settings showing a list of agent conversations across projects](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/ai-admin-threads-light.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=34eed1c9345deb132aa5be8b729eba92) To see usage across the whole organization, select **Insights** on the **Threads** page. It opens the **AI Agents Insights** dashboard, which summarizes AI agent usage for your organization. Only organization admins can open Insights. Admins who see **Threads** for the projects they manage can't open it. ### Pull thread data with the API To load agent conversations into your warehouse or another tool, call the [Lightdash API](/api-reference/v1/introduction) with a [personal access token](/personal-settings/create-personal-tokens): * `GET /api/v1/aiAgents/admin/threads` lists threads across the projects you manage, with the same scope as **Threads**. Filter with `projectUuids`, `agentUuids`, `userUuids`, `createdFrom`, `humanScore`, `dateFrom`, `dateTo` and `search`. It returns 50 threads per page by default; use `page` and `pageSize` to page through. * `GET /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}` returns a thread's messages. Each answer carries its feedback (`humanScore`, `humanFeedback`), its token usage (`tokenUsage`) and its artifacts, whose `savedQueryUuid` and `savedDashboardUuid` identify charts and dashboards saved from the thread. * `GET /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads` lists only your own threads with that agent. Add `allUsers=true` to list everyone's, which needs permission to manage the agent. ## MCP activity The **MCP → Analytics** page covers both directions of MCP activity: external assistants calling tools on the [Lightdash MCP server](/agents/lightdash-mcp), and Lightdash agents calling tools on [connected external MCP servers](/agents/connect-external-mcp-servers). Admins can see what was called, by whom, and whether it succeeded. ![MCP activity feed showing a list of tool calls with tool name, agent, status, and duration columns](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/agents/mcp-activity-feed-light.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=2ce5c10ba66081156545bb6a6e04b8e1) Activity is retained for 90 days. Which tools an agent is *allowed* to call is decided separately, per MCP server, in project settings. See [choosing which tools are exposed](/agents/connect-external-mcp-servers#choose-which-tools-are-exposed-to-the-agent). ## Review findings and test fixes When a conversation reveals a recurring error, use [Issues](/agents/issues) to review findings and proposed fixes. Add representative questions from the thread to an [evaluation suite](/agents/create-evaluation-suites) to check whether a change fixes the problem and to catch regressions. Scheduled maintenance has its own record: see [Autopilot activity](/agents/autopilot#reviewing-activity). # Add AI agent review item comment Source: https://docs.lightdash.com/api-reference/add-ai-agent-review-item-comment https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/aiAgents/admin/review-items/{fingerprint}/comments Add a comment to an AI agent review item # Delete apiv1projects aiagents threads live activities Source: https://docs.lightdash.com/api-reference/ai-agent-live-activities/delete-apiv1projects-aiagents-threads-live-activities https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}/live-activities/{liveActivityUuid} # Put apiv1projects aiagents threads live activities Source: https://docs.lightdash.com/api-reference/ai-agent-live-activities/put-apiv1projects-aiagents-threads-live-activities https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}/live-activities/{liveActivityUuid} # Backfill retained Analytics history Source: https://docs.lightdash.com/api-reference/analytics-project/backfill-retained-analytics-history https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/org/analytics-project/backfill # Check Analytics history backfill completion Source: https://docs.lightdash.com/api-reference/analytics-project/check-analytics-history-backfill-completion https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/analytics-project/backfill # Delete the organization's internal analytics project Source: https://docs.lightdash.com/api-reference/analytics-project/delete-the-organizations-internal-analytics-project https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/org/analytics-project/{projectUuid} # Ensure internal analytics project Source: https://docs.lightdash.com/api-reference/analytics-project/ensure-internal-analytics-project https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/org/analytics-project # Get internal analytics project status Source: https://docs.lightdash.com/api-reference/analytics-project/get-internal-analytics-project-status https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/analytics-project # Install sample charts and dashboard in the internal analytics project Source: https://docs.lightdash.com/api-reference/analytics-project/install-sample-charts-and-dashboard-in-the-internal-analytics-project https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/org/analytics-project/sample-content # Generate web identity audience Source: https://docs.lightdash.com/api-reference/aws-web-identity/generate-web-identity-audience https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/aws/web-identity/audiences Generate an audience for Athena web identity authentication. Add it to the IAM role's trust policy as accounts.google.com:oaud. # Get web identity subject Source: https://docs.lightdash.com/api-reference/aws-web-identity/get-web-identity-subject https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aws/web-identity Get this instance's identity for Athena web identity authentication. Add the subject to the IAM role's trust policy. # Backfill AI review Jira issues Source: https://docs.lightdash.com/api-reference/backfill-ai-review-jira-issues https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/aiAgents/admin/review-jira-issues/backfill Create Jira issues for existing open AI review findings # Backfill AI review Linear issues Source: https://docs.lightdash.com/api-reference/backfill-ai-review-linear-issues https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/aiAgents/admin/review-linear-issues/backfill Create Linear issues for existing open AI review findings # Get BigQuery workload identity Source: https://docs.lightdash.com/api-reference/bigquery-workload-identity/get-bigquery-workload-identity https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/bigquery/workload-identity Get the issuer and subject to pin in a workload identity pool provider. # Cancel Deep Research run Source: https://docs.lightdash.com/api-reference/cancel-deep-research-run https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/ee/projects/{projectUuid}/ai-deep-research/{aiDeepResearchRunUuid}/cancel Cancel a queued run immediately or request cancellation for a running run. # Acquire tree lock Source: https://docs.lightdash.com/api-reference/catalog/acquire-tree-lock https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/dataCatalog/metrics/trees/{metricsTreeUuid}/lock Acquire an edit lock on a metrics tree # Add category to catalog item Source: https://docs.lightdash.com/api-reference/catalog/add-category-to-catalog-item https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/dataCatalog/{catalogSearchUuid}/categories Add a category to a catalog item # Check if metrics exist in catalog Source: https://docs.lightdash.com/api-reference/catalog/check-if-metrics-exist-in-catalog https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/dataCatalog/metrics/has Check if there are any metrics in catalog # Create metrics tree Source: https://docs.lightdash.com/api-reference/catalog/create-metrics-tree https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/dataCatalog/metrics/trees Create a new saved metrics tree with nodes and edges # Create metrics tree edge Source: https://docs.lightdash.com/api-reference/catalog/create-metrics-tree-edge https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/dataCatalog/metrics/tree/edges Create an edge in the metrics tree # Delete metrics tree Source: https://docs.lightdash.com/api-reference/catalog/delete-metrics-tree https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/dataCatalog/metrics/trees/{metricsTreeUuid} Delete a saved metrics tree and its associated nodes # Delete metrics tree edge Source: https://docs.lightdash.com/api-reference/catalog/delete-metrics-tree-edge https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/dataCatalog/metrics/tree/edges/{sourceCatalogSearchUuid}/{targetCatalogSearchUuid} Delete an edge from the metrics tree # Get all metrics tree edges Source: https://docs.lightdash.com/api-reference/catalog/get-all-metrics-tree-edges https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/dataCatalog/metrics/tree/edges Get all edges in the metrics tree for a project # Get catalog Source: https://docs.lightdash.com/api-reference/catalog/get-catalog https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/dataCatalog Get catalog items # Get field analytics Source: https://docs.lightdash.com/api-reference/catalog/get-field-analytics https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/dataCatalog/{table}/analytics/{field} Get catalog analytics for fields # Get filter dimensions Source: https://docs.lightdash.com/api-reference/catalog/get-filter-dimensions https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/dataCatalog/{tableName}/filter-dimensions Get dimensions that can be used to filter metrics # Get metric Source: https://docs.lightdash.com/api-reference/catalog/get-metric https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/dataCatalog/metrics/{tableName}/{metricName} Get metric by table and metric name # Get metrics tree Source: https://docs.lightdash.com/api-reference/catalog/get-metrics-tree https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/dataCatalog/metrics/tree Get the metrics tree structure (deprecated, use POST instead) # Get metrics tree Source: https://docs.lightdash.com/api-reference/catalog/get-metrics-tree-1 https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/dataCatalog/metrics/tree Get the metrics tree structure # Get metrics tree details Source: https://docs.lightdash.com/api-reference/catalog/get-metrics-tree-details https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/dataCatalog/metrics/trees/{metricsTreeUuidOrSlug} Get details of a saved metrics tree including nodes and edges # Get metrics with time dimensions Source: https://docs.lightdash.com/api-reference/catalog/get-metrics-with-time-dimensions https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/dataCatalog/metrics-with-time-dimensions Get metrics with time dimensions # Get segment dimensions Source: https://docs.lightdash.com/api-reference/catalog/get-segment-dimensions https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/dataCatalog/{tableName}/segment-dimensions Get dimensions that can be used to segment metrics # Get table analytics Source: https://docs.lightdash.com/api-reference/catalog/get-table-analytics https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/dataCatalog/{table}/analytics Get catalog analytics for tables # Get table metadata Source: https://docs.lightdash.com/api-reference/catalog/get-table-metadata https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/dataCatalog/{table}/metadata Get catalog metadata for tables # List metric owners Source: https://docs.lightdash.com/api-reference/catalog/list-metric-owners https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/dataCatalog/metrics/owners Get distinct metric owners for filter dropdown # List metrics catalog tables Source: https://docs.lightdash.com/api-reference/catalog/list-metrics-catalog-tables https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/dataCatalog/metrics/tables Get the tables that have metrics visible in the metrics catalog, for the tables filter dropdown # List metrics in catalog Source: https://docs.lightdash.com/api-reference/catalog/list-metrics-in-catalog https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/dataCatalog/metrics Get metrics catalog # List metrics trees Source: https://docs.lightdash.com/api-reference/catalog/list-metrics-trees https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/dataCatalog/metrics/trees List saved metrics trees for a project # Refresh tree lock heartbeat Source: https://docs.lightdash.com/api-reference/catalog/refresh-tree-lock-heartbeat https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/projects/{projectUuid}/dataCatalog/metrics/trees/{metricsTreeUuid}/lock/heartbeat Refresh the heartbeat on an edit lock to keep it alive # Release tree lock Source: https://docs.lightdash.com/api-reference/catalog/release-tree-lock https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/dataCatalog/metrics/trees/{metricsTreeUuid}/lock Release an edit lock on a metrics tree # Remove category from catalog item Source: https://docs.lightdash.com/api-reference/catalog/remove-category-from-catalog-item https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/dataCatalog/{catalogSearchUuid}/categories/{tagUuid} Remove a category from a catalog item # Update catalog item icon Source: https://docs.lightdash.com/api-reference/catalog/update-catalog-item-icon https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/dataCatalog/{catalogSearchUuid}/icon Update the icon for a catalog item # Update metrics tree Source: https://docs.lightdash.com/api-reference/catalog/update-metrics-tree https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/dataCatalog/metrics/trees/{metricsTreeUuid} Update a saved metrics tree including nodes and edges # Calculate total from saved chart Source: https://docs.lightdash.com/api-reference/charts/calculate-total-from-saved-chart https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/saved/{chartUuid}/calculate-total Calculate metric totals from a saved chart # Create saved chart scheduler Source: https://docs.lightdash.com/api-reference/charts/create-saved-chart-scheduler https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/saved/{chartUuid}/schedulers Create a scheduler for a saved chart # Export chart image Source: https://docs.lightdash.com/api-reference/charts/export-chart-image https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/saved/{chartUuid}/export Export a saved chart as a PNG image # Get chart and results Source: https://docs.lightdash.com/api-reference/charts/get-chart-and-results https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/saved/{chartUuid}/chart-and-results Deprecated — use the v2 Execute dashboard chart endpoint instead. This endpoint was deprecated on 20 March 2025 and is past its sunset date (20 June 2025) — it may be removed at any time. Migrate to the v2 async query flow: Execute dashboard chart, then Get results. > [!WARNING] > > **This endpoint is deprecated and past its sunset date (20 June 2025) — it may be removed at any time.** > > Migrate to the v2 async query flow: [Execute dashboard chart](https://docs.lightdash.com/api-reference/v2/execute-dashboard-chart) (`POST /api/v2/projects/{projectUuid}/query/dashboard-chart`) to start the query, then [Get results](https://docs.lightdash.com/api-reference/v2/get-results) to fetch rows. See also [Cancel query](https://docs.lightdash.com/api-reference/v2/cancel-query) and [Download results](https://docs.lightdash.com/api-reference/v2/download-results). # Get chart promotion diff Source: https://docs.lightdash.com/api-reference/charts/get-chart-promotion-diff https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/saved/{chartUuid}/promoteDiff Get diff from chart to promote # Get chart version Source: https://docs.lightdash.com/api-reference/charts/get-chart-version https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/saved/{chartUuid}/version/{versionUuid} Get chart version # Get chart version history Source: https://docs.lightdash.com/api-reference/charts/get-chart-version-history https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/saved/{chartUuid}/history Get chart version history from last 30 days # Get chart version results Source: https://docs.lightdash.com/api-reference/charts/get-chart-version-results https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/saved/{chartUuid}/version/{versionUuid}/results Deprecated — use the v2 Execute saved chart endpoint instead. This endpoint was deprecated on 20 March 2025 and is past its sunset date (30 April 2025) — it may be removed at any time. Migrate to the v2 async query flow: Execute saved chart, then Get results. > [!WARNING] > > **This endpoint is deprecated and past its sunset date (30 April 2025) — it may be removed at any time.** > > Migrate to the v2 async query flow: [Execute saved chart](https://docs.lightdash.com/api-reference/v2/execute-saved-chart) (`POST /api/v2/projects/{projectUuid}/query/chart`) to run the chart's latest version, then [Get results](https://docs.lightdash.com/api-reference/v2/get-results) to fetch rows. Running a query for a specific chart version has no v2 equivalent. # List saved chart schedulers Source: https://docs.lightdash.com/api-reference/charts/list-saved-chart-schedulers https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/saved/{chartUuid}/schedulers Get schedulers for a saved chart # Promote chart Source: https://docs.lightdash.com/api-reference/charts/promote-chart https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/saved/{chartUuid}/promote Promote chart to its upstream project # Rollback chart to version Source: https://docs.lightdash.com/api-reference/charts/rollback-chart-to-version https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/saved/{chartUuid}/rollback/{versionUuid} Rollback chart to version # Run chart query Source: https://docs.lightdash.com/api-reference/charts/run-chart-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/saved/{chartUuid}/results Deprecated — use the v2 Execute saved chart endpoint instead. This endpoint was deprecated on 20 March 2025 and is past its sunset date (30 April 2025) — it may be removed at any time. Migrate to the v2 async query flow: Execute saved chart, then Get results. > [!WARNING] > > **This endpoint is deprecated and past its sunset date (30 April 2025) — it may be removed at any time.** > > Migrate to the v2 async query flow: [Execute saved chart](https://docs.lightdash.com/api-reference/v2/execute-saved-chart) (`POST /api/v2/projects/{projectUuid}/query/chart`) to start the query, then [Get results](https://docs.lightdash.com/api-reference/v2/get-results) to fetch rows. See also [Cancel query](https://docs.lightdash.com/api-reference/v2/cancel-query) and [Download results](https://docs.lightdash.com/api-reference/v2/download-results). # Unverify chart Source: https://docs.lightdash.com/api-reference/charts/unverify-chart https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/saved/{chartUuid}/verification Remove verification from a chart # Verify chart Source: https://docs.lightdash.com/api-reference/charts/verify-chart https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/saved/{chartUuid}/verification Verify a chart # Create comment Source: https://docs.lightdash.com/api-reference/comments/create-comment https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/comments/dashboards/{dashboardUuid}/{dashboardTileUuid} Creates a comment on a dashboard tile # Delete comment Source: https://docs.lightdash.com/api-reference/comments/delete-comment https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/comments/dashboards/{dashboardUuid}/{commentId} Deletes a comment on a dashboard # Get comments Source: https://docs.lightdash.com/api-reference/comments/get-comments https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/comments/dashboards/{dashboardUuidOrSlug} Gets all comments for a dashboard # Resolve comment Source: https://docs.lightdash.com/api-reference/comments/resolve-comment https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/comments/dashboards/{dashboardUuid}/{commentId} Resolves or unresolves a comment on a dashboard # Commit router decision Source: https://docs.lightdash.com/api-reference/commit-router-decision https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/org/aiRouter/decisions/{decisionUuid}/commit Commit a router decision once the user has resolved it (router auto-routed and the thread is created, or the user picked an agent from the picker). Decisions left uncommitted indicate the user abandoned the flow. # Approve a review request Source: https://docs.lightdash.com/api-reference/content-review-requests/approve-a-review-request https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/review-requests/{requestUuid}/approve Move the content to the target space and optionally verify it # Cancel your own review request Source: https://docs.lightdash.com/api-reference/content-review-requests/cancel-your-own-review-request https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/review-requests/{requestUuid}/cancel # Find related charts using names and query definitions Source: https://docs.lightdash.com/api-reference/content-review-requests/find-related-charts-using-names-and-query-definitions https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/review-requests/similar # Find similar content Source: https://docs.lightdash.com/api-reference/content-review-requests/find-similar-content https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/review-requests/similar Deprecated — use POST /similar for AI-powered chart comparison instead. Preserves name matching until 14 December 2026. The replacement requires Ambient AI and a saved chart UUID or metric query context. > [!WARNING] > > This endpoint is deprecated and scheduled for removal after 14 December 2026. Migrate to POST /api/v1/projects//review-requests/similar with contentType, name, excludeContentUuid, and chart query context when comparing unsaved charts. The replacement requires Ambient AI; it does not support name-only, SQL chart, or dashboard comparisons. # Get a review request Source: https://docs.lightdash.com/api-reference/content-review-requests/get-a-review-request https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/review-requests/{requestUuid} # Get review settings Source: https://docs.lightdash.com/api-reference/content-review-requests/get-review-settings https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/review-requests/settings Review settings for a project: reviewer group, verify-on-approve default and Slack channel # Get the pending review request for content Source: https://docs.lightdash.com/api-reference/content-review-requests/get-the-pending-review-request-for-content https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/review-requests/content/{contentType}/{contentUuid} The open review request on a chart or dashboard, if any # List review requests Source: https://docs.lightdash.com/api-reference/content-review-requests/list-review-requests https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/review-requests Requests to review (routed to the caller) or the caller's own requests # Reject a review request Source: https://docs.lightdash.com/api-reference/content-review-requests/reject-a-review-request https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/review-requests/{requestUuid}/reject # Submit a review request Source: https://docs.lightdash.com/api-reference/content-review-requests/submit-a-review-request https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/review-requests Ask for a chart or dashboard in your personal space to be reviewed and moved to a shared space # Update review settings Source: https://docs.lightdash.com/api-reference/content-review-requests/update-review-settings https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/review-requests/settings # Bulk delete content Source: https://docs.lightdash.com/api-reference/content/bulk-delete-content https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/content/bulk-action/{projectUuid}/delete Delete multiple items (Charts, Dashboards, Spaces). Items the caller cannot delete are skipped and reported in the response. # Bulk move content Source: https://docs.lightdash.com/api-reference/content/bulk-move-content https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/content/bulk-action/{projectUuid}/move Move multiple items (Charts, Dashboards, Spaces) to another space # Delete content Source: https://docs.lightdash.com/api-reference/content/delete-content https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/content/{projectUuid}/delete Delete a single item (Chart, Dashboard, Space). Soft-deletes when the instance has soft delete enabled, otherwise deletes permanently. # Get favorites Source: https://docs.lightdash.com/api-reference/content/get-favorites https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/favorites Get the current user's favorite items in a project # Get pinned items Source: https://docs.lightdash.com/api-reference/content/get-pinned-items https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/pinned-lists/{pinnedListUuid}/items Get pinned items # Move content Source: https://docs.lightdash.com/api-reference/content/move-content https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/content/{projectUuid}/move Move a single item (Chart, Dashboard, Space) to another space # Toggle favorite Source: https://docs.lightdash.com/api-reference/content/toggle-favorite https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/favorites Toggle a favorite item for the current user # Update pinned items order Source: https://docs.lightdash.com/api-reference/content/update-pinned-items-order https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/pinned-lists/{pinnedListUuid}/items/order Update pinned items order # Convert a legacy Bedrock configuration into a managed credential Source: https://docs.lightdash.com/api-reference/convert-a-legacy-bedrock-configuration-into-a-managed-credential https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/ai/provider-credentials/adopt-legacy Lets an organization that configured Bedrock before named credentials existed take ownership of that configuration so it can be edited or removed, without having to add a second credential first. # Create agent document Source: https://docs.lightdash.com/api-reference/create-agent-document https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/documents Create a knowledge document scoped to this project and agent. # Create AI agent document Source: https://docs.lightdash.com/api-reference/create-ai-agent-document https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/aiAgents/documents Create a knowledge document. The projectUuid and agentAccess body fields are deprecated: scope the document by creating it on the agent route instead. Without them the document is available to every agent. # Create AI agent review item Source: https://docs.lightdash.com/api-reference/create-ai-agent-review-item https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/aiAgents/admin/review-items Create a manual AI agent issue # Create AI agent review item writeback PR Source: https://docs.lightdash.com/api-reference/create-ai-agent-review-item-writeback-pr https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/aiAgents/admin/review-items/{fingerprint}/writeback Open a writeback pull request for a review item (semantic-layer or project-context root cause) # Create an AI agent skill Source: https://docs.lightdash.com/api-reference/create-an-ai-agent-skill https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/aiAgents/skills Create a custom skill from its files and publish version 1. # Create GitHub repository Source: https://docs.lightdash.com/api-reference/create-github-repository https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/github/repos Create a new GitHub repository via the installed app # Create dashboard scheduler Source: https://docs.lightdash.com/api-reference/dashboards/create-dashboard-scheduler https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/dashboards/{dashboardUuidOrSlug}/schedulers Create a scheduler for a dashboard # Delete dashboard custom metric Source: https://docs.lightdash.com/api-reference/dashboards/delete-dashboard-custom-metric https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/dashboards/{dashboardUuidOrSlug}/custom-metrics/{metricTable}/{metricName} Remove a custom metric from the dashboard registry. Charts keep their local snapshots — the metric just stops being offered to new charts. With `dryRun` it only reports the charts still using it. # Get dashboard history Source: https://docs.lightdash.com/api-reference/dashboards/get-dashboard-history https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/dashboards/{dashboardUuidOrSlug}/history Get dashboard version history # Get dashboard promotion diff Source: https://docs.lightdash.com/api-reference/dashboards/get-dashboard-promotion-diff https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/dashboards/{dashboardUuidOrSlug}/promoteDiff Get diff from dashboard to promote # Get dashboard version Source: https://docs.lightdash.com/api-reference/dashboards/get-dashboard-version https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/dashboards/{dashboardUuidOrSlug}/version/{versionUuid} Get specific dashboard version # List dashboard schedulers Source: https://docs.lightdash.com/api-reference/dashboards/list-dashboard-schedulers https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/dashboards/{dashboardUuidOrSlug}/schedulers Get schedulers for a dashboard # Promote dashboard Source: https://docs.lightdash.com/api-reference/dashboards/promote-dashboard https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/dashboards/{dashboardUuidOrSlug}/promote Promote dashboard to its upstream project # Rollback dashboard version Source: https://docs.lightdash.com/api-reference/dashboards/rollback-dashboard-version https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/dashboards/{dashboardUuidOrSlug}/rollback/{versionUuid} Rollback dashboard to a previous version # Unverify dashboard Source: https://docs.lightdash.com/api-reference/dashboards/unverify-dashboard https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/dashboards/{dashboardUuidOrSlug}/verification Remove verification from a dashboard # Update dashboard custom metric Source: https://docs.lightdash.com/api-reference/dashboards/update-dashboard-custom-metric https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/dashboards/{dashboardUuidOrSlug}/custom-metrics Edit a dashboard registry custom metric. Swaps the registry entry and re-versions every dashboard-owned chart that references it, atomically. With `dryRun` it only reports the charts that would change. # Verify dashboard Source: https://docs.lightdash.com/api-reference/dashboards/verify-dashboard https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/dashboards/{dashboardUuidOrSlug}/verification Verify a dashboard # Delete agent document Source: https://docs.lightdash.com/api-reference/delete-agent-document https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/documents/{documentUuid} Delete a knowledge document this agent can use. # Delete AI agent document Source: https://docs.lightdash.com/api-reference/delete-ai-agent-document https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/aiAgents/documents/{documentUuid} Delete a knowledge document anywhere in the organization. # Delete AI agent thread Source: https://docs.lightdash.com/api-reference/delete-ai-agent-thread https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid} Permanently delete an AI agent thread and everything derived from it. Available to the thread owner and to agent admins. # Delete AI agent thread Source: https://docs.lightdash.com/api-reference/delete-ai-agent-thread-1 https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/aiAgents/admin/threads/{threadUuid} Permanently delete an AI agent thread and everything derived from it. # Delete an AI agent skill Source: https://docs.lightdash.com/api-reference/delete-an-ai-agent-skill https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/aiAgents/skills/{skillUuid} Soft-delete the skill and unbind it from every agent. Returns the agents that lost it. # Delete apiv1aiprovider credentials Source: https://docs.lightdash.com/api-reference/delete-apiv1aiprovider-credentials https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/ai/provider-credentials/{credentialUuid} # Delete apiv1projects aiagents Source: https://docs.lightdash.com/api-reference/delete-apiv1projects-aiagents https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/aiAgents/{agentUuid} # Delete apiv1projects aiagents evaluations Source: https://docs.lightdash.com/api-reference/delete-apiv1projects-aiagents-evaluations https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/evaluations/{evalUuid} # Delete apiv1projects aiagentsmcpservers Source: https://docs.lightdash.com/api-reference/delete-apiv1projects-aiagentsmcpservers https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/aiAgents/mcpServers/{mcpServerUuid} # Delete apiv1projects aiagentspreferences Source: https://docs.lightdash.com/api-reference/delete-apiv1projects-aiagentspreferences https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/aiAgents/preferences # Distill thread Source: https://docs.lightdash.com/api-reference/distill-thread https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgentMemories/threads/{threadUuid}/distill Queues distillation for one thread immediately, skipping the event debounce and the backfill sweep. Re-distills a thread that is already up to date. Requires permission to manage AI agents in the project. # Documents linking a chart Source: https://docs.lightdash.com/api-reference/documents/documents-linking-a-chart https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/documents/linking-chart The Documents you can view whose current version links a saved chart or saved SQL chart # Export document as PDF Source: https://docs.lightdash.com/api-reference/documents/export-document-as-pdf https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/documents/{documentUuidOrSlug}/exports/pdf Export the Document as a paginated PDF, rendered with your access. Poll `GET /api/v1/schedulers/job/{jobId}/status`; the completed job's details hold the file `url` and `numFailures` (charts that failed to load). # Get apiv1projects documents Source: https://docs.lightdash.com/api-reference/documents/get-apiv1projects-documents https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/documents # Get apiv1projects documents 1 Source: https://docs.lightdash.com/api-reference/documents/get-apiv1projects-documents-1 https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/documents/{documentUuidOrSlug} # Get apiv1projects documents as code Source: https://docs.lightdash.com/api-reference/documents/get-apiv1projects-documents-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/documents/{documentUuidOrSlug}/as-code # Get apiv1projects documents versions Source: https://docs.lightdash.com/api-reference/documents/get-apiv1projects-documents-versions https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/documents/{documentUuid}/versions # Get apiv1projects documents versions 1 Source: https://docs.lightdash.com/api-reference/documents/get-apiv1projects-documents-versions-1 https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/documents/{documentUuid}/versions/{versionUuid} # Get Document promotion diff Source: https://docs.lightdash.com/api-reference/documents/get-document-promotion-diff https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/documents/{documentUuid}/promoteDiff Preview promoting a Document to its upstream project: the spaces, custom chart types and Document it would create or update. # Patch apiv1projects documents Source: https://docs.lightdash.com/api-reference/documents/patch-apiv1projects-documents https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/documents/{documentUuidOrSlug} # Patch apiv1projects documents pinning Source: https://docs.lightdash.com/api-reference/documents/patch-apiv1projects-documents-pinning https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/documents/{documentUuidOrSlug}/pinning # Post apiv1projects documents Source: https://docs.lightdash.com/api-reference/documents/post-apiv1projects-documents https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/documents # Post apiv1projects documents charts query Source: https://docs.lightdash.com/api-reference/documents/post-apiv1projects-documents-charts-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/documents/{documentUuid}/charts/{chartId}/query # Post apiv1projects documents duplicate Source: https://docs.lightdash.com/api-reference/documents/post-apiv1projects-documents-duplicate https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/documents/{documentUuidOrSlug}/duplicate # Post apiv1projects documents versions Source: https://docs.lightdash.com/api-reference/documents/post-apiv1projects-documents-versions https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/documents/{documentUuid}/versions # Promote Document Source: https://docs.lightdash.com/api-reference/documents/promote-document https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/documents/{documentUuid}/promote Promote a Document to its upstream project. # Unverify Document Source: https://docs.lightdash.com/api-reference/documents/unverify-document https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/documents/{documentUuid}/verification Remove verification from a Document # Verify Document Source: https://docs.lightdash.com/api-reference/documents/verify-document https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/documents/{documentUuid}/verification Verify a Document # Download AI agent skills as code Source: https://docs.lightdash.com/api-reference/download-ai-agent-skills-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/skills/code Download skills as code: each skill's `SKILL.md` and resources, keyed by path. Names filter the set; missing names are reported. # Compile merge query Source: https://docs.lightdash.com/api-reference/exploring/compile-merge-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/mergeQuery/compile Compile several queries into a single merged warehouse statement. Returns the statement and the fields it produces, without running it. Use it to validate a merge while it is being built: a merge that would produce wrong numbers comes back with `errors` and a null `sql` — most importantly the fan-out case, where a query still carries a dimension that is neither joined on nor pivoted. Run a valid merge with POST {projectUuid}/mergeQuery/run. # Run merge query Source: https://docs.lightdash.com/api-reference/exploring/run-merge-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/mergeQuery/run Run a merge, returning a query uuid to page results from. The merged statement is registered as an ordinary async query, so its results are fetched, formatted, cancelled and downloaded through the same endpoints as any other query — page them with GET /api/v2/projects/{projectUuid}/query/{queryUuid}. A merge that cannot be run is rejected here rather than returned: compile it first to show the problem against the query that caused it. # Run metric query Source: https://docs.lightdash.com/api-reference/exploring/run-metric-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/explores/{exploreId}/runQuery Deprecated — use the v2 Execute metric query endpoint instead. This endpoint was deprecated on 20 March 2025 and is past its sunset date (30 April 2025) — it may be removed at any time. Migrate to the v2 async query flow: Execute metric query, then Get results. > [!WARNING] > > **This endpoint is deprecated and past its sunset date (30 April 2025) — it may be removed at any time.** > > Migrate to the v2 async query flow: [Execute metric query](https://docs.lightdash.com/api-reference/v2/execute-metric-query) (`POST /api/v2/projects/{projectUuid}/query/metric-query`) to start the query, then [Get results](https://docs.lightdash.com/api-reference/v2/get-results) to fetch rows. See also [Cancel query](https://docs.lightdash.com/api-reference/v2/cancel-query) and [Download results](https://docs.lightdash.com/api-reference/v2/download-results). # Run SQL query Source: https://docs.lightdash.com/api-reference/exploring/run-sql-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/sqlQuery Deprecated — use the v2 Execute SQL query endpoint instead. This endpoint was deprecated on 17 February 2025 and is past its sunset date (17 May 2025) — it may be removed at any time. Migrate to the v2 async query flow: Execute SQL query, then Get results. > [!WARNING] > > **This endpoint is deprecated and past its sunset date (17 May 2025) — it may be removed at any time.** > > Migrate to the v2 async query flow: [Execute SQL query](https://docs.lightdash.com/api-reference/v2/execute-sql-query) (`POST /api/v2/projects/{projectUuid}/query/sql`) to start the query, then [Get results](https://docs.lightdash.com/api-reference/v2/get-results) to fetch rows. See also [Cancel query](https://docs.lightdash.com/api-reference/v2/cancel-query) and [Download results](https://docs.lightdash.com/api-reference/v2/download-results). # Run underlying data query Source: https://docs.lightdash.com/api-reference/exploring/run-underlying-data-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/explores/{exploreId}/runUnderlyingDataQuery Deprecated — use the v2 Execute underlying data endpoint instead. This endpoint was deprecated on 20 March 2025 and is past its sunset date (30 April 2025) — it may be removed at any time. Migrate to the v2 async query flow: Execute underlying data, then Get results. > [!WARNING] > > **This endpoint is deprecated and past its sunset date (30 April 2025) — it may be removed at any time.** > > Migrate to the v2 async query flow: [Execute underlying data](https://docs.lightdash.com/api-reference/v2/execute-underlying-data) (`POST /api/v2/projects/{projectUuid}/query/underlying-data`) to start the query, then [Get results](https://docs.lightdash.com/api-reference/v2/get-results) to fetch rows. See also [Cancel query](https://docs.lightdash.com/api-reference/v2/cancel-query) and [Download results](https://docs.lightdash.com/api-reference/v2/download-results). # Get export status Source: https://docs.lightdash.com/api-reference/exports/get-export-status https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/csv/{jobId} Get the status/URL of a Google Sheets export job # Get file Source: https://docs.lightdash.com/api-reference/files/get-file https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/file/{fileId} Get a persistent file download. Streams the file body through the backend so self-hosted deployments don't need to expose their internal S3-compatible storage endpoint to browsers. # Get event names Source: https://docs.lightdash.com/api-reference/funnel/get-event-names https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/funnel/event-names Get distinct event names from a dimension for funnel step selection. Scans the last 30 days of data to limit query cost. # Run funnel query Source: https://docs.lightdash.com/api-reference/funnel/run-funnel-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/funnel/query Execute a funnel analysis query and return conversion metrics # Get a memory Source: https://docs.lightdash.com/api-reference/get-a-memory https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgentMemories/{slug} Returns one memory the requesting user can read, without going through an agent: memories consolidated across agents have no agent to route by. # Get agent document content Source: https://docs.lightdash.com/api-reference/get-agent-document-content https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/documents/{documentUuid}/content Read the full content of a knowledge document this agent can use. # Get AI agent node citation pipeline Source: https://docs.lightdash.com/api-reference/get-ai-agent-node-citation-pipeline https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}/messages/{messageUuid}/nodes/{nodeId} Get a cited node's pipeline: the node and everything it reads. # Get AI agent node citation query results Source: https://docs.lightdash.com/api-reference/get-ai-agent-node-citation-query-results https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}/messages/{messageUuid}/nodes/{nodeId}/query-results Read a node result of a node citation's run. # Get AI agent node citation viz query Source: https://docs.lightdash.com/api-reference/get-ai-agent-node-citation-viz-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}/messages/{messageUuid}/nodes/{nodeId}/viz-query Run a cited node and what it reads for preview; returns each node's queryUuid. # Get AI agent review item activity Source: https://docs.lightdash.com/api-reference/get-ai-agent-review-item-activity https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/review-items/{fingerprint}/activity Get the remediation activity feed for a review item # Get AI agent review item by preview thread Source: https://docs.lightdash.com/api-reference/get-ai-agent-review-item-by-preview-thread https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/review-items/by-preview-thread/{threadUuid} Get the review item linked to a remediation preview work thread # Get AI agent review item PR diff Source: https://docs.lightdash.com/api-reference/get-ai-agent-review-item-pr-diff https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/review-items/{fingerprint}/pr-diff Get the file diff of the pull request linked to a review item # Get AI agent thread composer node ids Source: https://docs.lightdash.com/api-reference/get-ai-agent-thread-composer-node-ids https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}/nodes List the composer query node ids registered in a thread, used to resolve node citations. # Get AI agent thread dump Source: https://docs.lightdash.com/api-reference/get-ai-agent-thread-dump https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/threads/{threadUuid}/dump Download a sanitized debug dump of an AI agent thread for troubleshooting. Requires AI_COPILOT_THREAD_DUMP_ENABLED on the instance. # Get AI agent thread pull request Source: https://docs.lightdash.com/api-reference/get-ai-agent-thread-pull-request https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}/pull-request Get the writeback pull request associated with a thread — the PR the agent opened in this thread, or the PR a verification thread verifies. # Get AI credit usage Source: https://docs.lightdash.com/api-reference/get-ai-credit-usage https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/ai-credits/usage The organization's AI usage for the current period, in tokens and credits, with its allowance when one is agreed. Organization admins only. # Get AI review Jira destination Source: https://docs.lightdash.com/api-reference/get-ai-review-jira-destination https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/review-jira-destination/{projectUuid} Get a project's Jira destination for AI reviews # Get AI review Jira routing Source: https://docs.lightdash.com/api-reference/get-ai-review-jira-routing https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/review-jira-routing Get Jira routing for AI review issues # Get AI review Linear destination Source: https://docs.lightdash.com/api-reference/get-ai-review-linear-destination https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/review-linear-destination/{projectUuid} Get a project's Linear destination for AI reviews # Get AI review Linear routing Source: https://docs.lightdash.com/api-reference/get-ai-review-linear-routing https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/review-linear-routing Get Linear routing for AI review issues # Get AI review notification settings Source: https://docs.lightdash.com/api-reference/get-ai-review-notification-settings https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/review-notification-settings Get AI review notification settings # Get AI router config Source: https://docs.lightdash.com/api-reference/get-ai-router-config https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/aiRouter Get the AI router configuration for the organization. Returns 404 when the router has not been configured yet — clients use this to detect first-use. # Get AI router instruction Source: https://docs.lightdash.com/api-reference/get-ai-router-instruction https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/aiRouter/instructions/{projectUuid} Get the active routing instruction for a project. Returns null when no instruction has been written for the project yet. # Get AI settings Source: https://docs.lightdash.com/api-reference/get-ai-settings https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/settings Get AI organization settings # Get an AI agent skill Source: https://docs.lightdash.com/api-reference/get-an-ai-agent-skill https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/skills/{skillUuid} The skill with its current content and parsed frontmatter. Deleted skills are returned too, so their history stays reachable. # Get apiv1aiagentsadminreview signals Source: https://docs.lightdash.com/api-reference/get-apiv1aiagentsadminreview-signals https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/review-signals # Get apiv1aiagentssettings Source: https://docs.lightdash.com/api-reference/get-apiv1aiagentssettings https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/settings # Get apiv1aiprovider credentials Source: https://docs.lightdash.com/api-reference/get-apiv1aiprovider-credentials https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/ai/provider-credentials # Get apiv1eeprojects ai deep research queries results Source: https://docs.lightdash.com/api-reference/get-apiv1eeprojects-ai-deep-research-queries-results https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/ee/projects/{projectUuid}/ai-deep-research/{aiDeepResearchRunUuid}/queries/{queryUuid}/results # Get apiv1projects aiagents Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagents https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents # Get apiv1projects aiagents 1 Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagents-1 https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid} # Get apiv1projects aiagents artifacts Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagents-artifacts https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/artifacts/{artifactUuid} # Get apiv1projects aiagents artifacts versions Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagents-artifacts-versions https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/artifacts/{artifactUuid}/versions/{versionUuid} # Get apiv1projects aiagents artifacts versions charts viz query Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagents-artifacts-versions-charts-viz-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/artifacts/{artifactUuid}/versions/{versionUuid}/charts/{chartIndex}/viz-query # Get apiv1projects aiagents artifacts versions query results Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagents-artifacts-versions-query-results https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/artifacts/{artifactUuid}/versions/{versionUuid}/query-results # Get apiv1projects aiagents artifacts versions viz query Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagents-artifacts-versions-viz-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/artifacts/{artifactUuid}/versions/{versionUuid}/viz-query # Get apiv1projects aiagents evaluations Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagents-evaluations https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/evaluations # Get apiv1projects aiagents evaluations 1 Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagents-evaluations-1 https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/evaluations/{evalUuid} # Get apiv1projects aiagents evaluations runs Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagents-evaluations-runs https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/evaluations/{evalUuid}/runs # Get apiv1projects aiagents evaluations runs 1 Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagents-evaluations-runs-1 https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/evaluations/{evalUuid}/runs/{runUuid} # Get apiv1projects aiagents mcpservers Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagents-mcpservers https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/mcpServers # Get apiv1projects aiagents mcpservers tools Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagents-mcpservers-tools https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/mcpServers/{mcpServerUuid}/tools # Get apiv1projects aiagents memories Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagents-memories https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/memories/{slug} # Get apiv1projects aiagents models Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagents-models https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/models # Get apiv1projects aiagents suggestions Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagents-suggestions https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/suggestions # Get apiv1projects aiagents threads Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagents-threads https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads # Get apiv1projects aiagents threads 1 Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagents-threads-1 https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid} # Get apiv1projects aiagents verified artifacts Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagents-verified-artifacts https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/verified-artifacts # Get apiv1projects aiagents verified questions Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagents-verified-questions https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/verified-questions # Get apiv1projects aiagentsmcpservers Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagentsmcpservers https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/mcpServers # Get apiv1projects aiagentsmcpservers tools Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagentsmcpservers-tools https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/mcpServers/{mcpServerUuid}/tools # Get apiv1projects aiagentsmcpserversgithubavailability Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagentsmcpserversgithubavailability https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/mcpServers/github/availability # Get apiv1projects aiagentspreferences Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagentspreferences https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/preferences # Get apiv1projects aiagentsthreads Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagentsthreads https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/threads # Get apiv1projects aiagentsthreadslive statuses Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiagentsthreadslive-statuses https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/threads/live-statuses # Get apiv1projects aiprovider credential Source: https://docs.lightdash.com/api-reference/get-apiv1projects-aiprovider-credential https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/ai/provider-credential # Get apiv1projects codeaiagents Source: https://docs.lightdash.com/api-reference/get-apiv1projects-codeaiagents https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/code/aiAgents # Get daily AI credit usage Source: https://docs.lightdash.com/api-reference/get-daily-ai-credit-usage https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/ai-credits/usage/daily Billable AI credits per day of the current period, by feature. Organization admins only. # Get Deep Research chart Source: https://docs.lightdash.com/api-reference/get-deep-research-chart https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/ee/projects/{projectUuid}/ai-deep-research/{aiDeepResearchRunUuid}/charts/{queryUuid} Load the retained query metadata behind a report chart. # Get Deep Research run Source: https://docs.lightdash.com/api-reference/get-deep-research-run https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/ee/projects/{projectUuid}/ai-deep-research/{aiDeepResearchRunUuid} Get the durable state and result of a Deep Research run. # Get GitHub App configuration Source: https://docs.lightdash.com/api-reference/get-github-app-configuration https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/github/config Get GitHub App configuration for the organization # Get linked GitHub account Source: https://docs.lightdash.com/api-reference/get-linked-github-account https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/github/user Get the authenticated user's linked GitHub account, if any # Get MCP activity stats Source: https://docs.lightdash.com/api-reference/get-mcp-activity-stats https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/mcp-activity/stats Get aggregated MCP tool call stats for admin # Get one version of an AI agent skill Source: https://docs.lightdash.com/api-reference/get-one-version-of-an-ai-agent-skill https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/skills/{skillUuid}/versions/{versionNumber} One version of the skill with its full content. # Get project AI agent prompt activity Source: https://docs.lightdash.com/api-reference/get-project-ai-agent-prompt-activity https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/projects/{projectUuid}/prompt-activity Get prompt activity for one project # Create branch Source: https://docs.lightdash.com/api-reference/git-files/create-branch https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/git/branches Create a new branch from a source branch # Create pull request Source: https://docs.lightdash.com/api-reference/git-files/create-pull-request https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/git/branches/{branch}/pull-request Create a pull request from a branch to the default branch # Delete file Source: https://docs.lightdash.com/api-reference/git-files/delete-file https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/git/branches/{branch}/files Delete a file from the repository # Get file or directory Source: https://docs.lightdash.com/api-reference/git-files/get-file-or-directory https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/git/branches/{branch}/files Get file content or directory listing. Returns directory entries if path is a directory, file content if path is a file. # List branches Source: https://docs.lightdash.com/api-reference/git-files/list-branches https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/git/branches List branches for the connected repository # Save file Source: https://docs.lightdash.com/api-reference/git-files/save-file https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/projects/{projectUuid}/git/branches/{branch}/files Create or update a file. Provide sha to update existing file, omit for new file. Send text as content, or a binary file's bytes as contentBase64: one of the two. # Create PR for custom dimensions Source: https://docs.lightdash.com/api-reference/git-integration/create-pr-for-custom-dimensions https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/git-integration/pull-requests/custom-dimensions Create a pull request for custom dimensions # Create PR for custom metrics Source: https://docs.lightdash.com/api-reference/git-integration/create-pr-for-custom-metrics https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/git-integration/pull-requests/custom-metrics Create a pull request for custom metrics # Preview custom dimension YAML Source: https://docs.lightdash.com/api-reference/git-integration/preview-custom-dimension-yaml https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/git-integration/pull-requests/custom-dimensions/preview Preview custom dimensions using the project's dbt model and warehouse dialect # GitHub OAuth callback Source: https://docs.lightdash.com/api-reference/github-oauth-callback https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/github/oauth/callback Callback URL for GitHub App Authorization also used for GitHub App Installation with combined Authorization # GitLab OAuth callback Source: https://docs.lightdash.com/api-reference/gitlab-oauth-callback https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/gitlab/oauth/callback GitLab OAuth callback handler # Delete apiv1eehomepagerecommended action skips Source: https://docs.lightdash.com/api-reference/homepage/delete-apiv1eehomepagerecommended-action-skips https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/ee/homepage/recommended-action-skips/{actionKey} # Delete apiv1projects announcements Source: https://docs.lightdash.com/api-reference/homepage/delete-apiv1projects-announcements https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/announcements/{announcementUuid} # Delete apiv1projects homepage Source: https://docs.lightdash.com/api-reference/homepage/delete-apiv1projects-homepage https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/homepage/{homepageUuid} # Get apiv1eehomepagerecommended action skips Source: https://docs.lightdash.com/api-reference/homepage/get-apiv1eehomepagerecommended-action-skips https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/ee/homepage/recommended-action-skips # Get apiv1orghomepage settings Source: https://docs.lightdash.com/api-reference/homepage/get-apiv1orghomepage-settings https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/homepage-settings # Get apiv1projects announcements Source: https://docs.lightdash.com/api-reference/homepage/get-apiv1projects-announcements https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/announcements # Get apiv1projects homepage Source: https://docs.lightdash.com/api-reference/homepage/get-apiv1projects-homepage https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/homepage # Get apiv1projects homepageassignments Source: https://docs.lightdash.com/api-reference/homepage/get-apiv1projects-homepageassignments https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/homepage/assignments # Get apiv1projects homepagebuilder Source: https://docs.lightdash.com/api-reference/homepage/get-apiv1projects-homepagebuilder https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/homepage/builder # Get apiv1projects homepagelink metadata Source: https://docs.lightdash.com/api-reference/homepage/get-apiv1projects-homepagelink-metadata https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/homepage/link-metadata # Get apiv1projects homepagelist Source: https://docs.lightdash.com/api-reference/homepage/get-apiv1projects-homepagelist https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/homepage/list # Get apiv1projects homepagerecently viewed Source: https://docs.lightdash.com/api-reference/homepage/get-apiv1projects-homepagerecently-viewed https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/homepage/recently-viewed # Get apiv1projects homepageview as Source: https://docs.lightdash.com/api-reference/homepage/get-apiv1projects-homepageview-as https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/homepage/view-as # Patch apiv1orghomepage settings Source: https://docs.lightdash.com/api-reference/homepage/patch-apiv1orghomepage-settings https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/org/homepage-settings # Patch apiv1projects announcements Source: https://docs.lightdash.com/api-reference/homepage/patch-apiv1projects-announcements https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/announcements/{announcementUuid} # Patch apiv1projects homepage Source: https://docs.lightdash.com/api-reference/homepage/patch-apiv1projects-homepage https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/homepage/{homepageUuid} # Patch apiv1projects homepagegroup priorities Source: https://docs.lightdash.com/api-reference/homepage/patch-apiv1projects-homepagegroup-priorities https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/homepage/group-priorities # Post apiv1eehomepagerecommended action skips Source: https://docs.lightdash.com/api-reference/homepage/post-apiv1eehomepagerecommended-action-skips https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/ee/homepage/recommended-action-skips # Post apiv1projects announcements Source: https://docs.lightdash.com/api-reference/homepage/post-apiv1projects-announcements https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/announcements # Post apiv1projects announcementsimages Source: https://docs.lightdash.com/api-reference/homepage/post-apiv1projects-announcementsimages https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/announcements/images # Post apiv1projects homepage Source: https://docs.lightdash.com/api-reference/homepage/post-apiv1projects-homepage https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/homepage # Post apiv1projects homepage discard draft Source: https://docs.lightdash.com/api-reference/homepage/post-apiv1projects-homepage-discard-draft https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/homepage/{homepageUuid}/discard-draft # Post apiv1projects homepage publish Source: https://docs.lightdash.com/api-reference/homepage/post-apiv1projects-homepage-publish https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/homepage/{homepageUuid}/publish # Start impersonation Source: https://docs.lightdash.com/api-reference/impersonation/start-impersonation https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/impersonation/start Start impersonating a user # Stop impersonation Source: https://docs.lightdash.com/api-reference/impersonation/stop-impersonation https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/impersonation/stop Stop impersonating a user # Install GitHub App Source: https://docs.lightdash.com/api-reference/install-github-app https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/github/install Install the Lightdash GitHub App and link to an organization # Install GitLab integration Source: https://docs.lightdash.com/api-reference/install-gitlab-integration https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/gitlab/install Initiate GitLab OAuth integration # Check Slack OpenID link status Source: https://docs.lightdash.com/api-reference/integrations/check-slack-openid-link-status https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/slack/is-authenticated Check if the user has an OpenID identity for Slack # Connect Jira Source: https://docs.lightdash.com/api-reference/integrations/connect-jira https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/jira/install Start Jira OAuth with the organization's own Atlassian OAuth 2.0 app # Connect Linear Source: https://docs.lightdash.com/api-reference/integrations/connect-linear https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/linear/install Start Linear OAuth with PKCE # Delete Slack installation Source: https://docs.lightdash.com/api-reference/integrations/delete-slack-installation https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/slack Delete the Slack installation for the organization # Get Google Drive access token Source: https://docs.lightdash.com/api-reference/integrations/get-google-drive-access-token https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/gdrive/get-access-token Get access token for google drive # Get Jira installation Source: https://docs.lightdash.com/api-reference/integrations/get-jira-installation https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/jira Get the Jira site connected to the organization # Get Linear installation Source: https://docs.lightdash.com/api-reference/integrations/get-linear-installation https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/linear Get the current Linear workspace connected to the organization # Get Slack card image Source: https://docs.lightdash.com/api-reference/integrations/get-slack-card-image https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/slack/card-image/{id} Get a Slack AI agent card image. Falls back to a placeholder image if the image is not found. Intentionally public (no auth): Slack's unfurl bot fetches preview images without user credentials. Access is guarded by an unguessable 21-char nanoid (only minted server-side and shared with Slack during the unfurl of a resource the user already has access to), strict `{id}` validation, and no-store / noindex response headers. # Get Slack channels Source: https://docs.lightdash.com/api-reference/integrations/get-slack-channels https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/slack/channels Get slack channels # Get Slack image Source: https://docs.lightdash.com/api-reference/integrations/get-slack-image https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/slack/image/{nanoId} Get a Slack image by nanoId # Get Slack installation Source: https://docs.lightdash.com/api-reference/integrations/get-slack-installation https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/slack Get Slack installation details for the organization # Get Slack preview Source: https://docs.lightdash.com/api-reference/integrations/get-slack-preview https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/slack/preview/{id} Get a Slack unfurl preview image via redirect to a fresh signed URL. Falls back to a placeholder image if the preview is not found. # Install Slack Source: https://docs.lightdash.com/api-reference/integrations/install-slack https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/slack/install Start the Slack installation flow # Jira OAuth callback Source: https://docs.lightdash.com/api-reference/integrations/jira-oauth-callback https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/jira/oauth/callback Finish Jira OAuth and return to Ask AI settings # Linear OAuth callback Source: https://docs.lightdash.com/api-reference/integrations/linear-oauth-callback https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/linear/oauth/callback Finish Linear OAuth and return to Ask AI settings # List Jira issue types Source: https://docs.lightdash.com/api-reference/integrations/list-jira-issue-types https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/jira/issue-types List Jira issue types available in a project # List Jira projects Source: https://docs.lightdash.com/api-reference/integrations/list-jira-projects https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/jira/projects List Jira projects accessible through the connection # List Jira sites Source: https://docs.lightdash.com/api-reference/integrations/list-jira-sites https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/jira/sites List Jira sites available through the connection # List Linear projects Source: https://docs.lightdash.com/api-reference/integrations/list-linear-projects https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/linear/projects List the Linear projects belonging to a team # List Linear teams Source: https://docs.lightdash.com/api-reference/integrations/list-linear-teams https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/linear/teams List Linear teams accessible via the integration # Lookup channel Source: https://docs.lightdash.com/api-reference/integrations/lookup-channel https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/slack/channels/{channelId} Look up a single Slack channel by ID. Used for on-demand fetching when user pastes a channel ID not in the cache. # Reconnect Jira Source: https://docs.lightdash.com/api-reference/integrations/reconnect-jira https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/jira/install Restart Jira OAuth with the credentials already saved for the organization # Select Jira site Source: https://docs.lightdash.com/api-reference/integrations/select-jira-site https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/jira/site Select the Jira site used by the organization # Uninstall Jira integration Source: https://docs.lightdash.com/api-reference/integrations/uninstall-jira-integration https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/jira/uninstall Uninstall Jira integration from the organization # Uninstall Linear integration Source: https://docs.lightdash.com/api-reference/integrations/uninstall-linear-integration https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/linear/uninstall Uninstall Linear integration from the organization # Update Slack custom settings Source: https://docs.lightdash.com/api-reference/integrations/update-slack-custom-settings https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/slack/custom-settings Update slack notification channel to send notifications to scheduled jobs fail # Upload rows to Google Sheet Source: https://docs.lightdash.com/api-reference/integrations/upload-rows-to-google-sheet https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/gdrive/upload-gsheet-from-rows Upload client-supplied rows to a new Google Sheet (data apps). # Upload to Google Sheet Source: https://docs.lightdash.com/api-reference/integrations/upload-to-google-sheet https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/gdrive/upload-gsheet Upload results from query to Google Sheet # Get workspace command output Source: https://docs.lightdash.com/api-reference/learn/get-workspace-command-output https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/learn/workspace/commands/{commandUuid} Get the status and output of a previously queued sandbox command. Pass `after` (the highest `seq` already received) to page through output as it streams in. # Get workspace file Source: https://docs.lightdash.com/api-reference/learn/get-workspace-file https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/learn/workspace/files/{path} Get the content of a single file in the learner's sandbox workspace. The path is URL-encoded (e.g. `models%2Forders.yml`); tsoa/Express decode it (including any encoded slashes) before it reaches this handler, so `path` already holds the plain file path. # List workspace files Source: https://docs.lightdash.com/api-reference/learn/list-workspace-files https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/learn/workspace/files List the files in the learner's sandbox workspace # Run workspace command Source: https://docs.lightdash.com/api-reference/learn/run-workspace-command https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/learn/workspace/commands Queue a lightdash or dbt command to run in the learner's sandbox workspace # Save workspace file Source: https://docs.lightdash.com/api-reference/learn/save-workspace-file https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/projects/{projectUuid}/learn/workspace/files/{path} Save the content of a single file in the learner's sandbox workspace. The path is URL-encoded (e.g. `models%2Forders.yml`); tsoa/Express decode it (including any encoded slashes) before it reaches this handler, so `path` already holds the plain file path. # Link GitHub account Source: https://docs.lightdash.com/api-reference/link-github-account https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/github/user/authorize Link the authenticated user's personal GitHub account so write-backs can be authored as them instead of the Lightdash GitHub App # List agent documents Source: https://docs.lightdash.com/api-reference/list-agent-documents https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/documents List the knowledge documents this agent can use: the organization level documents plus the ones granted to this agent in this project. # List agent skills Source: https://docs.lightdash.com/api-reference/list-agent-skills https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/skills The skills this agent serves: its bound custom skills plus the built-in ones. Anyone who can use the agent can read this. # List AI agent documents Source: https://docs.lightdash.com/api-reference/list-ai-agent-documents https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/documents List every knowledge document in the organization. # List AI agent evaluation prompts Source: https://docs.lightdash.com/api-reference/list-ai-agent-evaluation-prompts https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/evals/{evalUuid}/prompts Get the prompts of an AI agent evaluation for admin # List AI agent evaluations Source: https://docs.lightdash.com/api-reference/list-ai-agent-evaluations https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/evals Get all AI agent evaluations for admin # List AI agent memories Source: https://docs.lightdash.com/api-reference/list-ai-agent-memories https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/memories Get all AI agent memories for admin # List AI agent review items Source: https://docs.lightdash.com/api-reference/list-ai-agent-review-items https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/review-items Get AI agent classifier review items for admin # List AI agent review signals Source: https://docs.lightdash.com/api-reference/list-ai-agent-review-signals https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/review-items/{fingerprint} Get AI agent classifier review signals for admin debugging # List AI agent skills Source: https://docs.lightdash.com/api-reference/list-ai-agent-skills https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/skills List the organization's custom skills. With a project, returns the organization-wide skills plus the ones scoped to that project. Deleted skills are included on request so one of their versions can be restored. # List AI agent thread pull requests Source: https://docs.lightdash.com/api-reference/list-ai-agent-thread-pull-requests https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}/pull-requests List every pull request the coding agent has opened in this thread (its workstreams), each enriched with live PR state where available. A thread can drive several PRs across one or more repos. # List AI agent threads Source: https://docs.lightdash.com/api-reference/list-ai-agent-threads https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/threads Get all AI agent threads for admin # List AI agents Source: https://docs.lightdash.com/api-reference/list-ai-agents https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/agents Get all AI agents for admin # List AI agents as code (deprecated) Source: https://docs.lightdash.com/api-reference/list-ai-agents-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgents/code # List an AI agent skill's versions Source: https://docs.lightdash.com/api-reference/list-an-ai-agent-skills-versions https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/skills/{skillUuid}/versions Every version of the skill, newest first, without content. # List Deep Research events Source: https://docs.lightdash.com/api-reference/list-deep-research-events https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/ee/projects/{projectUuid}/ai-deep-research/{aiDeepResearchRunUuid}/events List persisted progress for a Deep Research run in chronological order. Pass the returned cursor unchanged to receive only newer events. The cursor remains usable when no new events are available. # List Deep Research runs Source: https://docs.lightdash.com/api-reference/list-deep-research-runs https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/ee/projects/{projectUuid}/ai-deep-research List the caller's Deep Research runs attached to an agent thread. # List GitHub repositories Source: https://docs.lightdash.com/api-reference/list-github-repositories https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/github/repos/list List GitHub repositories accessible via the installed app. Requires permission to manage the organization's Git integration. # List GitLab projects Source: https://docs.lightdash.com/api-reference/list-gitlab-projects https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/gitlab/repos/list List GitLab projects accessible via the integration # List MCP activity Source: https://docs.lightdash.com/api-reference/list-mcp-activity https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/mcp-activity Get MCP tool call activity for admin # List my memories Source: https://docs.lightdash.com/api-reference/list-my-memories https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/aiAgentMemories Lists the active memories the AI agents saved from the requesting user's own threads in this project. The owner is always the session user. # List router decisions Source: https://docs.lightdash.com/api-reference/list-router-decisions https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/aiRouter/decisions List recent routing decisions for the org's router. # Get map tile Source: https://docs.lightdash.com/api-reference/map/get-map-tile https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/map-tiles/{style}/{z}/{x}/{y}.png Serve CARTO basemap images without exposing the provider credential. Session and verified embed accounts are both supported. # Proxy GeoJSON Source: https://docs.lightdash.com/api-reference/map/proxy-geojson https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/geojson-proxy Proxies external GeoJSON files to bypass CORS restrictions # Compile metric total query Source: https://docs.lightdash.com/api-reference/metrics-explorer/compile-metric-total-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/metricsExplorer/{explore}/{metric}/compileMetricTotalQuery Compile the metric total query SQL # Run metric series query Source: https://docs.lightdash.com/api-reference/metrics-explorer/run-metric-series-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/metricsExplorer/{explore}/{metric}/runMetricSeries Run a metric time series query for a sparkline # Run metric total query Source: https://docs.lightdash.com/api-reference/metrics-explorer/run-metric-total-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/metricsExplorer/{explore}/{metric}/runMetricTotal Run a metric total query with comparison # Delete apiv1mobilepush notificationsinstallations Source: https://docs.lightdash.com/api-reference/mobile-push-notifications/delete-apiv1mobilepush-notificationsinstallations https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/mobile/push-notifications/installations/{installationUuid} # Get apiv1mobilepush notificationsstatus Source: https://docs.lightdash.com/api-reference/mobile-push-notifications/get-apiv1mobilepush-notificationsstatus https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/mobile/push-notifications/status # Put apiv1mobilepush notificationsinstallations Source: https://docs.lightdash.com/api-reference/mobile-push-notifications/put-apiv1mobilepush-notificationsinstallations https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/mobile/push-notifications/installations/{installationUuid} # Put apiv1mobilepush notificationsinstallations live activity push to start token Source: https://docs.lightdash.com/api-reference/mobile-push-notifications/put-apiv1mobilepush-notificationsinstallations-live-activity-push-to-start-token https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/mobile/push-notifications/installations/{installationUuid}/live-activity-push-to-start-token # Complete onboarding tour Source: https://docs.lightdash.com/api-reference/my-account/complete-onboarding-tour https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/user/onboarding Mark a feature tour as completed for the authenticated user # Complete Redshift AWS SSO login Source: https://docs.lightdash.com/api-reference/my-account/complete-redshift-aws-sso-login https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/user/warehouseCredentials/redshift/aws-sso/complete Complete Redshift AWS SSO login # Create email one-time passcode Source: https://docs.lightdash.com/api-reference/my-account/create-email-one-time-passcode https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/user/me/email/otp Create a new one-time passcode for the current user's primary email. The user will receive an email with the passcode. # Create personal access token Source: https://docs.lightdash.com/api-reference/my-account/create-personal-access-token https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/user/me/personal-access-tokens Create personal access token # Create warehouse credentials Source: https://docs.lightdash.com/api-reference/my-account/create-warehouse-credentials https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/user/warehouseCredentials Create user warehouse credentials # Delete avatar Source: https://docs.lightdash.com/api-reference/my-account/delete-avatar https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/user/me/avatar Remove the current user's uploaded avatar. # Delete personal access token Source: https://docs.lightdash.com/api-reference/my-account/delete-personal-access-token https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/user/me/personal-access-tokens/{personalAccessTokenUuid} Delete personal access token # Delete user Source: https://docs.lightdash.com/api-reference/my-account/delete-user https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/user/me Delete user # Delete warehouse credentials Source: https://docs.lightdash.com/api-reference/my-account/delete-warehouse-credentials https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/user/warehouseCredentials/{uuid} Delete user warehouse credentials # Get account Source: https://docs.lightdash.com/api-reference/my-account/get-account https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/user/account Get account information # Get authenticated user Source: https://docs.lightdash.com/api-reference/my-account/get-authenticated-user https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/user Get authenticated user # Get email verification status Source: https://docs.lightdash.com/api-reference/my-account/get-email-verification-status https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/user/me/email/status Get the verification status for the current user's primary email # Get Learn progress Source: https://docs.lightdash.com/api-reference/my-account/get-learn-progress https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/user/learn-progress Learn walkthrough progress for the authenticated user: what the library shows as complete, started, and up next, from any browser. # Get login options Source: https://docs.lightdash.com/api-reference/my-account/get-login-options https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/user/login-options Get login options # Get onboarding Source: https://docs.lightdash.com/api-reference/my-account/get-onboarding https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/user/onboarding Get the authenticated user's onboarding state, i.e. which feature tours they have completed # Get user avatar Source: https://docs.lightdash.com/api-reference/my-account/get-user-avatar https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/users/{userUuid}/avatar/{contentHash} Serve a user's avatar image. Content-addressed by hash, so responses are immutable and cached by the browser indefinitely. # Join organization Source: https://docs.lightdash.com/api-reference/my-account/join-organization https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/user/me/joinOrganization/{organizationUuid} Add the current user to an organization that accepts users with a verified email domain. This will fail if the organization email domain does not match the user's primary email domain. # Leave organization Source: https://docs.lightdash.com/api-reference/my-account/leave-organization https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/user/me/leaveOrganization Remove the current user from their organization. Fails if the caller is the only admin remaining. The user record is preserved so they can join another organization later. # List available organizations Source: https://docs.lightdash.com/api-reference/my-account/list-available-organizations https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/user/me/allowedOrganizations List the organizations that the current user can join. This is based on the user's primary email domain and the organization's allowed email domains. # List personal access tokens Source: https://docs.lightdash.com/api-reference/my-account/list-personal-access-tokens https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/user/me/personal-access-tokens List personal access tokens # List warehouse credentials Source: https://docs.lightdash.com/api-reference/my-account/list-warehouse-credentials https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/user/warehouseCredentials Get user warehouse credentials # Mark Learn walkthrough completed Source: https://docs.lightdash.com/api-reference/my-account/mark-learn-walkthrough-completed https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/user/learn-progress/{scope}/completed Record that the authenticated user completed a Learn walkthrough. Idempotent: the first completion time is kept. # Mark Learn walkthrough started Source: https://docs.lightdash.com/api-reference/my-account/mark-learn-walkthrough-started https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/user/learn-progress/{scope}/started Record that the authenticated user started a Learn walkthrough. The scope must be one the instance's scope registry knows. # Merge browser Learn progress Source: https://docs.lightdash.com/api-reference/my-account/merge-browser-learn-progress https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/user/learn-progress/merge Take in progress a browser recorded before the instance kept it. Unioned with what the instance holds; server timestamps win, and unknown scopes are dropped. # Post apiv1userlogin email otp Source: https://docs.lightdash.com/api-reference/my-account/post-apiv1userlogin-email-otp https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/user/login-email-otp # Post apiv1userlogin email otpverify Source: https://docs.lightdash.com/api-reference/my-account/post-apiv1userlogin-email-otpverify https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/user/login-email-otp/verify # Register user Source: https://docs.lightdash.com/api-reference/my-account/register-user https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/user Register user # Rotate personal access token Source: https://docs.lightdash.com/api-reference/my-account/rotate-personal-access-token https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/user/me/personal-access-tokens/{personalAccessTokenUuid}/rotate Rotate personal access token # Start Redshift AWS SSO login Source: https://docs.lightdash.com/api-reference/my-account/start-redshift-aws-sso-login https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/user/warehouseCredentials/redshift/aws-sso/start Start Redshift AWS SSO login # Update warehouse credentials Source: https://docs.lightdash.com/api-reference/my-account/update-warehouse-credentials https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/user/warehouseCredentials/{uuid} Update user warehouse credentials # Upload avatar Source: https://docs.lightdash.com/api-reference/my-account/upload-avatar https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/user/me/avatar Upload a profile avatar. Send raw image bytes as the body with an image/png, image/jpeg or image/webp Content-Type. The image is center-cropped, resized and re-encoded server-side. # Get notifications Source: https://docs.lightdash.com/api-reference/notifications/get-notifications https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/notifications Gets notifications for a user based on the type # Update notification Source: https://docs.lightdash.com/api-reference/notifications/update-notification https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/notifications/{notificationId} Update notification # Clear default organization design Source: https://docs.lightdash.com/api-reference/organizations/clear-default-organization-design https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/org/designs/default Clear whichever design is currently the organization default. Idempotent — succeeds when no default is set. NOTE: This literal `/default` route MUST stay registered before `Delete('/{designUuidOrSlug}')` below so Express routes a request to `DELETE /api/v1/org/designs/default` here rather than treating "default" as a `designUuidOrSlug` path param. # Confirm domain verification Source: https://docs.lightdash.com/api-reference/organizations/confirm-domain-verification https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/org/domains/confirm Confirms a domain verification passcode. On success the domain is marked verified for the organization. # Create color palette Source: https://docs.lightdash.com/api-reference/organizations/create-color-palette https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/org/color-palettes Create a new color palette # Create group Source: https://docs.lightdash.com/api-reference/organizations/create-group https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/org/groups Creates a new group in the current user's organization # Create invite link Source: https://docs.lightdash.com/api-reference/organizations/create-invite-link https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/invite-links Invite a new user to the organization and create an invite link for them. If the email already belongs to a pending user, a new invite link is generated for them. Only available to organization admins. # Create organization Source: https://docs.lightdash.com/api-reference/organizations/create-organization https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/org Creates a new organization, the current user becomes the Admin of the new organization. This is only available to users that are not already in an organization. # Create organization design Source: https://docs.lightdash.com/api-reference/organizations/create-organization-design https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/org/designs Create a new organization design. Starts empty — upload files separately. # Create project Source: https://docs.lightdash.com/api-reference/organizations/create-project https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/org/projects Create a new project in the organization # Delete all files from organization design Source: https://docs.lightdash.com/api-reference/organizations/delete-all-files-from-organization-design https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/org/designs/{designUuidOrSlug}/files Delete every file in an organization design, keeping the design itself. Idempotent — succeeds when the design already has no files. # Delete Azure AD SSO configuration Source: https://docs.lightdash.com/api-reference/organizations/delete-azure-ad-sso-configuration https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/org/sso/azuread Removes the current organization's Azure AD SSO configuration. # Delete color palette Source: https://docs.lightdash.com/api-reference/organizations/delete-color-palette https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/org/color-palettes/{colorPaletteUuid} Delete a color palette # Delete email sending domain Source: https://docs.lightdash.com/api-reference/organizations/delete-email-sending-domain https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/org/{organizationUuid}/email-whitelabel Removes the sending domain and reverts the organization to the Lightdash sending identity. # Delete file from organization design Source: https://docs.lightdash.com/api-reference/organizations/delete-file-from-organization-design https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/org/designs/{designUuidOrSlug}/files/{fileUuid} Delete a single file from an organization design. # Delete generic OIDC SSO configuration Source: https://docs.lightdash.com/api-reference/organizations/delete-generic-oidc-sso-configuration https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/org/sso/oidc Removes the current organization's generic OIDC SSO configuration. # Delete Google SSO configuration Source: https://docs.lightdash.com/api-reference/organizations/delete-google-sso-configuration https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/org/sso/google Removes the current organization's Google SSO policy, reverting to the instance default (Google enabled). # Delete Okta SSO configuration Source: https://docs.lightdash.com/api-reference/organizations/delete-okta-sso-configuration https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/org/sso/okta Removes the current organization's Okta SSO configuration. # Delete OneLogin SSO configuration Source: https://docs.lightdash.com/api-reference/organizations/delete-onelogin-sso-configuration https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/org/sso/oneLogin Removes the current organization's OneLogin SSO configuration. # Delete organization Source: https://docs.lightdash.com/api-reference/organizations/delete-organization https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/org/{organizationUuid} Deletes an organization and all users inside that organization # Delete organization design Source: https://docs.lightdash.com/api-reference/organizations/delete-organization-design https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/org/designs/{designUuidOrSlug} Delete an organization design and all its files (cascades S3). # Delete organization member Source: https://docs.lightdash.com/api-reference/organizations/delete-organization-member https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/org/user/{userUuid} Deletes a user from the current user's organization # Delete verified domain Source: https://docs.lightdash.com/api-reference/organizations/delete-verified-domain https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/org/domains/{domain} Removes a verified domain and strips it from any SSO provider that routed to it. # Download file from organization design Source: https://docs.lightdash.com/api-reference/organizations/download-file-from-organization-design https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/designs/{designUuidOrSlug}/files/{fileUuid} Download a single file from an organization design. Streams the S3 object body back with the stored Content-Type and a sensible Content-Disposition. # Download theme package Source: https://docs.lightdash.com/api-reference/organizations/download-theme-package https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/designs/{designUuidOrSlug}/package Download a complete organization theme as the canonical theme-as-code tar package. # Enable Learn Source: https://docs.lightdash.com/api-reference/organizations/enable-learn https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/org/training-project Enable Learn for the current organization: create the training project with the caller as its admin. Org admins only. Idempotent. # Enable or disable email sending domain Source: https://docs.lightdash.com/api-reference/organizations/enable-or-disable-email-sending-domain https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/org/{organizationUuid}/email-whitelabel Enables or disables sending from the verified domain. Can only be enabled once both DKIM and return-path are verified. # Ensure playground project Source: https://docs.lightdash.com/api-reference/organizations/ensure-playground-project https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/org/playground-projects/ensure Return the organization's existing project or provision its sample-data playground when the new onboarding flow is available. # Fetch organization brand Source: https://docs.lightdash.com/api-reference/organizations/fetch-organization-brand https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/org/brand/fetch Fetch the brand profile for a domain from Brandfetch without storing it. Used to preview a brand in the appearance settings before saving. Requires the Brandfetch API key to be configured on the instance. # Get Azure AD SSO configuration Source: https://docs.lightdash.com/api-reference/organizations/get-azure-ad-sso-configuration https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/sso/azuread Returns the current organization's Azure AD SSO configuration (sensitive fields are not included). # Get current organization Source: https://docs.lightdash.com/api-reference/organizations/get-current-organization https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org Get the current user's organization # Get email whitelabel configuration Source: https://docs.lightdash.com/api-reference/organizations/get-email-whitelabel-configuration https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/{organizationUuid}/email-whitelabel Returns the organization's email sending domain configuration, or null if none has been set up. # Get generic OIDC SSO configuration Source: https://docs.lightdash.com/api-reference/organizations/get-generic-oidc-sso-configuration https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/sso/oidc Returns the current organization's generic OIDC SSO configuration (sensitive fields are not included). # Get Google SSO configuration Source: https://docs.lightdash.com/api-reference/organizations/get-google-sso-configuration https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/sso/google Returns the current organization's Google SSO policy. Google is enabled by default using the shared instance OAuth app; a configuration only exists when the org has set an explicit policy (e.g. disabled Google). `null` means no explicit policy — Google follows the instance default. # Get impersonation settings Source: https://docs.lightdash.com/api-reference/organizations/get-impersonation-settings https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/impersonation Get the impersonation setting for the current organization # Get invite link Source: https://docs.lightdash.com/api-reference/organizations/get-invite-link https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/invite-links/{inviteLinkCode} Get an invite link by its code. Public endpoint used by the invite acceptance page. # Get Learn access Source: https://docs.lightdash.com/api-reference/organizations/get-learn-access https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/training-project/access Everything the caller can do, anywhere: the scopes they hold through their organization role, any organization-level custom roles, and every project role they hold directly or through a group. The Learn library shows those features and keeps the rest behind a toggle. # Get Okta SSO configuration Source: https://docs.lightdash.com/api-reference/organizations/get-okta-sso-configuration https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/sso/okta Returns the current organization's Okta SSO configuration (sensitive fields are not included). # Get OneLogin SSO configuration Source: https://docs.lightdash.com/api-reference/organizations/get-onelogin-sso-configuration https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/sso/oneLogin Returns the current organization's OneLogin SSO configuration (sensitive fields are not included). # Get organization brand Source: https://docs.lightdash.com/api-reference/organizations/get-organization-brand https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/brand Get the organization's brand profile, previously fetched from Brandfetch. Returns null if no brand profile has been fetched yet. # Get organization brand logo Source: https://docs.lightdash.com/api-reference/organizations/get-organization-brand-logo https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/brand/logos/{logoUuid} Get an uploaded organization brand logo image. # Get organization design Source: https://docs.lightdash.com/api-reference/organizations/get-organization-design https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/designs/{designUuidOrSlug} Get a single organization design with its files. # Get organization member by email Source: https://docs.lightdash.com/api-reference/organizations/get-organization-member-by-email https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/users/email/{email} Get the member profile for a user in the current user's organization by email # Get organization member by UUID Source: https://docs.lightdash.com/api-reference/organizations/get-organization-member-by-uuid https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/users/{userUuid} Get the member profile for a user in the current user's organization by uuid # Get organization settings Source: https://docs.lightdash.com/api-reference/organizations/get-organization-settings https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/settings Returns the current organization's settings. Defaults are returned when no settings have been saved. # Get user dashboards Source: https://docs.lightdash.com/api-reference/organizations/get-user-dashboards https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/user/{userUuid}/dashboards-summary Gets a summary of dashboards owned by a user across all projects # Get user schedulers Source: https://docs.lightdash.com/api-reference/organizations/get-user-schedulers https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/user/{userUuid}/schedulers-summary Gets a summary of scheduled deliveries owned by a user across all projects # Import theme package Source: https://docs.lightdash.com/api-reference/organizations/import-theme-package https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/org/designs/package Create or atomically replace an organization theme from a canonical theme-as-code tar package. Send the uncompressed tar as the raw `application/x-tar` request body; the manifest slug selects the remote theme. # List allowed email domains Source: https://docs.lightdash.com/api-reference/organizations/list-allowed-email-domains https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/allowedEmailDomains Gets the allowed email domains for the current user's organization # List color palettes Source: https://docs.lightdash.com/api-reference/organizations/list-color-palettes https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/color-palettes List all color palettes in the organization # List organization designs Source: https://docs.lightdash.com/api-reference/organizations/list-organization-designs https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/designs List all organization design assets. # List organization groups Source: https://docs.lightdash.com/api-reference/organizations/list-organization-groups https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/groups Gets all the groups in the current user's organization # List organization members Source: https://docs.lightdash.com/api-reference/organizations/list-organization-members https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/users Gets all the members of the current user's organization # List organization projects Source: https://docs.lightdash.com/api-reference/organizations/list-organization-projects https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/projects Gets all projects of the current user's organization # List verified domains Source: https://docs.lightdash.com/api-reference/organizations/list-verified-domains https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/domains Lists the domains the current organization has verified ownership of. # Post apiv1invite links activate Source: https://docs.lightdash.com/api-reference/organizations/post-apiv1invite-links-activate https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/invite-links/{inviteCode}/activate # Reassign dashboards Source: https://docs.lightdash.com/api-reference/organizations/reassign-dashboards https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/org/user/{userUuid}/reassign-dashboards Transfers ownership of all dashboards from one user to another # Reassign schedulers Source: https://docs.lightdash.com/api-reference/organizations/reassign-schedulers https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/org/user/{userUuid}/reassign-schedulers Reassigns all scheduled deliveries from one user to another # Request domain verification Source: https://docs.lightdash.com/api-reference/organizations/request-domain-verification https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/org/domains/verify Sends a one-time passcode to an address at the domain to begin verifying ownership. The domain must not be a public email provider and must not already be verified by another organization. # Revoke all invite links Source: https://docs.lightdash.com/api-reference/organizations/revoke-all-invite-links https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/invite-links Revoke all invite links in the organization. Only available to organization admins. # Save organization brand Source: https://docs.lightdash.com/api-reference/organizations/save-organization-brand https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/org/brand Save the organization's brand appearance as edited by the user. Stores the provided colors, logos, fonts and domain as-is without calling Brandfetch. # Set active color palette Source: https://docs.lightdash.com/api-reference/organizations/set-active-color-palette https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/org/color-palettes/{colorPaletteUuid}/active Set a color palette as the active palette # Set default organization design Source: https://docs.lightdash.com/api-reference/organizations/set-default-organization-design https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/org/designs/{designUuidOrSlug}/default Mark this design as the organization's default. Clears any previous default. # Set up email sending domain Source: https://docs.lightdash.com/api-reference/organizations/set-up-email-sending-domain https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/org/{organizationUuid}/email-whitelabel Sets up (or replaces) the organization's sending domain and returns the DNS records to publish. Does not start sending — the domain must be verified and enabled first. # Update allowed email domains Source: https://docs.lightdash.com/api-reference/organizations/update-allowed-email-domains https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/org/allowedEmailDomains Updates the allowed email domains for the current user's organization # Update color palette Source: https://docs.lightdash.com/api-reference/organizations/update-color-palette https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/org/color-palettes/{colorPaletteUuid} Update a color palette # Update current organization Source: https://docs.lightdash.com/api-reference/organizations/update-current-organization https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/org Update the current user's organization # Update impersonation settings Source: https://docs.lightdash.com/api-reference/organizations/update-impersonation-settings https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/org/impersonation Update the impersonation setting for the current organization # Update organization design Source: https://docs.lightdash.com/api-reference/organizations/update-organization-design https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/org/designs/{designUuidOrSlug} Update an organization design's name or description. # Update organization settings Source: https://docs.lightdash.com/api-reference/organizations/update-organization-settings https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/org/settings Updates the current organization's settings. Only the provided fields are changed. # Upload file to organization design Source: https://docs.lightdash.com/api-reference/organizations/upload-file-to-organization-design https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/org/designs/{designUuidOrSlug}/files Upload a file into a design. Send raw bytes as the body with the appropriate Content-Type and Content-Length headers. Pass `kind` and `filename` as query parameters. Mirrors the data-app image upload pattern — no multipart wrapping required. # Upload organization brand logo Source: https://docs.lightdash.com/api-reference/organizations/upload-organization-brand-logo https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/org/brand/logos Upload a logo image for the organization brand. Send the raw image bytes as the body (PNG, JPEG, WebP, GIF or SVG). Returns the URL to store in the brand's logos when saving the brand. # Upsert Azure AD SSO configuration Source: https://docs.lightdash.com/api-reference/organizations/upsert-azure-ad-sso-configuration https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/org/sso/azuread Creates or updates the current organization's Azure AD SSO configuration. Omit `oauth2ClientSecret` to preserve the previously stored secret on updates. # Upsert generic OIDC SSO configuration Source: https://docs.lightdash.com/api-reference/organizations/upsert-generic-oidc-sso-configuration https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/org/sso/oidc Creates or updates the current organization's generic OIDC SSO configuration. Omit `clientSecret` to preserve the previously stored secret on updates. # Upsert Google SSO configuration Source: https://docs.lightdash.com/api-reference/organizations/upsert-google-sso-configuration https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/org/sso/google Creates or updates the current organization's Google SSO policy. Google has no per-org credentials — only the `enabled` / domain / password flags are stored. # Upsert Okta SSO configuration Source: https://docs.lightdash.com/api-reference/organizations/upsert-okta-sso-configuration https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/org/sso/okta Creates or updates the current organization's Okta SSO configuration. Omit `oauth2ClientSecret` to preserve the previously stored secret on updates. # Upsert OneLogin SSO configuration Source: https://docs.lightdash.com/api-reference/organizations/upsert-onelogin-sso-configuration https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/org/sso/oneLogin Creates or updates the current organization's OneLogin SSO configuration. Omit `oauth2ClientSecret` to preserve the previously stored secret on updates. # Verify email sending domain Source: https://docs.lightdash.com/api-reference/organizations/verify-email-sending-domain https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/org/{organizationUuid}/email-whitelabel/verify Triggers verification of the DNS records with the email provider and returns the refreshed status. Safe to call repeatedly while DNS propagates. # Patch apiv1aiprovider credentials Source: https://docs.lightdash.com/api-reference/patch-apiv1aiprovider-credentials https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/ai/provider-credentials/{credentialUuid} # Patch apiv1projects aiagents Source: https://docs.lightdash.com/api-reference/patch-apiv1projects-aiagents https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/aiAgents/{agentUuid} # Patch apiv1projects aiagents artifacts versions saveddashboard Source: https://docs.lightdash.com/api-reference/patch-apiv1projects-aiagents-artifacts-versions-saveddashboard https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/artifacts/{artifactUuid}/versions/{versionUuid}/savedDashboard # Patch apiv1projects aiagents artifacts versions savedsql Source: https://docs.lightdash.com/api-reference/patch-apiv1projects-aiagents-artifacts-versions-savedsql https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/artifacts/{artifactUuid}/versions/{versionUuid}/savedSql # Patch apiv1projects aiagents artifacts versions verified Source: https://docs.lightdash.com/api-reference/patch-apiv1projects-aiagents-artifacts-versions-verified https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/artifacts/{artifactUuid}/versions/{versionUuid}/verified # Patch apiv1projects aiagents artifacts versions viz config Source: https://docs.lightdash.com/api-reference/patch-apiv1projects-aiagents-artifacts-versions-viz-config https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/artifacts/{artifactUuid}/versions/{versionUuid}/viz-config # Patch apiv1projects aiagents evaluations Source: https://docs.lightdash.com/api-reference/patch-apiv1projects-aiagents-evaluations https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/evaluations/{evalUuid} # Patch apiv1projects aiagents mcpservers tools Source: https://docs.lightdash.com/api-reference/patch-apiv1projects-aiagents-mcpservers-tools https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/mcpServers/{mcpServerUuid}/tools # Patch apiv1projects aiagents threads messages feedback Source: https://docs.lightdash.com/api-reference/patch-apiv1projects-aiagents-threads-messages-feedback https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}/messages/{messageUuid}/feedback # Patch apiv1projects aiagents threads messages savedquery Source: https://docs.lightdash.com/api-reference/patch-apiv1projects-aiagents-threads-messages-savedquery https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}/messages/{messageUuid}/savedQuery # Patch apiv1projects aiagentsmcpservers Source: https://docs.lightdash.com/api-reference/patch-apiv1projects-aiagentsmcpservers https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/aiAgents/mcpServers/{mcpServerUuid} # Pin AI agent thread Source: https://docs.lightdash.com/api-reference/pin-ai-agent-thread https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}/pin Pin a thread to the top of the sidebar. # Post apiv1aiprovider credentials Source: https://docs.lightdash.com/api-reference/post-apiv1aiprovider-credentials https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/ai/provider-credentials # Post apiv1projects aiagents Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagents https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents # Post apiv1projects aiagents append instruction Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagents-append-instruction https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/append-instruction # Post apiv1projects aiagents avatar Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagents-avatar https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/avatar # Post apiv1projects aiagents evaluatereadiness Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagents-evaluatereadiness https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/evaluateReadiness # Post apiv1projects aiagents evaluations Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagents-evaluations https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/evaluations # Post apiv1projects aiagents evaluations append Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagents-evaluations-append https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/evaluations/{evalUuid}/append # Post apiv1projects aiagents evaluations run Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagents-evaluations-run https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/evaluations/{evalUuid}/run # Post apiv1projects aiagents threads Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagents-threads https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads # Post apiv1projects aiagents threads clone Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagents-threads-clone https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}/clone/{promptUuid} # Post apiv1projects aiagents threads generate Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagents-threads-generate https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}/generate # Post apiv1projects aiagents threads generate title Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagents-threads-generate-title https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}/generate-title # Post apiv1projects aiagents threads messages Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagents-threads-messages https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}/messages # Post apiv1projects aiagents threads messages interrupt Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagents-threads-messages-interrupt https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}/messages/{messageUuid}/interrupt # Post apiv1projects aiagents threads messages steers Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagents-threads-messages-steers https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}/messages/{messageUuid}/steers # Post apiv1projects aiagents threads shares Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagents-threads-shares https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}/shares # Post apiv1projects aiagents threads stream Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagents-threads-stream https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}/stream # Post apiv1projects aiagents threads tool calls sql approval Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagents-threads-tool-calls-sql-approval https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}/tool-calls/{toolCallId}/sql-approval # Post apiv1projects aiagentsexplore access summary Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagentsexplore-access-summary https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/explore-access-summary # Post apiv1projects aiagentsmcpservers Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagentsmcpservers https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/mcpServers # Post apiv1projects aiagentsmcpservers credential Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagentsmcpservers-credential https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/mcpServers/{mcpServerUuid}/credential # Post apiv1projects aiagentsmcpservers oauthdisconnect Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagentsmcpservers-oauthdisconnect https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/mcpServers/{mcpServerUuid}/oauth/disconnect # Post apiv1projects aiagentsmcpservers oauthstart Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagentsmcpservers-oauthstart https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/mcpServers/{mcpServerUuid}/oauth/start # Post apiv1projects aiagentsmcpservers toolsrefresh Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagentsmcpservers-toolsrefresh https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/mcpServers/{mcpServerUuid}/tools/refresh # Post apiv1projects aiagentsmcpserversgithubconnect Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagentsmcpserversgithubconnect https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/mcpServers/github/connect # Post apiv1projects aiagentsmcpserversgithubconnect app Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagentsmcpserversgithubconnect-app https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/mcpServers/github/connect-app # Post apiv1projects aiagentspreferences Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagentspreferences https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/preferences # Post apiv1projects aiagentsthread shares clone Source: https://docs.lightdash.com/api-reference/post-apiv1projects-aiagentsthread-shares-clone https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/thread-shares/{aiThreadShareUuid}/clone # Post apiv1projects codeaiagents Source: https://docs.lightdash.com/api-reference/post-apiv1projects-codeaiagents https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/code/aiAgents # Preview AI agent review item writeback diff Source: https://docs.lightdash.com/api-reference/preview-ai-agent-review-item-writeback-diff https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/review-items/{fingerprint}/writeback-preview Preview the file change a writeback PR would make, without opening it. Only project_context findings have a deterministic diff. # Preview thread retention impact Source: https://docs.lightdash.com/api-reference/preview-thread-retention-impact https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/aiAgents/admin/settings/thread-retention-preview Preview what an org-level thread retention window would delete on the next cleanup run # Preview visualize Slack chart Source: https://docs.lightdash.com/api-reference/preview-visualize-slack-chart https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/visualize/slack-preview Draw rows with a visualize-tool viz config as the Slack chart image, for debugging the Slack renderer. # Add deploy batch Source: https://docs.lightdash.com/api-reference/project/add-deploy-batch https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/deploy/{sessionUuid}/batch Add a batch of explores to an existing deploy session # Deploy explores Source: https://docs.lightdash.com/api-reference/project/deploy-explores https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v2/projects/{projectUuid}/deploy Deploy explores with the full dbt model inventory for selective cleanup. # Finalize deploy Source: https://docs.lightdash.com/api-reference/project/finalize-deploy https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/deploy/{sessionUuid}/finalize Finalize a deploy session and commit all staged explores to the project # Start deploy session Source: https://docs.lightdash.com/api-reference/project/start-deploy-session https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/deploy Start a new deploy session for batched explore uploads # Add dbt source Source: https://docs.lightdash.com/api-reference/projects/add-dbt-source https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/dbt-sources Add an additional dbt source to a project. # Calculate subtotals from query Source: https://docs.lightdash.com/api-reference/projects/calculate-subtotals-from-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/calculate-subtotals Calculate subtotals from a metricQuery # Calculate total from query Source: https://docs.lightdash.com/api-reference/projects/calculate-total-from-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/calculate-total Calculate all metric totals from a metricQuery # Check BigQuery authentication Source: https://docs.lightdash.com/api-reference/projects/check-bigquery-authentication https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/bigquery/sso/is-authenticated Check if user is authenticated with BigQuery # Check Databricks OAuth authentication Source: https://docs.lightdash.com/api-reference/projects/check-databricks-oauth-authentication https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/databricks/sso/is-authenticated Check if user is authenticated with Databricks OAuth # Check pre-aggregate Source: https://docs.lightdash.com/api-reference/projects/check-pre-aggregate https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/explores/{exploreId}/preAggregateCheck Check pre-aggregate availability for a metric query # Check Snowflake SSO authentication Source: https://docs.lightdash.com/api-reference/projects/check-snowflake-sso-authentication https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/snowflake/sso/is-authenticated Check if the user is authenticated with Snowflake SSO # Claim connect code Source: https://docs.lightdash.com/api-reference/projects/claim-connect-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/warehouse-connect/claim Retrieves credentials deposited against a connect code created by the current user. Returns them until the code expires; expired codes are deleted by a scheduled cleanup job # Compile query Source: https://docs.lightdash.com/api-reference/projects/compile-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/explores/{exploreId}/compileQuery Compile a metric query for an explore # Create connect code Source: https://docs.lightdash.com/api-reference/projects/create-connect-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/warehouse-connect/code Creates a short-lived, single-use connect code the Lightdash CLI can use to deposit warehouse credentials on behalf of the current user # Create dashboard Source: https://docs.lightdash.com/api-reference/projects/create-dashboard https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/dashboards Create a new dashboard in a project # Create dashboard with charts Source: https://docs.lightdash.com/api-reference/projects/create-dashboard-with-charts https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/dashboards/with-charts Create a new dashboard with embedded charts # Create project preview Source: https://docs.lightdash.com/api-reference/projects/create-project-preview https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/createPreview Create a preview project # Create tag Source: https://docs.lightdash.com/api-reference/projects/create-tag https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/tags Create a new tag in a project # Create training preview Source: https://docs.lightdash.com/api-reference/projects/create-training-preview https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/training-previews The caller's own copy of the training project for a walkthrough: the copy they already have, kept for another day, or a new one from the seeded state when they have none or it has expired. # Delete tag Source: https://docs.lightdash.com/api-reference/projects/delete-tag https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/tags/{tagUuid} Delete a tag from a project # Delete training previews Source: https://docs.lightdash.com/api-reference/projects/delete-training-previews https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/training-previews Remove the caller's own copies of the training project, once a walkthrough is finished or abandoned. # Deposit connection Source: https://docs.lightdash.com/api-reference/projects/deposit-connection https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/warehouse-connect/deposit Deposits durable warehouse credentials against a connect code. Called by the Lightdash CLI; the connect code is the bearer credential, so this endpoint is intentionally unauthenticated # Dismiss content draft Source: https://docs.lightdash.com/api-reference/projects/dismiss-content-draft https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/code/drafts/{draftUuid}/dismiss Dismiss a draft without writing it back # Dismiss validation error Source: https://docs.lightdash.com/api-reference/projects/dismiss-validation-error https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/validate/{validationIdOrUuid} Deletes a single validation error. # Download user activity CSV Source: https://docs.lightdash.com/api-reference/projects/download-user-activity-csv https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/analytics/user-activity/{projectUuid}/download Download user activity as CSV # Get agent SQL scope Source: https://docs.lightdash.com/api-reference/projects/get-agent-sql-scope https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/agentSqlScope Get the agent SQL scope for a project # Get apiv1projects codehomepages Source: https://docs.lightdash.com/api-reference/projects/get-apiv1projects-codehomepages https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/code/homepages # Get apiv1projects colorpalette Source: https://docs.lightdash.com/api-reference/projects/get-apiv1projects-colorpalette https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/colorPalette # Get apiv1projects dbtmanifest Source: https://docs.lightdash.com/api-reference/projects/get-apiv1projects-dbtmanifest https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/dbt/manifest # Get apiv1projects warehouse credentialsshared sign in Source: https://docs.lightdash.com/api-reference/projects/get-apiv1projects-warehouse-credentialsshared-sign-in https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/warehouse-credentials/shared-sign-in # Get BigQuery datasets Source: https://docs.lightdash.com/api-reference/projects/get-bigquery-datasets https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/bigquery/sso/datasets Get BigQuery datasets for a project # Get BigQuery project recommendation Source: https://docs.lightdash.com/api-reference/projects/get-bigquery-project-recommendation https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/bigquery/sso/projects/recommendation Get the recommended BigQuery project based on dataset size # Get BigQuery projects Source: https://docs.lightdash.com/api-reference/projects/get-bigquery-projects https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/bigquery/sso/projects Get BigQuery projects accessible by the user # Get chart fields for rename Source: https://docs.lightdash.com/api-reference/projects/get-chart-fields-for-rename https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/rename/chart/{chartUuid}/fields Get a list of fields for this chart's explore to be used when renaming a chart in the UI # Get compilation log for a specific job Source: https://docs.lightdash.com/api-reference/projects/get-compilation-log-for-a-specific-job https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/compile-logs/job/{jobUuid} Get compilation log by job UUID # Get content-as-code settings Source: https://docs.lightdash.com/api-reference/projects/get-content-as-code-settings https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/code/sync-settings The content_as_code flags last stamped on this project by an upload # Get content-as-code upload advisory Source: https://docs.lightdash.com/api-reference/projects/get-content-as-code-upload-advisory https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/code/upload-advisory Advisory state shown by the CLI before an upload. It never gates upload. # Get content draft review Source: https://docs.lightdash.com/api-reference/projects/get-content-draft-review https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/code/drafts/{draftUuid}/review The review payload for one draft: published vs draft as canonical YAML # Get content draft staleness Source: https://docs.lightdash.com/api-reference/projects/get-content-draft-staleness https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/code/drafts/{draftUuid}/staleness What the repo and the draft each changed since the draft's base # Get dashboard fields for rename Source: https://docs.lightdash.com/api-reference/projects/get-dashboard-fields-for-rename https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/rename/dashboard/{dashboardUuid}/fields Get a list of fields from explores referenced by the dashboard's filters # Get dbt source Source: https://docs.lightdash.com/api-reference/projects/get-dbt-source https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/dbt-sources/{projectDbtSourceUuid} Get a single dbt source including its connection, with credentials stripped — used to pre-fill the edit form. # Get download activity log Source: https://docs.lightdash.com/api-reference/projects/get-download-activity-log https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/analytics/user-activity/{projectUuid}/download-activity Get download activity log for a project, ordered by most recent first. Two pagination modes are supported: - Offset mode: pass `page` (1-indexed) and `pageSize`. Response includes `page`/`totalResults`/`totalPageCount`. - Cursor mode: pass `cursor` (from a previous response's `nextCursor`) and `pageSize`. `page` is ignored when `cursor` is provided. Avoids the count query so `page`/`totalResults`/`totalPageCount` are null in the response. # Get explore Source: https://docs.lightdash.com/api-reference/projects/get-explore https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/explores/{exploreId} Get a specific explore # Get preview expiration settings Source: https://docs.lightdash.com/api-reference/projects/get-preview-expiration-settings https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/previews-config Get preview project expiration settings for a project # Get project Source: https://docs.lightdash.com/api-reference/projects/get-project https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid} Get a project of an organiztion # Get project color palette Source: https://docs.lightdash.com/api-reference/projects/get-project-color-palette https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/table-groups Get the resolved color palette for a project, walking the chart -> dashboard -> space -> project -> organization fallback chain (matches saved-chart resolution). The optional UUIDs let unsaved renderers (Explore, AI viz, sql runner) opt into deeper layers as they become available. # Get project compilation logs Source: https://docs.lightdash.com/api-reference/projects/get-project-compilation-logs https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/compile-logs Get compilation logs for a project # Get results cache settings Source: https://docs.lightdash.com/api-reference/projects/get-results-cache-settings https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/results-cache-config Get the results cache settings for a project: whether caching is enabled and its TTL. A null TTL means the instance-wide default applies. # Get results cache stats Source: https://docs.lightdash.com/api-reference/projects/get-results-cache-stats https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/results-cache/stats Hit rate, warehouse time saved and recommendations for the project's results cache over the last 7 or 30 days. Requires project admin access. # Get results cache status Source: https://docs.lightdash.com/api-reference/projects/get-results-cache-status https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/results-cache-config/status Whether query results are cached for a project. Readable by anyone who can view the project. # Get results cache TTL projections Source: https://docs.lightdash.com/api-reference/projects/get-results-cache-ttl-projections https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/results-cache/ttl-projections Estimated hit rate for the next longer cache durations, replayed from the queries in the selected period (last 7 or 30 days). Requires project admin access. # Get SQL charts as code Source: https://docs.lightdash.com/api-reference/projects/get-sql-charts-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/code/sqlCharts Gets SQL charts in code representation # Get upstream diff Source: https://docs.lightdash.com/api-reference/projects/get-upstream-diff https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/upstreamDiff Diff a preview project against the project it was copied from, using the catalog index. Detects added/removed fields and label changes; does not detect SQL-only field changes. # Get user activity Source: https://docs.lightdash.com/api-reference/projects/get-user-activity https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/analytics/user-activity/{projectUuid} Get user activity for a project # Get user warehouse credentials preference Source: https://docs.lightdash.com/api-reference/projects/get-user-warehouse-credentials-preference https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/user-credentials Get the user's warehouse credentials preference for a project # Get validation results Source: https://docs.lightdash.com/api-reference/projects/get-validation-results https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/validate Get validation results for a project. This will return the results of the latest validation job. # Handle dbt Cloud webhook Source: https://docs.lightdash.com/api-reference/projects/handle-dbt-cloud-webhook https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/dbt-cloud/webhook Handle dbt Cloud webhook for job completion # Invalidate explores results cache Source: https://docs.lightdash.com/api-reference/projects/invalidate-explores-results-cache https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/results-cache/invalidate/explores Invalidate the cached query results of the listed explores. The next run of each query against them executes against the warehouse, and results from other explores stay cached. Queries that share a cache key are invalidated too. Query history and existing result files are kept. Requires project admin access. Only the listed explores are cleared by default. Set includeJoinedExplores to also clear every explore that reads the base table of a listed explore, for example by joining it. The response lists every explore that was cleared. Pre-aggregates are not rebuilt: refresh them as well, or queries routed to them keep returning the same data. Call this from a data pipeline once a load finishes, e.g. `curl -X POST -H "Authorization: ApiKey $LIGHTDASH_API_KEY" -H "Content-Type: application/json" -d '{"exploreNames":["orders","payments"]}' "$LIGHTDASH_URL/api/v1/projects/$PROJECT_UUID/results-cache/invalidate/explores"` # Invalidate results cache Source: https://docs.lightdash.com/api-reference/projects/invalidate-results-cache https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/results-cache/invalidate Invalidate every cached query result in the project. The next run of each chart, dashboard tile or API query executes against the warehouse and repopulates the cache. Query history and existing result files are kept. Requires project admin access. Call this from a data pipeline once a dbt run or load finishes, e.g. `curl -X POST -H "Authorization: ApiKey $LIGHTDASH_API_KEY" "$LIGHTDASH_URL/api/v1/projects/$PROJECT_UUID/results-cache/invalidate"` # List alerts as code Source: https://docs.lightdash.com/api-reference/projects/list-alerts-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/code/alerts Get alerts in code representation # List alerts as code (deprecated) Source: https://docs.lightdash.com/api-reference/projects/list-alerts-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/alerts/code # List BigQuery datasets for a key file Source: https://docs.lightdash.com/api-reference/projects/list-bigquery-datasets-for-a-key-file https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/bigquery/datasets List the datasets a service account key can see, before a project exists # List chart summaries in project Source: https://docs.lightdash.com/api-reference/projects/list-chart-summaries-in-project https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/chart-summaries List all charts summaries in a project # List charts as code Source: https://docs.lightdash.com/api-reference/projects/list-charts-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/code/charts Get charts in code representation # List charts as code (deprecated) Source: https://docs.lightdash.com/api-reference/projects/list-charts-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/charts/code # List charts by explore Source: https://docs.lightdash.com/api-reference/projects/list-charts-by-explore https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/explores/{exploreId}/charts List charts referencing a given explore # List charts in project Source: https://docs.lightdash.com/api-reference/projects/list-charts-in-project https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/charts List all charts in a project # List content-as-code write-backs Source: https://docs.lightdash.com/api-reference/projects/list-content-as-code-write-backs https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/code/writebacks List this instance's content-as-code write-back PRs for the project. Pass refresh=true to also re-check open PRs against the git provider (a merged PR then reads as merged instead of a stale pending badge). # List content drafts Source: https://docs.lightdash.com/api-reference/projects/list-content-drafts https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/code/drafts Unpublished content drafts awaiting review # List custom metrics Source: https://docs.lightdash.com/api-reference/projects/list-custom-metrics https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/custom-metrics Get all custom metrics in a project # List dashboards Source: https://docs.lightdash.com/api-reference/projects/list-dashboards https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/dashboards Get all dashboards in a project # List dashboards as code Source: https://docs.lightdash.com/api-reference/projects/list-dashboards-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/code/dashboards Get dashboards in code representation # List dashboards as code (deprecated) Source: https://docs.lightdash.com/api-reference/projects/list-dashboards-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/dashboards/code # List dbt sources Source: https://docs.lightdash.com/api-reference/projects/list-dbt-sources https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/dbt-sources List the dbt sources connected to a project (the primary source plus any additional sources), without credentials. # List Documents as code Source: https://docs.lightdash.com/api-reference/projects/list-documents-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/code/documents List the Documents you can view, in code representation # List explores Source: https://docs.lightdash.com/api-reference/projects/list-explores https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/explores Get all explores for a project # List external connections as code Source: https://docs.lightdash.com/api-reference/projects/list-external-connections-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/code/externalConnections Get data-app external connections in code representation. Enterprise only; requires the manage ExternalConnection permission. Secrets are never included. # List Google Sheets syncs as code Source: https://docs.lightdash.com/api-reference/projects/list-google-sheets-syncs-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/code/googleSheets Get Google Sheets syncs in code representation # List Google Sheets syncs as code (deprecated) Source: https://docs.lightdash.com/api-reference/projects/list-google-sheets-syncs-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/googleSheets/code # List project group accesses Source: https://docs.lightdash.com/api-reference/projects/list-project-group-accesses https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/groupAccesses List group access for projects # List project user warehouse credentials Source: https://docs.lightdash.com/api-reference/projects/list-project-user-warehouse-credentials https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/user-warehouse-credentials Get user warehouse credentials available for a project # List scheduled deliveries as code Source: https://docs.lightdash.com/api-reference/projects/list-scheduled-deliveries-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/code/scheduledDeliveries Get scheduled deliveries in code representation # List scheduled deliveries as code (deprecated) Source: https://docs.lightdash.com/api-reference/projects/list-scheduled-deliveries-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/scheduledDeliveries/code # List spaces in project Source: https://docs.lightdash.com/api-reference/projects/list-spaces-in-project https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/spaces List all spaces in a project # List SQL charts as code (deprecated) Source: https://docs.lightdash.com/api-reference/projects/list-sql-charts-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/sqlCharts/code # List tags Source: https://docs.lightdash.com/api-reference/projects/list-tags https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/tags Get all tags in a project # List verified content Source: https://docs.lightdash.com/api-reference/projects/list-verified-content https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/content-verification List all verified content (charts and dashboards) in a project # List virtual views as code Source: https://docs.lightdash.com/api-reference/projects/list-virtual-views-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/code/virtualViews Get virtual views in code representation # List virtual views as code (deprecated) Source: https://docs.lightdash.com/api-reference/projects/list-virtual-views-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/virtualViews/code # Post apiv1projects codehomepages Source: https://docs.lightdash.com/api-reference/projects/post-apiv1projects-codehomepages https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/code/homepages/{name} # Post apiv1projects warehouse credentialsshared sign in Source: https://docs.lightdash.com/api-reference/projects/post-apiv1projects-warehouse-credentialsshared-sign-in https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/warehouse-credentials/shared-sign-in # Preview data timezone Source: https://docs.lightdash.com/api-reference/projects/preview-data-timezone https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/preview-data-timezone Preview how the warehouse disambiguates "now" under a data timezone # Preview rename Source: https://docs.lightdash.com/api-reference/projects/preview-rename https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/rename/preview Preview which resources would be affected by a bulk rename # Propose chart to git Source: https://docs.lightdash.com/api-reference/projects/propose-chart-to-git https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/code/writebacks/charts/{slug}/propose Propose the current instance version of a managed chart back to the connected repo: opens (or appends to) this instance's write-back PR for the slug. The retroactive migration path for drifted content. # Propose dashboard to git Source: https://docs.lightdash.com/api-reference/projects/propose-dashboard-to-git https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/code/writebacks/dashboards/{slug}/propose Propose the current instance version of a managed dashboard back to the connected repo, including its dashboard-owned tile charts. Pass addToGit to deliberately add UI-only content to the repo. # Prune content-as-code snapshots Source: https://docs.lightdash.com/api-reference/projects/prune-content-as-code-snapshots https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/code/snapshots/prune Called by the CLI after a full upload of a directory so content whose file was removed from the repo stops being Git-managed. # Pull content from git Source: https://docs.lightdash.com/api-reference/projects/pull-content-from-git https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/code/pull Apply charts and dashboards as code from the project's repo, the in-app equivalent of `lightdash upload` # Rebase content draft Source: https://docs.lightdash.com/api-reference/projects/rebase-content-draft https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/code/drafts/{draftUuid}/rebase Move the caller's draft onto the repo's latest upload snapshot # Refresh pre-aggregate by definition name Source: https://docs.lightdash.com/api-reference/projects/refresh-pre-aggregate-by-definition-name https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/pre-aggregates/definitions/{preAggregateDefinitionName}/refresh Refresh a single pre-aggregate by its definition name # Refresh project Source: https://docs.lightdash.com/api-reference/projects/refresh-project https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/refresh Refresh a project by recompiling dbt # Refresh project pre-aggregates Source: https://docs.lightdash.com/api-reference/projects/refresh-project-pre-aggregates https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/pre-aggregates/refresh Refresh all pre-aggregates in a project # Release content-as-code snapshot Source: https://docs.lightdash.com/api-reference/projects/release-content-as-code-snapshot https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/code/snapshots/{contentType}/{slug} Stop managing one chart or dashboard from the repo so UI saves publish directly again. The content itself is kept. # Remove dbt source Source: https://docs.lightdash.com/api-reference/projects/remove-dbt-source https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/dbt-sources/{projectDbtSourceUuid} Remove an additional dbt source from a project. The primary source cannot be removed. # Rename chart Source: https://docs.lightdash.com/api-reference/projects/rename-chart https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/rename/chart/{chartUuid} Rename a chart and its fields # Rename content slug Source: https://docs.lightdash.com/api-reference/projects/rename-content-slug https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/slugs/rename Rename a project-scoped content slug # Rename dashboard filter Source: https://docs.lightdash.com/api-reference/projects/rename-dashboard-filter https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/rename/dashboard/{dashboardUuid} Rename a dashboard filter's field or model reference # Rename resources Source: https://docs.lightdash.com/api-reference/projects/rename-resources https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/rename Rename resources in a project # Reopen content draft Source: https://docs.lightdash.com/api-reference/projects/reopen-content-draft https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/code/drafts/{draftUuid}/reopen Reopen the caller's dismissed draft without creating another record # Replace project AI context Source: https://docs.lightdash.com/api-reference/projects/replace-project-ai-context https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/projects/{projectUuid}/project-context Replace the project's AI agent context with the contents of `lightdash.project_context.yml`. Sent by the CLI on deploy/preview so projects without a Git connection get the same context a server-side compile would ingest. The CLI only calls this when the file exists, so removing the file leaves the stored entries unchanged; send an empty `entries: []` file to clear them. Requires the organization's "Review AI agent turns" setting; when it is off the entries are left unchanged. # Replace project table groups Source: https://docs.lightdash.com/api-reference/projects/replace-project-table-groups https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/projects/{projectUuid}/table-groups Replace project-level table-group definitions. Sent by the CLI on deploy/preview so labels & descriptions from `table_groups` in `lightdash.config.yml` are applied. Pass an empty object to clear. # Replace YAML tags Source: https://docs.lightdash.com/api-reference/projects/replace-yaml-tags https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/projects/{projectUuid}/tags/yaml Replace all YAML-defined tags in a project # Set explores Source: https://docs.lightdash.com/api-reference/projects/set-explores https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/projects/{projectUuid}/explores Set explores for a project # Stamp content-as-code settings Source: https://docs.lightdash.com/api-reference/projects/stamp-content-as-code-settings https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/code/sync-settings Persist the repo's content_as_code flags as project-level state. Called by the CLI at upload time so the instance learns what the repo has opted into (Git-backed tracking and write-back). # Test warehouse connection Source: https://docs.lightdash.com/api-reference/projects/test-warehouse-connection https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/warehouse/test Tests warehouse credentials without saving them. Reports each SSH tunnel hop and the database login separately so a broken bastion setup points at the step to fix. # Update agent SQL scope Source: https://docs.lightdash.com/api-reference/projects/update-agent-sql-scope https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/agentSqlScope Update the agent SQL scope for a project # Update dashboards Source: https://docs.lightdash.com/api-reference/projects/update-dashboards https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/dashboards Update multiple dashboards # Update dbt source Source: https://docs.lightdash.com/api-reference/projects/update-dbt-source https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/dbt-sources/{projectDbtSourceUuid} Update an additional dbt source's name or connection. # Update default user spaces setting Source: https://docs.lightdash.com/api-reference/projects/update-default-user-spaces-setting https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/hasDefaultUserSpaces Toggle default user spaces for a project. When enabled, queues a background job that creates personal spaces for all eligible users. # Update preview expiration Source: https://docs.lightdash.com/api-reference/projects/update-preview-expiration https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/preview-expiration Update the expiration date of a preview project. The expiration is recomputed from now, clamped to the upstream project's maximum preview expiration. Omit expiresInHours to reset to the upstream default. # Update preview expiration settings Source: https://docs.lightdash.com/api-reference/projects/update-preview-expiration-settings https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/previews-config Update preview project expiration settings for a project # Update project color palette Source: https://docs.lightdash.com/api-reference/projects/update-project-color-palette https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/colorPalette Set the project's color palette to one of its organization's palettes, or null to inherit from the organization's active palette. # Update project details Source: https://docs.lightdash.com/api-reference/projects/update-project-details https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/details Update simple project details without changing its connection configuration # Update project metadata Source: https://docs.lightdash.com/api-reference/projects/update-project-metadata https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/metadata Update project metadata like upstreamProjectUuid we don't trigger a compile, so not for updating warehouse or credentials # Update query timezone settings Source: https://docs.lightdash.com/api-reference/projects/update-query-timezone-settings https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/queryTimezoneSettings Update query timezone settings for a project # Update results cache clear schedule Source: https://docs.lightdash.com/api-reference/projects/update-results-cache-clear-schedule https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/projects/{projectUuid}/results-cache-config/clear-schedule Set a recurring schedule that invalidates every cached query result in the project. Schedules run daily or weekly at one or more hours, on the hour, in the project's scheduler timezone. Requires project admin access. # Update results cache settings Source: https://docs.lightdash.com/api-reference/projects/update-results-cache-settings https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/results-cache-config Enable or disable results caching for a project, or update its TTL. Omitted fields keep their current value. Pass a null TTL to fall back to the instance-wide default. # Update scheduler settings Source: https://docs.lightdash.com/api-reference/projects/update-scheduler-settings https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/schedulerSettings Update scheduler settings for a project # Update tag Source: https://docs.lightdash.com/api-reference/projects/update-tag https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/tags/{tagUuid} Update a tag in a project # Update user warehouse credentials preference Source: https://docs.lightdash.com/api-reference/projects/update-user-warehouse-credentials-preference https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/user-credentials/{userWarehouseCredentialsUuid} Update the user's warehouse credentials preference for a project # Upsert alert as code Source: https://docs.lightdash.com/api-reference/projects/upsert-alert-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/code/alerts/{slug} Upsert an alert from code representation # Upsert alert as code (deprecated) Source: https://docs.lightdash.com/api-reference/projects/upsert-alert-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/alerts/{slug}/code # Upsert chart as code Source: https://docs.lightdash.com/api-reference/projects/upsert-chart-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/code/charts/{slug} Upsert a chart from code representation # Upsert chart as code (deprecated) Source: https://docs.lightdash.com/api-reference/projects/upsert-chart-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/charts/{slug}/code # Upsert dashboard as code Source: https://docs.lightdash.com/api-reference/projects/upsert-dashboard-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/code/dashboards/{slug} Upsert a dashboard from code representation # Upsert dashboard as code (deprecated) Source: https://docs.lightdash.com/api-reference/projects/upsert-dashboard-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/dashboards/{slug}/code # Upsert Document as code Source: https://docs.lightdash.com/api-reference/projects/upsert-document-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/code/documents/{slug} Create or update a Document, matched by slug, from code representation # Upsert external connection as code Source: https://docs.lightdash.com/api-reference/projects/upsert-external-connection-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/code/externalConnections/{slug} Create or update a data-app external connection from its code representation. Enterprise only; requires the manage ExternalConnection permission. The body nests the document under `connection`; the optional `secret` rides alongside it and is never part of the YAML document. # Upsert Google Sheets sync as code Source: https://docs.lightdash.com/api-reference/projects/upsert-google-sheets-sync-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/code/googleSheets/{slug} Upsert a Google Sheets sync from code representation # Upsert Google Sheets sync as code (deprecated) Source: https://docs.lightdash.com/api-reference/projects/upsert-google-sheets-sync-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/googleSheets/{slug}/code # Upsert scheduled delivery as code Source: https://docs.lightdash.com/api-reference/projects/upsert-scheduled-delivery-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/code/scheduledDeliveries/{slug} Upsert a scheduled delivery from code representation # Upsert scheduled delivery as code (deprecated) Source: https://docs.lightdash.com/api-reference/projects/upsert-scheduled-delivery-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/scheduledDeliveries/{slug}/code # Upsert SQL chart as code Source: https://docs.lightdash.com/api-reference/projects/upsert-sql-chart-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/code/sqlCharts/{slug} Upserts an SQL chart from code representation # Upsert SQL chart as code (deprecated) Source: https://docs.lightdash.com/api-reference/projects/upsert-sql-chart-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/sqlCharts/{slug}/code # Upsert virtual view as code Source: https://docs.lightdash.com/api-reference/projects/upsert-virtual-view-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/code/virtualViews/{slug} Upsert a virtual view from code representation # Upsert virtual view as code (deprecated) Source: https://docs.lightdash.com/api-reference/projects/upsert-virtual-view-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/virtualViews/{slug}/code # Validate formula Source: https://docs.lightdash.com/api-reference/projects/validate-formula https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/explores/{exploreId}/validateFormula Validate a spreadsheet formula against the explore's fields # Validate project Source: https://docs.lightdash.com/api-reference/projects/validate-project https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/validate Validate content inside a project. This will start a validation job and return the job id. Validation jobs scan all charts and dashboards inside a project to find any broken references to metrics or dimensions that aren't available. Results are available after the job is completed. # Validate specific chart Source: https://docs.lightdash.com/api-reference/projects/validate-specific-chart https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/validate/chart/{chartUuid} Validates a specific chart and updates validation entries in database. # Validate specific dashboard Source: https://docs.lightdash.com/api-reference/projects/validate-specific-dashboard https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/validate/dashboard/{dashboardUuid} Validates a specific dashboard and updates validation entries in database. # Write back content draft Source: https://docs.lightdash.com/api-reference/projects/write-back-content-draft https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/code/drafts/{draftUuid}/write-back Write a reviewed draft back to the repo as a pull request # Promote memory Source: https://docs.lightdash.com/api-reference/promote-memory https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgentMemories/{memoryUuid}/promote Nominates a readable memory for project-context review. # Get prompt Source: https://docs.lightdash.com/api-reference/prompts/get-prompt https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/prompts/{name} Get public instructions for a named prompt # List pull requests Source: https://docs.lightdash.com/api-reference/pull-requests/list-pull-requests https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/pull-requests List the pull requests that have been created by write-backs for a project # Put apiv1aiprovider credentials default Source: https://docs.lightdash.com/api-reference/put-apiv1aiprovider-credentials-default https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/ai/provider-credentials/{credentialUuid}/default # Put apiv1projects aiprovider credential Source: https://docs.lightdash.com/api-reference/put-apiv1projects-aiprovider-credential https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/projects/{projectUuid}/ai/provider-credential # Refresh Deep Research chart Source: https://docs.lightdash.com/api-reference/refresh-deep-research-chart https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/ee/projects/{projectUuid}/ai-deep-research/{aiDeepResearchRunUuid}/charts/{chartKey}/refresh Re-execute the metric query behind a warehouse-backed report chart to load its live results. # Reorder AI agent review items on the board Source: https://docs.lightdash.com/api-reference/reorder-ai-agent-review-items-on-the-board https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/aiAgents/admin/review-items/reorder Persist the board's manual card order for one lane. Declared before the `{fingerprint}` route so "reorder" isn't matched as a fingerprint. # Replace an AI provider credential Source: https://docs.lightdash.com/api-reference/replace-an-ai-provider-credential https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/ai/provider-credentials/{credentialUuid} Full replacement. Unlike PATCH this never reads the stored ciphertext, so it is how an administrator repairs a credential that can no longer be decrypted. Every field is required. # Restore a version of an AI agent skill Source: https://docs.lightdash.com/api-reference/restore-a-version-of-an-ai-agent-skill https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/aiAgents/skills/{skillUuid}/versions/{versionNumber}/restore Publish a new version whose content equals the chosen one. Also restores a soft-deleted skill. # Restore data app version Source: https://docs.lightdash.com/api-reference/restore-data-app-version https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}/data-app-restores Restores a ready data app version as a new latest version on behalf of the thread and records the restore as a hidden thread turn # Retest an AI agent review remediation Source: https://docs.lightdash.com/api-reference/retest-an-ai-agent-review-remediation https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/aiAgents/admin/review-items/{fingerprint}/retest Re-verify a remediation after its PR changed: recompiles the existing preview and re-runs the Test-fix verification thread. # Create space Source: https://docs.lightdash.com/api-reference/roles-&-permissions/create-space https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/spaces Create a new space inside a project # Get project member access Source: https://docs.lightdash.com/api-reference/roles-&-permissions/get-project-member-access https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/user/{userUuid} Get a project explicit member's access. There may be users that have access to the project via their organization membership. # Grant group access to space Source: https://docs.lightdash.com/api-reference/roles-&-permissions/grant-group-access-to-space https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/spaces/{spaceUuid}/group/share Grant a group access to a space # Grant project access to user Source: https://docs.lightdash.com/api-reference/roles-&-permissions/grant-project-access-to-user https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/access Grant a user access to a project # Grant user access to space Source: https://docs.lightdash.com/api-reference/roles-&-permissions/grant-user-access-to-space https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/spaces/{spaceUuid}/share Grant a user access to a space # List project access Source: https://docs.lightdash.com/api-reference/roles-&-permissions/list-project-access https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/access Get access list for a project. This is a list of users that have been explictly granted access to the project. There may be other users that have access to the project via their organization membership. # List service account candidates Source: https://docs.lightdash.com/api-reference/roles-&-permissions/list-service-account-candidates https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/spaces/{spaceUuid}/share/service-accounts List service accounts eligible for direct access to this space. # List space access Source: https://docs.lightdash.com/api-reference/roles-&-permissions/list-space-access https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/spaces/{spaceUuid}/access Get the resolved user access list for a space # Revoke group access to space Source: https://docs.lightdash.com/api-reference/roles-&-permissions/revoke-group-access-to-space https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/spaces/{spaceUuid}/group/share/{groupUuid} Remove a group's access to a space # Revoke project access for user Source: https://docs.lightdash.com/api-reference/roles-&-permissions/revoke-project-access-for-user https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/access/{userUuid} Remove a user's access to a project # Revoke user access to space Source: https://docs.lightdash.com/api-reference/roles-&-permissions/revoke-user-access-to-space https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/spaces/{spaceUuid}/share/{userUuid} Remove a user's access to a space # Update organization member Source: https://docs.lightdash.com/api-reference/roles-&-permissions/update-organization-member https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/org/users/{userUuid} Updates the membership profile for a user in the current user's organization # Update project access for user Source: https://docs.lightdash.com/api-reference/roles-&-permissions/update-project-access-for-user https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/access/{userUuid} Update a user's access to a project # Update space Source: https://docs.lightdash.com/api-reference/roles-&-permissions/update-space https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/spaces/{spaceUuid} Update a space in a project # Route prompt Source: https://docs.lightdash.com/api-reference/route-prompt https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/org/aiRouter/route Route a user prompt to the best candidate agent in the current project. # Delete scheduler Source: https://docs.lightdash.com/api-reference/schedulers/delete-scheduler https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/schedulers/{schedulerUuid} Delete a scheduler # Delete scheduler AI augmentation Source: https://docs.lightdash.com/api-reference/schedulers/delete-scheduler-ai-augmentation https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/schedulers/{schedulerUuid}/ai-augmentation Remove the AI augmentation from a scheduled delivery. # Get run logs Source: https://docs.lightdash.com/api-reference/schedulers/get-run-logs https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/schedulers/runs/{runId}/logs Get detailed logs for a specific scheduler run # Get scheduled jobs Source: https://docs.lightdash.com/api-reference/schedulers/get-scheduled-jobs https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/schedulers/{schedulerUuid}/jobs Get scheduled jobs # Get scheduler Source: https://docs.lightdash.com/api-reference/schedulers/get-scheduler https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/schedulers/{schedulerUuid} Get a scheduler # Get scheduler AI augmentation Source: https://docs.lightdash.com/api-reference/schedulers/get-scheduler-ai-augmentation https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/schedulers/{schedulerUuid}/ai-augmentation Get the AI augmentation attached to a scheduled delivery, or null. # Get scheduler job status Source: https://docs.lightdash.com/api-reference/schedulers/get-scheduler-job-status https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/schedulers/job/{jobId}/status Get a generic job status This method can be used when polling from the frontend # Get scheduler logs Source: https://docs.lightdash.com/api-reference/schedulers/get-scheduler-logs https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/schedulers/{projectUuid}/logs Get scheduled logs # List scheduler runs Source: https://docs.lightdash.com/api-reference/schedulers/list-scheduler-runs https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/schedulers/{projectUuid}/runs Get paginated scheduler runs with aggregated child job counts # List schedulers Source: https://docs.lightdash.com/api-reference/schedulers/list-schedulers https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/schedulers/{projectUuid}/list List all schedulers with pagination, search, sorting, and filtering # List user schedulers Source: https://docs.lightdash.com/api-reference/schedulers/list-user-schedulers https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/schedulers/user-schedulers List all schedulers for the current user across all projects with pagination, search, sorting, and filtering # Reassign scheduler owner Source: https://docs.lightdash.com/api-reference/schedulers/reassign-scheduler-owner https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/schedulers/{projectUuid}/reassign-owner Reassign ownership of multiple schedulers # Send scheduler Source: https://docs.lightdash.com/api-reference/schedulers/send-scheduler https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/schedulers/send Send a scheduler now before saving it # Send scheduler by uuid Source: https://docs.lightdash.com/api-reference/schedulers/send-scheduler-by-uuid https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/schedulers/{schedulerUuid}/send Send an existing scheduler now by its uuid # Update scheduler Source: https://docs.lightdash.com/api-reference/schedulers/update-scheduler https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/schedulers/{schedulerUuid} Update a scheduler # Update scheduler enabled status Source: https://docs.lightdash.com/api-reference/schedulers/update-scheduler-enabled-status https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/schedulers/{schedulerUuid}/enabled Set scheduler enabled # Upsert scheduler AI augmentation Source: https://docs.lightdash.com/api-reference/schedulers/upsert-scheduler-ai-augmentation https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/schedulers/{schedulerUuid}/ai-augmentation Attach or replace the AI augmentation on a scheduled delivery. # Create group Source: https://docs.lightdash.com/api-reference/scim/create-group https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/scim/v2/Groups Create a new group in the SCIM application # Create user Source: https://docs.lightdash.com/api-reference/scim/create-user https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/scim/v2/Users Create a new user # Delete group Source: https://docs.lightdash.com/api-reference/scim/delete-group https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/scim/v2/Groups/{id} Delete a specific group by its SCIM ID # Delete user Source: https://docs.lightdash.com/api-reference/scim/delete-user https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/scim/v2/Users/{userUuid} Delete a user by ID # Get group Source: https://docs.lightdash.com/api-reference/scim/get-group https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/scim/v2/Groups/{id} Get a specific group by its SCIM ID # Get resource type Source: https://docs.lightdash.com/api-reference/scim/get-resource-type https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/scim/v2/ResourceTypes/{resourceTypeId} Get individual SCIM resource type # Get role Source: https://docs.lightdash.com/api-reference/scim/get-role https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/scim/v2/Roles/{roleId} Get a SCIM role by ID # Get schema Source: https://docs.lightdash.com/api-reference/scim/get-schema https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/scim/v2/Schemas/{schemaId} Get individual SCIM schema # Get user Source: https://docs.lightdash.com/api-reference/scim/get-user https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/scim/v2/Users/{userUuid} Get a SCIM user by ID # List groups Source: https://docs.lightdash.com/api-reference/scim/list-groups https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/scim/v2/Groups Get a list of groups within an organization # List resource types Source: https://docs.lightdash.com/api-reference/scim/list-resource-types https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/scim/v2/ResourceTypes Get SCIM resource types # List roles Source: https://docs.lightdash.com/api-reference/scim/list-roles https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/scim/v2/Roles Get a list of roles within an organization # List schemas Source: https://docs.lightdash.com/api-reference/scim/list-schemas https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/scim/v2/Schemas Get SCIM schemas # List users Source: https://docs.lightdash.com/api-reference/scim/list-users https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/scim/v2/Users List SCIM users in the organization # Patch group Source: https://docs.lightdash.com/api-reference/scim/patch-group https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/scim/v2/Groups/{id} Partially updates a group’s attributes (e.g., add or remove members). # Patch user Source: https://docs.lightdash.com/api-reference/scim/patch-user https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/scim/v2/Users/{userUuid} Patch a user by ID (SCIM PATCH) # Provider config Source: https://docs.lightdash.com/api-reference/scim/provider-config https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/scim/v2/ServiceProviderConfig Get SCIM service provider configuration # Replace group Source: https://docs.lightdash.com/api-reference/scim/replace-group https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/scim/v2/Groups/{id} Update a group's attributes completely # Replace user Source: https://docs.lightdash.com/api-reference/scim/replace-user https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/scim/v2/Users/{userUuid} Update a user by ID (SCIM PUT) # Root check Source: https://docs.lightdash.com/api-reference/scim/root-check https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/scim/v2 Root SCIM endpoint for validating SCIM configuration # Create service account Source: https://docs.lightdash.com/api-reference/service-accounts/create-service-account https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/service-accounts Create a service account using an admin session, personal access token, or service account token. Requires organization administration permission. Specify either organization scopes or an organization custom role UUID. For project access, use scopes ["system:member"] and projectAccess grants. The returned token is only available on creation; store it securely. # Delete service account Source: https://docs.lightdash.com/api-reference/service-accounts/delete-service-account https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/service-accounts/{tokenUuid} Revoke a service account by UUID. Requires organization administration permission in the account's organization. Its token immediately stops working. # List service-account project grants Source: https://docs.lightdash.com/api-reference/service-accounts/list-service-account-project-grants https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/service-accounts/{serviceAccountUuid}/projects List a service account's project grants. Requires organization administration permission in the account's organization. # List service accounts Source: https://docs.lightdash.com/api-reference/service-accounts/list-service-accounts https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/service-accounts List the organization's service accounts, excluding SCIM-only tokens. Requires organization administration permission. Tokens are never returned. # Rotate service account Source: https://docs.lightdash.com/api-reference/service-accounts/rotate-service-account https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/service-accounts/{tokenUuid}/rotate Rotate an expiring service account's token. Requires organization administration permission. The old token is immediately revoked and the replacement is returned once. Rotation is limited to once per hour. # Update service account Source: https://docs.lightdash.com/api-reference/service-accounts/update-service-account https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/service-accounts/{tokenUuid} Update a service account's name and permissions in place by UUID, without rotating its token. Requires organization administration permission. Providing projectAccess replaces all project grants. Omit all permission fields to preserve existing permissions. Grants are limited to the caller's organization permissions. # Set agent skills Source: https://docs.lightdash.com/api-reference/set-agent-skills https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/skills Replace the set of custom skills bound to this agent. # Create share URL Source: https://docs.lightdash.com/api-reference/share-links/create-share-url https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/share Given a full URL generates a short url id that can be used for sharing # Get share URL Source: https://docs.lightdash.com/api-reference/share-links/get-share-url https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/share/{nanoId} Get a share url from a short url id # Delete space Source: https://docs.lightdash.com/api-reference/spaces/delete-space https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/spaces/{spaceUuid} Delete a space from a project # Get delete impact Source: https://docs.lightdash.com/api-reference/spaces/get-delete-impact https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/spaces/{spaceUuid}/delete-impact Get the impact of deleting a space (affected child spaces, charts, dashboards) # Get personal space Source: https://docs.lightdash.com/api-reference/spaces/get-personal-space https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/spaces/personal Get the current user's personal space in a project, if they have one # Get space Source: https://docs.lightdash.com/api-reference/spaces/get-space https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/spaces/{spaceUuid} Get details for a space in a project # List spaces as code Source: https://docs.lightdash.com/api-reference/spaces/list-spaces-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/code/spaces Get spaces and their direct access policy in code representation # List spaces as code (deprecated) Source: https://docs.lightdash.com/api-reference/spaces/list-spaces-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/spaces/code # Upsert space as code Source: https://docs.lightdash.com/api-reference/spaces/upsert-space-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/code/spaces Create or update a space and its direct access policy from code # Upsert space as code (deprecated) Source: https://docs.lightdash.com/api-reference/spaces/upsert-space-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/spaces/code # Get spotlight table config Source: https://docs.lightdash.com/api-reference/spotlight/get-spotlight-table-config https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/spotlight/table/config Get spotlight table configuration # Reset spotlight table config Source: https://docs.lightdash.com/api-reference/spotlight/reset-spotlight-table-config https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/spotlight/table/config Reset spotlight table configuration to defaults # Update spotlight table config Source: https://docs.lightdash.com/api-reference/spotlight/update-spotlight-table-config https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/spotlight/table/config Create or update spotlight table configuration # Create SQL chart Source: https://docs.lightdash.com/api-reference/sql-runner/create-sql-chart https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/sqlRunner/saved Create sql chart # Create SQL chart scheduler Source: https://docs.lightdash.com/api-reference/sql-runner/create-sql-chart-scheduler https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/sqlRunner/saved/{savedSqlUuid}/schedulers Create a scheduler for a SQL chart # Create virtual view Source: https://docs.lightdash.com/api-reference/sql-runner/create-virtual-view https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/sqlRunner/virtual-view Create a virtual-view # Create write back PR Source: https://docs.lightdash.com/api-reference/sql-runner/create-write-back-pr https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/sqlRunner/pull-request Write back from SQL runner # Delete SQL chart Source: https://docs.lightdash.com/api-reference/sql-runner/delete-sql-chart https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/sqlRunner/saved/{uuid} Delete sql chart # Delete virtual view Source: https://docs.lightdash.com/api-reference/sql-runner/delete-virtual-view https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/sqlRunner/virtual-view/{name} Delete a virtual-view # Get SQL chart Source: https://docs.lightdash.com/api-reference/sql-runner/get-sql-chart https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/sqlRunner/saved/{uuid} Get saved sql chart # Get SQL chart by slug Source: https://docs.lightdash.com/api-reference/sql-runner/get-sql-chart-by-slug https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/sqlRunner/saved/slug/{slug} Get saved sql chart # Get SQL chart promotion diff Source: https://docs.lightdash.com/api-reference/sql-runner/get-sql-chart-promotion-diff https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/sqlRunner/saved/{uuid}/promoteDiff Get diff from SQL chart to promote # Get SQL chart results job Source: https://docs.lightdash.com/api-reference/sql-runner/get-sql-chart-results-job https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/sqlRunner/saved/slug/{slug}/results-job Schedules a job to get its results # Get SQL chart results job by UUID Source: https://docs.lightdash.com/api-reference/sql-runner/get-sql-chart-results-job-by-uuid https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/sqlRunner/saved/{uuid}/results-job Schedules a job to get its results # Get stored results Source: https://docs.lightdash.com/api-reference/sql-runner/get-stored-results https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/sqlRunner/results/{fileId} Get results from a file stored locally # Get table fields Source: https://docs.lightdash.com/api-reference/sql-runner/get-table-fields https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/sqlRunner/fields Get fields for a warehouse table # List SQL chart schedulers Source: https://docs.lightdash.com/api-reference/sql-runner/list-sql-chart-schedulers https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/sqlRunner/saved/{savedSqlUuid}/schedulers Get all schedulers for a SQL chart # List warehouse tables Source: https://docs.lightdash.com/api-reference/sql-runner/list-warehouse-tables https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/sqlRunner/tables Get warehouse tables for a project # Preview write back Source: https://docs.lightdash.com/api-reference/sql-runner/preview-write-back https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/sqlRunner/preview Preview write back from SQL runner # Promote SQL chart Source: https://docs.lightdash.com/api-reference/sql-runner/promote-sql-chart https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/sqlRunner/saved/{uuid}/promote Promote SQL chart to upstream project # Refresh catalog cache Source: https://docs.lightdash.com/api-reference/sql-runner/refresh-catalog-cache https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/sqlRunner/refresh-catalog Refresh the catalog cache # Run SQL pivot query Source: https://docs.lightdash.com/api-reference/sql-runner/run-sql-pivot-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/sqlRunner/runPivotQuery Run a SQL pivot query # Run SQL query Source: https://docs.lightdash.com/api-reference/sql-runner/run-sql-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/sqlRunner/run Run a SQL query # Update SQL chart Source: https://docs.lightdash.com/api-reference/sql-runner/update-sql-chart https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/sqlRunner/saved/{uuid} Update sql chart # Update virtual view Source: https://docs.lightdash.com/api-reference/sql-runner/update-virtual-view https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/projects/{projectUuid}/sqlRunner/virtual-view/{name} Update a virtual view # Create SSH key pair Source: https://docs.lightdash.com/api-reference/ssh-keypairs/create-ssh-key-pair https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/ssh/key-pairs Create a new SSH key pair # Start Deep Research run Source: https://docs.lightdash.com/api-reference/start-deep-research-run https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/ee/projects/{projectUuid}/ai-deep-research Start a durable Deep Research investigation. # Uninstall GitHub App Source: https://docs.lightdash.com/api-reference/uninstall-github-app https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/github/uninstall Uninstall the GitHub App from the organization # Uninstall GitLab integration Source: https://docs.lightdash.com/api-reference/uninstall-gitlab-integration https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/gitlab/uninstall Uninstall GitLab integration from the organization # Unlink GitHub account Source: https://docs.lightdash.com/api-reference/unlink-github-account https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/github/user Unlink the authenticated user's GitHub account and revoke its token # Unpin AI agent thread Source: https://docs.lightdash.com/api-reference/unpin-ai-agent-thread https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid}/pin Unpin a thread. # Update agent document Source: https://docs.lightdash.com/api-reference/update-agent-document https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/documents/{documentUuid} Choose whether the full knowledge document is included in every prompt. # Update agent document content Source: https://docs.lightdash.com/api-reference/update-agent-document-content https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/documents/{documentUuid}/content Replace the name and content of a knowledge document this agent can use. # Update AI agent review item assignee Source: https://docs.lightdash.com/api-reference/update-ai-agent-review-item-assignee https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/aiAgents/admin/review-items/{fingerprint}/assignee Set the assignee on an AI agent review item # Update AI agent review item priority Source: https://docs.lightdash.com/api-reference/update-ai-agent-review-item-priority https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/aiAgents/admin/review-items/{fingerprint}/priority Set the priority on an AI agent review item # Update AI agent review item status Source: https://docs.lightdash.com/api-reference/update-ai-agent-review-item-status https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/aiAgents/admin/review-items/{fingerprint} Update the status of an AI agent review item (e.g. dismiss it) # Update AI agent thread Source: https://docs.lightdash.com/api-reference/update-ai-agent-thread https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/threads/{threadUuid} Rename a thread. Only the thread owner or a project admin may do this. # Update AI review Jira destination Source: https://docs.lightdash.com/api-reference/update-ai-review-jira-destination https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/aiAgents/admin/review-jira-destination/{projectUuid} Update a project's Jira destination for AI reviews # Update AI review Jira routing Source: https://docs.lightdash.com/api-reference/update-ai-review-jira-routing https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/aiAgents/admin/review-jira-routing Update Jira routing for AI review issues # Update AI review Linear destination Source: https://docs.lightdash.com/api-reference/update-ai-review-linear-destination https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/aiAgents/admin/review-linear-destination/{projectUuid} Update a project's Linear destination for AI reviews # Update AI review Linear routing Source: https://docs.lightdash.com/api-reference/update-ai-review-linear-routing https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/aiAgents/admin/review-linear-routing Update Linear routing for AI review issues # Update AI review notification settings Source: https://docs.lightdash.com/api-reference/update-ai-review-notification-settings https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/aiAgents/admin/review-notification-settings Update AI review notification settings # Update AI settings Source: https://docs.lightdash.com/api-reference/update-ai-settings https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/aiAgents/admin/settings Update AI organization settings # Update an AI agent skill Source: https://docs.lightdash.com/api-reference/update-an-ai-agent-skill https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/aiAgents/skills/{skillUuid} Save the skill's files. Publishes a new version when the content changed. # Update memory status Source: https://docs.lightdash.com/api-reference/update-memory-status https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/projects/{projectUuid}/aiAgentMemories/{memoryUuid}/status Changes whether a memory is available to the AI agent. # Upload AI agent skills as code Source: https://docs.lightdash.com/api-reference/upload-ai-agent-skills-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/aiAgents/skills/code Upload skills as code. Creates new skills, publishes a version for changed ones, reports unchanged ones, and soft-deletes only the names listed in `deleteNames`. # Upsert AI agents as code (deprecated) Source: https://docs.lightdash.com/api-reference/upsert-ai-agents-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/projects/{projectUuid}/aiAgents/code # Upsert AI router config Source: https://docs.lightdash.com/api-reference/upsert-ai-router-config https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/org/aiRouter Upsert the AI router configuration. Creates the row lazily on first save. # Upsert AI router instruction Source: https://docs.lightdash.com/api-reference/upsert-ai-router-instruction https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/org/aiRouter/instructions/{projectUuid} Write a new routing-instruction version for a project. Versions are append-only; the latest one is the active instruction. # Create user attribute Source: https://docs.lightdash.com/api-reference/user-attributes/create-user-attribute https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/org/attributes Creates new user attribute # Delete user attribute Source: https://docs.lightdash.com/api-reference/user-attributes/delete-user-attribute https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/org/attributes/{userAttributeUuid} Remove a user attribute # List user attributes Source: https://docs.lightdash.com/api-reference/user-attributes/list-user-attributes https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/org/attributes Get all user attributes # Update user attribute Source: https://docs.lightdash.com/api-reference/user-attributes/update-user-attribute https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/org/attributes/{userAttributeUuid} Updates a user attribute # Add project access to group Source: https://docs.lightdash.com/api-reference/user-groups/add-project-access-to-group https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/groups/{groupUuid}/projects/{projectUuid} Add project access to a group # Add user to group Source: https://docs.lightdash.com/api-reference/user-groups/add-user-to-group https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v1/groups/{groupUuid}/members/{userUuid} Add a Lightdash user to a group # Delete group Source: https://docs.lightdash.com/api-reference/user-groups/delete-group https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/groups/{groupUuid} Delete a group # Get group Source: https://docs.lightdash.com/api-reference/user-groups/get-group https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/groups/{groupUuid} Get group details # Get group members Source: https://docs.lightdash.com/api-reference/user-groups/get-group-members https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/groups/{groupUuid}/members View members of a group # Remove project access from group Source: https://docs.lightdash.com/api-reference/user-groups/remove-project-access-from-group https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/groups/{groupUuid}/projects/{projectUuid} Remove project access from a group # Remove user from group Source: https://docs.lightdash.com/api-reference/user-groups/remove-user-from-group https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v1/groups/{groupUuid}/members/{userUuid} Remove a user from a group # Update group Source: https://docs.lightdash.com/api-reference/user-groups/update-group https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/groups/{groupUuid} Update a group # Update project access for group Source: https://docs.lightdash.com/api-reference/user-groups/update-project-access-for-group https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v1/groups/{groupUuid}/projects/{projectUuid} Update project access for a group # Lightdash API Source: https://docs.lightdash.com/api-reference/v1/introduction Every public Lightdash endpoint, and how to authenticate with a personal access token [Support](/support): [support@lightdash.com](mailto:support@lightdash.com) | License: [MIT](#) ## Open API documentation for all public Lightdash API endpoints. Before you get started, you might need to create a Personal Access Token to authenticate via the API. You can create a token by following this guide: [/personal-settings/create-personal-tokens](/personal-settings/create-personal-tokens) # Recipes Source: https://docs.lightdash.com/api-reference/v1/recipes Copy-paste examples that combine Lightdash API endpoints into common workflows ## What are API recipes? The Lightdash API is intentionally modular: most endpoints return small, focused pieces of information. While this keeps the API flexible, some real-world tasks require calling multiple endpoints together or assembling responses in a certain order. For example, Lightdash doesn’t provide a single endpoint that returns “SQL for every chart,” but you *can* accomplish this by combining the chart-listing endpoint with the metric-query endpoint. Follow the recipes below. **API recipes** are short guides that show you *how to do exactly that*. Each recipe walks through: * **What you’re trying to accomplish** (e.g., fetch SQL for all charts in a project) * **Which endpoints to call and in what order** * **Example requests** in `curl` * **Optional scripts** in JS/Python when useful ## When should you use recipes? Use a recipe when: * You want to automate a workflow that spans multiple endpoints * You need to query Lightdash programmatically but aren’t sure which calls to chain * You want real examples of authentication, pagination, or interpreting metric queries * You’re building internal tooling or dashboards powered by the Lightdash API This page includes a few of the most common API recipes, but it’s not a complete list. For all available recipes, see the full collection [here](https://github.com/lightdash/lightdash-api-examples). ## Before you run any recipe You will need: * Python 3.9+ installed * A [Personal Access Token (PAT)](/personal-settings/create-personal-tokens) * Your Lightdash instance URL * The project UUID you want to modify ## Extract SQL from a saved Lightdash chart using the API This recipe shows how to fetch the underlying SQL for any saved chart. You can use this to debug queries, run them directly in your warehouse, or automate data pulls outside of Lightdash. ### Step 1: Fetch the saved chart (You must first create a Personal Access Token (PAT)) ``` curl -H "Authorization: ApiKey ldpat_{{your_personal_access_token}}" \ https://{{your.lightdash.instance}}/api/v1/saved/{{your_chart_uuid}} ``` ### Step 2: Extract the `metricQuery` JSON ``` curl -s \ -H "Authorization: ApiKey ldpat_{{your_personal_access_token}}" \ https://{{your.lightdash.instance}}/api/v1/saved/{{your_chart_uuid}} \ | jq '.results.metricQuery' > metricQuery.json ``` This writes the chart’s semantic query definition to `metricQuery.json`. ### Step 3: Compile the `metricQuery` into SQL ``` curl -s -X POST \ -H "Authorization: ApiKey ldpat_{{your_personal_access_token}}" \ -H "Content-Type: application/json" \ -d @metricQuery.json \ https://{{your.lightdash.instance}}/api/v1/projects/{{your_project_uuid}}/explores/{{your_explore_name}}/compileQuery \ | jq '.results.query' ``` The request body needs a `sorts` array and a numeric `limit`. If `sorts` is empty, the compiled SQL still has an `ORDER BY`: Lightdash sorts by the first selected date or timestamp dimension (descending), otherwise the first metric (descending), otherwise the first dimension (ascending). A query with no dimensions returns one aggregated row and gets no default sort. The SQL uses the `limit` you send; compiling doesn't cap it at the [maximum query rows](/workspace-admin/export-limits), which applies when Lightdash runs a query. ### One-Step Solution ``` curl -s -H "Authorization: ApiKey ldpat_{{your_personal_access_token}}" \ https://{{your.lightdash.instance}}/api/v1/savedc/{{your_chart_uuid}} \ | jq '.results.metricQuery' \ | curl -s -X POST \ -H "Authorization: ApiKey ldpat_{{your_personal_access_token}}" \ -H "Content-Type: application/json" \ -d @- \ https://{{your.lightdash.instance}}/api/v1/projects/{{your_project_uuid}}/explores/{{your_explore_name}}/compileQuery \ | jq '.results.query' ``` ## List SQL charts in a project using the API This recipe lists the SQL charts you can view in a project and fetches the SQL behind each one, for example to audit which tables your SQL charts query. ### Step 1: List the project's SQL charts The content API returns every kind of chart. Each chart has a `source` field: `sql` for a chart saved from the SQL runner, `dbt_explore` for a chart built from an explore. Filter for `sql`: ```bash theme={null} curl -s -H "Authorization: ApiKey ldpat_{{your_personal_access_token}}" \ "https://{{your.lightdash.instance}}/api/v2/content?projectUuids={{your_project_uuid}}&contentTypes=chart&pageSize=100&page=1" \ | jq '.results.data[] | select(.source == "sql") | {uuid, name}' ``` Results are paginated. If `.results.pagination.totalPageCount` is greater than 1, repeat the request with `page=2`, `page=3`, and so on. ### Step 2: Fetch the SQL for each chart ```bash theme={null} curl -s -H "Authorization: ApiKey ldpat_{{your_personal_access_token}}" \ https://{{your.lightdash.instance}}/api/v1/projects/{{your_project_uuid}}/sqlRunner/saved/{{your_sql_chart_uuid}} \ | jq -r '.results.sql' ``` ### Update the SQL of many charts To rewrite SQL across many charts, for example after renaming a schema, the simplest route is [content as code](/workflow/content-as-code#sql-runner-charts): `lightdash download` writes each SQL chart's `sql` to a file, you edit and review the files, and `lightdash upload` pushes them back. To do it through the API instead, send a `PATCH` to the URL from step 2 with a `versionedData` object. It needs `sql`, `limit` and `config`, so copy `limit` and `config` from the step 2 response and change only `sql`: ```bash theme={null} curl -s -X PATCH -H "Authorization: ApiKey ldpat_{{your_personal_access_token}}" \ -H "Content-Type: application/json" \ -d '{"versionedData": {"sql": "select * from acme_analytics.orders", "limit": 500, "config": {{config_from_step_2}}}}' \ https://{{your.lightdash.instance}}/api/v1/projects/{{your_project_uuid}}/sqlRunner/saved/{{your_sql_chart_uuid}} ``` ## Run a SQL query using the API Running SQL through the API takes two calls: the first starts the query and returns a `queryUuid`, the second fetches its results. The v1 `POST /api/v1/projects/{projectUuid}/sqlRunner/run` endpoint is deprecated; use these instead. ### Step 1: Start the query ```bash theme={null} curl -s -X POST -H "Authorization: ApiKey ldpat_{{your_personal_access_token}}" \ -H "Content-Type: application/json" \ -d '{"sql": "select * from acme_analytics.orders", "limit": 500}' \ https://{{your.lightdash.instance}}/api/v2/projects/{{your_project_uuid}}/query/sql \ | jq -r '.results.queryUuid' ``` ### Step 2: Fetch the results ```bash theme={null} curl -s -H "Authorization: ApiKey ldpat_{{your_personal_access_token}}" \ "https://{{your.lightdash.instance}}/api/v2/projects/{{your_project_uuid}}/query/{{your_query_uuid}}?page=1&pageSize=500" ``` While the query runs, `results.status` is `pending`, `queued` or `executing`, so repeat the request until it's `ready`. A ready response holds that page's `rows` and `columns`, and `nextPage` is set while more pages remain. A failed query has the status `error`, with the message in `results.error`. ## Dashboard cleanup & usage audit for a project This Python script helps you **clean up dashboards** in a specific Lightdash project. It uses the v2 Content API and can export results to CSV, Excel, or JSON for deeper analysis. This script provides: * A complete list of all dashboards with metadata for that project * View counts and first viewed dates * Creation and last modification dates * Dashboard organization by spaces * Cleanup recommendations based on usage patterns (never viewed, low engagement, stale, no description, etc.) ### Before you run this script You will need: * A copy of [find\_dashboards.py](https://github.com/lightdash/lightdash-api-examples/blob/main/python/find_dashboards.py) ### Step 1: Install dependencies You can run this script with **poetry** or plain Python: ``` poetry install # OR pip install -r requirements.txt ``` (Dependencies include `requests` and `pandas`.) ### Step 2: Update script configuration Open the script and update these fields: ``` API_URL = 'https://{YOUR_INSTANCE_URL}.lightdash.cloud' # Your Lightdash instance API_KEY = '' # Your Personal Access Token PROJECT_UUID = '' # Project you want to analyze (REQUIRED) EXPORT_METHOD = 'csv' # 'csv', 'excel', or 'json' ``` ### Step 3: Run the script Using poetry: ``` poetry run python find_dashboards.py ``` Or directly: ``` python find_dashboards.py ``` ## Export all users in your organization This Python script fetches **all users in your Lightdash organization** using the `/api/v1/org/users` endpoint. This is useful for **audits**, **access reviews**, and **governance**. It returns: * Full name * Email * Role * Group membership * Optional Excel or CSV export ### Before you run this script You will need: * A copy of [get\_all\_organization\_users.py](https://github.com/lightdash/lightdash-api-examples/blob/main/python/get_all_organization_users.py) ### Step 1: Install dependencies ``` pip install requests pandas ``` (or add them to your environment of choice) ### Step 2: Update script configuration Open the script and replace: ``` API_URL = 'https://.lightdash.cloud/api/v1/org/users' API_KEY = '' EXPORT_METHOD = 'excel' # or 'csv' ``` ### Step 3: Run the script ``` python get_all_organization_users.py ``` ## Invite users to your organization using the API To invite people who don't have a Lightdash account yet, send one request per email address. Use a token from an organization admin or an admin [service account](/workspace-admin/service-accounts). `role` is optional and defaults to `member`; it takes the organization roles `member`, `viewer`, `interactive_viewer`, `editor`, `developer` or `admin`. ```bash theme={null} curl -s -X POST -H "Authorization: ApiKey ldpat_{{your_personal_access_token}}" \ -H "Content-Type: application/json" \ -d '{"email": "jane@example.com", "role": "viewer"}' \ https://{{your.lightdash.instance}}/api/v1/invite-links ``` Lightdash emails the invite and returns its `inviteUrl`. `expiresAt` is optional: a future date earlier than your organization's [invite link expiry](/workspace-admin/invite-new-users) is kept, and anything else gets the default expiry. Sending the request again for a pending invite creates a new link. If the email already belongs to a user in your organization or in another organization, the request fails with a `400` error. ## Assign or update project access for a list of users This Python script assigns Lightdash **project roles** to a list of users from a CSV file, and upgrades roles when needed. This is useful for **large-scale onboarding**, **role synchronization**, or **managing customer/partner access**. This script handles: * Bulk granting of project access * Automatic role upgrades (e.g., viewer → editor) * Skipping users who already have equal or higher access * Checking whether users exist in the organization * Merging org users, project access, and your CSV into one unified dataset ### Before you run this script You will need: * A CSV file of users with desired roles * A copy of [assign\_project\_access\_to\_user\_list.py](https://github.com/lightdash/lightdash-api-examples/blob/main/python/assign_project_access_to_user_list.py) ### Step 1: Prepare your CSV file Your CSV should contain **two columns**: ``` email,role user1@example.com,viewer user2@example.com,editor user3@example.com,developer ``` Valid roles: ``` viewer, interactive_viewer, editor, developer, admin ``` ### Step 2: Install dependencies ``` pip install pandas lightdash-api-client ``` (or via poetry) ### Step 3: Update script configuration Open the script and update: ``` TARGET_URL = 'https://app.lightdash.cloud/api/v1/' TARGET_API_KEY = '' TARGET_PROJECT_ID = '' USER_PERMS_FILEPATH = '~/Documents/user_permission_list.csv' ``` ### Step 4: Run the script ``` python assign_project_access_to_user_list.py ``` ### Grant project access to one user To add a single user without the script, send their `email`, a project `role` and `sendEmail`: ```bash theme={null} curl -s -X POST -H "Authorization: ApiKey ldpat_{{your_personal_access_token}}" \ -H "Content-Type: application/json" \ -d '{"email": "jane@example.com", "role": "viewer", "sendEmail": true}' \ https://{{your.lightdash.instance}}/api/v1/projects/{{your_project_uuid}}/access ``` `sendEmail` is required, and a request without it fails validation without adding the user. Set it to `true` to email the user a link to the project, or `false` to add them silently. The user must already belong to your organization; [invite](#invite-users-to-your-organization-using-the-api) new people first. The role assignment endpoint `POST /api/v2/projects/{projectUuid}/roles/assignments/user/{userUuid}` also accepts `sendEmail`, but there it's optional. It sends the email only when it's `true` and the user had no role on the project before. ## Assign Metrics Catalog categories using the API Categories are the labels shown in the Metrics Catalog. Use this recipe to create a category and assign it to metrics from a script, for example to mark metrics as reviewed. The token's user needs the editor role or above in the project. To manage categories in your dbt project instead, see [Assigning categories to metrics](/explore/metrics-catalog/curate-the-catalog#assigning-categories-to-metrics). ### Step 1: Create a category Set `color` to one of the colors the catalog offers: `gray`, `violet`, `red`, `orange`, `green`, `blue`, `indigo`, `pink`, or `yellow`. The response returns the new category's `tagUuid`. To find an existing category's `tagUuid`, send a `GET` to the same URL. ```bash theme={null} curl -s -X POST -H "Authorization: ApiKey ldpat_{{your_personal_access_token}}" \ -H "Content-Type: application/json" \ -d '{"name": "Reviewed", "color": "green"}' \ https://{{your.lightdash.instance}}/api/v1/projects/{{your_project_uuid}}/tags ``` ### Step 2: Assign the category to a metric Find the metric's `catalogSearchUuid` in the results of `GET /api/v1/projects/{{your_project_uuid}}/dataCatalog/metrics`, then assign the category: ```bash theme={null} curl -s -X POST -H "Authorization: ApiKey ldpat_{{your_personal_access_token}}" \ -H "Content-Type: application/json" \ -d '{"tagUuid": "{{your_tag_uuid}}"}' \ https://{{your.lightdash.instance}}/api/v1/projects/{{your_project_uuid}}/dataCatalog/{{catalog_search_uuid}}/categories ``` To remove it, send a `DELETE` to `/api/v1/projects/{{your_project_uuid}}/dataCatalog/{{catalog_search_uuid}}/categories/{{your_tag_uuid}}`. ## Filter metrics by tag using the data catalog API The `/api/v2/projects/{projectUuid}/dataCatalog/metrics-with-time-dimensions` endpoint returns metrics from your project's data catalog. You can filter the results by field-level tags using the `tags` query parameter, which makes it possible to retrieve only the metrics relevant to a specific workflow — such as a headless metrics store pipeline or a semantic layer integration. Field-level tags are set in your dbt YAML under individual metrics and dimensions. See the [metrics reference](/semantic-layer/metrics#tags) and [dimensions reference](/semantic-layer/dimensions#tags) for syntax details. ### Step 1: Tag your metrics in dbt Add tags to specific metrics in your dbt YAML: ```yaml dbt v1.10+ theme={null} models: - name: orders columns: - name: amount config: meta: metrics: total_order_amount: type: sum tags: ["core", "finance"] average_order_amount: type: average tags: ["core"] ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: orders columns: - name: amount meta: metrics: total_order_amount: type: sum tags: ["core", "finance"] average_order_amount: type: average tags: ["core"] ``` ```yaml Lightdash YAML theme={null} type: model name: orders metrics: total_order_amount: type: sum sql: ${TABLE}.amount tags: ["core", "finance"] average_order_amount: type: average sql: ${TABLE}.amount tags: ["core"] ``` ### Step 2: Fetch metrics filtered by tag Use the `tags` query parameter to retrieve only metrics with matching tags. You can pass multiple `tags` parameters to filter by more than one tag (OR logic — metrics matching **any** of the provided tags are returned). ```bash theme={null} curl -H "Authorization: ApiKey ldpat_{{your_personal_access_token}}" \ "https://{{your.lightdash.instance}}/api/v2/projects/{{your_project_uuid}}/dataCatalog/metrics-with-time-dimensions?page=1&pageSize=10&sort=label&order=asc&tags=core&tags=finance" ``` ### Example response Each metric in the response includes a `tags` array showing all tags assigned to it: ```json theme={null} { "status": "ok", "results": { "data": [ { "name": "total_order_amount", "label": "Total order amount", "tags": ["core", "finance"], "categories": [], "tableName": "orders", "tableLabel": "Orders", ... }, { "name": "average_order_amount", "label": "Average order amount", "tags": ["core"], "categories": [], "tableName": "orders", "tableLabel": "Orders", ... } ] } } ``` ### Supported query parameters | Parameter | Type | Description | | :- | :- | :- | | `page` | number | Page number for pagination (starts at 1) | | `pageSize` | number | Number of results per page | | `sort` | string | Field to sort by (e.g., `label`) | | `order` | string | Sort order: `asc` or `desc` | | `tags` | string | Filter by tag. Repeat the parameter to filter by multiple tags (OR logic). | Tags are a backend-only mechanism — they are **not** displayed as Spotlight categories in the Lightdash UI. This makes them suitable for controlling API-driven workflows without affecting the end-user experience. # Add scopes to role Source: https://docs.lightdash.com/api-reference/v2/add-scopes-to-role https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/orgs/{orgUuid}/roles/{roleUuid}/scopes Add scopes to role # Assign organization role to user Source: https://docs.lightdash.com/api-reference/v2/assign-organization-role-to-user https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/orgs/{orgUuid}/roles/assignments/user/{userId} Assign system or organization-level custom role to user at organization level # Assign project role to group Source: https://docs.lightdash.com/api-reference/v2/assign-project-role-to-group https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectId}/roles/assignments/group/{groupId} Create or update project role assignment for group (upsert) # Assign project role to user Source: https://docs.lightdash.com/api-reference/v2/assign-project-role-to-user https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectId}/roles/assignments/user/{userId} Create or update project role assignment for user (upsert) # Calculate totals Source: https://docs.lightdash.com/api-reference/v2/calculate-totals https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/query/{queryUuid}/calculate-total Calculates totals for a previously-executed query, referenced by its queryUuid. Re-runs the source query's MetricQuery against the warehouse so totals are correct for every metric type (count distinct, average, ratio, etc.) — unlike client-side cell summation, which only works for sum/count. The requested `kind` selects which totals to compute. # Cancel query Source: https://docs.lightdash.com/api-reference/v2/cancel-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/query/{queryUuid}/cancel Cancels a running async query and discards any partial results # Create custom role Source: https://docs.lightdash.com/api-reference/v2/create-custom-role https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/orgs/{orgUuid}/roles Create a new role in organization # Delete apiv2projects ai accessservice account Source: https://docs.lightdash.com/api-reference/v2/delete-apiv2projects-ai-accessservice-account https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v2/projects/{projectUuid}/ai-access/service-account # Delete chart Source: https://docs.lightdash.com/api-reference/v2/delete-chart https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v2/projects/{projectUuid}/saved/{chartUuidOrSlug} Delete a saved chart by uuid or slug within a project # Delete custom role Source: https://docs.lightdash.com/api-reference/v2/delete-custom-role https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v2/orgs/{orgUuid}/roles/{roleUuid} Delete role from organization # Delete dashboard Source: https://docs.lightdash.com/api-reference/v2/delete-dashboard https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v2/projects/{projectUuid}/dashboards/{dashboardUuidOrSlug} Delete a dashboard by uuid or slug within a project # Delete feature flag override Source: https://docs.lightdash.com/api-reference/v2/delete-feature-flag-override https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v2/feature-flag/{featureFlagId} Remove the organization override for a feature flag, restoring the environment default. Preview environments only. # Download results Source: https://docs.lightdash.com/api-reference/v2/download-results https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/query/{queryUuid}/download Downloads query results in various formats with custom formatting options # Download results Source: https://docs.lightdash.com/api-reference/v2/download-results-1 https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/query/{queryUuid}/schedule-download Downloads query results in various formats with custom formatting options # Duplicate role Source: https://docs.lightdash.com/api-reference/v2/duplicate-role https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/orgs/{orgUuid}/roles/{roleId}/duplicate Duplicate a role # Estimate metric query Source: https://docs.lightdash.com/api-reference/v2/estimate-metric-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/query/metric-query/estimate Estimates the bytes a metric query would process with a free warehouse dry run, without running it. Only BigQuery connections with query estimates enabled return an estimate. # Estimate SQL query Source: https://docs.lightdash.com/api-reference/v2/estimate-sql-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/query/sql/estimate Estimates the bytes a SQL runner query would process with a free warehouse dry run, without running it. Only BigQuery connections with query estimates enabled return an estimate. # Execute compose merge query Source: https://docs.lightdash.com/api-reference/v2/execute-compose-merge-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/query/compose-merge-query Validates and executes a merge on the compose engine as one asynchronous query request. Unlike Execute merge query, sources may reference existing query results by queryUuid; each referenced query is authorized with the same access checks as fetching its results. # Execute compose SQL query Source: https://docs.lightdash.com/api-reference/v2/execute-compose-sql-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/query/compose-sql Executes a DuckDB SQL query asynchronously on the pre-aggregate DuckDB engine. Requires run-queries access (interactive viewer and up) and the compose-sql-runner feature flag. The references map exposes other async queries' results as named tables the SQL can select from ({"orders": "queryUuid"} lets the SQL run SELECT * FROM orders); each referenced query is authorized with the same access checks as Get results, so you can reference any query you can already fetch by uuid. References to queries that are still running are waited on — this query executes once every referenced result is ready and fails if a referenced query fails. Direct file access in the SQL is rejected. Returns a queryUuid to poll for results via Get results. # Execute dashboard chart Source: https://docs.lightdash.com/api-reference/v2/execute-dashboard-chart https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/query/dashboard-chart Executes a chart within a dashboard context asynchronously with inherited dashboard filters # Execute dashboard SQL chart Source: https://docs.lightdash.com/api-reference/v2/execute-dashboard-sql-chart https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/query/dashboard-sql-chart Executes a SQL chart within a dashboard context asynchronously with inherited filters # Execute merge query Source: https://docs.lightdash.com/api-reference/v2/execute-merge-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/query/merge-query Validates and executes a merge as one asynchronous query request. # Execute metric query Source: https://docs.lightdash.com/api-reference/v2/execute-metric-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/query/metric-query Executes a metric query asynchronously against your data warehouse using dimensions, metrics, filters, and sorts # Execute python query Source: https://docs.lightdash.com/api-reference/v2/execute-python-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/query/python Executes python `run(inputs, params)` asynchronously in an isolated sandbox over other async queries' results. Requires run-queries access (interactive viewer and up) and the compose-sql-runner feature flag. The references map exposes other queries' results as pandas DataFrames in `inputs` ({"orders": "queryUuid"} is read as inputs["orders"]); each referenced query is authorized with the same access checks as Get results and still-running references are waited on. The returned DataFrame is validated, capped at `limit` rows and stored as a regular result. The sandbox has no network access and no credentials. Returns a queryUuid to poll for results via Get results. # Execute saved chart Source: https://docs.lightdash.com/api-reference/v2/execute-saved-chart https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/query/chart Executes a saved chart query asynchronously with optional parameter overrides # Execute source queries Source: https://docs.lightdash.com/api-reference/v2/execute-source-queries https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/query-sources/queries Submits one or more source queries through the common interface. Every query body is tagged by sourceType and every query returns a queryUuid, polled with the standard async query results endpoint (or Get source query status for many at once). Queries reference each other's results by nodeId: a duckdb query's references expose other queries' results as tables, named by node id (array shorthand) or by alias (map form, which also accepts queryUuids of results from previous submissions). A referenced result keeps the column names of the query that produced it — field ids for semanticLayer queries, SELECT output names for sql queries. All queries are submitted immediately; a query referencing still-running results waits inside its own execution and fails if a referenced query fails, so no orchestration happens outside the queries themselves. Submit queries one at a time (interactive use) or as a whole pipeline in one call — the two are equivalent, so a serialized multi-query analysis is just the bodies of the queries that were run interactively, with queryUuid references swapped for node ids. Note that results expire: re-run upstream queries whose results have expired instead of referencing their old queryUuids. # Execute SQL chart Source: https://docs.lightdash.com/api-reference/v2/execute-sql-chart https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/query/sql-chart Executes a saved SQL chart query asynchronously with optional chart configurations # Execute SQL query Source: https://docs.lightdash.com/api-reference/v2/execute-sql-query https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/query/sql Executes a raw SQL query asynchronously against your data warehouse for custom queries # Execute underlying data Source: https://docs.lightdash.com/api-reference/v2/execute-underlying-data https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/query/underlying-data Executes a query to retrieve underlying raw data for drilling down into aggregated values # Export dashboard content Source: https://docs.lightdash.com/api-reference/v2/export-dashboard-content https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/dashboards/{dashboardUuid}/exports Export dashboard content as an image, PDF, CSV or XLSX. Schedules a job; poll `GET /api/v1/schedulers/job/{jobId}/status` until it is `completed`, then download the file from `details.url`. Embed tokens can call this with the `Lightdash-Embed-Token` header and a `projectUuid` query param. The export uses the viewer's access, filters, parameters, date zoom and tabs. Each format needs an embed permission: - `image`: `canExportImages` or `view:EmbedImageExport` - `pdf`: `canExportPagePdf` or `view:EmbedPagePdfExport` - `csv` / `xlsx`: `canExportDashboardCsv` or `view:EmbedDashboardCsvExport` Poll the job status with the same token. The file URL is a signed link that expires. # Get apiv2contentrecently viewed Source: https://docs.lightdash.com/api-reference/v2/get-apiv2contentrecently-viewed https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/content/recently-viewed # Get apiv2orgagent identity Source: https://docs.lightdash.com/api-reference/v2/get-apiv2orgagent-identity https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/org/agent-identity # Get apiv2orgagent identity projects without ai service account Source: https://docs.lightdash.com/api-reference/v2/get-apiv2orgagent-identity-projects-without-ai-service-account https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/org/agent-identity/{warehouseType}/projects-without-ai-service-account # Get apiv2orgagent identitysnowflakesetup Source: https://docs.lightdash.com/api-reference/v2/get-apiv2orgagent-identitysnowflakesetup https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/org/agent-identity/snowflake/setup # Get apiv2orgagent permissions Source: https://docs.lightdash.com/api-reference/v2/get-apiv2orgagent-permissions https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/org/agent-permissions # Get apiv2orgs codegroups Source: https://docs.lightdash.com/api-reference/v2/get-apiv2orgs-codegroups https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/orgs/{orgUuid}/code/groups # Get apiv2orgs codeuserattributes Source: https://docs.lightdash.com/api-reference/v2/get-apiv2orgs-codeuserattributes https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/orgs/{orgUuid}/code/userAttributes # Get apiv2orgs codeusers Source: https://docs.lightdash.com/api-reference/v2/get-apiv2orgs-codeusers https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/orgs/{orgUuid}/code/users # Get apiv2projects ai accesscapabilities Source: https://docs.lightdash.com/api-reference/v2/get-apiv2projects-ai-accesscapabilities https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/ai-access/capabilities # Get apiv2projects ai accessme Source: https://docs.lightdash.com/api-reference/v2/get-apiv2projects-ai-accessme https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/ai-access/me # Get apiv2projects ai accessservice account Source: https://docs.lightdash.com/api-reference/v2/get-apiv2projects-ai-accessservice-account https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/ai-access/service-account # Get apiv2useragent connectionsrequests Source: https://docs.lightdash.com/api-reference/v2/get-apiv2useragent-connectionsrequests https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/user/agent-connections/requests/{requestUuid} # Get apiv2useragent connectionsrequests completion Source: https://docs.lightdash.com/api-reference/v2/get-apiv2useragent-connectionsrequests-completion https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/user/agent-connections/requests/{requestUuid}/completion # Get chart Source: https://docs.lightdash.com/api-reference/v2/get-chart https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/saved/{chartUuidOrSlug} Get a saved chart by uuid or slug within a project # Get comments Source: https://docs.lightdash.com/api-reference/v2/get-comments https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/dashboards/{dashboardUuidOrSlug}/comments Gets all comments for a dashboard within a project # Get connection status Source: https://docs.lightdash.com/api-reference/v2/get-connection-status https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/user/agent-connections/{grantUuid}/status Reads stored approval and current project and action restrictions. An allowed action has current person permission, organisation agent policy approval, and support from an agent connection in that project. A request can still be refused by a narrower rule: private-space access, a protected branch, a second required action (uploads need Deploy and upload), or scheduled pre-aggregate refreshes in the project. # Get custom role Source: https://docs.lightdash.com/api-reference/v2/get-custom-role https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/orgs/{orgUuid}/roles/{roleUuid} Get custom role by uuid # Get dashboard Source: https://docs.lightdash.com/api-reference/v2/get-dashboard https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/dashboards/{dashboardUuidOrSlug} Get a dashboard by uuid or slug within a project. Pass includeUnpublishedDraft=true to see your own unpublished draft applied on top; omitted, the published dashboard is returned. Rendered and machine-driven reads must omit it so a draft never reaches an export or a scheduled delivery. # Get dashboard pre-aggregate audit Source: https://docs.lightdash.com/api-reference/v2/get-dashboard-pre-aggregate-audit https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/pre-aggregates/dashboards/{dashboardUuidOrSlug}/audit Audits pre-aggregate hit/miss coverage for every tile on a dashboard without executing the queries. Returns a per-tile breakdown grouped by tab, suitable for CI coverage checks and pre-aggregate tuning. # Get feature flag Source: https://docs.lightdash.com/api-reference/v2/get-feature-flag https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/feature-flag/{featureFlagId} Get feature flag # Get organization role set for user Source: https://docs.lightdash.com/api-reference/v2/get-organization-role-set-for-user https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/orgs/{orgUuid}/roles/assignments/user/{userId}/set Get the complete role set (system role plus custom roles) a user holds in the organization. Requires custom roles (Enterprise). # Get organization roles Source: https://docs.lightdash.com/api-reference/v2/get-organization-roles https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/orgs/{orgUuid}/roles Get roles for organization # Get pre-aggregate materializations Source: https://docs.lightdash.com/api-reference/v2/get-pre-aggregate-materializations https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/pre-aggregates/materializations Retrieves pre-aggregate definitions with their latest materialization status # Get pre-aggregate stats Source: https://docs.lightdash.com/api-reference/v2/get-pre-aggregate-stats https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/pre-aggregates/stats Retrieves aggregated pre-aggregate hit/miss statistics for a project # Get project defaults Source: https://docs.lightdash.com/api-reference/v2/get-project-defaults https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/defaults Get project defaults configuration # Get project parameters Source: https://docs.lightdash.com/api-reference/v2/get-project-parameters https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/parameters Get project parameters by names # Get project role set for group Source: https://docs.lightdash.com/api-reference/v2/get-project-role-set-for-group https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectId}/roles/assignments/group/{groupId}/set Get the complete role set a group holds on the project. Requires custom roles (Enterprise). # Get project role set for user Source: https://docs.lightdash.com/api-reference/v2/get-project-role-set-for-user https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectId}/roles/assignments/user/{userId}/set Get the complete role set a user holds directly on the project. Requires custom roles (Enterprise). # Get results Source: https://docs.lightdash.com/api-reference/v2/get-results https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/query/{queryUuid} Retrieves paginated results from a previously executed async query using its UUID # Get source query status Source: https://docs.lightdash.com/api-reference/v2/get-source-query-status https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/query-sources/queries/status Gets the status of many submitted queries at once — the standard async query status lifecycle (pending, running, ready, error, ...) plus the error message for failed queries. Poll this after Execute source queries; fetch each ready query's rows with the standard async query results endpoint. Statuses are visible to the query creator only. # Get tile parameter references Source: https://docs.lightdash.com/api-reference/v2/get-tile-parameter-references https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/dashboards/tile-parameter-references List the parameters each dashboard tile uses, read from its saved query without running it. Tiles that can't be loaded or viewed report an error. The dashboard calls this while it is edited; in view mode each tile reports its parameters with its own query results. Embed tokens can call this with the `Lightdash-Embed-Token` header. The token must embed a dashboard: only that dashboard's tiles are listed, with the charts saved on it (request chart uuids are ignored), and a tile not on it reports an error. # Get validation result Source: https://docs.lightdash.com/api-reference/v2/get-validation-result https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/validate/{validationIdOrUuid} Get a single validation result. # Get validation summary Source: https://docs.lightdash.com/api-reference/v2/get-validation-summary https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/validate/summary Get validation errors grouped by root cause (e.g. all errors caused by one deleted model), with counts and a capped list of affected content. # Invalidate chart results cache Source: https://docs.lightdash.com/api-reference/v2/invalidate-chart-results-cache https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/saved/{chartUuid}/results-cache/invalidate Invalidate the cached results of this chart for every user. Covers the chart wherever it is viewed, including dashboards and embeds. Queries that share a cache key are invalidated too, and the next run queries the warehouse. Requires project admin access. # Invalidate dashboard results cache Source: https://docs.lightdash.com/api-reference/v2/invalidate-dashboard-results-cache https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/dashboards/{dashboardUuid}/results-cache/invalidate Invalidate the cached results of this dashboard for every user. Covers every tile, including for embedded viewers. Queries that share a cache key are invalidated too, and the next run queries the warehouse. Requires project admin access. # List agent connections Source: https://docs.lightdash.com/api-reference/v2/list-agent-connections https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/user/agent-connections Lists the signed-in person's agent connections and stored approvals. # List chart scheduler runs Source: https://docs.lightdash.com/api-reference/v2/list-chart-scheduler-runs https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/saved/{chartUuid}/schedulers/{schedulerUuid}/runs Get the run history of a single scheduler on a chart # List chart schedulers Source: https://docs.lightdash.com/api-reference/v2/list-chart-schedulers https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/saved/{chartUuid}/schedulers Get all schedulers for a saved chart # List content Source: https://docs.lightdash.com/api-reference/v2/list-content https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/content Get content (charts, dashboards, spaces) # List custom roles as code Source: https://docs.lightdash.com/api-reference/v2/list-custom-roles-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/orgs/{orgUuid}/code/roles Get custom roles in code representation # List custom roles as code (deprecated) Source: https://docs.lightdash.com/api-reference/v2/list-custom-roles-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/orgs/{orgUuid}/roles/code # List dashboard scheduler runs Source: https://docs.lightdash.com/api-reference/v2/list-dashboard-scheduler-runs https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/dashboards/{dashboardUuid}/schedulers/{schedulerUuid}/runs Get the run history of a single scheduler on a dashboard # List dashboard schedulers Source: https://docs.lightdash.com/api-reference/v2/list-dashboard-schedulers https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/dashboards/{dashboardUuid}/schedulers Get all schedulers for a dashboard # List deleted content Source: https://docs.lightdash.com/api-reference/v2/list-deleted-content https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/content/deleted Get deleted content (soft-deleted charts, dashboards, etc.) # List direct access Source: https://docs.lightdash.com/api-reference/v2/list-direct-access https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/direct-access/{resourceType}/{resourceUuid}/assignments List the direct access assignments stored for one resource. Returns direct assignments and direct roles only; inherited or effective roles are never reconstructed here. # List feature flags Source: https://docs.lightdash.com/api-reference/v2/list-feature-flags https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/feature-flag List every known feature flag with its resolved value for the requesting user. Preview environments only. # List groups eligible for direct access Source: https://docs.lightdash.com/api-reference/v2/list-groups-eligible-for-direct-access https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/direct-access/{resourceType}/{resourceUuid}/groups List project groups eligible for sharing this resource. Requires the same permission as managing its direct access assignments. # List metrics with time dimensions Source: https://docs.lightdash.com/api-reference/v2/list-metrics-with-time-dimensions https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/dataCatalog/metrics-with-time-dimensions Get paginated metrics that have time dimensions available # List my query history Source: https://docs.lightdash.com/api-reference/v2/list-my-query-history https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/query/history Lists the requesting user's own query history for a project, newest first, with per-trigger and per-window counts. Must stay declared before `getAsyncQueryResults` so the generated `/history` route is matched before `/{queryUuid}`. # List organization groups as code (deprecated) Source: https://docs.lightdash.com/api-reference/v2/list-organization-groups-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/orgs/{orgUuid}/groups/code # List organization role assignments Source: https://docs.lightdash.com/api-reference/v2/list-organization-role-assignments https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/orgs/{orgUuid}/roles/assignments List organization role assignments # List organization users as code (deprecated) Source: https://docs.lightdash.com/api-reference/v2/list-organization-users-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/orgs/{orgUuid}/users/code # List project parameters Source: https://docs.lightdash.com/api-reference/v2/list-project-parameters https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/parameters/list Get a paginated list of project parameters with search and sorting capabilities. # List project role assignments Source: https://docs.lightdash.com/api-reference/v2/list-project-role-assignments https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectId}/roles/assignments List project role assignments # List query sources Source: https://docs.lightdash.com/api-reference/v2/list-query-sources https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/query-sources Lists the query sources registered for this deployment. Every source supports the same operations: scan its schema, and submit queries that return a queryUuid whose results are fetched with the standard async query results endpoint. Requires the compose-sql-runner feature flag. # List role assignees Source: https://docs.lightdash.com/api-reference/v2/list-role-assignees https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/orgs/{orgUuid}/roles/{roleUuid}/assignees List the users, groups, and service accounts currently assigned to a role. Used by the delete-confirmation modal to explain why a role cannot be deleted while still in use. # List users eligible for direct access Source: https://docs.lightdash.com/api-reference/v2/list-users-eligible-for-direct-access https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/direct-access/{resourceType}/{resourceUuid}/users List users eligible for sharing this resource: active users with current access to the project. Requires the same permission as managing its direct access assignments. # List validation results Source: https://docs.lightdash.com/api-reference/v2/list-validation-results https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/validate Get paginated validation results for a project with search, filter, and sort support. # Permanently delete content Source: https://docs.lightdash.com/api-reference/v2/permanently-delete-content https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v2/content/{projectUuid}/permanent Permanently delete a soft-deleted item (chart, dashboard, etc.) # Post apiv2contentrecently viewed Source: https://docs.lightdash.com/api-reference/v2/post-apiv2contentrecently-viewed https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/content/recently-viewed # Post apiv2orgagent identitysnowflakeverify Source: https://docs.lightdash.com/api-reference/v2/post-apiv2orgagent-identitysnowflakeverify https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/org/agent-identity/snowflake/verify # Post apiv2orgagent permissionsreset Source: https://docs.lightdash.com/api-reference/v2/post-apiv2orgagent-permissionsreset https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/org/agent-permissions/reset # Post apiv2orgs codegroups Source: https://docs.lightdash.com/api-reference/v2/post-apiv2orgs-codegroups https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/orgs/{orgUuid}/code/groups # Post apiv2orgs codeuserattributes Source: https://docs.lightdash.com/api-reference/v2/post-apiv2orgs-codeuserattributes https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/orgs/{orgUuid}/code/userAttributes # Post apiv2orgs codeusers Source: https://docs.lightdash.com/api-reference/v2/post-apiv2orgs-codeusers https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/orgs/{orgUuid}/code/users # Post apiv2projects ai accessmarkertest Source: https://docs.lightdash.com/api-reference/v2/post-apiv2projects-ai-accessmarkertest https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/ai-access/marker/test # Post apiv2projects ai accessservice accounttest Source: https://docs.lightdash.com/api-reference/v2/post-apiv2projects-ai-accessservice-accounttest https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/ai-access/service-account/test # Post apiv2useragent connectionsrequests Source: https://docs.lightdash.com/api-reference/v2/post-apiv2useragent-connectionsrequests https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/user/agent-connections/requests # Post apiv2useragent connectionsrequests decision Source: https://docs.lightdash.com/api-reference/v2/post-apiv2useragent-connectionsrequests-decision https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/user/agent-connections/requests/{requestUuid}/decision # Put apiv2orgagent identity Source: https://docs.lightdash.com/api-reference/v2/put-apiv2orgagent-identity https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v2/org/agent-identity # Put apiv2orgagent identity 1 Source: https://docs.lightdash.com/api-reference/v2/put-apiv2orgagent-identity-1 https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v2/org/agent-identity/{warehouseType} # Put apiv2orgagent permissions Source: https://docs.lightdash.com/api-reference/v2/put-apiv2orgagent-permissions https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v2/org/agent-permissions # Put apiv2projects ai accessservice account Source: https://docs.lightdash.com/api-reference/v2/put-apiv2projects-ai-accessservice-account https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v2/projects/{projectUuid}/ai-access/service-account # Remove project role from group Source: https://docs.lightdash.com/api-reference/v2/remove-project-role-from-group https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v2/projects/{projectId}/roles/assignments/group/{groupId} Delete project role assignment for group # Remove project role from user Source: https://docs.lightdash.com/api-reference/v2/remove-project-role-from-user https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v2/projects/{projectId}/roles/assignments/user/{userId} Delete project role assignment for user # Remove scope from role Source: https://docs.lightdash.com/api-reference/v2/remove-scope-from-role https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v2/orgs/{orgUuid}/roles/{roleUuid}/scopes/{scopeName} Remove scope from role # Replace direct access role Source: https://docs.lightdash.com/api-reference/v2/replace-direct-access-role https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v2/projects/{projectUuid}/direct-access/{resourceType}/{resourceUuid}/assignments/{principalType}/{principalUuid} Create or replace one principal's direct role on a resource. # Replace organization role set for user Source: https://docs.lightdash.com/api-reference/v2/replace-organization-role-set-for-user https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v2/orgs/{orgUuid}/roles/assignments/user/{userId}/set Atomically replace the complete role set a user holds in the organization. At most one system role plus any number of custom roles; the set must not be empty. Requires custom roles (Enterprise). # Replace project defaults Source: https://docs.lightdash.com/api-reference/v2/replace-project-defaults https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v2/projects/{projectUuid}/defaults Replace project defaults configuration # Replace project parameters Source: https://docs.lightdash.com/api-reference/v2/replace-project-parameters https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v2/projects/{projectUuid}/parameters Replace all project parameters # Replace project role set for group Source: https://docs.lightdash.com/api-reference/v2/replace-project-role-set-for-group https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v2/projects/{projectId}/roles/assignments/group/{groupId}/set Atomically replace the complete role set a group holds on the project. At most one system role plus any number of custom roles; the set must not be empty. Requires custom roles (Enterprise). # Replace project role set for user Source: https://docs.lightdash.com/api-reference/v2/replace-project-role-set-for-user https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v2/projects/{projectId}/roles/assignments/user/{userId}/set Atomically replace the complete role set a user holds directly on the project. At most one system role plus any number of custom roles; the set must not be empty. Requires custom roles (Enterprise). # Reset direct access Source: https://docs.lightdash.com/api-reference/v2/reset-direct-access https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v2/projects/{projectUuid}/direct-access/{resourceType}/{resourceUuid}/assignments Remove every direct access assignment from one resource. # Restore content Source: https://docs.lightdash.com/api-reference/v2/restore-content https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/content/{projectUuid}/restore Restore a soft-deleted item (chart, dashboard, etc.) # Revoke agent connection Source: https://docs.lightdash.com/api-reference/v2/revoke-agent-connection https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v2/user/agent-connections/{grantUuid} Revokes the whole connection and returns its stored state. # Revoke direct access Source: https://docs.lightdash.com/api-reference/v2/revoke-direct-access https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json delete /api/v2/projects/{projectUuid}/direct-access/{resourceType}/{resourceUuid}/assignments/{principalType}/{principalUuid} Revoke one principal's direct access. Revoking an assignment that does not exist succeeds as a no-op. # Run dashboard pre-aggregate audit Source: https://docs.lightdash.com/api-reference/v2/run-dashboard-pre-aggregate-audit https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/pre-aggregates/dashboards/{dashboardUuidOrSlug}/audit Audit pre-aggregate hit/miss coverage with runtime filter overrides # Save Snowflake client Source: https://docs.lightdash.com/api-reference/v2/save-snowflake-client https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json put /api/v2/org/agent-identity/snowflake/client Saves the organization's Snowflake agent OAuth client. # Scan query source schema Source: https://docs.lightdash.com/api-reference/v2/scan-query-source-schema https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v2/projects/{projectUuid}/query-sources/{sourceType}/schema Scans the schema of one query source into the standard shape: tables with columns of {reference, type}. For the semantic layer, tables are explores and columns are field ids; for warehouse SQL, tables come from the warehouse catalog resolved for your credentials, like the SQL runner; the duckdb source has no schema of its own — its tables are the references given to each query. # Search field values Source: https://docs.lightdash.com/api-reference/v2/search-field-values https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/projects/{projectUuid}/query/field-values Searches for unique field values asynchronously, returning a query UUID to poll for results # Set feature flag override Source: https://docs.lightdash.com/api-reference/v2/set-feature-flag-override https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/feature-flag/{featureFlagId} Override a feature flag for the requesting user's organization. Preview environments only — lets QA toggle flags without a redeploy. # Update custom role Source: https://docs.lightdash.com/api-reference/v2/update-custom-role https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v2/orgs/{orgUuid}/roles/{roleUuid} Update role in organization # Update dashboard Source: https://docs.lightdash.com/api-reference/v2/update-dashboard https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v2/projects/{projectUuid}/dashboards/{dashboardUuidOrSlug} Update a dashboard by uuid or slug within a project # Update project group role Source: https://docs.lightdash.com/api-reference/v2/update-project-group-role https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json patch /api/v2/projects/{projectId}/roles/assignments/group/{groupId} Update project role assignment for group # Upsert custom role as code Source: https://docs.lightdash.com/api-reference/v2/upsert-custom-role-as-code https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/orgs/{orgUuid}/code/roles Upsert a custom role from code representation # Upsert custom role as code (deprecated) Source: https://docs.lightdash.com/api-reference/v2/upsert-custom-role-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/orgs/{orgUuid}/roles/code # Upsert organization group as code (deprecated) Source: https://docs.lightdash.com/api-reference/v2/upsert-organization-group-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/orgs/{orgUuid}/groups/code # Upsert organization user as code (deprecated) Source: https://docs.lightdash.com/api-reference/v2/upsert-organization-user-as-code-deprecated https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v2/orgs/{orgUuid}/users/code # Validate an AI agent skill Source: https://docs.lightdash.com/api-reference/validate-an-ai-agent-skill https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json post /api/v1/aiAgents/skills/validate Validate a skill folder without saving it. Returns the same errors and warnings the editor and the CLI show. # Data apps Source: https://docs.lightdash.com/data-apps Build interactive, AI-generated apps on top of your Lightdash semantic layer [Add-on](/support/feature-badges#add-ons) > [!NOTE] > > Data apps require the data apps add-on for Cloud Pro or Enterprise. For self-hosted deployments, follow [data apps setup](/self-host/enterprise-features/data-apps). Data apps let you describe what you want in plain English and get back a working, interactive application built on top of your semantic layer. Behind the scenes, a coding agent generates a React app inside an isolated sandbox and Lightdash serves it back to you in a sandboxed iframe. Lightdash Cloud uses Claude; self-hosted operators can also configure OpenAI Codex. When the app runs, every query goes through Lightdash, so results respect the same permissions, user attributes, and access controls as the rest of your project. Once you're happy with an app, you can move it into a space and share it with the rest of your organization. You can also ask [AI agents](/agents#ask-more-questions) questions about your data and get charts, tables, and explanations in a conversation. To build and preview apps on your computer using your own Claude or ChatGPT subscription, try [Lightdash Desktop](/workflow/lightdash-desktop) on Lightdash Cloud. ## Creating a new app You create a new data app from the 'New' menu in the navigation bar. ### Choosing a template Every new app starts from a template. The template you pick tells the agent what kind of layout you have in mind and sets up some of the built in interactions: * **Dashboard** - a single-page layout with multiple charts and KPIs, optimized for at-a-glance reading. * **Slide show** - a presentation-style app you can step through, useful for narratives or executive reviews. * **PDF report** - a print-friendly layout designed to be exported as a PDF. * **Custom** - start from a blank prompt with no layout assumptions. You can also apply a shared [theme](/data-apps/customize-themes) for fonts, styles, and instructions. Themes are managed under **Settings → Data apps → Themes**. ![Clean Shot 2026 04 29 At 18 35 18@2x](https://mintcdn.com/lightdash/K5Nfi9SN6t3X6zFl/images/CleanShot-2026-04-29-at-18.35.18@2x.png?fit=max\&auto=format\&n=K5Nfi9SN6t3X6zFl\&q=85\&s=91a8867520fde4983045d78712038bb7) After picking a template, you write your first prompt. If the prompt is vague, the agent will ask one or more clarifying questions - things like the topic, the audience, or the key metrics you want to highlight - before it starts building. If your prompt is already specific enough, it skips straight to the build. Templates only affect the first version of the app. Once you start iterating, the agent works from the existing code and your follow-up prompts.\ \ We encourage you to try out Custom apps to make something wildly different - the sky is the limit! ### Adding context The more context you give the agent, the better the result. You can attach several types of context to your prompt: * **Charts** - pick existing saved charts to give the agent a working metric query it can reuse. The agent gets the structure of the query (the dimensions, metrics, filters, and table) so it knows exactly which fields to use. * **Dashboards** - attach a dashboard to pull in every query on it at once. The agent also gets the dashboard's layout - its tabs, tile positions, tile types and titles, and dashboard filters - and recreates that structure unless you ask for a different design. If the app drifts from the dashboard, ask it to keep each tile's chart type and the dashboard's filters, or attach a screenshot of the dashboard. For a dashboard with many charts, ask for a few tiles at a time. * **Images** - upload screenshots, mockups, or design references. Images are one of the fastest ways to nail the visual style you want. * **Files** - attach a PDF or a text-based file (JSON, CSV, Markdown, Tableau `.twb` workbooks, code, and similar) using the attach button, or by pasting or dragging it into the prompt box. The agent reads the file's contents alongside your prompt - for example, it can read a Tableau workbook's XML to recreate its charts, or work from a JSON export from another tool. Each file is capped at 10MB, and you can attach up to 10 files to a single prompt. Files are reference material for that build only: they aren't added to the app, so the running app can't read them or refresh from them. Values the agent copies from a file into the app stay fixed until you prompt again, so for data that has to stay current, query your semantic layer or use an [external connection](/data-apps/external-connections). * **Elements of the running app** - turn on the element picker (the pointer icon next to the screenshot button), then click an element in the preview to insert a reference to it in your prompt. Put one reference per line, each followed by the change you want, to make several targeted edits in one prompt. * **Screenshots of the running app** - the preview panel has a **Screenshot** button that captures the current state of the running app and attaches it as context to your next prompt. Use it when you want the agent to react to what you're looking at right now ("make this header smaller", "the spacing here is off") instead of describing it from scratch. * **Sample data** - each chart and dashboard chip has an **Include sample data** toggle. When you turn it on, Lightdash runs the query and passes the first 10 rows to the agent so it can make better decisions about formatting, content, and copy. Sample data is opt-in per resource because rows can be sensitive - the agent will see whatever you send it. On self-hosted instances, `LIGHTDASH_APP_SAMPLE_DATA_ENABLED=false` turns sample data off for every organization and hides the toggle; see [environment variables](/self-host/customize-deployment/environment-variables#data-apps-runtime). * **Live-linked charts** - each chart chip also has a **Link** toggle next to Include sample data. When Link is off (the default), the agent embeds a frozen copy of the chart's metric query into the app - later edits to the chart in Lightdash won't flow through. When Link is on, the app runs the chart live by its UUID on every load, so changes made to the saved chart in Lightdash (metric swaps, filter tweaks, additional dimensions) show up in the app on the next refresh. Linked charts still respect the viewer's permissions and appear in the Queries tab of the inspector like any other query. Link is not yet supported for embedded apps that authenticate via JWT. Dashboard filters propagate to every query a data app tile runs, linked charts and the app's own queries alike, the same way they propagate to any other chart on the dashboard: filters that reference a field on the query's explore narrow the results, and filters that reference fields outside that explore are silently ignored for that query. This propagation is handled by the dashboard itself, so **existing data apps pick it up without regeneration**. Interactive filter controls, downloads, and drill-downs on linked charts work end-to-end. When a user changes a filter control the app is wiring into a linked chart, the chart re-runs against Lightdash with those filters ANDed onto the chart's own filters - the query can only narrow, never widen or replace what the saved chart defines. Filters on a linked chart apply to dimension fields only (metric-threshold filters need to live in the saved chart itself). Downloading a linked chart's results and drilling into an underlying row both work the same way they do on any other Lightdash chart, and drill-downs from a filtered linked chart inherit the active filters so you drill into the rows you're actually seeing. Interactive controls, downloads, and drill-downs for linked charts ship to **newly generated** data apps. Existing apps aren't retroactively upgraded — regenerate or ask the agent to rebuild the affected section to pick up the new behavior. * **Chart galleries from a space** - instead of linking charts one by one, an app can list whatever saved charts a space contains at the moment a viewer opens it. Ask for it by space - "a gallery of the charts in the Sales space" or "a 'my charts' page for the Marketing space" - and the app discovers the space's charts at runtime and renders each one live, the same way a linked chart runs. Charts saved into the space later show up on the next load or refresh, **without regenerating the app**. The listing runs with the viewer's own permissions: it only ever shows spaces and charts that viewer can already open in Lightdash, and a space the viewer can't access looks exactly like one that doesn't exist. It covers the space's charts only - dashboards and nested spaces are not included - and, like linked charts, it is not yet supported for embedded apps that authenticate via JWT. Each chart comes back with its saved visualization settings (chart type, which fields sit on each axis, series, and pivots), so the app can draw it the way it looks in Lightdash rather than guessing from the data alone. ### Choosing a model Next to the send button, a model picker lets you choose which model runs the generation. The available models depend on the coding agent configured for your Lightdash instance. With Claude: * **Sonnet** (default) - balanced quality and speed; the right choice for most apps. * **Opus** - highest quality, best for complex apps or when you want the agent to make more nuanced design decisions. Slower. * **Haiku** - fastest, useful for small tweaks where you don't need the full reasoning of the larger models. With Codex on a self-hosted instance: * **GPT-5.6 Terra** (default) - balanced quality and cost. * **GPT-5.6 Sol** - highest quality for complex generation and design work. * **GPT-5.6 Luna** - lowest cost for smaller apps and targeted iterations. You can change the model on every prompt - including mid-iteration. The existing app source remains the starting point, so switching models doesn't reset the app. Self-hosted operators can learn how to select an agent and provider in [data apps on self-hosted Lightdash](/self-host/enterprise-features/data-apps). ### Iterating on your app Every prompt you send creates a new version of the app. The agent works from the current app source, so follow-up prompts like "make the header smaller" or "swap the bar chart for a line chart" land as targeted changes instead of full rewrites. If a build is taking too long or going in the wrong direction, you can cancel it and try a different prompt. The agent keeps the conversation between prompts. With Claude, a long conversation is summarized automatically before the next build, so build time depends on how much a request changes and on the model, not on how many versions the app has. To start a fresh conversation, click **Clear agent context** (the eraser icon next to the model picker). The agent forgets the conversation and starts from your latest ready version, and unfinished changes from a cancelled build are discarded. ### Upgrading an app An app keeps the template and SDK it was built with, so later improvements to them don't reach it on their own. When a newer version is available, the app's **⋯** menu shows **Upgrade app** with a **New** badge. Upgrading creates a new version on the latest template and lists what's now active and which new features you can ask the agent to add. Nothing that changes your app is added automatically. ### Restoring an earlier version If a recent prompt took the app in the wrong direction, you can roll back to any earlier ready version and keep iterating from there. 1. Click an earlier version in the version timeline to preview it. 2. In the callout in the bottom left, click **Restore this version**. 3. Confirm in the dialog. Restoring duplicates the selected version to the head of the timeline as a new latest version. Your next prompt iterates from the restored version, while the intermediate versions stay in the timeline as history. The restore happens instantly — there's no rebuild. A version stores the app's code, not its data. Previewing or restoring an earlier version runs that version's queries against your current semantic layer and warehouse, so you see today's results, not the numbers the app showed when that version was built. ![Clean Shot 2026 05 20 At 11 28 07@2x](https://mintcdn.com/lightdash/tjYYxEmQSGz9dwf4/images/CleanShot-2026-05-20-at-11.28.07@2x.png?fit=max\&auto=format\&n=tjYYxEmQSGz9dwf4\&q=85\&s=9f67e31a232eecfa8a3865f7900031b8) ### Thumbnails Every ready version gets a thumbnail automatically. Lightdash renders the version as the user who created it and uses the latest ready version's thumbnail on app cards, previews and the homepage. Older versions keep theirs, so the version timeline shows a small preview of each ready version - click one to view that version. To set a thumbnail by hand, open the app's **⋯** menu and select **Capture thumbnail**. It saves the version you're viewing and is never replaced by an automatic capture. **Remove thumbnail** clears it. Restored and duplicated versions keep the thumbnail of the version they were copied from. Organization admins can turn automatic capture off under **Settings → Data apps → General**. Existing thumbnails stay, and you can still capture them by hand. To turn off all thumbnails, screenshots, and attachments, see [Turning off screenshots and attachments](#turning-off-screenshots-and-attachments). On self-hosted instances automatic capture needs a [headless browser](/self-host/customize-deployment/enable-headless-browser-for-lightdash). ### Duplicating an app If you want to fork an app - to experiment with a different direction, use it as a starting point for a new app, or grab a personal copy of something a teammate built - you can duplicate it. You can duplicate any app you can view. The duplicate lands in your **Settings > My apps** as a personal app you own, regardless of where the original lives. The original is untouched. To duplicate an app: * From the apps list, open the **⋯** menu on any app card and select **Duplicate**. * Or, from inside an app, open the **⋯** menu in the chat header and select **Duplicate**. The duplicate starts at version 1, seeded from the source app's latest ready version. The following is carried over: * The generated app code (the version you see in the preview). * The template the source app was built from. * Any chart and dashboard resource references attached to the source app. The following is **not** carried over: * Prior version history - the duplicate starts fresh at v1. * Images attached to earlier prompts. * Pending clarifications from in-progress builds. * The running sandbox - a fresh sandbox spins up on your first prompt. To duplicate, you need **view** access on the source app and **create** permission for data apps on the project. ### Network inspector The inspector is a tabbed network panel that captures everything the running app talks to. Open it from **View network** in the preview header. * **Queries** - every metric query the app runs against your semantic layer, including the underlying query definition, the fields it's pulling, and the rows it gets back. Live-linked charts show up here too. Use it to verify the app is asking for the right data, debug unexpected numbers, sanity-check performance, or spot a query returning far more rows than the app needs (see [App is slow to load](#app-is-slow-to-load)). * **Requests** - every external fetch the app makes at runtime through a linked external connection, with the method, path, status, response, and round-trip duration. Use it to confirm the app is calling the right endpoint and that the response shape matches what the UI expects. The inspector only ever sees the connection alias and path - credentials are injected server-side, so they're never displayed here. Both tabs are always visible so you can see at a glance whether the app has run any queries or external requests yet. Entries are held in-memory and cleared when you refresh the preview or load a new version unless you turn on the **Persist** toggle in the panel. Each Query row has two actions: * **Open in Explore** - opens the query in a full explore view so you can pivot on it, tweak filters, or dig into a single number. * **Save to Lightdash** - creates a governed table chart from the exact query the app ran. You pick a chart name and a target space; the chart is created via the same flow as saving from an explore, so your normal chart-create permission on the space applies. Save to Lightdash is available on inline app queries; linked charts already live in Lightdash, so the action is hidden there. ![Clean Shot 2026 04 29 At 18 38 42@2x](https://mintcdn.com/lightdash/K5Nfi9SN6t3X6zFl/images/CleanShot-2026-04-29-at-18.38.42@2x.png?fit=max\&auto=format\&n=K5Nfi9SN6t3X6zFl\&q=85\&s=7a6e102351c91b041854ddbb29601033) #### Inspect data The Queries tab has an **Inspect data** toggle (the database-search icon in the panel's title bar) that turns on a two-way link between the inspector and what's rendered in the app: * **Hover a query row** to highlight every data point in the preview that was rendered from that query - individual bars, table rows, KPI values, chart segments, and cells all light up together, so you can see exactly where a query's results end up in the UI. * **Click** a data point or a query row to pin the selection so you can scroll or interact with both sides without losing the highlight; click again (or press `Esc`) to cancel. Inspect data relies on lineage metadata that the agent emits during the build. If the toggle is disabled with a tooltip that says *"Inspect data is not available in this app version"*, the app was generated before lineage was introduced - regenerate the app (send any follow-up prompt, or ask the agent to rebuild) to enable it. ### Refreshing an app The preview header has a **Refresh** button that reloads the app's iframe and re-runs every metric query against the warehouse, without starting a new build. Use it when you've changed something in your semantic layer (for example, pushed a dbt update) and want to see the new results in the running preview. Refreshing also **invalidates the warehouse cache** for that app, so every query stays fresh for the rest of the session. See [Caching](/semantic-layer/caching#chart-and-dashboard-results-caching) for how results caching works across Lightdash. The same **Refresh** button is in the header when you view a published app, so anyone with access can re-run its queries and bypass cached results for the rest of their session. ### Exporting data You can ask the agent to add export controls to any table, chart, or KPI in your app — for example, "add a CSV export button to the orders table" or "let me download the revenue chart as XLSX". Exports run through the same Lightdash backend pipeline used by core charts and dashboards, so file generation, row limits, and raw vs. formatted values all behave consistently with the rest of the product. When the agent wires up an export control, it can offer the user: * **File type** - CSV or XLSX. * **Row scope** - the rows currently loaded in the app, or all matching results for the underlying query. * **Value mode** - formatted values (currency, percentages, prefixes/suffixes from your dbt YAML) or raw warehouse values. Exports respect the same permissions, user attributes, and export limits as exports started from a chart or dashboard. Rows are generated by Lightdash and streamed to the browser as a real file download - the app itself never serializes the data. CSV and XLSX are the only built-in file formats. Other formats, such as PowerPoint or Word files, need a client-side library added as a [custom dependency](/data-apps/custom-dependencies). ### Exporting to PDF You can ask the agent to add a PDF download button to any app — for example, "add a download as PDF button to the header" or "let me export this report as a PDF". This works especially well with the **PDF report** template, which is laid out for print, but you can add PDF export to any app. PDF exports are **image-based**: the app rasterizes the rendered pages in the browser and writes them into a PDF file. The output captures exactly what's on screen, including charts, tables, and styling, but the text in the PDF is not selectable or searchable. When you click the button yourself, the file is generated in the iframe and downloaded directly — nothing is sent to the Lightdash backend. A [scheduled `PDF` delivery](/data-apps/deliveries-and-syncs#format) reuses this same build: Lightdash renders the app headlessly and asks it for the finished PDF. Without a Download PDF button registered for scheduled deliveries, the delivery fails with `This app has no PDF export. Regenerate or upgrade the app to add one.` To fix it, an editor can choose **Upgrade app** from the app's **⋯** menu, when an upgrade is available, or regenerate the app. For text-heavy reports where you need selectable text, use the browser's built-in **Print → Save as PDF** option instead. ## Chart types Data apps also power reusable custom chart types, which are built and managed in Chart Studio rather than here. See [Chart Studio](/visualizations/chart-studio). ## Sharing an app Newly created apps are personal - only you can see them. Apps will initially appear in **Settings > My apps.** To share an app with your team, add it to a space or use [Direct access](/workspace-admin/direct-access). To open the app without the build chat, select **Preview latest** in the app's **⋯** menu. It opens the app's `/view` address in a new tab - the same page people see when they open the app from a space - which always shows the latest ready version. Share that address rather than the builder's. To show a specific version, use `/versions//view` in place of `/view`. An app opened on its own page has no comments. To discuss an app with your team, add it to a dashboard: data app tiles carry their own [comment thread](/explore/dashboards/interact#comment-on-a-tile) like any other tile. Access to a data app combines the user's **project role** with their **space access** or [direct content role](/workspace-admin/direct-access#how-roles-combine). ### Project role Your [project role](/workspace-admin/roles#project-roles-and-permissions) determines what you're allowed to do with data apps anywhere in the project: | Project role | What they can do with data apps | | :- | :- | | **Viewer** | Cannot open data apps. A data app runs new queries on the fly, which Viewers don't have permission to do. | | **Interactive Viewer** | Open and interact with shared data apps (through space access or direct access). Edit, rename, move, and delete existing apps in spaces where they have `Can edit` or `Full access`. Cannot create new apps. | | **Editor** | Everything an Interactive Viewer can do, plus create new apps. | | **Developer** | Same as Editor for data apps. | | **Admin** | Same as Editor for data apps, plus access to every space in the project (admins inherit `Full access` to all spaces). | **Project roles can be inherited from organization roles.** If you're an Editor at the organization level, you're at least an Editor on every project. You can be given a higher role on a specific project, but never a lower one. See [Roles in your Lightdash instance](/workspace-admin/roles#roles-in-your-lightdash-instance) for details. In a [custom role](/workspace-admin/custom-roles), **View Data App** (`view:DataApp`) depends on **Manage Explore** (`manage:Explore`), because apps run queries on the fly. A role with both can also build queries in Explore, but saving charts still needs its own scopes. ### Space access Once an app is added to a space, the user's [space access level](/workspace-admin/roles#space-roles) decides whether they can see and edit it within that space: * Users with `Can view` access to the space can open the app and interact with it (if their project role allows it). * Users with `Can edit` or `Full access` to the space can iterate on it, rename it, move it, and delete it (Interactive Viewer or above). * The app respects the same project-level access controls (user attributes, row-level filters) as the rest of your content. Personal apps stay tied to whoever created them until they're moved into a space. Once moved, the original creator no longer has special rights - access follows its space and any direct assignments. ![Clean Shot 2026 04 29 At 18 39 56@2x](https://mintcdn.com/lightdash/K5Nfi9SN6t3X6zFl/images/CleanShot-2026-04-29-at-18.39.56@2x.png?fit=max\&auto=format\&n=K5Nfi9SN6t3X6zFl\&q=85\&s=e4bd7656fc533874d04bc6a8fc157db1) ### Sharing a link to the current view As you use an app, Lightdash keeps its view state, such as the selected filters and the active tab, in the `state` parameter of the page address. To share that view, copy the address bar: anyone who opens the link sees the app with the same selections. The app decides which controls are kept in the link, so if one you need isn't, ask the agent to include it in the shareable URL. You can also build a link by hand to open an app with a value already set. The `state` parameter is a URL-encoded JSON object of the keys the app reads, for example `?state=%7B%22region%22%3A%22EMEA%22%7D` for `{"region":"EMEA"}`, and is ignored if it is longer than 4,096 characters or isn't a JSON object. In app code, read a key with `useUrlState('region', '')` from `@lightdash/query-sdk`, and validate the value before using it, since anyone can edit the link. Apps shown as dashboard tiles don't read or write the `state` parameter. ## Promoting an app If you're building in a [preview project](/workflow/preview-projects), you can promote a data app into the preview's upstream (production) project once it's ready. This mirrors how chart and dashboard [promotion](/explore/promote-content) works: you iterate safely in preview, then push a snapshot to production. To promote an app: 1. Open the app's **⋯** menu - either on the app card in a list, or in the chat header inside the app - and select **Promote**. 2. In the confirmation dialog, review whether the action will **create** a new production app or **update** the existing linked one, and which space it will land in. 3. Click **Promote**. When it finishes, you're taken to the promoted app in the production project. The first promotion creates a new app in the upstream project and links the two together. Every later promotion of the same preview app appends a new version to that linked production app, so production keeps a clean history of what was promoted and when. The latest ready version in preview is what gets snapshotted - in-progress builds are skipped. The app lands in a space that matches the source app's space by path. If no space with that path exists in the upstream project, Lightdash creates one. Personal apps (apps not in a space) are promoted as personal apps owned by the promoter. To promote, you need: * **Manage** access on the source data app in the preview project. * **Create** permission for data apps in the upstream project. * The preview project must have an upstream project configured under **Settings → Data ops**. **Data apps in new previews.** When a preview project is created from an upstream production project, every data app in production is duplicated into the preview - so you can open, iterate on, and promote those apps from inside the preview. Iterating on a duplicated app and promoting it updates the original production app rather than creating a new one. ### Promoting a dashboard with data app tiles If you embed a data app in a [dashboard](/explore/promote-content#promote-dashboards) and promote the dashboard, every referenced app is promoted alongside it. Each app is created or updated in the upstream project using the same rules as standalone app promotion, and the tile is remapped to point at the upstream app so the production dashboard renders the production copy. ## Data apps as code To edit app source in your own editor, preview changes against real data, and publish with the CLI, follow [Local data app development](/workflow/local-data-app-development). ## Data context and the app model Data apps don't ship with their own copy of your data. They run inside a sandboxed iframe with no direct access to the Lightdash API, so every query the app wants to run is proxied through the Lightdash UI hosting the iframe. This means: * **Permissions are enforced by Lightdash, not the app.** Whoever opens the app sees data based on their own role, group memberships, and user attributes - exactly as if they had run the query themselves in an explore. * **Apps run in the browser only.** An app is a React app with no Python runtime or server-side code, and it can't call outside services directly. To call a third-party API, link an [external connection](/data-apps/external-connections). To send results on a schedule, use [scheduled deliveries and syncs](/data-apps/deliveries-and-syncs); for custom scripts, use the [Lightdash API](/api-reference/v1/introduction). * **The agent generates code, not data.** When the app is being built, the configured coding agent sees your dbt model catalog (tables, dimensions, metrics) and any context you attach to the prompt. It writes queries against your semantic layer; it does not get a dump of your warehouse. Clarifying questions before a build use only your prompt, a summary of your tables, and the names of the charts and dashboards you attached. * **The sandbox only runs during builds.** The coding agent works in an isolated sandbox while it builds or edits the app. When someone opens the app, it runs in their browser and its queries go from the browser to Lightdash to your warehouse, so query results never pass through the sandbox or reach the agent. * **The agent can see anything you attach.** Charts, dashboards, images, files, screenshots, and sample data you include in the prompt are passed to the agent as context. These are the only ways rows from your warehouse reach the agent. Don't include data you wouldn't be comfortable sending to the model. * **Build errors go back to the agent.** If the generated code fails to build or fails Lightdash's app checks, Lightdash sends the compiler output or the check's message to the agent so it can fix the code, up to two times. These messages describe the code, not your query results. * **Apps can render field links from the semantic layer.** Query result columns include the link patterns configured with a dimension's [`urls`](/semantic-layer/dimensions#urls). The app's code decides how to display them. Ask the agent to make values clickable using their configured field links, rather than copying the URL pattern into your prompt. If you edit the app's code, use `resolveColumnUrls` from `@lightdash/query-sdk` in your cell renderer to resolve the patterns for each row. ### Links out of an app The app's sandboxed iframe limits how a link can leave the app: * A link that opens in a new tab (`target="_blank"`, or `window.open(url, '_blank')`) works, and the new tab is an ordinary browser tab. * A link with `target="_top"` replaces the Lightdash page, but only when the viewer clicks it. The app can't redirect the page on load or on a timer. * A link with no target loads inside the app's own frame instead of replacing the page. Ask the agent for the behavior you want, for example "make each card open its URL in a new tab". ### Turning off screenshots and attachments Organization admins can stop images of your data from being captured or sent to the agent. Go to **Settings → Data apps → General** and turn off **Allow screenshots and attachments**. While it's off: * The **Screenshot** button and image and file attachments are hidden in the prompt bar. Files staged before the switch was turned off aren't sent. * **Capture thumbnail** and automatic thumbnails are disabled. Existing thumbnails are kept but hidden until you turn the setting back on. **Remove thumbnail** stays available. * Images attached to earlier prompts are hidden in the build history. The files are kept and reappear when you turn the setting back on. * Slack build notifications and Slack link previews of an app don't include a rendered image of the app. On self-hosted instances, `LIGHTDASH_APP_CAPTURES_ENABLED=false` turns this off for every organization, and admins can't turn it back on in settings. See [environment variables](/self-host/customize-deployment/environment-variables#data-apps-runtime). ## Getting better results * **Iterate.** Most apps get substantially better after a few rounds of iteration. Start with the rough shape, then refine. * **Use images to lock in style.** A screenshot of a dashboard, a brand guideline, or even a hand-drawn mockup goes a long way toward getting the layout, typography, and colors right on the first try. * **Attach sample data when content matters.** If the app is making decisions based on what's actually in your data - picking a chart type, writing copy, or formatting values - turn on sample data for the relevant charts. Just remember the agent will see the rows you share. * **Reference existing charts and dashboards.** Pointing the agent at a working metric query is faster and more reliable than describing the query in prose. Attach only the charts the app needs: a long list, or several copies of the same chart, makes the output less consistent. * **Describe drill-downs in full.** Say what a click opens, what it shows, and what data it needs - for example, "clicking a month opens a dialog with that month's daily order count". * **Use the network inspector early.** If something looks off, check the queries and external requests the app is running before tweaking the prompt. * **Build what-if inputs on existing metrics.** The app gets each query's rows in its own code, so a slider or input that scales a result (for example, a growth rate applied to revenue) can work on any metric you already have, with no dbt changes. You only need [parameters](/semantic-layer/parameters) when the input should change the query's SQL itself; the app then passes the value with the query. * **Keep query results small.** Aggregate, filter, or lower the query's row limit so it returns hundreds of rows rather than tens of thousands. Large results load slowly even when the warehouse is fast - see [App is slow to load](#app-is-slow-to-load). ## Troubleshooting ### "Breaking Browser Locker Behavior detected" error If the app preview fails to render and you see a **"Breaking Browser Locker Behavior detected"** error, this is a false positive from a browser extension - most commonly **Malwarebytes Browser Guard**. The extension tries to detect "browser locker" scam pages, and its heuristic misfires on the data app preview (likely because data apps can produce pop-ups, such as the print/export dialog used by PDF reports). Other legitimate web apps like Vercel's v0 have hit the same false positive - it's a known issue on the Malwarebytes side. To fix it, allowlist Lightdash in Malwarebytes Browser Guard: 1. Click the **Malwarebytes Browser Guard** icon in your browser toolbar. 2. Open **Settings → Allow List**. 3. Add the Lightdash domain you're using (for example, your Lightdash Cloud subdomain or your self-hosted Lightdash URL). 4. Reload the page. ### App is slow to load A data app loads every row a query returns before it renders anything. Results come back in pages of 500 rows, fetched one after another, so load time grows with how many rows the query returns - not with how long the warehouse takes to run it. A query that returns 50,000 rows takes 100 sequential page requests to finish loading, which can take minutes even when the warehouse answers the query itself in seconds. Open the [network inspector](#network-inspector)'s Queries tab and check each query's row count to find the one that's slowing the app down. To fix it, return fewer rows from the query itself: * Ask the agent to aggregate or filter the data in the query, rather than fetching everything and filtering in the app. * Lower the query's `.limit()` so it returns hundreds of rows, not tens of thousands. If the app needs row-level detail, ask the agent to show a summary first and load the detailed rows separately - for example, only the rows for whatever the user clicks on. ## Self-hosting Data apps are enabled by default on Lightdash Cloud. If you're running a self-hosted enterprise instance, see [data apps on self-hosted Lightdash](/self-host/enterprise-features/data-apps) for the configuration you'll need to add — a [sandbox provider](/self-host/customize-deployment/sandboxes), a Claude provider, and an S3 bucket for the built artifacts. # AI analysis Source: https://docs.lightdash.com/data-apps/ai-analysis Summarize what a data app or dashboard shows, flag anomalies, and investigate why [Experimental](/support/feature-badges#experimental) > [!NOTE] > > AI analysis is off by default. It needs [AI agents](/workspace-admin/ai-settings#enable-ai-features) enabled for your organization and a feature flag — `enable-data-app-analysis` for data apps, `enable-dashboard-analysis` for [classic dashboards](#on-classic-dashboards) — which Lightdash support turns on for Cloud organizations on request. AI analysis reads the results a data app has loaded for the viewer's current filters and tells them what stands out: a headline, a short summary, a list of notable data points, and what the data could not show. For any notable point, an AI agent can then investigate the likely causes using data beyond the page. Nothing about this is written into the app. Lightdash runs the analysis over the queries the app already executed, so every result respects the viewer's permissions and user attributes, and an app can pick the analysis up and render it in place without any AI code of its own. The same analysis also works on [classic dashboards](#on-classic-dashboards) — no data app required. ## Turn it on An organization admin enables AI analysis under **Settings → Data apps → AI analysis**. The page appears only when the feature flag is on. * **AI analysis** turns it on for every data app — and, with the dashboards flag, every [dashboard](#on-classic-dashboards) — in the organization. It sends query results the viewer can already see to your configured AI provider. If you have [brought your own provider keys](/workspace-admin/ai-settings#bring-your-own-ai-providers-and-models), the calls go through your account; otherwise they run on Lightdash's key. * **Continue investigations in Ask AI** lets viewers continue an investigation as an Ask AI thread. Turn it off to limit viewers to the written explanation. * **Summary instructions** set organization-wide guidance every analysis summary follows — a language ("write in British English"), formats ("amounts in ZAR"), or a line of domain vocabulary. An app's own [analysis instructions](#steer-the-summaries) are applied on top of these. Changing the instructions invalidates stored analyses, so the next view runs fresh. AI analysis doesn't depend on Ask AI being shown elsewhere in Lightdash. To run it in data apps while hiding the Ask AI homepage card, navbar action, and agent chat, turn off **Lightdash UI** under **Settings → Ask AI → General → Visibility**. Self-hosted instances add `enable-data-app-analysis` (and/or `enable-dashboard-analysis`) to `LIGHTDASH_ENABLE_FEATURE_FLAGS`; see [feature flags](/self-host/customize-deployment/environment-variables#feature-flags). ### Limits The same page sets caps on how much analysis the organization can run. Each is a number; the daily caps can also be left empty for no cap. | Setting | Default | What it bounds | | - | - | - | | Analyses per day | 300 | Runs of the model over a view, organization-wide, per UTC day. Reused analyses don't count. | | Investigations per day | 100 | Agent investigations, organization-wide, per UTC day. | | Prompts per day | 500 | Questions apps ask through `useAiPrompt`, organization-wide, per UTC day. | | Maximum steps per investigation | 12 | Model steps the agent may take before it must answer. | | Maximum warehouse queries per investigation | 15 | Queries the agent may run; when the budget runs out the explanation is marked partial. | On Lightdash's key, the daily caps can't be raised above the defaults. On your own key, they apply as you set them. Once a daily cap is reached, the panel says so and analysis resumes the next day. Analyses and prompts run on a fast model Lightdash picks: with your own Anthropic key, the fastest Claude model the key can reach (Haiku, falling back to another Claude model the key serves); on Lightdash's key, the instance's default fast model. The Data Apps **Opus**/**Sonnet**/**Haiku** tiers under [Settings → Ask AI → AI providers & models](/workspace-admin/ai-settings#control-which-models-users-can-pick) only control which models build apps. You can't pin the model per app or per prompt. Extended reasoning is off for these calls and not configurable; adaptive models may still think briefly before answering. Each prompt answer has a fixed output allowance, set by Lightdash and not an admin setting, that includes any thinking the model does before answering. Independently of those caps, each viewer is limited per app to 6 analyses, 3 investigations, and 20 prompts a minute. An analysis served from storage doesn't count. When the limit is hit, an analysis a viewer asked for says when to retry; an automatic one on load shows no error and tries again on the next view change. Investigations are also capped at three minutes each. ## Analyze a view Open a data app and click the sparkles icon in the header, labeled **Analyse this view**. It opens the **AI analysis** panel on the right. If the organization has analysis off, the icon's tooltip and the panel say so, and organization admins get a link straight to the setting. ![The data app header, with the sparkles button and its Analyse this view tooltip](https://mintcdn.com/lightdash/4IXA5ZV0fSHcoUlE/images/data-apps/ai-analysis/analyse-this-view-button.png?fit=max\&auto=format\&n=4IXA5ZV0fSHcoUlE\&q=85\&s=1f5d23eee8a1d65a5ea71316323c8915) 1. Pick an **agent for investigations**. The analysis itself needs no agent; the agent is what investigates a finding later, so any agent with access to the app's data works. Your choice is remembered per app. 2. Click **Analyse this view**. The panel reads every query the app ran for the current filters. Queries on tabs you aren't looking at count too, as long as the app has loaded them. Apps built on a current SDK report exactly which queries are on screen, so the analysis covers what you see. When it finishes you get: * A **headline** with the main finding and a **summary** an executive can read without the charts. * **Findings**, each with a severity of High, Medium, Positive, or Info. High and Medium point at something worth investigating, Positive at a good surprise, and Info at context the summary relies on. A finding that refers to one row names the row; a finding about a whole table names only the table. Hovering a finding highlights the chart it came from when the app supports [data lineage](/data-apps#network-inspector). * **Limitations**, such as a missing comparison period or truncated results. Read them before acting on the headline. ![The AI analysis panel: agent picker, Re-analyse button, headline, summary and the first finding](https://mintcdn.com/lightdash/4IXA5ZV0fSHcoUlE/images/data-apps/ai-analysis/ai-analysis-panel.png?fit=max\&auto=format\&n=4IXA5ZV0fSHcoUlE\&q=85\&s=befca9157ec3bddf2f4eca9f265c6ff2) An analysis with no findings is a normal outcome. The headline says so. If you change a filter or move to a different tab after analyzing, the panel flags that the view changed and offers **Re-analyse**. The earlier result stays visible until you do. If the results behind the view have expired since the app loaded them, Lightdash reloads the app once so its queries run again, then analyzes the fresh view. If that also fails, the panel asks you to refresh the app yourself. ### Reuse Lightdash stores every analysis with the app version and a fingerprint of the results it read. Opening a view whose results match an analysis someone already ran shows that analysis immediately instead of running the model again, and the same applies when you return to the app later. Findings are shared this way; investigations are personal and are never copied between viewers. **Re-analyse** always runs a new analysis. Stored analyses and investigations are deleted after 30 days. A view opened after that is analyzed again. ## Investigate a finding Click **Investigate** on a finding. The agent you picked runs in the background with read-only tools: it can search the semantic layer, run queries, read saved charts and dashboards, and read the agent's knowledge documents. It can't save content, change anything, or reach external systems. A run is bounded by the organization's [limits](#limits); if the query budget runs out, the explanation says the answer is partial. The explanation arrives as Markdown with a summary, a **Possible drivers** list with evidence for each, an **Evidence** list of what was checked, and a confidence line. It stays attached to the finding for you and is restored when you reopen the app. Viewers without access to any agent in the project still get the analysis. The panel explains that findings can't be investigated, and apps hide their Investigate actions for them. ### Continue in Ask AI When the organization allows it, a finished investigation has a **Continue in Ask AI** button. It opens the investigation as a thread in Ask AI with the agent's reasoning already in place, so you can keep asking questions. The thread stays read-only permanently: every later prompt keeps the investigation's tool set, so it can't save charts, write back, or start a [deep research](/agents/deep-research) run, whatever the agent is otherwise allowed to do. ## Show the analysis inside the app Viewers don't have to open the panel. Ask the app agent to add AI analysis and the app renders the same analysis in place: * **"Add AI analysis"** gives the full set: a summary block at the top of the page, markers on the flagged data points of every chart, **Investigate with AI** in every data point's menu, and the investigation card under the chart. * **"Just an executive summary"** gives the summary block alone. * **"Mark anomalies on the charts"** gives the markers, the menu entry, and the card. If the app shouldn't wait for a click, ask for that too — "analyse as soon as it loads". The agent builds **analyse on load** into the app, and the analysis then runs whenever a viewer opens it or changes the view. A stored analysis of the same results is shown instead of re-running the model (see [Reuse](#reuse)), and the organization's [limits](#limits) still apply to automatic runs. Analyse on load is set while building the app — there's no organization or per-app setting for it — so it's also turned off with a prompt: "stop analysing on load". The summary block has an **Analyse** button of its own and shows a **Regenerate** button once a result exists. Markers appear on High, Medium, and Positive findings only, colored by severity, and one metric's finding never marks another series of the same chart. Hovering a marked point shows the finding under the value, and the point's menu opens the investigation, or reopens it once one exists. ### Steer the summaries When the summaries should be written a certain way, ask the agent for it — "write the summaries in British English", "amounts are in EUR", or a line of domain vocabulary such as "stage labels are covenant stages, not sales stages". The agent stores the guidance in the app as **analysis instructions**, and every analysis of that app follows it, including analyses run from the panel. Instructions guide wording and interpretation only: they can't grant data access or change which results are analyzed, and they're capped at 2,000 characters. Guidance that should apply to every app — house style, language, currency — belongs in the organization-wide **Summary instructions** under [Settings → Data apps → AI analysis](#turn-it-on) instead. The organization default applies first and an app's own instructions are added after it, so an app adds its domain vocabulary on top of the house style rather than replacing it. All of this renders nothing when AI analysis is off, so an app built with it works unchanged for organizations that haven't turned it on. While you build, the app builder shows an **AI analysis off** chip next to the prompt when the app renders analysis but the organization has it off; admins can click it to turn analysis on. > [!NOTE] > > Apps built before AI analysis existed don't pick it up on their own. Ask the agent to add it, which creates a new version of the app. If an app was wired to a model provider through an [external connection](/data-apps/external-connections) as a stopgap, ask the agent to replace that with AI analysis: it removes the author's key from the app, so the organization's consent setting and the viewer's permissions apply again. ### For app code If you [edit app code locally](/workflow/local-data-app-development), two hooks from `@lightdash/query-sdk` expose the analysis: * `useInsights()` returns the view's analysis, and `useInsights(result)` narrows it to the findings on one `useLightdash` query, with a `matches(row, fieldId)` helper for marking data points. The template ships ready-made components under `src/components/insights/` for the summary block, markers, menu entry, and investigation card. * `useInsights({ instructions })` — or the `instructions` prop on the shipped `InsightsSummary` component — sets the app's [analysis instructions](#steer-the-summaries). One string per app. * `useInsights({ analyseOnLoad: true })` — or the `analyseOnLoad` prop on `InsightsSummary` — declares [analyse on load](#show-the-analysis-inside-the-app) in app code. One value per app. * `useAiPrompt()` lets the app ask its own short question about results it has already loaded, for an author-written takeaway under a chart or an explanation of a clicked row. Answers are plain text. Prompts are capped at 2,000 characters and count against the prompt limits above, and run on the same model as analysis, with a fixed output cap set by Lightdash — see [Limits](#limits). * `useSharedAiCommentary()` combines `useAiPrompt` with [shared storage](/data-apps/saved-app-state#shared-storage) to save commentary per selection: the first viewer generates it, later viewers of the same selection read the saved text instead of generating it again, and anyone can edit it — the edited text wins and is labeled as edited. It needs both this feature and [saved app state](/data-apps/saved-app-state) turned on. Because the saved text is shared by selection, a viewer may read commentary generated from data they couldn't query themselves — keep selections coarse when row-level access matters. Neither hook sends rows anywhere: the app names the query, and Lightdash reads the results from the viewer's own query history. Both report the feature as unavailable, and render nothing, outside a Lightdash host that has analysis on. The app template's `references/ai-analysis.md` documents both in full. ## On classic dashboards The same analysis runs on any dashboard, without building a data app. It's gated by its own `enable-dashboard-analysis` feature flag — independent of the data-apps flags, so an organization can have dashboard analysis without data apps — which Lightdash support turns on for Cloud organizations on request; self-hosted instances add it to `LIGHTDASH_ENABLE_FEATURE_FLAGS`. The same organization consent toggle under [Settings → AI analysis](#turn-it-on) applies (when data apps aren't enabled, the page appears as a top-level settings item), and so do the same [limits](#limits), [reuse](#reuse), and 30-day retention. Open a dashboard in view mode and pick **Analyse this view** from the AI launcher in the corner. The analysis covers the queries the dashboard ran for the current filters, and **charts on the active tab only** — unlike apps, where hidden tabs may be included. A different tab, filter, or parameter value is a different view, analyzed (or served from storage) separately. Hovering a finding scrolls the chart it came from into view, and once an analysis exists, the launcher shows the next viewer of that view an **Insights on this view** card — the headline and top findings — instead of waiting for a click. [Investigations](#investigate-a-finding) and [Continue in Ask AI](#continue-in-ask-ai) work exactly as they do for apps. Dashboards have no app code to carry [analysis instructions](#steer-the-summaries), so the organization-wide **Summary instructions** are the way to steer dashboard summaries. Dashboard analysis is for signed-in viewers: it isn't offered in edit mode, on embedded dashboards, or in scheduled deliveries. ## Where it works AI analysis is for people viewing a data app in Lightdash while signed in. It isn't available, and apps built with it show nothing extra, in: * **Scheduled deliveries** and Google Sheets syncs, which render the app under the creator's account. * **Embedded apps**, which run under an embed token. * **Local preview** with `lightdash apps preview`, where there is no Lightdash host to run the analysis. ## What is sent to the model * **Analysis** sends the query results the app loaded for the viewer, with their field names and any [analysis instructions](#steer-the-summaries) — the organization default and the app's own — to the AI provider configured for your organization. * **Investigation** runs the agent you picked, with the same data access that agent has anywhere else. * **App prompts** send the results the app named, and the author's question. Results a viewer can't see never reach the model, because the analysis only ever reads queries that viewer ran. Analyses are stored in your Lightdash database alongside the app for 30 days. Every run is recorded against the app, the viewer, the operation, and the model, so usage can be attributed. # Build maps and globes in a data app Source: https://docs.lightdash.com/data-apps/build-maps-and-globes Build interactive d3 maps and globes in a data app from external shapes and your semantic layer This tutorial shows how to pull map shapes from an external connection, render them with `d3-geo`, and connect data from Lightdash inside a data app. ![A data app showing an interactive d3 globe with countries colored by GDP and a country detail panel for Spain](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/data-apps/build-maps-and-globes/maps-world-view-hero.jpg?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=a1e9e50ab6247b5594ad19ad7c598290) The ingredients: * **An external connection** that serves GeoJSON country shapes. * **A prompt** describing the globe and its interactions. * **A Lightdash query** joined onto the shapes by country code. ## 1. Set up an external connection for geo data The map needs country boundary shapes. Data apps fetch external data through [external connections](/data-apps/external-connections) — a project admin registers the API once, and apps call it through a proxy that pins requests to the registered host. A great free source is the [Natural Earth](https://www.naturalearthdata.com/) dataset mirrored on jsDelivr. Create a connection under **Project Settings → Data app connections** with: * **Name** - `world_geojson` (the name becomes the alias the app calls — keep it short and descriptive) * **Base URL** - `https://cdn.jsdelivr.net` * **Auth** - None (it's a public CDN) * **Allowed methods** - `GET` * **Allowed paths** - `/gh/nvkelso/natural-earth-vector/geojson/` * **Content types** - `application/json` and `application/geo+json` * **Max response size** - raise it to 8 MB. The world-countries file used below is \~0.8 MB, which brushes against the 1 MB default; higher-resolution files need more (see [Troubleshooting](#troubleshooting)). In the connection's **Instructions** field, tell the agent what lives there — this text is passed into the app-build sandbox: ```markdown theme={null} Country and land shapes from the Natural Earth dataset. Fetch GeoJSON files under /gh/nvkelso/natural-earth-vector/geojson/, e.g. ne_110m_admin_0_countries.geojson for world country polygons. Features carry useful properties: NAME, ADM0_A3 (ISO-3 code), CONTINENT, POP_EST, GDP_MD. ``` Finally, use the wizard's **Test** step with the path `/gh/nvkelso/natural-earth-vector/geojson/ne_110m_admin_0_countries.geojson` and **Save as sample** — the generator then knows the exact response shape when it builds your app. ![The Data app connections settings page with a GeoJSON connection configured](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/data-apps/build-maps-and-globes/maps-connection-wizard.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=60cb2af99648d417e199b22343b16536) ### Where else geo data can come from Any HTTPS API an admin registers works the same way: * **Your own storage** - host simplified GeoJSON for your sales regions, store catchment areas, or delivery zones on S3/GCS/your CDN, and register that origin. * **Open-data APIs** - many government portals serve boundaries as GeoJSON (e.g. census, postcode, or administrative-area APIs). * **No connection at all** - for small, stable shapes you can ask the agent to inline a simplified GeoJSON directly into the app source. No network, no connection to manage — best under a few hundred KB. Prefer **GeoJSON** over TopoJSON sources. TopoJSON is smaller on the wire, but decoding it needs the `topojson-client` package, which isn't available in the app sandbox. Natural Earth publishes plain GeoJSON, so no conversion is needed. ## 2. Prompt the globe Create a new app with the **Custom** template. Describing the projection, the interactions, and the connection by name gets you most of the way in one prompt. This is the kind of prompt that produced the World Atlas app: ```text theme={null} Build a "World Atlas" data explorer using the world_geojson connection. - A large interactive globe (d3 orthographic projection) that slowly auto-rotates and can be dragged to spin. Draw it from /gh/nvkelso/natural-earth-vector/geojson/ne_110m_admin_0_countries.geojson. - Color countries by a switchable metric — population, GDP, income group, continent — with a matching legend. - Clicking a country pauses the rotation and opens a side panel with its details. - Dark space theme with a subtle starfield. Aim for the polish of the d3 gallery on Observable. ``` Prompting tips for maps: * **Name the projection.** "Orthographic globe", "Natural Earth projection", "Mercator focused on Europe" — d3 supports them all, and naming one removes the guesswork. * **Name the connection and the file path.** The agent sees the connection's instructions and samples, but spelling out the exact file avoids a wrong guess. * **Describe the interactions** — rotate, hover tooltips, click-to-select, metric switcher — as user-visible behavior. * **Point at inspiration.** The [d3 gallery](https://observablehq.com/@d3/gallery) is a good shared vocabulary for the look you're after. ## 3. Link the connection When you create or iterate on the app, open the resource picker in the builder and link `world_geojson`. The link is what authorizes the app to call the connection at runtime — the prompt text alone doesn't grant access. If the app calls a connection that isn't linked, the fetch fails with: ```text theme={null} This app is not linked to the requested connection ``` You can review and change an app's linked connections from the same picker when iterating, without regenerating the app. Under the hood, the generated code fetches shapes like this: ```tsx theme={null} import { useLightdashClient } from '@lightdash/query-sdk'; const client = useLightdashClient(); useEffect(() => { client .externalFetch('world_geojson', { method: 'GET', path: '/gh/nvkelso/natural-earth-vector/geojson/ne_110m_admin_0_countries.geojson', }) .then((res) => setGeo(res.body)) // parsed GeoJSON FeatureCollection .catch((err) => setError(err.message)); }, [client]); ``` and the globe itself is standard `d3-geo` — a projection, a path generator, and one SVG `` per country: ```tsx theme={null} const projection = d3.geoOrthographic().scale(R).translate([cx, cy]).clipAngle(90); const path = d3.geoPath(projection); svg.append('path').datum({ type: 'Sphere' }).attr('class', 'geo') .attr('d', path).attr('fill', '#0d3868'); // ocean svg.append('g').selectAll('path.country') .data(geo.features) .join('path') .attr('class', 'geo country') .attr('d', path) .attr('fill', (feature) => colorFor(feature)) .attr('stroke', '#08121e'); // Drag to rotate: nudge the projection, redraw every path const drag = d3.drag().on('drag', (event) => { const [lambda, phi, gamma] = projection.rotate(); projection.rotate([ lambda + event.dx * 0.3, Math.max(-70, Math.min(70, phi - event.dy * 0.3)), gamma, ]); svg.selectAll('.geo').attr('d', path); }); svg.call(drag); ``` You rarely write this by hand — but recognizing the shape helps you iterate with precise follow-up prompts ("slow the auto-rotation", "thicken country borders on hover"). ### A second connection: live data per location The same mechanism works for any API. The World Atlas app links a second connection, `weather` (Base URL `https://api.open-meteo.com`, path `/v1/forecast`, no auth), and fetches a forecast when you click a country: ```tsx theme={null} const res = await client.externalFetch('weather', { method: 'GET', path: '/v1/forecast', query: { latitude: '48.86', // query values must be strings longitude: '2.35', current: 'temperature_2m,weathercode', timezone: 'auto', }, }); ``` ## 4. Add Lightdash query data So far the colors come from properties baked into the GeoJSON. The real power move is coloring the map from **your semantic layer** — revenue by country, active users by region, on-time delivery by state — with the same permissions and access controls as everything else in your project. Ask for it in an iteration prompt: ```text theme={null} Color the countries by total revenue from the orders explore instead of population. Join on the customer country ISO-3 code. Countries with no revenue stay gray. ``` The generated code runs a Lightdash query and joins it onto the features by country code: ```tsx theme={null} import { query, useLightdash } from '@lightdash/query-sdk'; const revenueByCountry = query('orders') .label('Revenue by country') .dimensions(['customers_country_code']) // ISO 3166-1 alpha-3 .metrics(['orders_total_revenue']) .limit(500); function Globe({ geo }) { const { data, loading, error, lineage } = useLightdash(revenueByCountry); const byCountry = useMemo( () => new Map( (data ?? []).map((row) => [ row.customers_country_code, row.orders_total_revenue, ]), ), [data], ); const color = d3 .scaleSequential(d3.interpolateBlues) .domain([0, d3.max([...byCountry.values()]) ?? 1]); const fillFor = (feature) => { const value = byCountry.get(feature.properties.ADM0_A3); return value != null ? color(value) : '#1a2535'; // gray = no data }; // Render the globe with fillFor, and spread {...lineage} on the // root element so the host's "Inspect data" can trace the query. } ``` > [!TIP] > > **Mind your join keys.** A map only lights up where a row in your data matches a shape in the geo file. Pick a key that exists on both sides — country code, region code, postcode, admin ID — and make sure the format matches (ISO alpha-2 vs alpha-3, upper vs lower case, leading zeros). If your warehouse uses a different code than the geo file does, either translate it in the app or expose a matching dimension in your model. Because the query runs through Lightdash, viewers only ever see data they're allowed to see — a map in a data app respects user attributes and project permissions like any chart. ## 5. Flat maps and regions A globe is one `projection` swap away from a flat map. Useful iteration prompts: * "Make it a flat world map instead of a globe" → `d3.geoNaturalEarth1()` * "Focus the map on Europe only" → filter features, then fit the projection ```tsx theme={null} // Flat world map, sized to the container const projection = d3.geoNaturalEarth1().fitSize([width, height], geo); // One region: filter the features, then fit the projection to them const europe = { type: 'FeatureCollection', features: geo.features.filter((f) => f.properties.CONTINENT === 'Europe'), }; const regional = d3.geoMercator().fitExtent( [[16, 16], [width - 16, height - 16]], europe, ); ``` For sub-country maps, Natural Earth also publishes first-level admin areas (states and provinces) under the same connection path — `ne_110m_admin_1_states_provinces.geojson`, or the more detailed `ne_50m_...` variants (raise the connection's max response size first). ## Troubleshooting * **`This app is not linked to the requested connection`** - the app calls an alias that isn't linked. Link the connection in the builder's resource picker. * **Fetch fails or the response is cut off** - the GeoJSON is bigger than the connection's max response size. The 110m world file is \~0.8 MB (fine at 8 MB); 50m is \~5 MB; 10m files are larger still. Raise the limit, or step down a resolution — 110m is plenty for a world view. * **Countries missing or gray after a join** - check the join key. Use `ADM0_A3` (see the tip above), and make sure your dimension returns ISO alpha-3 codes. * **The agent tried to `fetch()` a URL directly** - direct network calls are blocked in the app sandbox. Data must come through `externalFetch` on a linked connection. If this happens, iterate with "use the `world_geojson` connection instead of fetching directly". * **No map tiles / basemap imagery** - tile servers are blocked by the app's content security policy, by design. d3's SVG projections don't need them. For a tile-based scatter or choropleth on a dashboard, use the core [Map chart](/visualizations/map) instead. * **Fonts look different than expected** - external stylesheets (e.g. Google Fonts) are also blocked by the content security policy; the app falls back to system fonts. Ask for system fonts in your prompt to avoid the console noise. # Custom dependencies Source: https://docs.lightdash.com/data-apps/custom-dependencies Add packages to data apps and check dependency requirements and limits [Experimental](/support/feature-badges#experimental) > [!NOTE] > > Custom dependencies are off by default. On Lightdash Cloud, contact Lightdash support to enable them for your organization. On self-hosted instances, add `enable-data-app-custom-dependencies` to `LIGHTDASH_ENABLE_FEATURE_FLAGS` (see [feature flags](/self-host/customize-deployment/environment-variables#feature-flags)). Uploading an app that declares custom dependencies also requires the `manage:DataAppDependency` permission, granted only to admins by default. By default, apps build against a fixed, pre-installed library set that Lightdash vets and ships — edits to `package.json` are ignored. Turning custom dependencies on lets an app pull additional packages from the public npm registry into the build sandbox, which is why it's opt-in: * A third-party library becomes part of your app. It can shape how the app behaves and touch any data the app is allowed to query, so the main consideration is trust in the libraries you choose. That's also why the upload permission (`manage:DataAppDependency`) is restricted to admins by default. * Lightdash adds several layers of protection to reduce that risk: every uploaded version is screened against the OSV malicious-package feed, installs use `--frozen-lockfile --ignore-scripts` so lifecycle scripts can't run, the sandbox has no access to Lightdash credentials, and network egress is limited to the npm registry. With custom dependencies enabled, you can extend the pre-installed set from the app folder. Follow [Local data app development](/workflow/local-data-app-development) to download or create the app first: ```bash theme={null} cd lightdash/apps/revenue-explorer pnpm add deck.gl # updates package.json AND pnpm-lock.yaml lightdash upload --apps revenue-explorer ``` Both files matter: the dependency set is `package.json` plus a matching `pnpm-lock.yaml` (the server installs with pnpm, so an npm lockfile won't do). On upload, the CLI shows what you're adding and asks for confirmation: ```text theme={null} "revenue-explorer" declares custom dependencies that will be installed in the build sandbox: + deck.gl@^9.3.5 (not in default template) Upload "revenue-explorer" with custom dependencies? ``` If the upload fails with `Custom app dependencies are not enabled for your organization`, you have the `manage:DataAppDependency` permission, but custom dependencies aren't turned on for your organization. **Rules the CLI and server enforce:** * Registry semver specs only (`^9.3.5`, `~1.2.0`, ranges). No `git:`/`file:`/URL specs and no dist-tags like `latest`. * At most 60 direct dependencies; lockfile ≤ 2 MB and consistent with `package.json`. * Every version is screened against the OSV malicious-package feed at upload; known-bad versions are rejected outright. **Additional hardening:** install scripts also never run on your machine — the scaffolded `.npmrc` sets `ignore-scripts=true`; keep it. Self-hosted instances can further tighten the policy by requiring a minimum package release age (`LIGHTDASH_APP_DEPENDENCY_MIN_RELEASE_AGE_DAYS`) or pointing installs at an internal mirror (`LIGHTDASH_APP_DEPENDENCY_REGISTRY_HOSTS`). **Uploads are the only way to change dependencies.** When someone iterates on the app in the UI, the AI builder can edit `src/` but the stored dependency set is restored as-is — its `package.json` edits are ignored. Dependency changes on a version are visible in the version history. # Customize themes Source: https://docs.lightdash.com/data-apps/customize-themes Create shared themes to give your data apps consistent styles, fonts, and instructions Themes let you define a reusable set of styles and instructions that data apps can pick up. They're a good way to keep apps on-brand across your organization without having to re-prompt the agent for the same look and feel every time. ## What's in a theme A theme is a bundle of resources the agent uses when it builds an app: * **CSS rules.** Instantiated at the root of the app. Global styles are picked up automatically, and class-targeted styles are available for the agent to apply to specific elements based on the theme's instructions. * **Fonts.** Loaded into the app and available to the agent. * **Images.** Logos, imagery intended to be used in the app, design inspiration, or examples of component styles you'd like the agent to follow. The agent tries to guess each image's intent from its name and content, but you can be explicit in the instructions. * **`skill.md`.** Free-form instructions for the agent on how to use the theme. This can describe a vibe, specific interactions, or tell the agent exactly how to use the other resources in the theme. * **Extra instructions.** A free-text field on the theme itself, edited inline from the theme detail panel. Useful for quick tweaks you don't want to manage as a file. See [Extra instructions](#extra-instructions) below. The quality of a theme depends largely on the specificity of the instructions in `skill.md` and the extra instructions field. The more concretely you describe how the agent should use the CSS, fonts, and images - and what the app should feel like - the more consistent your results will be. ### Size limit A theme's files are streamed into the app sandbox. To keep things fast and predictable, themes have a hard limit of **100 MB total across all uploaded assets** (fonts, images, and instruction files combined). Individual files are capped at 10 MB, the manifest at 64 KiB, and the complete uncompressed package at 110 MB. The cap is on aggregate bytes, not file count — a theme with many small text files is cheap, but a handful of large images can blow past it. Compress or downscale image assets, or split them into a smaller curated set, if you're near the limit. ## Extra instructions Each theme has an **Extra instructions** field that you can edit directly from the theme detail panel in **Settings → Data apps → Themes**. These instructions are passed to the agent alongside any uploaded instruction markdown files when an app is built with the theme. Use extra instructions for: * Quick guidance you want to iterate on without uploading or re-uploading a file. * Overrides or additions that complement a stable `skill.md`. * Short, focused directives — for example, capitalization rules, layout preferences, or tone. Example: ```text Extra instructions theme={null} Use sentence case for all headings. Prefer dense layouts over generous whitespace. Always show the company logo in the top-left corner of the app. ``` Leave the field blank to disable it — empty values are ignored at build time. ## Creating a theme You create and manage themes under **Settings → Data apps → Themes**. The page needs the `manage:OrganizationDesign` scope, which only the built-in Admin role holds by default; see [theme scopes](/workspace-admin/custom-roles#organization-design-theme-scopes) to grant it to another role. Bootstrapping a theme with an agent (for example, asking an LLM to draft CSS rules and a `skill.md` against these guidelines) is a quick way to get a usable first version. From there, iterate on the instructions until the agent produces apps that match what you have in mind. ## Setting a default theme You can mark one theme as the default for your organization. New data apps will use the default theme unless you pick a different one. ## Using a theme in a data app When you create a new data app, you can choose which theme to apply. The agent will use the theme's CSS, fonts, images, and `skill.md` instructions as part of the context for the build. To change the theme of an existing app, open the app and click the theme chip above the prompt box. It shows the app's current theme, or **No theme**. Pick another theme to restyle the app with it, or pick **No theme** to remove the current one. The change runs as a new iteration, so it creates a new version and keeps earlier versions in the timeline. The chip is disabled while the agent is working. ## Themes as code Themes download, version, review, and upload through the same [organization content-as-code workflow](/workflow/content-as-code#organization-content-as-code) used for custom roles, users, and groups: ```bash theme={null} lightdash download --organization # Edit or add lightdash/themes// lightdash upload --organization ``` Use it to move a UI-created theme into version control, or to create a theme locally. Organization download includes every theme and writes each one under its immutable slug: ```text theme={null} lightdash/ themes/ acme-brand/ lightdash-theme.yml css/ theme.css fonts/ acme-sans.woff2 images/ logo.svg instructions/ skill.md ``` The directory name must exactly match the manifest's `slug`. Every manifest field is required; use `null` for an empty description or extra instructions: ```yaml lightdash/themes/acme-brand/lightdash-theme.yml theme={null} codeVersion: 1 slug: acme-brand name: Acme Brand description: Brand theme for customer-facing data apps extraInstructions: |- Use the horizontal logo in page headers. Keep data-dense tables compact. ``` To create a theme locally, choose a lowercase, hyphenated slug, write this manifest and any asset folders you need, then run `lightdash upload --organization`. Upload creates or updates the theme by manifest slug. Treat the slug as immutable; change `name` when you only want to rename the theme for display. > [!WARNING] > > Organization mode has no theme-only selector. Before uploading, review custom roles, users, and groups under the same `lightdash/` directory as well as your themes. ### Files and validation The CLI validates every local theme before changing any organization resource. A theme package accepts: * `.css` files under `css/` * `.woff`, `.woff2`, `.ttf`, and `.otf` files under `fonts/` * `.png`, `.jpg`, `.jpeg`, `.gif`, `.webp`, and `.svg` files under `images/` * Markdown files under `instructions/` Files must live directly inside one of these folders. Nested folders, symlinks, unknown paths, unsafe filenames, unsupported file types, empty files, and files whose contents don't match their extension are rejected, as are packages over the [size limits](#size-limit). Don't commit or upload restricted Apple system-font binaries such as SF-family or New York fonts. Use a system font stack instead: ```css theme={null} font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; ``` ### Synchronization behavior * A successful download replaces the complete local `themes/` directory with the remote theme set. If any theme cannot be downloaded or validated, your previous local themes are preserved. * Upload preflights every local theme before applying custom roles, users, groups, or themes. One invalid theme prevents all organization changes in that run. * An existing slug is updated, a new slug is created, and a theme whose manifest and files already match is skipped as unchanged. * A missing or empty local `themes/` directory is a no-op. Removing one local theme directory does not delete the remote theme. * Upload preserves each theme's UUID and whether it is the organization default. Set the default or delete a theme in the Lightdash UI. * Each theme import is atomic, but a multi-theme upload is not one transaction. If a later import fails, themes that completed earlier remain applied and the CLI reports the partial failure. There is no standalone `lightdash themes` command, theme-specific `--only` flag, or local theme preview. If an organization theme endpoint returns `404`, check that the Lightdash CLI and server versions both support theme packages. ### Evaluate your changes Uploading proves the package is valid, but it doesn't rebuild or restyle existing data app versions. To see whether you like a theme, select it when generating a new data app or apply it to an existing app from the theme picker above the prompt. Lightdash creates a new app version that you can compare with the previous version. If you edit themes with an AI coding agent, install or update the [Lightdash agent skills](/workflow/install-agent-skills). The `developing-in-lightdash` skill teaches the agent this package format and the organization download/upload workflow. The agent can verify the CLI round trip without browser access; you still evaluate the generated app visually in Lightdash. ## Permissions To give a non-admin role permission to manage themes, configure the [organization design scopes](/workspace-admin/custom-roles#organization-design-theme-scopes) in an organization-level custom role. # Scheduled deliveries and syncs Source: https://docs.lightdash.com/data-apps/deliveries-and-syncs Send a data app's results on a schedule as files, or sync them to a Google Sheet A data app can be delivered on a schedule like a chart or a dashboard, and it can keep a Google Sheet up to date like a chart Sync. Everything about **when, where, and to whom** works exactly as documented elsewhere — frequency and cron, time zones, email and Slack recipients, Microsoft Teams and Google Chat, run history, and the `Syncs & Scheduled Deliveries` overview page. See [Scheduled deliveries](/explore/create-scheduled-deliveries) and [Google Sheets](/integrations/google-sheets) for those. This page covers the part that is different for apps: **what ends up in the file**. ## What gets delivered A chart delivers one result set. A dashboard delivers a known set of tiles. An app declares neither — so Lightdash renders the app the way a viewer would, watches which queries it actually runs, and turns each one into its own file (or its own tab, for a Google Sheets sync). That has a few consequences worth knowing before you set one up: * **One file per query, not per chart.** A chart fed by two queries produces two files. A KPI row and a table driven by the same query produce one. The count you get is the number of *distinct queries the app executed*, which often isn't the number of things you can see on screen. * **Files are named after the query.** The label comes from the app itself — the same label you see in the **Queries** tab of the [network inspector](/data-apps#network-inspector). Two queries sharing a label are given distinct names so neither overwrites the other. * **The delivery form tells you what it found.** When you open the delivery configuration, a caption under the format control reads `N data queries detected in the current view — each query becomes a file`. It's a live preview of the current app state, not a limit — an app that fetches more data during delivery renders (see [Tabs and coverage](#tabs-and-coverage)) can capture more than the count suggests. * **There's a cap of 50 distinct queries per delivery.** Beyond that, the extra queries are dropped and reported alongside the delivery — or, for a Google Sheets sync, the run fails outright. * **An app that fetches nothing has nothing to deliver.** If the render captures no successful query, a data delivery or sync fails rather than sending an empty attachment. ## Creating a scheduled delivery Open the app, click the **⋯** menu in the header, and choose **Schedule delivery**. You need edit access on the app. ![The data app header menu, with Schedule delivery and Google Sheets Sync entries](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/data-apps/deliveries-and-syncs/delivery-app-menu.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=773cfc5fe63c866bc1f8a32a8ba5ce71) The delivery has a `Setup` section and a `Message` section that behave exactly as they do for charts and dashboards, plus the `Data & format` section covered below. Two things you'll find on chart and dashboard deliveries are not offered for apps: **AI-enhanced messages**, and threshold-based [alerts](/explore/create-alerts). To get alerted on an app's data, save the query you want to watch as a chart with **Save to Lightdash** in the [network inspector](/data-apps#network-inspector), then add an alert to that saved chart. An alert checks only the first value in the results, so save a query that returns a single aggregate, such as a count, rather than a list of rows. ### Format Apps support `.csv`, `.xlsx`, `Image`, and `PDF`. * **`.csv` / `.xlsx`** deliver the data — one file per captured query, attached to the email or Slack message. * **`Image`** delivers a screenshot of the rendered app, the same as an image delivery of a chart or dashboard. No data files are attached, so nothing on this page about capture, row limits, or per-query failures applies. * **`PDF`** sends the app's own **Download PDF** build — the same paginated output the in-app button produces, not a screenshot. Like `Image`, it needs the headless browser, and it's unavailable while the delivery has a Microsoft Teams or Google Chat destination. The app needs a Download PDF button registered for scheduled deliveries — see [Exporting to PDF](/data-apps#exporting-to-pdf). If an app on an older template has the button but the delivery fails, use [**Upgrade app**](/data-apps#upgrading-an-app), then ask the agent to register its PDF export for scheduled deliveries. An app with no PDF export registered fails the delivery with an error rather than sending a screenshot in its place. With `Image`, **Also include image as PDF attachment** adds the same screenshot as a single-page PDF sized to the app's content — it isn't paginated, and it's a different file from the `PDF` format above. ![The Data & format section of an app scheduled delivery, showing the delivery formats, the detected query count, and the Results in Table and All Results limit options](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/data-apps/deliveries-and-syncs/delivery-data-and-format.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=ad99902fe2bb14874dc24c39f31d1333) ### Send current app state Dashboards let you adjust saved filters per delivery. Apps use a single toggle instead: **Send current app state**. * **Off (default)** — the delivery renders the app's default view, the same thing a viewer sees when they open it fresh. * **On** — the delivery renders the app with the state you have right now: selected filters, the tab or slide you're on, and anything else the app keeps in its URL. The toggle only appears when the app you opened the modal from actually has state to capture. Turning it on shows you exactly what was captured, so you don't have to take it on trust: the full **URL** that will be rendered, and a **State values** table decoding it into the individual keys the app defines and the value pinned for each. ![The App state section of an app scheduled delivery, showing the Send current app state checkbox, the captured URL, and a State values table with one key pinned](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/data-apps/deliveries-and-syncs/data-apps-app-state.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=c1c90ae5b026bf32aedad87578f05e07) What the state controls depends on the format. For an `Image` delivery it determines the whole render, tab selection included. For `.csv` and `.xlsx` the filters and selections in the state shape the delivered data, but an app that fetches every tab's data during delivery renders (see [Tabs and coverage](#tabs-and-coverage)) still captures all of them regardless of which tab was selected when you saved the state. ### Rows For `.csv` and `.xlsx`, a **Limit** control offers two options: * **Results in Table** (default) — each file contains the rows the app's own query asked for. * **All Results** — queries that hit their row limit are re-run without a limit at delivery time. Queries that were already under their limit are not re-run. There's no `Custom...` numeric option here, because a single row cap can't sensibly apply across an app's heterogeneous queries. **All Results** re-runs affected queries server-side from their query-history record, under the same identity the delivery already runs as. It makes the delivery slower, and the re-run is still bounded by your organization's [export limits](/workspace-admin/export-limits) — if a re-run wouldn't return more rows than the original, Lightdash keeps the original file rather than running a second query for nothing. ### Tabs and coverage Delivery capture is WYSIWYG: it captures what the rendered state actually fetches. For an app with tabs, that means a tab nobody is looking at contributes nothing — unless the app is built to fetch its data during delivery renders. Newly generated apps handle this for you: the agent builds them to detect a delivery render and mount every tab's data for it, while still fetching only the active tab on normal interactive loads, so an interactive pageload doesn't pay for data nobody asked for. Apps generated without that behavior aren't retroactively upgraded — they only capture what the delivered state renders. If a delivery is missing data you expected from another tab, regenerate the app (send any follow-up prompt, or ask the agent to fetch every tab's data during delivery renders) and the next delivery will pick it up. ### When a query fails If some queries succeed and others fail, the delivery still goes out with the files it has, and the failures are reported alongside it — by name, in the email body or the Slack, Teams, or Google Chat message, and in the run details in `Syncs & Scheduled Deliveries`. The delivery only fails outright when *nothing* was captured successfully. A query that hit its row limit is reported as a notice rather than a failure, since the file is complete as far as the query defined it. ## Syncing an app to Google Sheets Syncs are set up in their own modal, separate from scheduled deliveries. Open the app, click the **⋯** menu in the header, and choose **Google Sheets Sync**. You need edit access on the app plus permission to manage Google Sheets, and your organization needs the [Google Sheets integration](/integrations/google-sheets) configured. The modal lists the app's existing syncs, each with a switch to pause it and buttons to sync it now, edit it, or delete it. Click **Create** to add one. ![The Sync with Google Sheets modal for a data app, listing an existing daily sync](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/data-apps/deliveries-and-syncs/delivery-gsheets-sync-modal.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=110a0593e3cef5001d8f50fc37119bc8) Setup mirrors a chart Sync: name the sync, set a frequency and time zone, then pick the Google Sheet to write to. ![The Sync with Google Sheets create form for a data app, with name, frequency, and Select Google Sheet controls](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/data-apps/deliveries-and-syncs/data-apps-gsheet-sync-create.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=9a02e1686e1cc73e1c6d7262b69ebb25) **Select Google Sheet** opens Google's own file picker. The sheet has to exist already — create it in Google Drive first, then pick it here. ![Google's file picker listing the spreadsheets available to sync to](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/data-apps/deliveries-and-syncs/data-apps-gsheet-select-file.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=adb96eff7a2c8c77c9426f3b00169929) Two things work differently from a chart Sync: * **One tab per query.** Every query the app runs gets its own tab, named after the query. There's no **Save in a new tab** option, because there's no single "first tab" for an app to overwrite. Where two queries share a label, each gets a fixed suffix so a given query keeps writing to the same tab run after run. * **No app state.** Syncs always render the app's default view. If you need a specific filtered cut on a schedule, use a `.csv` or `.xlsx` scheduled delivery with **Send current app state** instead. As with chart Syncs, Lightdash also writes a `metadata` tab recording when the sheet was last updated, how often it refreshes, and which tabs were written. Each run overwrites the tabs it writes. Syncs also fail as a unit rather than partially: if any query errors during the render, or the app runs more than 50 queries, the whole sync fails and names what went wrong. A Google Sheet is a single shared artifact with nowhere to attach a partial-failure notice, so a quietly missing tab would be worse than a failed run. A sync with many queries is deliberately paced to stay inside Google's Sheets API write quota, so a large app takes noticeably longer to sync than a single chart does. ## Managing app deliveries and syncs App scheduled deliveries and syncs appear in `Project Settings → Syncs & Scheduled Deliveries` alongside every other delivery in the project, with the same status indicators, run history, `Send now`, and owner reassignment. See [Overview of your scheduled deliveries](/explore/create-scheduled-deliveries#overview-of-your-scheduled-deliveries). # External connections Source: https://docs.lightdash.com/data-apps/external-connections Let data apps fetch from third-party HTTP APIs through a credential-injecting proxy A data app can also fetch from third-party HTTP APIs — for example, your own product API, a payments provider, or a Google API like BigQuery's REST endpoint. A project admin registers each API as an **external connection** (base URL, allowed methods, auth), and app builders link the connections they need. At runtime, requests go through a Lightdash-mediated proxy that injects credentials server-side, so secrets are never exposed to the app code or the browser. External connections are managed under **Project Settings → Data app connections** on the project. The proxy requires HTTPS and blocks private/internal addresses by default. Self-hosted instance operators can explicitly approve trusted internal destinations with `APP_RUNTIME_EXTERNAL_CONNECTION_ALLOWED_PRIVATE_HOST_CIDRS`. See [private-network external connections](/self-host/enterprise-features/data-apps#private-network-external-connections) for configuration and security boundaries. [Chart Studio chart types](/visualizations/chart-studio#linking-external-connections) link connections the same way, so a chart type can call an API or show images from a URL field. ## Configuring a connection A connection is scoped to a project and stores: * **Name** - a short, human-readable identifier the app uses to refer to the connection. * **Base URL** - the origin the app is allowed to reach. The proxy pins requests to this host; an app cannot redirect a fetch elsewhere. * **Allowed methods** - which of `GET`, `POST`, `PUT`, `PATCH`, `DELETE` the app can use. New connections default to `GET` only; broaden the set only for APIs that actually need writes. * **Allowed paths** - optional path prefixes that further restrict where under the base URL the app can call. * **Auth** - see [Auth types](#auth-types) below. * **Custom headers** - up to 20 static headers sent with every request, for APIs that expect a version or similar header. Header values are stored as plain configuration, so never put a secret here; credentials go in **Auth**. Credential and routing headers such as `Authorization`, `X-Api-Key`, `Cookie`, and `Content-Type` can't be set this way. * **Forward viewer identity** - see [Forwarding viewer identity](#forwarding-viewer-identity) below. * **Who can link it** - **Admins only**, or **Data app and chart type builders** so editors can attach the connection from a data app or Chart Studio. * **Public images** - the **Allow public images in linked apps** toggle lets linked apps and chart types load images straight from the origin, in `` tags or CSS. Off by default; enable it only for trusted public image or tile hosts. * **Instructions** - see [Usage instructions](#usage-instructions) below. * **Size limits** - under **Advanced settings**, **Response max bytes** caps what the API can send back (default 1 MiB, up to 25 MiB). Once `POST` is allowed, **Request max bytes** caps the query string and JSON body an app can send (default 256 KiB, up to 10 MiB). A request or response over its limit fails with an error rather than being cut short, so raise the limit or narrow the request. Configuring a connection (create, edit, delete) requires the admin-only `manage:ExternalConnection` scope. Viewing the list — so an app builder can pick a connection to link — is available to Interactive Viewer and above, and only shows connections set to **Data app and chart type builders**; admins see all of them. **Who can link it** controls who can attach a connection to an app, not who can use it afterwards. Once a connection is linked, anyone who can view the app, including embedded viewers, can make requests through it with the connection's credential. To limit what they can reach, narrow the connection's **Allowed methods** and **Allowed paths**, or turn on [**Forward viewer identity**](#forwarding-viewer-identity) so the external service applies its own per-user rules. ## Auth types Pick the auth method that matches the target API. The secret is encrypted at rest and never returned to the client after it's saved — the proxy decrypts it server-side only when actually making a request. * **None** - no credentials are injected. Use this for public endpoints. * **API key** - a secret injected either as an HTTP header or a query parameter. You provide the parameter name (e.g. `X-Api-Key`) and the location (`header` or `query`). The secret is sent exactly as entered, with no prefix, so include any scheme the API expects. To call the Lightdash API with a personal access token, use the header `Authorization` and the value `ApiKey `. * **Bearer token** - a secret injected as `Authorization: Bearer `. * **Google service account** - paste a Google service-account key file (the full JSON) and enter one or more **OAuth scopes** (e.g. `https://www.googleapis.com/auth/bigquery`). At request time, the proxy exchanges the key file and scopes for a short-lived Google access token and injects it as `Authorization: Bearer `. For example, to read Google Sheets, set the base URL to `https://sheets.googleapis.com`, add the scope `https://www.googleapis.com/auth/spreadsheets.readonly`, and share each sheet with the service account's email address (`client_email` in the key file). * **OAuth 2.0 client credentials** - provide a token URL, client ID, client secret, and optional scopes. Choose **Authorization header** or **Request body** to match the OAuth server's client authentication requirements. The proxy obtains and caches an access token server-side, then sends it to the API as a bearer token. A private token endpoint needs its own operator-approved hostname and CIDR when it differs from the API host. In every case the injected credential is added by the proxy at request time; the generated app only ever sees the connection alias and the response body. ## Forwarding viewer identity Enable **Forward viewer identity** below **Custom headers** when adding or editing a connection to let the external service apply per-user access rules. This setting is off by default for each connection. When enabled, Lightdash adds these headers alongside the connection's credentials: | Header | Value | | - | - | | `X-Lightdash-User-Email` | The viewer's email, when available | | `X-Lightdash-User-Id` | The viewer's Lightdash user UUID, when available | | `X-Lightdash-App-Id` | The app UUID | | `X-Lightdash-Organization-Id` | The connection's organization UUID | | `X-Lightdash-Project-Id` | The connection's project UUID | Lightdash sets these headers server-side; app code cannot override them, and their names are reserved in custom and API-key headers. Missing identity attributes are omitted. Connection tests use the testing administrator's identity and omit the app ID. The headers are unsigned. Enable forwarding only for services you trust with viewer information. Before using the headers for authorization, the receiving service must authenticate Lightdash through the connection credentials or a trusted network boundary. ## Testing a connection The add-connection wizard and the Edit modal both include a **Test** step you can use to verify the connection before an app depends on it. The test runs through the exact same proxy path as a real app fetch (including host pinning and credential injection), so a passing test reflects real runtime behavior. On the Test step you can: * Pick any **method** the connection allows (the dropdown is restricted to your allowed-methods list). * Enter a **path** relative to the base URL. * Provide a **JSON request body** for non-`GET` methods. The response comes back with its HTTP status, content type, and body (truncated if oversized). From a passing test you can optionally **Save as sample** — a redacted, size-capped snapshot of the response that's passed into the app-build sandbox so the generator knows the API's response shape. ## Usage instructions Each connection has an optional freeform **Instructions** field (markdown, up to 10,000 characters) where an admin can write notes on how apps should use the API — auth quirks, pagination style, which endpoints matter, rate-limit hints, response caveats. These instructions are passed into the app-build sandbox alongside the technical spec, so the generator uses the same guidance you'd give a human integrator. For example, on a fictional ecom `orders_api` you might write: ```markdown theme={null} - Paginate with `?page=` and `?per_page=` (max 100). The `Link` header contains the next-page URL. - Timestamps are returned in the store's local time, not UTC. The store timezone is in `GET /store`. - `/orders` returns open orders only unless `state=all` is passed. - Rate limit: 60 req/min per IP. ``` # Saved app state Source: https://docs.lightdash.com/data-apps/saved-app-state Remember each viewer's filters and settings, and share data like comments across an app [Experimental](/support/feature-badges#experimental) > [!NOTE] > > Saved app state is off by default. It needs the `enable-data-app-state` feature flag, which Lightdash support turns on for Cloud organizations on request. Every data app can save values through Lightdash so they come back the next time someone opens it, on any device. Each app has two kinds of storage: user storage and shared storage. Apps run in a sandboxed frame with no access to browser storage such as `localStorage`, so values an app keeps only in memory reset when the page reloads. Saved app state is how an app remembers them. ## User storage User storage keeps values for each person separately. It suits anything a viewer sets up for themselves, like filter selections, the active tab, or display settings. Set the app up the way you want it, and it opens in that state when you come back. Other viewers don't see your choices. There is no setting to turn user storage on for an app. The agent uses it by default for inputs that make sense to remember, such as filters and settings. If you don't want something remembered, tell the agent when you build or iterate on the app. ## Shared storage Shared storage holds values that everyone using the app can see and edit. It suits things people collaborate on, like comment threads, annotations, targets, or a simple ticket tracker. Lightdash keeps a history of who changed each shared value. The agent doesn't use shared storage by default. Ask for it in your prompt and say what should be shared, for example "let the team leave comments on each region, visible to everyone". Shared storage also powers saved [AI commentary](/data-apps/ai-analysis#for-app-code): ask for "AI commentary that is saved and shared between viewers" and the app generates a takeaway once per selection, saves it for every later viewer, and lets anyone edit the text. This needs [AI analysis](/data-apps/ai-analysis) turned on as well. ## Embedded apps In an [embedded app](/embed/embed-data-apps), viewers can read shared values, but they can't read user values, and the app can't save any state. To save values from embedded viewers, or to keep values in your own database, have the app send them to your own API through an [external connection](/data-apps/external-connections), keyed by the viewer (see [Forwarding viewer identity](/data-apps/external-connections#forwarding-viewer-identity)) or by the record people share. # Embedding Source: https://docs.lightdash.com/embed Embed Lightdash charts, dashboards, agents, and data apps in your own product [Add-on](/support/feature-badges#add-ons) > [!NOTE] > > Embedding requires the embedding add-on for Cloud Pro or Enterprise. [Get in touch](https://lightdash.typeform.com/to/BujU5wg5) to add embedding to your plan. For self-hosted deployments, follow [embedding setup](/self-host/enterprise-features#embedding). Embed Lightdash charts, dashboards, AI agents, data apps, and the metrics catalog directly in your own product, so your users get self-serve analytics without leaving your app. You can embed using a simple iframe with an expirable, JWT-scoped URL, or the React SDK for tighter control over layout, theming, and interactivity. # How to embed AI agents Source: https://docs.lightdash.com/embed/embed-ai-agents Embed a Lightdash AI agent so your users can chat with their data inside your product [Add-on](/support/feature-badges#add-ons) > [!NOTE] > > Embedding requires the embedding add-on for Cloud Pro or Enterprise. [Get in touch](https://lightdash.typeform.com/to/BujU5wg5) to add embedding to your plan. For self-hosted deployments, follow [embedding setup](/self-host/enterprise-features#embedding). > [!TIP] > > **Try it and see the code.** [embed.lightdash.com](https://embed.lightdash.com) is an interactive demo and helper that lets you preview embedded content and generate a JWT for your own project. For a working end-to-end example, see the [example embed app on GitHub](https://github.com/lightdash/example-embed-dashboard-with-nodejs-app) — a Node.js app that mints tokens server-side and renders a Lightdash dashboard. ## Overview AI agent embedding lets you drop a Lightdash [AI agent](/agents) into your own application. Embedded users can start new threads, ask questions in natural language, and view the charts the agent generates — all scoped to a single agent and space that you control with the embed JWT. AI agent embeds use the same JWT-based security model as dashboard and chart embeds, but with a dedicated `content.type: "aiAgent"` token. Dashboard and chart tokens cannot access AI agent routes, and an AI agent token only grants access to the agent named in the token. ### When to use AI agent embedding * Add a "Chat with your data" experience to your customer-facing app * Let customers ask ad-hoc questions about their own data without giving them a Lightdash login * Scope each customer's AI session to their own spaces, so the agent only sees and writes content the customer is allowed to see * Keep one shared conversation per customer dashboard, with the agent's changes limited to that dashboard To build your own chat interface instead, connect it to the [Lightdash MCP server](/agents/lightdash-mcp). MCP clients sign in as a Lightdash user, through OAuth or a personal access token, or with a service account token. There's no embed token: to scope each request to one of your customers, pass their attributes in the [`X-Lightdash-User-Attributes` header](/agents/lightdash-mcp#override-user-attributes-with-the-x-lightdash-user-attributes-header). Charts from `render_chart` only display in MCP App-capable clients, so your interface draws charts itself from the query results. ### Available features Embedded AI agents support: * Creating and continuing threads with the agent, and stopping or steering an answer while it streams * Resuming a previous conversation on load, and listing past threads to build your own thread history UI * [Binding a thread to a dashboard](#bind-a-thread-to-a-dashboard) and giving it background context * Viewing agent-generated charts and tables in the response * Opening saved charts and dashboards the agent references, when they live in one of the token's write spaces or `sourceSpaceUuids`: charts in a side panel next to the chat, dashboards as a read-only view inside the embed * Saving AI-generated charts into the token's write spaces (via [write actions](/embed/reference#write-actions)) * Row-level filtering via [user attributes](/workspace-admin/user-attributes) Embedded AI sessions hide non-embed UI surfaces by default — including thread history sidebars, dashboard navigation, SQL mode, MCP server tools, and user preference screens. Saved charts from the write spaces open in a read-only side panel, and saved dashboards from those spaces open as a read-only view with a "Back to AI" control, both inside the embed. "Explore from here" appears only when the token sets `content.canExplore` or the actor's role grants `view:EmbedExplore`, and Explore stays inside the embed. The Debug panel on agent answers is hidden unless the token sets `content.canViewDebugInfo` (or the actor's role grants it in `roles` mode); see [Debug information](/embed/reference#debug-information). **View SQL** and **Download** on chart answers follow the actor's role; see [SQL and downloads on answers](/embed/reference#sql-and-downloads-on-answers). Embedded users can't [verify answers](/agents/verified-answers), whatever the token or the actor's role, so verify them in the Lightdash app. Links to other content, such as documents or scheduled deliveries, are shown as plain references. ## Prerequisites Before you embed an AI agent, you need: * An AI agent configured in your Lightdash project. See [Set up AI agents](/agents/set-up-agents). * An embed secret for the project. See [Embedding quickstart](/embed/set-up-embedding). * At least one space where AI-generated charts will be saved. * A service account user (or regular Lightdash user) to act as the writer for AI actions. See [Write actions](/embed/reference#write-actions). ## Embed an AI agent with the React SDK The React SDK ships a `Lightdash.AiAgent` component. Use it when you want the agent to live inside a React or Next.js app. By default it renders the agent inside an iframe; set `renderMode="native"` to render it directly in your page instead [Beta](/support/feature-badges#beta). ```tsx theme={null} import Lightdash from '@lightdash/sdk'; function MyAiAgent() { return ( ); } ``` You can pass a `threadUuid` to deep-link the embed straight into an existing thread, or omit it to land on the new-thread screen. Pair it with the `onThreadChange` callback to persist the active thread in your app (for example in `localStorage`) so users pick up where they left off next time they visit. To render a list of the embed user's previous conversations, use the [`Lightdash.useLightdashAiAgentThreads`](/embed/react-sdk#lightdashuselightdashaiagentthreads) hook — it calls the AI agent threads endpoint with the same embed JWT and returns only threads scoped to the JWT user and their embed space. See [`Lightdash.AiAgent`](/embed/react-sdk#lightdashaiagent) for the full prop list and styling options. ### Resuming a thread from an iframe embed If you construct the embed URL yourself (Node, Python, Go, or any other backend), append the thread UUID as an extra path segment before the JWT fragment to resume a specific conversation: ``` {siteUrl}/embed/{projectUuid}/ai-agents/{agentUuid}/threads/{threadUuid}#{embedJwt} ``` Omit the `/{threadUuid}` segment to land on the new-thread screen. The thread must have been created with an embed token for the same agent, write actor, and first write space — thread access is enforced server-side. Threads aren't separated by `user.externalId`, so every viewer whose token shares that actor and first write space can open them. ## Bind a thread to a dashboard A thread can be bound to one dashboard for its whole life, and can carry background context for the agent. Use this when each customer has a dashboard with one shared conversation, for example to keep a dashboard's conversation going after you copy it into another customer's space. In a bound thread: * A **Linked dashboard** card at the top of the thread opens the dashboard. * The agent treats "this dashboard" as the bound dashboard. If the agent can create content, its changes are limited to that dashboard and the charts saved in it; see [Threads bound to a dashboard](/agents/enable-content-tools#threads-bound-to-a-dashboard). * The thread context, up to 10,000 characters, is given to the agent on every turn as background from the user. It is never shown as a chat message, and embedded viewers can't read it back. * Neither the binding nor the context can be changed after the thread is created. The dashboard must be in one of the token's write spaces or `sourceSpaceUuids`. When it's in a source space, the agent reads it and answers questions about it but can't change it; anything the agent creates from it, such as a copy filtered to one region, is saved into a write space. To refresh an embedded dashboard after the agent edits it, see [Refresh a dashboard after the agent saves it](/embed/react-sdk#refresh-a-dashboard-after-the-agent-saves-it). ### From the React SDK Pass `binding` and `threadContext` to `Lightdash.AiAgent`. The embed creates the bound thread when the user sends the first message, and `onThreadChange` returns its UUID so you can reopen it later. See [Start a thread bound to a dashboard](/embed/react-sdk#start-a-thread-bound-to-a-dashboard) for the example. ### From your backend To create a bound thread before anyone opens it, call the create-thread endpoint from your server with the customer's AI agent embed token in the `lightdash-embed-token` header. `prompt` is optional when you send `binding` or `threadContext`; without one, the thread starts empty. ```bash theme={null} curl -X POST "https://app.lightdash.cloud/api/v1/projects/$PROJECT_UUID/aiAgents/$AGENT_UUID/threads" \ -H "lightdash-embed-token: $EMBED_JWT" \ -H "Content-Type: application/json" \ -d '{ "binding": { "type": "dashboard", "dashboardUuid": "'"$DASHBOARD_UUID"'" }, "threadContext": "Summary of the previous conversation..." }' ``` The response's `results.uuid` is the thread UUID; pass it to `Lightdash.AiAgent` as `threadUuid`, or add it to the [iframe URL](#resuming-a-thread-from-an-iframe-embed). > [!WARNING] > > Create the thread with the same embed token setup your viewers use. A thread created with a personal access token or a Lightdash session isn't attached to an embed space, so embedded viewers can't open it. | Response | Cause | | - | - | | `400` | No `prompt`, `binding`, or `threadContext`, or a `threadContext` longer than 10,000 characters | | `403` | The dashboard is outside the token's write spaces and `sourceSpaceUuids`, or the actor can't view it | | `404` | The dashboard doesn't exist, is in the trash, or belongs to another project | If the bound dashboard is deleted later, the thread stays bound and shows **Dashboard no longer available**. The agent can still answer questions and run queries, but can't create or change saved content in that thread. ## Generate an AI agent embed token AI agent embeds require a JWT with `content.type: "aiAgent"` and a `writeActions` claim. Generate it server-side using your embed secret; the [embedding reference](/embed/reference#ai-agent-token) has the complete token structure. ```javascript theme={null} import jwt from 'jsonwebtoken'; const token = jwt.sign({ content: { type: 'aiAgent', projectUuid: 'your-project-uuid', agentUuid: 'your-agent-uuid', }, writeActions: { serviceAccountUserUuid: 'service-account-user-uuid', writeSpaceUuids: ['destination-space-uuid'], }, userAttributes: { tenant_id: 'tenant-abc', // Row-level filtering for the embedded viewer }, user: { email: 'customer@example.com', }, }, process.env.LIGHTDASH_EMBED_SECRET, { expiresIn: '1h' }); ``` **Required fields:** * `content.type` — must be `"aiAgent"`. * `content.agentUuid` — the agent the embed is allowed to use. Tokens cannot switch to a different agent at runtime. * `writeActions.writeSpaceUuids` — the spaces the agent can create and update charts and dashboards in, and read them from. The first space is the default save target and scopes the embed's threads. * One of `writeActions.serviceAccountUserUuid` or `writeActions.userUuid` — the actor whose permissions are used when the agent runs queries and saves charts, and whose name appears next to messages in the chat. See [Write actions](/embed/reference#write-actions). Every space on the token — each write space, and each space in `writeActions.sourceSpaceUuids` — is gated twice: the write actor needs its own view access to it, and if the agent itself is restricted to certain spaces, the space must be on the agent's own list. A space that fails either check is silently dropped from what the agent can read or bind to; the token as a whole is only rejected once the agent has access to none of the write spaces. See [Add charts from other spaces](/embed/reference#add-charts-from-other-spaces) for the full rules, including `sourceSpaceUuids`. **Optional fields:** * `content.projectUuid` — pins the embed to a specific project. * `content.canViewDebugInfo` — shows the Debug panel on agent answers. See [Debug information](/embed/reference#debug-information). * `writeActions.sourceSpaceUuids` — extra spaces the agent can read, search, and bind threads to dashboards in, without being able to create or update content in them. See [Add charts from other spaces](/embed/reference#add-charts-from-other-spaces). * `userAttributes` — applies row-level filters to the agent's queries, identical to other embed types. * `user.externalId` / `user.email` — identifies the embedded viewer. Agent queries run as the write actor, so neither value is sent as a warehouse query tag; see [User metadata](/embed/reference#user-metadata) for per-viewer attribution. ## Access control To let the actor's role enable or disable embedded AI access, configure [Permission modes](/embed/reference#permission-modes) in your server-side token generation. AI agent embeds enforce a tight scope: * A token issued for agent A cannot access agent B, even within the same project. * The agent can read dashboards and saved charts that live in the token's write spaces or `sourceSpaceUuids`, and only the spaces the write actor can view and the agent itself has access to. Other content returns a not-found error. * Embedded viewers can open those saved charts in the chat side panel and those dashboards as a read-only view. Both run with the write actor's permissions and the token's `userAttributes`; content outside that scope is rejected. * Charts are saved into the first write space by default. When the actor can create charts in more than one write space, the save dialog lets embedded users choose among them. * Threads belong to the write actor and the first write space. Changing which space comes first changes which past threads viewers see. * In a [bound thread](#bind-a-thread-to-a-dashboard), the agent can only change the bound dashboard and the charts saved in it. * Query results respect the write actor's permissions and any `userAttributes` claims on the JWT, so embedded viewers only see the rows they're entitled to. * Dashboard and chart embed tokens are rejected by AI agent routes, and AI agent tokens are rejected by dashboard or chart routes. # How to Embed Charts Source: https://docs.lightdash.com/embed/embed-charts Embed a single saved Lightdash chart with a minimal UI via iframe or React SDK [Add-on](/support/feature-badges#add-ons) > [!NOTE] > > Embedding requires the embedding add-on for Cloud Pro or Enterprise. [Get in touch](https://lightdash.typeform.com/to/BujU5wg5) to add embedding to your plan. For self-hosted deployments, follow [embedding setup](/self-host/enterprise-features#embedding). > [!TIP] > > **Try it and see the code.** [embed.lightdash.com](https://embed.lightdash.com) is an interactive demo and helper that lets you preview embedded content and generate a JWT for your own project. For a working end-to-end example, see the [example embed app on GitHub](https://github.com/lightdash/example-embed-dashboard-with-nodejs-app) — a Node.js app that mints tokens server-side and renders a Lightdash dashboard. ## Overview Chart embedding displays a single saved chart with a minimal, focused interface — a clean, distraction-free view of one visualization, scoped to that chart alone. By default, chart embeds are **read-only**: viewers can't change the configuration, apply filters, or reach Explore. ### When to use chart embedding * **Single KPI displays**: show one key metric or visualization * **Embedded widgets**: add analytics widgets to application pages * **Minimal UI**: a clean, focused display with no dashboard chrome * **Scoped access**: grant access to specific charts, not entire dashboards ### How it differs from dashboard embedding | Feature | Dashboard embedding | Chart embedding | | - | - | - | | **Method** | iframe or React SDK | iframe or React SDK | | **Content** | Multiple tiles, tabs | Single chart | | **Filters** | Interactive dashboard filters | Saved filters only, not interactive | | **JWT scope** | Dashboard UUID | Chart UUID (`contentId`) | | **Explore** | Can navigate to Explore | Only to drill down or edit, with [edit mode](#edit-and-drill-down) | Chart embeds support all chart types (bar, line, pie, table, big number, and so on), parameterized charts with their saved values, and — when enabled in the JWT — viewing underlying data. For CSV and image export, see [Limitations](#limitations). ## Set up a chart embed Follow the [embedding quickstart](/embed/set-up-embedding) for the shared setup: create an embed secret and generate tokens from your backend. The chart-specific part is the allowlist — each chart must be added individually under **Settings → Embed** before it can be embedded. ![Add allowed charts](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/embed/embed-charts/embed-add-chart.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=378d856ab5d72a87638fb49ffeddaf0a) ## Embed with an iframe iframe embedding needs no libraries or CORS setup. Put the project UUID and the chart UUID in the path and the JWT in the hash fragment. The token's `content.contentId` must match the chart UUID in the URL. ```text theme={null} https://your-instance.lightdash.cloud/embed/{projectUuid}/chart/{chartUuid}#{jwtToken} ``` ```html theme={null} ``` The [iframe embedding reference](/embed/iframe) covers URL parameters (including `theme`, `backgroundColor`, and `timezone`), responsive and dynamic sizing, token refresh, and troubleshooting. ## Embed with the React SDK Render a chart with `Lightdash.Chart`, passing the chart UUID and a server-generated token: ```tsx theme={null} import Lightdash from '@lightdash/sdk'; function MyChart() { return ( ); } ``` See the [React SDK reference](/embed/react-sdk#lightdashchart) for installation, CORS setup, props, and styling. ## Configure what viewers can do A chart token is scoped to one chart via `content.contentId` (the saved chart UUID). Inside `content`, you can allow CSV export, image export, and viewing underlying data. For the full schema, see the [chart token](/embed/reference#chart-token) in the embedding reference. ```javascript theme={null} import jwt from 'jsonwebtoken'; const token = jwt.sign({ content: { type: 'chart', projectUuid: 'your-project-uuid', contentId: 'your-chart-uuid', canExportCsv: true, canExportImages: true, canViewUnderlyingData: true, }, user: { externalId: 'user-123', email: 'user@example.com', }, }, LIGHTDASH_EMBED_SECRET, { expiresIn: '24h' }); ``` Parameter values are fixed when the chart is saved. A chart embed displays the chart with its saved parameter configuration. If the token's `userAttributes` don't meet the [required attributes](/workspace-admin/user-attributes) of the chart's model, the embed shows **Error loading chart** with an authorization message. ## Edit and drill down To let viewers edit the chart or drill into its data, add a `writeActions` claim whose write spaces include the chart's space, make sure the write actor can update the chart, and pass `isEditMode` to `Lightdash.Chart`. The chart then renders in Explore: `isEditMode={true}` opens it for editing, and `isEditMode={false}` lets viewers click a data point and **Drill into** it, with a **Back to Chart** button. See [Edit and drill into a chart](/embed/react-sdk#edit-and-drill-into-a-chart). ## Limitations Chart embeds are single-scope. Without [edit mode](#edit-and-drill-down), viewers **cannot** modify dimensions, metrics, or visualization type, drill down, or reach the Explore view. In every mode, viewers can't apply filters through the SDK `filters` prop or access any content beyond the chart named in `contentId`. A chart embed renders only the visualization, with no header or toolbar, so `canExportCsv` and `canExportImages` have no button to act on. **View underlying data** works, since viewers open it from the chart's data points. To give viewers CSV and image export, add the chart as the only tile on a dashboard and [embed that dashboard](/embed/embed-dashboards) instead; dashboard tiles keep their export menu. If you need interactive filters or exploration, use [dashboard embedding](/embed/embed-dashboards) instead, or reach out with your use case. ## Example: single KPI widget Drop a key metric into your own layout and let the chart background go transparent so it inherits your styling: ```tsx theme={null}

Monthly Revenue

``` Pass `user` metadata in the token to attribute queries in [usage analytics](/workspace-admin/usage-analytics#query-tags), and `userAttributes` for [row-level security](/workspace-admin/user-attributes). Styling and localization props are covered in the [React SDK reference](/embed/react-sdk#lightdashchart). # How to Embed Dashboards Source: https://docs.lightdash.com/embed/embed-dashboards Embed a dashboard with filters, exports, and interactive tiles via iframe or React SDK [Add-on](/support/feature-badges#add-ons) > [!NOTE] > > Embedding requires the embedding add-on for Cloud Pro or Enterprise. [Get in touch](https://lightdash.typeform.com/to/BujU5wg5) to add embedding to your plan. For self-hosted deployments, follow [embedding setup](/self-host/enterprise-features#embedding). > [!TIP] > > **Try it and see the code.** [embed.lightdash.com](https://embed.lightdash.com) is an interactive demo and helper that lets you preview embedded content and generate a JWT for your own project. For a working end-to-end example, see the [example embed app on GitHub](https://github.com/lightdash/example-embed-dashboard-with-nodejs-app) — a Node.js app that mints tokens server-side and renders a Lightdash dashboard. ## Overview Dashboard embedding displays a full Lightdash dashboard in your application — multiple visualizations, filters, tabs, and interactive features — so you can give users comprehensive analytics views without a Lightdash login. Embed it with a plain iframe or the [React SDK](/embed/react-sdk). ### When to use dashboard embedding * **Executive dashboards**: multiple KPIs and metrics in admin panels * **Customer-facing analytics**: analytics portals for SaaS customers * **Embedded reporting**: comprehensive data views inside your workflows * **Multi-chart views**: related visualizations with shared filters ### What you can put on an embedded dashboard An embedded dashboard renders the same tiles it does in Lightdash: saved charts, SQL Runner charts, [data app](/data-apps) tiles, and markdown, Loom, and heading tiles, organized across multiple tabs. A saved chart using a [custom chart type](/visualizations/custom-charts) renders the same way on the tile, fonts and styling included — see [Known limitations](/embed/reference#known-limitations). > [!NOTE] > > SQL Runner chart tiles are authorized through dashboard-tile membership, so they render with existing embed JWTs — you don't need to regenerate tokens or change embed URLs. A SQL chart is only embeddable as part of a dashboard; a chart-scoped JWT (`type: 'chart'`) can't embed one on its own. ## Set up a dashboard embed Embedding always starts with the shared setup: create an embed secret, add your dashboard to the allowlist, preview it, and generate tokens from your backend. Follow the [embedding quickstart](/embed/set-up-embedding) for those steps. The only dashboard-specific part of setup is the allowlist: only dashboards added to the **allowed dashboards** list can be embedded. Add yours under **Settings → Embed**, or toggle **Allow all dashboards** to embed any dashboard in the project. ![Add allowed dashboards](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/embed/embed-add-dashboard-cb6bef5fde69ba9d6eaeb693744d75cc.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=56b1e5f1e7e89fbbc865e8179d3d01e5) ## Configure what viewers can do By default, dashboard interactivity is controlled by fields nested inside the JWT `content` object: filters, parameters, exports, date zoom, Explore, underlying data, and data app tiles. To manage capabilities through the actor's role, follow [Permission modes](/embed/reference#permission-modes). Adding a `writeActions` claim also lets viewers save charts from Explore or edit and build dashboards through the SDK. > [!WARNING] > > Interactivity options like `dashboardFiltersInteractivity`, `canExportCsv`, and `canExplore` must live **inside `content`**, not at the top level of the payload. At the root level they're silently ignored. For the full list of options, their accepted values, and per-option UI screenshots, see the [dashboard token](/embed/reference#dashboard-token) and [interactivity options](/embed/reference#interactivity-options-reference) in the embedding reference. A token that exercises the common ones looks like this: ```javascript theme={null} import jwt from 'jsonwebtoken'; const token = jwt.sign({ content: { type: 'dashboard', projectUuid: 'your-project-uuid', dashboardUuid: 'your-dashboard-uuid', // Filters and parameters dashboardFiltersInteractivity: { enabled: 'all' }, parameterInteractivity: { enabled: true }, // Exports canExportCsv: true, canExportImages: true, canExportPagePdf: true, // Interactive features canDateZoom: true, canExplore: true, canViewUnderlyingData: true, canViewDataApps: true, }, // Analytics (optional) user: { externalId: 'user-123', email: 'user@example.com', }, // Row-level filtering (optional) userAttributes: { tenant_id: 'tenant-abc', }, }, LIGHTDASH_EMBED_SECRET, { expiresIn: '1h' }); ``` **Required filters behave the same as in the app.** Embedded dashboards honor [required filters and requirement groups](/explore/dashboards/filter#required-filters-and-filter-requirement-groups): tiles stay locked and don't load data while any rule is unmet, and viewers see the guided setup card. Style it with the [`ld-dashboard-guided-setup`](/embed/react-sdk#css-class-overrides) class. Embedded dashboards have no Refresh button. How fresh their data is depends on the project's [results cache duration](/semantic-layer/caching#cache-duration-per-project). Embedded viewers can't create or manage [scheduled deliveries](/explore/create-scheduled-deliveries). To let your users schedule a dashboard from your own app, create the delivery through the [Lightdash API](/api-reference/v1/introduction) with `POST /api/v1/dashboards/{dashboardUuid}/schedulers`, authenticated as a Lightdash user or service account. The request accepts dashboard filter overrides, parameter values, and selected tabs, and Lightdash runs and sends the delivery like any other. ### Let viewers save and edit content Add a `writeActions` claim to let embedded users save a new chart from Explore, or — through the React SDK — edit an existing dashboard or build a new one. Lightdash performs the write as a configured actor (a service account or user) into the spaces the token names. See [Write actions](/embed/reference#write-actions) for the claim and [`Lightdash.Dashboard` edit mode](/embed/react-sdk#with-edit-mode) for the SDK flow. In dashboard edit mode, if the token also sets `canExplore: true`, the add-tile menu has **New chart** and tiles whose chart is in a write space have **Edit chart**. Both open Explore in place: a new chart is added to the dashboard as a tile, and saving an edited chart updates its tile. Charts created with **New chart** or **Save as new chart** are saved to the dashboard itself, the same as [creating a chart from a dashboard](/explore/dashboards#create-a-new-chart) in Lightdash. They don't appear in any space's chart list, and removing their tile and saving the dashboard deletes them. If the dashboard isn't in one of the token's write spaces, Lightdash saves the chart to the first write space instead. With the React SDK, you can save these charts to a write space, or let users choose, with the [`chartSaveDestinations` prop](/embed/react-sdk#choose-where-new-charts-are-saved). Iframe embeds always save them to the dashboard. Newly saved charts aren't added to the embed allowlist, so they won't be re-embeddable unless you add them explicitly. ### View data apps [Data app](/data-apps) tiles run their own metric queries, so they only render when the JWT sets `canViewDataApps: true`. When it's off (the default), the tile shows a placeholder and no queries run. When on, the data app inherits the embed's [user attributes](/workspace-admin/user-attributes) and filters, so row-level access still applies — only enable it for audiences you trust with the data the app can query. For standalone data app embedding (no dashboard), see [How to embed data apps](/embed/embed-data-apps). > [!NOTE] > > Lightdash's floating Ask AI launcher never appears in an embed. If you see a chat window or modal you didn't add, it comes from a data app tile's own code, a separately integrated [AI agent embed](/embed/embed-ai-agents), or your host page. Open the same dashboard directly in Lightdash: if it appears there too, it belongs to the dashboard's content; if not, check what your page renders around the embed. ## Embed with an iframe iframe embedding needs no libraries or CORS. Pass the project UUID in the path and the JWT in the hash fragment; the dashboard is identified by `content.dashboardUuid` inside the token, not the URL: ``` https://your-instance.lightdash.cloud/embed/{projectUuid}#{jwtToken} ``` ```html theme={null} ``` The [iframe embedding reference](/embed/iframe) covers URL parameters (including `theme`, `backgroundColor`, and `timezone`), responsive and dynamic sizing, token refresh, and troubleshooting. ## Embed with the React SDK The React SDK renders the dashboard as a component and adds programmatic filters, callbacks, custom styling, and edit mode. ```tsx theme={null} import Lightdash from '@lightdash/sdk'; function MyDashboard() { return ( ); } ``` See the [React SDK reference](/embed/react-sdk#lightdashdashboard) for installation, CORS setup, props, filters, theming, and localization. # How to embed data apps Source: https://docs.lightdash.com/embed/embed-data-apps Embed a Lightdash data app as standalone content in an iframe using a JWT-scoped preview token [Add-on](/support/feature-badges#add-ons) > [!NOTE] > > Embedding requires the embedding add-on for Cloud Pro or Enterprise. [Get in touch](https://lightdash.typeform.com/to/BujU5wg5) to add embedding to your plan. For self-hosted deployments, follow [embedding setup](/self-host/enterprise-features#embedding). > [!TIP] > > **Try it and see the code.** [embed.lightdash.com](https://embed.lightdash.com) is an interactive demo and helper that lets you preview embedded content and generate a JWT for your own project. For a working end-to-end example, see the [example embed app on GitHub](https://github.com/lightdash/example-embed-dashboard-with-nodejs-app) — a Node.js app that mints tokens server-side and renders a Lightdash dashboard. ## Overview Standalone data app embedding lets you render a [data app](/data-apps) 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 | | Standalone data app | Data app tile on an embedded dashboard | Embedded chart | | - | - | - | - | | Content | One data app, full screen | One data app inside a dashboard | One saved chart | | JWT `content.type` | `dataApp` | `dashboard` with `canViewDataApps: true` | `chart` | | URL path | `/embed/{projectUuid}/app/{appUuid}` | `/embed/{projectUuid}` | `/embed/{projectUuid}/chart/{chartUuid}` | | Filters / tile chrome | None | Dashboard filters and tile chrome | None | For tile-based embedding inside a dashboard, see [View data apps in dashboards](/embed/embed-dashboards#view-data-apps). An app built from the **Dashboard** [template](/data-apps#choosing-a-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](/embed/embed-dashboards) is for native Lightdash dashboards. ## Setup These steps assume you've already created a project embed secret — see the [embedding quickstart](/embed/set-up-embedding) 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. Standalone embedding is denied for any app that isn't on the allowlist (or covered by the "allow all" switch). This is enforced server-side regardless of what your JWT contains. ### 2. Mint a data app JWT Sign a JWT with `content.type: 'dataApp'` and the `appUuid` of the data app you want to embed. The JWT must be signed with your project's embed secret. ```javascript theme={null} import jwt from 'jsonwebtoken'; const token = jwt.sign( { content: { type: 'dataApp', projectUuid: 'your-project-uuid', appUuid: 'your-app-uuid', }, user: { externalId: 'user-123', email: 'user@example.com', }, userAttributes: { tenant_id: 'tenant-abc', }, }, LIGHTDASH_EMBED_SECRET, { expiresIn: '1h' }, ); ``` A `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: ``` https://your-instance.lightdash.cloud/embed/{projectUuid}/app/{appUuid}#{token} ``` The hash fragment is never sent to the server or stored in browser history. ### 4. Render the iframe ```html theme={null} ``` You can copy ready-to-use Node, Python, and Go snippets from **Settings → Embedding → Preview → Data apps** in Lightdash. ## How access works A `dataApp` 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 `dataApp` token **cannot** be used to load dashboards, charts, or the explore page. Each embed token is scoped to a single content type. > [!WARNING] > > Because the token grants project-wide column access for the app's queries, only mint `dataApp` tokens for audiences you trust with that data. Use [user attributes](/workspace-admin/user-attributes) to enforce row-level access. ## 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](/embed/embed-dashboards#view-data-apps). * Standalone data app embedding is iframe-only. There is no React SDK component for it yet. * The standalone embed has no filter bar or tile chrome — the app is rendered in isolation. * Interactivity options like `canExportCsv`, `canExplore`, and `dashboardFiltersInteractivity` do not apply to `dataApp` tokens. ## See also * [Data apps overview](/data-apps) * [Embedding reference (JWT structure)](/embed/reference) * [iframe embedding reference](/embed/iframe) * [Embed dashboards with data app tiles](/embed/embed-dashboards#view-data-apps) # How to embed the metrics catalog Source: https://docs.lightdash.com/embed/embed-metrics-catalog Let your users browse a project's metrics and dimensions without a Lightdash login [Add-on](/support/feature-badges#add-ons) > [!NOTE] > > Embedding requires the embedding add-on for Cloud Pro or Enterprise. [Get in touch](https://lightdash.typeform.com/to/BujU5wg5) to add embedding to your plan. For self-hosted deployments, follow [embedding setup](/self-host/enterprise-features#embedding). > [!TIP] > > **Try it and see the code.** [embed.lightdash.com](https://embed.lightdash.com) is an interactive demo and helper that lets you preview embedded content and generate a JWT for your own project. For a working end-to-end example, see the [example embed app on GitHub](https://github.com/lightdash/example-embed-dashboard-with-nodejs-app) — a Node.js app that mints tokens server-side and renders a Lightdash dashboard. ## Overview Metrics catalog embedding lets you drop the Lightdash metrics catalog directly into your application. Embedded users can browse the metrics defined in a project, search by name or category, preview a metric on a small chart, and — if you allow it — jump into Explore to slice the metric by any dimension in the model. Metrics catalog embeds use the same JWT-based security model as other embed types, with a dedicated `content.type: "metricsCatalog"` token. Dashboard, chart, and AI agent tokens cannot access the metrics catalog, and a metrics catalog token cannot render other embed surfaces. ### When to use metrics catalog embedding * Give customers a self-serve "what can I measure?" view of your semantic layer inside your product. * Surface a metric browser next to your own charts so users can discover related metrics. * Let embedded users start a new exploration from any metric without exposing your full Lightdash workspace. ### Available features Embedded metrics catalog supports: * Browsing all metrics in the project the JWT is scoped to * Searching and filtering by table, owner, and category, with any of those filter controls [hidden](/embed/react-sdk#hide-filter-controls) * Previewing a metric with its default time-series chart * Continuing into an embedded Explore from any metric when `content.canExplore` is `true` * Saving Explore results into the token's write spaces via [write actions](/embed/reference#write-actions) * Row- and column-level filtering via [user attributes](/workspace-admin/user-attributes) ## Prerequisites Before you embed the metrics catalog, you need: * An embed secret for the project. See [Embedding quickstart](/embed/set-up-embedding). * At least one metric defined in the project's semantic layer. See [How to create metrics](/semantic-layer/metrics). * A React or Next.js host application — metrics catalog embedding is only available through the React SDK. * If you want embedded users to save charts from Explore, at least one write space and a write actor. See [Write actions](/embed/reference#write-actions). ## Embed the metrics catalog with the React SDK The React SDK ships a `Lightdash.MetricsCatalog` component that renders the catalog. When the embedded viewer clicks **Explore from here** on a metric, the same component swaps in an embedded Explore view — the host page never has to change route. ```tsx theme={null} import Lightdash from '@lightdash/sdk'; function MyMetricsCatalog() { return ( ); } ``` See [`Lightdash.MetricsCatalog`](/embed/react-sdk#lightdashmetricscatalog) for the full prop list and styling options. ## Generate a metrics catalog embed token Metrics catalog embeds require a JWT with `content.type: "metricsCatalog"`. Generate it server-side using your embed secret; the [embedding reference](/embed/reference#metrics-catalog-token) has the complete token structure. ```javascript theme={null} import jwt from 'jsonwebtoken'; const token = jwt.sign({ content: { type: 'metricsCatalog', projectUuid: 'your-project-uuid', canExplore: true, }, writeActions: { serviceAccountUserUuid: 'service-account-user-uuid', writeSpaceUuids: ['destination-space-uuid'], }, userAttributes: { tenant_id: 'tenant-abc', // Row-level filtering for the embedded viewer }, user: { email: 'customer@example.com', }, }, process.env.LIGHTDASH_EMBED_SECRET, { expiresIn: '1h' }); ``` **Required fields:** * `content.type` — must be `"metricsCatalog"`. * `content.projectUuid` — pins the embed to a specific project. The catalog only lists metrics from this project. **Optional fields:** * `content.canExplore` — when `true`, embedded users can click **Explore from here** on any metric to open the embedded Explore view. Omit or set to `false` to keep the embed read-only. * `writeActions` — needed only when `canExplore` is `true` and you want embedded users to save charts they build from Explore. See [Write actions](/embed/reference#write-actions). * `userAttributes` — applies row- and column-level filters to catalog previews and Explore queries, identical to other embed types. * `user.email` / `user.externalId` — surfaced in audit and analytics for the embedded viewer. ## Controlling access Metrics catalog embeds honor the same access controls as other embed surfaces: * The catalog only shows metrics from the project named in `content.projectUuid`. * [User attributes](/workspace-admin/user-attributes) applied to the JWT hide tables, dimensions, and [metrics](/workspace-admin/user-attributes#metric-access-control) whose `required_attributes` rules the embedded viewer does not satisfy, both in the catalog listing and in any Explore session launched from it. * Metric previews and Explore queries run with the write actor's permissions (when `writeActions` is set) plus any `userAttributes` filters, so embedded viewers only see rows and columns they are entitled to. * Metric and field SQL is hidden unless the write actor has the `view:EmbedCompiledSql` scope; see [Compiled SQL](/embed/reference#compiled-sql). * When `canExplore` isn't `true` and the write actor's role doesn't grant `view:EmbedExplore`, the catalog is read-only — the **Explore from here** action is hidden and Explore routes reject the token. * Metrics catalog tokens are rejected by dashboard, chart, AI agent, and data app routes, and vice versa. ## Example: read-only metrics catalog To publish a browse-only catalog without Explore or chart saving, mint a token with just `type` and `projectUuid`: ```javascript theme={null} const token = jwt.sign({ content: { type: 'metricsCatalog', projectUuid: 'your-project-uuid', }, userAttributes: { tenant_id: 'tenant-abc', }, }, process.env.LIGHTDASH_EMBED_SECRET, { expiresIn: '1h' }); ``` Embedded users can search and preview metrics, but the **Explore from here** action is hidden and Explore routes reject the token. # Embedding with iframe Source: https://docs.lightdash.com/embed/iframe Complete reference for embedding Lightdash content using iframes with JWTs in URL hash fragments [Add-on](/support/feature-badges#add-ons) > [!NOTE] > > Embedding requires the embedding add-on for Cloud Pro or Enterprise. [Get in touch](https://lightdash.typeform.com/to/BujU5wg5) to add embedding to your plan. For self-hosted deployments, follow [embedding setup](/self-host/enterprise-features#embedding). > [!TIP] > > **Try it and see the code.** [embed.lightdash.com](https://embed.lightdash.com) is an interactive demo and helper that lets you preview embedded content and generate a JWT for your own project. For a working end-to-end example, see the [example embed app on GitHub](https://github.com/lightdash/example-embed-dashboard-with-nodejs-app) — a Node.js app that mints tokens server-side and renders a Lightdash dashboard. ## Overview iframe embedding is the simplest way to embed Lightdash **dashboards**, **charts**, standalone **data apps**, and **AI agents** in your application. It requires no special libraries, dependencies, or CORS configuration—just generate a JWT and construct an embed URL. To compare supported content types, see [embedding methods](/embed/reference#embedding-methods). ### Benefits of iframe embedding * **Simple integration** - Standard HTML iframe element, works anywhere * **No dependencies** - No JavaScript libraries or SDK installation required * **No CORS configuration** - Unlike the React SDK, iframes don't require CORS setup * **Universal compatibility** - Works in any web environment (React, Vue, Angular, vanilla HTML) * **Secure** - JWT in URL hash fragment isn't sent to server or logged ### When to use iframe embedding * Quick integration without adding dependencies * Non-React applications * Content management systems (WordPress, Webflow, etc.) * Simple HTML pages or static sites * When you don't need programmatic control (filters, callbacks) ### When to use React SDK instead Consider the [React SDK](/embed/react-sdk) if you need: * Programmatic filters (apply filters via props) * Callbacks for saves, filter changes, and errors (`onEvent`, `onError`) * Seamless React integration * TypeScript type definitions For JWT structure and configuration options, see the [embedding reference](/embed/reference). > [!NOTE] > > `theme` and `backgroundColor` (below) are the only built-in style overrides for iframe embeds — the `fontFamily` style is a React SDK prop. For font or other visual customization on an iframe-embedded dashboard, see [Known limitations](/embed/reference#known-limitations). ## iframe URL patterns All embed URLs follow this pattern: `https://your-instance.lightdash.cloud/embed/{projectUuid}#{jwtToken}` The JWT is passed in the URL **hash fragment** (`#token`) for security—it's not sent to the server in requests or logged in browser history. ### Dashboard URL ``` https://your-instance.lightdash.cloud/embed/{projectUuid}#{jwtToken} ``` The `dashboardUuid` is specified inside the JWT payload as `content.dashboardUuid`, not in the URL path. **Example:** ``` https://app.lightdash.cloud/embed/abc-123-def-456#eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... ``` ### Data app URL Standalone [data app](/embed/embed-data-apps) embeds put both the project UUID and the app UUID in the path: ``` https://your-instance.lightdash.cloud/embed/{projectUuid}/app/{appUuid}#{jwtToken} ``` The JWT must use `content.type: 'dataApp'` and the same `appUuid` as the URL. A token for one app cannot render any other app. **Example:** ``` https://app.lightdash.cloud/embed/abc-123-def-456/app/app-uuid-789#eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... ``` ### Chart URL [Chart](/embed/embed-charts) embeds put both the project UUID and the chart UUID in the path: ```text theme={null} https://your-instance.lightdash.cloud/embed/{projectUuid}/chart/{chartUuid}#{jwtToken} ``` The JWT must use `content.type: 'chart'` and the same chart UUID as `content.contentId`. A token for one chart cannot render any other chart. **Example:** ```text theme={null} https://app.lightdash.cloud/embed/abc-123-def-456/chart/chart-uuid-789#eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... ``` ### AI agent URL [AI agent](/embed/embed-ai-agents) embeds put the project UUID and the agent UUID in the path: ```text theme={null} https://your-instance.lightdash.cloud/embed/{projectUuid}/ai-agents/{agentUuid}/threads#{jwtToken} ``` The JWT must use `content.type: 'aiAgent'` for the same agent. To open an existing conversation, add the thread UUID after `/threads`; see [Resuming a thread from an iframe embed](/embed/embed-ai-agents#resuming-a-thread-from-an-iframe-embed). Because the JWT sits in the hash fragment, it is never sent to the server with HTTP requests and never appears in server logs or browser history. ## URL construction ### Building the embed URL 1. **Get your project UUID** - Found in Lightdash project settings 2. **Get dashboard ID** - Dashboard UUID or slug 3. **Generate JWT** - See [embedding reference](/embed/reference#jwt-structure) for token structure 4. **Construct URL** - Combine parts with hash fragment ```javascript Node.js theme={null} import jwt from 'jsonwebtoken'; const LIGHTDASH_EMBED_SECRET = process.env.LIGHTDASH_EMBED_SECRET; const instanceUrl = 'https://app.lightdash.cloud'; const projectUuid = 'your-project-uuid'; const dashboardUuid = 'your-dashboard-uuid'; // Generate JWT const token = jwt.sign({ content: { type: 'dashboard', dashboardUuid: dashboardUuid, canExportCsv: true, }, }, LIGHTDASH_EMBED_SECRET, { expiresIn: '1h' }); // Build embed URL const embedUrl = `${instanceUrl}/embed/${projectUuid}#${token}`; console.log(embedUrl); ``` ```python Python theme={null} import jwt import datetime LIGHTDASH_EMBED_SECRET = os.getenv('LIGHTDASH_EMBED_SECRET') instance_url = 'https://app.lightdash.cloud' project_uuid = 'your-project-uuid' dashboard_uuid = 'your-dashboard-uuid' # Generate JWT payload = { 'content': { 'type': 'dashboard', 'dashboardUuid': dashboard_uuid, 'canExportCsv': True, }, 'exp': datetime.datetime.utcnow() + datetime.timedelta(hours=1) } token = jwt.encode(payload, LIGHTDASH_EMBED_SECRET, algorithm='HS256') # Build embed URL embed_url = f"{instance_url}/embed/{project_uuid}#{token}" print(embed_url) ``` ```ruby Ruby theme={null} require 'jwt' lightdash_embed_secret = ENV['LIGHTDASH_EMBED_SECRET'] instance_url = 'https://app.lightdash.cloud' project_uuid = 'your-project-uuid' dashboard_uuid = 'your-dashboard-uuid' # Generate JWT payload = { content: { type: 'dashboard', dashboardUuid: dashboard_uuid, canExportCsv: true }, exp: Time.now.to_i + 3600 } token = JWT.encode(payload, lightdash_embed_secret, 'HS256') # Build embed URL embed_url = "#{instance_url}/embed/#{project_uuid}##{token}" puts embed_url ``` ### URL with user attributes For row-level security, include user attributes in the JWT: ```javascript theme={null} const token = jwt.sign({ content: { type: 'dashboard', dashboardUuid: 'your-dashboard-uuid', }, userAttributes: { tenant_id: user.tenantId, // Filter data by tenant region: user.region, }, }, LIGHTDASH_EMBED_SECRET, { expiresIn: '1h' }); const embedUrl = `https://app.lightdash.cloud/embed/${projectUuid}#${token}`; ``` See [User attributes reference](/workspace-admin/user-attributes) for complete guide. ## URL parameters Embedded dashboards support a few optional URL parameters that customize the visual appearance and the query timezone of the session. These are added as **query parameters** before the hash fragment. ### URL format ``` https://your-instance.lightdash.cloud/embed/{projectUuid}?theme=dark&backgroundColor=1c1c1c&timezone=America%2FLos_Angeles#{jwtToken} ``` ### `theme` Sets the color scheme for the embedded content. | Value | Description | | - | - | | `light` | Light color scheme (default) | | `dark` | Dark color scheme | **Example:** ``` https://app.lightdash.cloud/embed/abc-123?theme=dark#eyJhbGci... ``` ### `backgroundColor` Sets a custom background color on the embed and its dashboard header, including tabs and the filter bar. Accepts bare hex codes **without** the `#` prefix, or `transparent` to show the host application's background. The `#` is automatically prepended to hex codes. | Format | Example | Description | | - | - | - | | 6-digit hex | `backgroundColor=121212` | Full hex color | | 3-digit hex | `backgroundColor=FFF` | Shorthand hex | | 4-digit hex | `backgroundColor=F008` | Shorthand hex with alpha | | 8-digit hex | `backgroundColor=FF000080` | Hex with alpha | | Transparent | `backgroundColor=transparent` | Show the host background | Other CSS color formats (named colors, `rgb()`, `hsl()`, etc.) are **not** supported. Omit the parameter to use the theme's default backgrounds. Dashboard tile backgrounds are unchanged. **Example:** ``` https://app.lightdash.cloud/embed/abc-123?backgroundColor=1c1c1c#eyJhbGci... ``` ### `timezone` The embed `timezone` param is available to all organizations. On self-hosted instances where timezone support is disabled with `LIGHTDASH_ENABLE_TIMEZONE_SUPPORT=false`, the param is ignored and the session falls back to the chart pin or project default. Sets a per-session query timezone for the embed. Use it when one embedded dashboard needs to render in different timezones for different viewers (for example, a multi-tenant app where each tenant has its own timezone), without creating separate charts per timezone. Accepts an IANA timezone name (e.g. `America/Los_Angeles`, `Europe/Berlin`, `Asia/Tokyo`). The value is used for dashboard tile queries, inherited totals and subtotals, and filter autocomplete in that session. URL-encode the value so the `/` is escaped (`America%2FLos_Angeles`); the plain `America/Los_Angeles` form is also accepted. A value that isn't a valid IANA name returns a 400 error. | Format | Example | Description | | - | - | - | | IANA timezone name | `timezone=America/Los_Angeles` | Renders the session in Los Angeles time | | IANA timezone name | `timezone=Europe/Berlin` | Renders the session in Berlin time | **Example:** ``` https://app.lightdash.cloud/embed/abc-123?timezone=America%2FLos_Angeles#eyJhbGci... ``` The embed `timezone` param sits at the top of the [timezone resolution priority](/personal-settings/timezone#report-timezone-resolution) for that session and overrides any per-chart timezone pin. It only applies to iframe embed URLs, including ones [opened as a link](#open-an-embed-url-as-a-link), not the React SDK, where the host app's URL is unrelated to the embed. ### Combining parameters You can use `theme`, `backgroundColor`, and `timezone` together: ``` https://app.lightdash.cloud/embed/abc-123?theme=dark&backgroundColor=1c1c1c&timezone=America%2FLos_Angeles#eyJhbGci... ``` All URL parameters are optional. Existing embed URLs without these parameters behave exactly as before — light theme, default background, and the chart or project query timezone. ### Building themed URLs ```javascript Node.js theme={null} import jwt from 'jsonwebtoken'; const LIGHTDASH_EMBED_SECRET = process.env.LIGHTDASH_EMBED_SECRET; const instanceUrl = 'https://app.lightdash.cloud'; const projectUuid = 'your-project-uuid'; const dashboardUuid = 'your-dashboard-uuid'; const token = jwt.sign({ content: { type: 'dashboard', dashboardUuid: dashboardUuid, }, }, LIGHTDASH_EMBED_SECRET, { expiresIn: '1h' }); // Build embed URL with theming parameters const embedUrl = `${instanceUrl}/embed/${projectUuid}?theme=dark&backgroundColor=1c1c1c#${token}`; ``` ```python Python theme={null} import jwt import datetime LIGHTDASH_EMBED_SECRET = os.getenv('LIGHTDASH_EMBED_SECRET') instance_url = 'https://app.lightdash.cloud' project_uuid = 'your-project-uuid' dashboard_uuid = 'your-dashboard-uuid' payload = { 'content': { 'type': 'dashboard', 'dashboardUuid': dashboard_uuid, }, 'exp': datetime.datetime.utcnow() + datetime.timedelta(hours=1) } token = jwt.encode(payload, LIGHTDASH_EMBED_SECRET, algorithm='HS256') # Build embed URL with theming parameters embed_url = f"{instance_url}/embed/{project_uuid}?theme=dark&backgroundColor=1c1c1c#{token}" ``` ## Embedding in HTML ### Basic iframe The simplest way to embed is with a standard HTML iframe: ```html theme={null} ``` ### Recommended attributes ```html theme={null} ``` **Attributes explained:** * `width="100%"` - Makes iframe responsive to container width * `height="600"` - Fixed height (adjust based on content) * `frameborder="0"` - Removes default border (legacy) * `style="border: none;"` - Removes border (modern CSS) * `loading="lazy"` - Defers loading until iframe is visible * `title="..."` - Accessibility: Describes iframe content for screen readers * `allowfullscreen` - Enables fullscreen mode (if your dashboard uses it) ### Responsive iframes To make iframes maintain aspect ratio and scale responsively: **Method 1: Aspect ratio wrapper (16:9)** ```html theme={null}
``` **Method 2: Modern CSS aspect-ratio (16:9)** ```html theme={null} ``` **Method 3: Fixed viewport percentage** ```html theme={null} ``` ### Fit the iframe to the dashboard height An embedded dashboard sends a `lightdash:contentHeightChanged` event with its rendered height in CSS pixels. Set the iframe's height from it, and the iframe grows and shrinks with the dashboard, with no blank space or inner scrollbar. 1. Set up [embed events](#listen-for-embed-events) for your page's origin, and add `targetOrigin` to the embed URL. 2. Listen for the event and set the iframe height from `payload.height`: ```javascript theme={null} const iframe = document.getElementById('dashboard-iframe'); window.addEventListener('message', (event) => { if (event.origin !== 'https://app.lightdash.cloud') return; if (event.data?.type === 'lightdash:contentHeightChanged') { iframe.style.height = `${event.data.payload.height}px`; } }); ``` The dashboard sends the event once when it renders, then again whenever its height changes, at most once every 150 ms. The height changes as tiles load, and when the iframe width moves the dashboard to a different grid layout. Only dashboard embeds send this event. Without embed events, give the iframe a fixed or viewport-based height: ```html theme={null} ``` ### Security considerations iframes provide natural security isolation, but you can add additional restrictions: ```html theme={null} ``` **sandbox attributes:** * `allow-scripts` - Required for Lightdash to function * `allow-same-origin` - Required for Lightdash to function * `allow-forms` - Required for filter interactions * `allow-downloads` - Required if you enable CSV/image exports The `sandbox` attribute provides additional security but may restrict functionality. Test thoroughly if you use it. ## Common patterns ### Server-side rendering Generate embed URLs in your server-side templates: **Express (Node.js)** ```javascript theme={null} app.get('/dashboard', authenticateUser, async (req, res) => { const user = await getUser(req.user.id); const token = jwt.sign({ content: { type: 'dashboard', dashboardUuid: 'dashboard-uuid', }, userAttributes: { tenant_id: user.tenantId, }, }, process.env.LIGHTDASH_EMBED_SECRET, { expiresIn: '1h' }); const embedUrl = `https://app.lightdash.cloud/embed/${projectUuid}#${token}`; res.render('dashboard', { embedUrl }); }); ``` **Template (EJS)** ```html theme={null}
``` ### Single-page apps (SPA) Generate URLs via API when component mounts: **React example** ```jsx theme={null} function EmbeddedDashboard() { const [embedUrl, setEmbedUrl] = useState(null); useEffect(() => { fetch('/api/dashboard-embed-url') .then(res => res.json()) .then(data => setEmbedUrl(data.url)); }, []); if (!embedUrl) return
Loading...
; return ( '; } add_shortcode('lightdash', 'lightdash_embed_shortcode'); ``` Tools with an embed block that takes a URL, such as Notion's `/embed` block, can show a dashboard from its embed URL. Paste the full URL, including the JWT after the `#`. The page has no way to refresh the token, so the embed stops working when the JWT expires; generate the URL with a [long-lived token](#option-1-long-lived-tokens) and replace it before it expires. ### Open an embed URL as a link The generated embed URL can also be used directly as a temporary link, useful for sharing content with people that don't have a Lightdash account. When they open the link, the browser will render the iframe itself. 1. Go to **Settings** → **Embed** and open the tab for the content type. 2. Pick the content, an expiry, and the interactivity and user attributes the viewer should get. 3. Click **Generate & copy URL**, then send the URL. The link has the same limits as the embed: * Anyone with the URL can open it until the token expires. You can't see who has it or revoke a single URL; [regenerating the embed secret](/embed/reference#embed-secret) invalidates every embed URL in the project. * The viewer sees exactly what the embed shows. A chart, for example, has no CSV or image export; see [chart embed limitations](/embed/embed-charts#limitations). ## Listen for embed events An iframe embed can send events to your page with `window.postMessage`. Each message has a `type`, such as `lightdash:filterChanged`, `lightdash:tabChanged`, `lightdash:allTilesLoaded`, `lightdash:chartSaved`, `lightdash:contentHeightChanged` or `lightdash:locationChanged`, plus a `payload` and a `timestamp`. Payloads are the same as for the [React SDK events](/embed/react-sdk#listen-to-events); `locationChanged`, which only iframe embeds send, carries `{ pathname, search, href }`. To size the iframe from `contentHeightChanged`, see [Fit the iframe to the dashboard height](#fit-the-iframe-to-the-dashboard-height). Messages are only sent when both of these are true: * Your instance has embed events with `postMessage` turned on, and your page's exact origin is in its iframe embedding domains. See [Events from the AI agent](/embed/react-sdk#events-from-the-ai-agent) for the Cloud and self-hosted setup. * The embed URL has a `targetOrigin` query parameter, before the `#`, set to that same origin: `?targetOrigin=https%3A%2F%2Fapp.example.com`. ```javascript theme={null} window.addEventListener('message', (event) => { if (event.origin !== 'https://app.lightdash.cloud') return; if (event.data?.type === 'lightdash:filterChanged') { console.log(event.data.payload.filterCount); } }); ``` ## Token refresh JWTs expire after the time specified in `expiresIn`. Handle token expiration: ### Option 1: Long-lived tokens For public or semi-public dashboards, use longer expiration: ```javascript theme={null} jwt.sign(payload, secret, { expiresIn: '7d' }) // 7 days ``` > [!WARNING] > > Long-lived tokens are convenient but less secure. Use only when appropriate for your use case. ### Option 2: Regenerate URL on expiration Detect when iframe shows "Token expired" error and reload with new URL: ```javascript theme={null} function refreshEmbed() { fetch('/api/dashboard-embed-url') .then(res => res.json()) .then(data => { document.getElementById('dashboard-iframe').src = data.url; }); } // Refresh before expiration (e.g., every 50 minutes for 1-hour tokens) setInterval(refreshEmbed, 50 * 60 * 1000); ``` ### Option 3: Backend proxy Create a backend endpoint that serves a static iframe URL but generates fresh tokens: ```javascript theme={null} app.get('/embed-proxy/dashboard/:dashboardUuid', authenticateUser, (req, res) => { const token = jwt.sign({ content: { type: 'dashboard', dashboardUuid: req.params.dashboardUuid, }, }, process.env.LIGHTDASH_EMBED_SECRET, { expiresIn: '1h' }); const embedUrl = `https://app.lightdash.cloud/embed/${projectUuid}#${token}`; // Redirect to actual embed URL res.redirect(embedUrl); }); ``` Then use: ```html theme={null} ``` The proxy also gives a screen that can't run code, such as a kiosk or a TV dashboard, a URL that never changes or expires. Anyone who can reach the endpoint gets the content, so protect it with authentication or restrict it to known IP addresses. To filter each screen's data, map a value from the path, such as a location ID, to a [user attribute](#url-with-user-attributes) in the token. ## Troubleshooting ### Token not working **Issue:** iframe shows "Invalid token" or "Token expired" **Solutions:** * Verify embed secret matches between token generation and Lightdash * Check token hasn't expired (`expiresIn` in jwt.sign) * Ensure JWT payload structure matches [embedding reference](/embed/reference#jwt-structure) * Test token expiration: `jwt.decode(token)` and check `exp` field ### Content not displaying **Issue:** iframe is blank or shows loading indefinitely **Solutions:** * Check browser console for errors * Verify dashboard/chart UUID is correct * Ensure content is added to "allowed dashboards/charts" in Lightdash settings * Check project UUID is correct * Try accessing embed URL directly in browser to see error message ### CORS errors **Issue:** Browser console shows CORS errors **Solution:** * iframes should NOT have CORS issues (CORS only affects React SDK) * If you see CORS errors with iframes, you may be using fetch/XHR to load content instead of iframe * Use standard iframe src attribute, not JavaScript-based loading ### URL encoding issues **Issue:** JWT or URL appears malformed **Solutions:** * Don't URL-encode the JWT in the hash fragment * If constructing URLs in templates, ensure proper escaping: ```html theme={null} ``` ### Dashboard filters not working **Issue:** Users can't interact with filters despite `dashboardFiltersInteractivity: { enabled: 'all' }` **Solutions:** * Verify JWT includes correct interactivity settings * Check browser console for JavaScript errors * Ensure iframe isn't using `sandbox` attribute without `allow-forms` # Embedding with React SDK Source: https://docs.lightdash.com/embed/react-sdk Components, props, and hooks for embedding Lightdash content in a React or Next.js app [Add-on](/support/feature-badges#add-ons) > [!NOTE] > > Embedding requires the embedding add-on for Cloud Pro or Enterprise. [Get in touch](https://lightdash.typeform.com/to/BujU5wg5) to add embedding to your plan. For self-hosted deployments, follow [embedding setup](/self-host/enterprise-features#embedding). > [!TIP] > > **Try it and see the code.** [embed.lightdash.com](https://embed.lightdash.com) is an interactive demo and helper that lets you preview embedded content and generate a JWT for your own project. For a working end-to-end example, see the [example embed app on GitHub](https://github.com/lightdash/example-embed-dashboard-with-nodejs-app) — a Node.js app that mints tokens server-side and renders a Lightdash dashboard. ## Overview The Lightdash React SDK (`@lightdash/sdk`) provides React components for embedding Lightdash content in your React or Next.js applications. The SDK offers advantages over [iframe embedding](/embed/iframe): * Seamless integration with your React application * Programmatic filters for dashboards * Callbacks for saves, filter changes, notifications, and errors (`onEvent`, `onError`) * Custom styling to match your application * TypeScript support with full type definitions For iframe embedding, see the [embedding reference](/embed/reference). ## Set up CORS To use the React SDK, you need to update your "Cross-Origin Resource Sharing" (CORS) policy so the domain hosting your React app is allowed to call the Lightdash API. In Lightdash, go to **Project settings -> Embed configuration -> CORS** and add each origin where you'll use the SDK. Only organization admins see the **CORS** tab. The allowed origins are an organization setting rather than a project one, so one list covers every project in your organization, including a separate development project. To test locally against the same instance, add your development origin, such as `http://localhost:3000`, alongside your production one. ![CORS settings panel showing regex and exact origin entries](https://mintcdn.com/lightdash/r5g66-wQ4pdXMZMF/images/embed/react-sdk/embed-cors-settings.png?fit=max\&auto=format\&n=r5g66-wQ4pdXMZMF\&q=85\&s=3e2d3ddcbecf705593dd4b9a31d9ab47) Use **origin mode** for exact origins and simple subdomain wildcards: * `https://app.example.com` allows only that exact origin. * `*.example.com` allows HTTPS subdomains like `https://app.example.com` and is saved as a regex pattern. Use **regex mode** (`.*`) for advanced patterns. Enter the pattern body only; Lightdash matches the whole origin automatically. For example, `https:\\/\\/.*\\.example\\.com` allows subdomains of `example.com`. > [!WARNING] > > Only add origins you control. Avoid broad patterns that could match arbitrary external domains. For self-hosted deployments, you can also configure instance-level allowed origins with environment variables: ```bash theme={null} LIGHTDASH_CORS_ALLOWED_DOMAINS=https://domain-where-you-are-going-to-use-the-sdk.com ``` CORS is enabled by default. Set `LIGHTDASH_CORS_ENABLED=false` only if you want to disable CORS for the whole instance. Browsers enforce a Same-Origin Policy that blocks a web application from making requests to a domain other than the one that served it. Because the React SDK calls the Lightdash API from your frontend, your instance has to name your application's origin in its CORS configuration for those requests to go through. CORS is **only required for the React SDK**. iframe embedding does not require CORS configuration. ## Installing the Lightdash SDK In your frontend project, use your preferred package manager to install the SDK. ```bash theme={null} npm install @lightdash/sdk # or pnpm add @lightdash/sdk # or yarn add @lightdash/sdk ``` > [!NOTE] > > Starting with Lightdash `v2.207.0`, the Embed SDK (`@lightdash/sdk`) requires **React and React DOM 19.2 or later**. Before installing or upgrading the SDK, update both `react` and `react-dom` in your frontend project to meet this requirement. > > This requirement does not apply to `@lightdash/query-sdk`, which is unaffected. > > For Next.js, version 15 or later is required. The SDK package contains the Lightdash frontend that draws your embed, so the version you install, not your Lightdash instance's version, decides how embedded charts render. iframe embeds always render with your instance's current version. If a chart looks different in your SDK embed than in Lightdash, upgrade `@lightdash/sdk` and redeploy your app before investigating further. ### Import CSS styles The Lightdash SDK requires CSS styles to render components correctly. Import the SDK's CSS file as the **first import** in your React application's entry point: ```tsx theme={null} import "@lightdash/sdk/sdk.css"; import React from "react"; import ReactDOM from "react-dom/client"; import App from "./App"; ReactDOM.createRoot(document.getElementById("root")!).render( ); ``` > [!WARNING] > > The CSS import must be the first import in your entry file to ensure Lightdash styles load before other styles and avoid conflicts. ## Components and hooks The Lightdash SDK exports components for embedding Lightdash content and hooks for building custom host-app UI around embedded content: * `Lightdash.Dashboard` - Embed complete dashboards with multiple tiles * `Lightdash.DashboardBuilder` - Let embedded users create a brand-new dashboard * `Lightdash.Chart` - Embed individual saved charts * `Lightdash.Explore` - Embed interactive data exploration interface * `Lightdash.AiAgent` - Embed an AI agent so users can chat with their data * `Lightdash.MetricsCatalog` - Embed the project metrics catalog so users can browse and explore metrics * `Lightdash.useLightdashContent` - List spaces, dashboards, charts, and data apps for a custom content catalog * `Lightdash.useLightdashAiAgentThreads` - List an embed user's previous AI agent threads to build a thread history UI All components share common props for authentication and styling. ### Lightdash.Dashboard Embed complete Lightdash dashboards with multiple visualizations, filters, and interactive features. See [Embedding dashboards](/embed/embed-dashboards) for the JWT claims that control what viewers can do. #### Props ```typescript theme={null} type DashboardProps = { // Required instanceUrl: string; // Your Lightdash instance URL token: string | Promise; // JWT (can be async; can be replaced at runtime) // Optional theme?: 'light' | 'dark'; // Force light or dark color scheme styles?: { backgroundColor?: string; // Background color or 'transparent' fontFamily?: string; // Font family for all text }; filters?: SdkFilter[]; // Apply filters programmatically paletteUuid?: string; // Color palette UUID for custom theming contentOverrides?: LanguageMap; // Translate your content (names, titles, markdown) uiOverrides?: SdkUiOverrides; // Translate Lightdash UI strings (filters, menus, buttons) isEditMode?: boolean; // Render the dashboard in edit mode (requires writeActions JWT) onEditModeChange?: ( isEditMode: boolean, ) => void; // Callback when the embed enters or leaves edit mode chartSaveDestinations?: ('dashboard' | 'space')[]; // Where "New chart" and "Save as new chart" save (default: ['dashboard']) onExplore?: (options: { chart: SavedChart }) => void; // Handle "Explore from here" in your app instead of the embed onEvent?: LightdashEventHandler; // Saves, filter and tab changes, notifications onError?: (error: SdkError) => void; // Load and request failures }; ``` #### Basic usage ```tsx theme={null} import Lightdash from '@lightdash/sdk'; function MyDashboard() { return ( ); } ``` #### With filters Apply filters programmatically using the `filters` prop: ```tsx theme={null} import Lightdash, { FilterOperator } from '@lightdash/sdk'; ``` See [Filtering data](#filtering-data) for complete filter documentation. #### With styling ```tsx theme={null} ``` #### Handle Explore in your app When the token allows Explore, **Explore from here** on a saved chart opens Explore inside the component, with a **Back** button that returns to the dashboard. Drill-downs always open there too. Pass `onExplore` to take over **Explore from here** for saved charts instead, for example to route to a page of your app that renders [`Lightdash.Explore`](#lightdashexplore). The component then doesn't open Explore itself, so don't pass `onExplore` only to track usage; use [`onEvent`](#listen-to-events) for that. ```tsx theme={null} { navigate(`/explore/${chart.uuid}`, { state: { chart } }); }} /> ``` #### With edit mode When the JWT includes a `writeActions` claim, you can render an existing dashboard in edit mode and let users rename it, add one or more saved charts, move or resize tiles, and save changes. The host app controls the edit-mode state through `isEditMode` and `onEditModeChange`. ```tsx theme={null} import Lightdash from '@lightdash/sdk'; import { useState } from 'react'; function EditableDashboard() { const [isEditMode, setIsEditMode] = useState(false); return ( <> {!isEditMode && ( )} ); } ``` The dashboard must be in one of the token's write spaces. The add-chart picker lists saved charts from the write spaces and any [source spaces](/embed/reference#add-charts-from-other-spaces); charts from a source space can't be edited from the dashboard. See [Write actions](/embed/reference#write-actions) for the JWT claim. #### Choose where new charts are saved When the token sets `canExplore: true`, edit mode offers **New chart** in the add-tile menu and **Save as new chart** when editing a chart. Use `chartSaveDestinations` to control where those new charts are saved: | Value | Behavior | | - | - | | `['dashboard']` (default) | The chart is saved to the dashboard. It doesn't appear in any space's chart list, and removing its tile and saving the dashboard deletes it. | | `['space']` | The chart is saved to a write space, and the dashboard tile references it. | | `['dashboard', 'space']` | The save dialog lets the user choose between the dashboard and the write spaces. The dashboard is selected by default. | ```tsx theme={null} ``` If the dashboard isn't in one of the token's write spaces, Lightdash saves new charts to the first write space whatever this prop says. Iframe embeds have no equivalent setting and always save to the dashboard. ### Lightdash.DashboardBuilder Let embedded users build a brand-new dashboard from scratch. On mount, the SDK creates an empty dashboard in the token's first write space and renders it through the same embedded dashboard component as `Lightdash.Dashboard`. The host app controls when the dashboard is in edit mode. Use this when you want your customers to author their own dashboards inside your app — for example, a "Create dashboard" page in your customer portal — without giving them a Lightdash login. #### Props ```typescript theme={null} type DashboardBuilderProps = { // Required instanceUrl: string; // Your Lightdash instance URL token: string | Promise; // JWT with writeActions claim // Optional theme?: 'light' | 'dark'; styles?: { backgroundColor?: string; fontFamily?: string; }; filters?: SdkFilter[]; paletteUuid?: string; contentOverrides?: LanguageMap; uiOverrides?: SdkUiOverrides; isEditMode?: boolean; // Render the new dashboard in edit mode onEditModeChange?: ( isEditMode: boolean, ) => void; // Callback when the embed enters or leaves edit mode chartSaveDestinations?: ('dashboard' | 'space')[]; // See "Choose where new charts are saved" onDashboardReady?: ( dashboard: EmbedDashboard, ) => void; // Called once the empty dashboard has been created onExplore?: (options: { chart: SavedChart }) => void; onEvent?: LightdashEventHandler; onError?: (error: SdkError) => void; }; ``` #### Basic usage ```tsx theme={null} import Lightdash from '@lightdash/sdk'; import { useEffect, useState } from 'react'; function MyDashboardBuilder() { const [isEditMode, setIsEditMode] = useState(false); const [isReady, setIsReady] = useState(false); return ( <> {isReady && !isEditMode && ( )} setIsReady(true)} /> ); } ``` #### Requirements and behavior * The JWT must include a `writeActions` claim with `writeSpaceUuids`. JWTs without `writeActions` fail closed for write-capable paths. * The new dashboard is created in the first write space, named "Untitled dashboard", and is empty. * The add-chart picker lists saved charts and SQL charts from the write spaces, plus charts from any [source spaces](/embed/reference#add-charts-from-other-spaces). * Dashboards created or edited through the SDK are normal Lightdash dashboards — they can be viewed and edited from Lightdash and vice versa. * See [Write actions](/embed/reference#write-actions) for the JWT claim and how to configure the actor and write spaces. ### Lightdash.Chart Embed individual saved charts for focused, single-metric displays with minimal UI. #### Props ```typescript theme={null} type ChartProps = { // Required instanceUrl: string; // Your Lightdash instance URL id: string; // Chart UUID (savedQueryUuid) token: string | Promise; // JWT with type: 'chart' // Optional theme?: 'light' | 'dark'; // Force light or dark color scheme styles?: { backgroundColor?: string; // Background color or 'transparent' fontFamily?: string; // Font family for all text }; contentOverrides?: LanguageMap; // Translate your content (names, titles, markdown) uiOverrides?: SdkUiOverrides; // Translate Lightdash UI strings (filters, menus, buttons) isEditMode?: boolean; // Render the chart in Explore (requires writeActions JWT) onExplore?: (options: { chart: SavedChart }) => void; // Handle "Explore from here" in your app instead of the embed onEvent?: LightdashEventHandler; onError?: (error: SdkError) => void; }; ``` Chart does not accept `filters`. #### Edit and drill into a chart Without `isEditMode`, the chart renders read-only with minimal UI. Pass `isEditMode` as `true` or `false` to render the chart in Explore when the token's write actor can update it, which requires a `writeActions` claim whose write spaces include the chart's space: * `isEditMode={true}` opens the chart for editing; saving updates the chart. * `isEditMode={false}` shows the chart in Explore's view mode, where viewers can click a data point and **Drill into** it. The drill-down opens inside the component, with a **Back to Chart** button. If the actor can't update the chart, `isEditMode={true}` shows an error and `isEditMode={false}` falls back to the read-only chart. #### Basic usage ```tsx theme={null} import Lightdash from '@lightdash/sdk'; function MyChart() { return ( ); } ``` #### With styling ```tsx theme={null} ``` #### Token generation for charts Charts require a JWT with `type: 'chart'`: ```javascript theme={null} // Backend API endpoint import jwt from 'jsonwebtoken'; export function generateChartToken(chartId) { return jwt.sign({ content: { type: 'chart', contentId: chartId, // savedQueryUuid canExportCsv: true, canExportImages: false, canViewUnderlyingData: true, }, }, process.env.LIGHTDASH_EMBED_SECRET, { expiresIn: '24h' }); } ``` See [Embedding charts guide](/embed/embed-charts) for details. ### Lightdash.Explore Embed interactive data exploration interface with full query builder capabilities. #### Props ```typescript theme={null} type ExploreProps = { // Required instanceUrl: string; // Your Lightdash instance URL token: string | Promise; // JWT with canExplore: true exploreId: string; // Explore (table) to open, e.g. chart.tableName savedChart: SavedChart; // Chart to start from // Optional theme?: 'light' | 'dark'; // Force light or dark color scheme styles?: { backgroundColor?: string; // Background color or 'transparent' fontFamily?: string; // Font family for all text }; filters?: SdkFilter[]; contentOverrides?: LanguageMap; // Translate your content (names, titles, markdown) uiOverrides?: SdkUiOverrides; // Translate Lightdash UI strings (filters, menus, buttons) onExplore?: (options: { chart: SavedChart }) => void; onEvent?: LightdashEventHandler; onError?: (error: SdkError) => void; }; ``` #### Basic usage `Lightdash.Explore` starts from a chart, usually the one a viewer chose **Explore from here** on in a dashboard whose [`onExplore`](#handle-explore-in-your-app) routed to this page: ```tsx theme={null} import Lightdash from '@lightdash/sdk'; import type { ComponentProps } from 'react'; type SavedChart = ComponentProps['savedChart']; function MyExplore({ chart }: { chart: SavedChart }) { return ( ); } ``` After a drill-down, **Back** returns to the starting query in one click. #### With styling ```tsx theme={null} ``` #### Token generation for explores Explores require `canExplore: true` in the JWT: ```javascript theme={null} // Backend API endpoint import jwt from 'jsonwebtoken'; export function generateExploreToken() { return jwt.sign({ content: { type: 'dashboard', // Can use dashboard type dashboardUuid: 'starting-dashboard-uuid', canExplore: true, // Required for explore access canExportCsv: true, canExportImages: true, }, }, process.env.LIGHTDASH_EMBED_SECRET, { expiresIn: '4h' }); } ``` ### Lightdash.AiAgent Embed a Lightdash [AI agent](/agents) so embedded users can chat with their data, generate charts, and save results back to a fixed space — without a Lightdash login. By default the component renders the agent inside an iframe; set `renderMode="native"` to [render it in your page](#render-the-agent-natively) instead. Use `threadUuid` to deep-link into an existing thread, or omit it to land on the new-thread screen. #### Props ```typescript theme={null} type AiAgentProps = { // Required instanceUrl: string; // Your Lightdash instance URL agentUuid: string; // Agent to embed (must match the JWT) token: string | Promise; // JWT with content.type: 'aiAgent' // Optional threadUuid?: string; // Open a specific thread on load onThreadChange?: (options: { threadUuid: string }) => void; // Fires when the embed opens or creates a thread binding?: AiThreadBinding; // Bind threads started here to a dashboard threadContext?: string; // Background for threads started here (max 10,000 characters) renderMode?: 'iframe' | 'native'; // Beta: 'native' renders in your page. Default 'iframe' onEvent?: LightdashEventHandler; // Charts and dashboards the agent creates or edits onError?: (error: SdkError) => void; theme?: 'light' | 'dark'; styles?: { backgroundColor?: string; fontFamily?: string; // Native mode only }; }; type AiThreadBinding = { type: 'dashboard'; dashboardUuid: string; }; ``` `Lightdash.AiAgent` does not accept `filters`, `contentOverrides`, `uiOverrides`, or `onExplore`. Threads, navigation, and chart actions are managed inside the embedded agent UI. In iframe mode, an open agent doesn't pick up a replaced `token`; see [Rotating tokens](#rotating-tokens). `onThreadChange` fires whenever the embedded agent creates a new thread or opens an existing one. Use it together with `threadUuid` to persist the current conversation in your app (for example in `localStorage` or your own backend) and resume it the next time the user returns. In iframe mode, the SDK passes a `targetOrigin` query parameter to the iframe and listens for `lightdash:aiAgentThreadChanged` `postMessage` events from the embedded page — no extra setup is required on your side. #### Basic usage ```tsx theme={null} import Lightdash from '@lightdash/sdk'; function MyAiAgent() { return ( ); } ``` #### Open a specific thread Pass `threadUuid` to deep-link the embed into a specific conversation on mount: ```tsx theme={null} ``` #### Persist and resume the last conversation Combine `threadUuid` and `onThreadChange` to keep users on their most recent thread across page reloads. This example stores the latest thread UUID in `localStorage`: ```tsx theme={null} import Lightdash from '@lightdash/sdk'; import { useState } from 'react'; const STORAGE_KEY = 'acme-shop:lightdash-ai-thread'; function ShopInsightsAgent({ token }: { token: string }) { const [threadUuid, setThreadUuid] = useState( () => localStorage.getItem(STORAGE_KEY) ?? undefined, ); return ( { setThreadUuid(nextThreadUuid); localStorage.setItem(STORAGE_KEY, nextThreadUuid); }} /> ); } ``` #### Start a thread bound to a dashboard Pass `binding` to bind the thread the embed creates to a dashboard, and `threadContext` to give the agent background for it, such as a summary of an earlier conversation. Both apply when the user sends the first message, and are ignored when `threadUuid` opens an existing thread. `onThreadChange` returns the new thread's UUID: ```tsx theme={null} saveThreadForDashboard(dashboardUuid, threadUuid)} /> ``` The dashboard must be in one of the token's write spaces or `sourceSpaceUuids`. Errors, such as a dashboard outside those spaces, surface when the first message is sent. See [Bind a thread to a dashboard](/embed/embed-ai-agents#bind-a-thread-to-a-dashboard) for what a bound thread does and how to create one from your backend. #### Render the agent natively [Beta](/support/feature-badges#beta) Set `renderMode="native"` to render the agent directly in your page instead of an iframe. It uses the same props and token: ```tsx theme={null}
``` In native mode: * The agent fills its container, so give the container a height. The chat scrolls inside the component, never your page. * The agent calls the Lightdash API from your page, like the other SDK components, so your origin must be allowed in [CORS](#set-up-cors). * `styles.fontFamily` applies, and `onError` reports every load and request failure. In iframe mode, `onError` only reports token errors. * `onThreadChange` is called directly instead of through `postMessage`. Setting `threadUuid` to `undefined` opens a new thread. * The agent shows no toast notifications. Its messages reach [`onEvent`](#listen-to-events) as `notification` events instead, and `onError` reports failures. #### Token generation for AI agents AI agent embeds require a JWT with `content.type: 'aiAgent'` and a `writeActions` claim that names the write spaces and the actor used for agent queries and chart saves: ```javascript theme={null} // Backend API endpoint import jwt from 'jsonwebtoken'; export function generateAiAgentToken() { return jwt.sign({ content: { type: 'aiAgent', projectUuid: 'your-project-uuid', agentUuid: 'your-agent-uuid', }, writeActions: { serviceAccountUserUuid: 'service-account-user-uuid', writeSpaceUuids: ['destination-space-uuid'], }, userAttributes: { tenant_id: 'tenant-abc', }, }, process.env.LIGHTDASH_EMBED_SECRET, { expiresIn: '1h' }); } ``` To let the agent read dashboards and charts it must not change, such as a library of curated dashboards, list their spaces in `writeActions.sourceSpaceUuids`. The agent can read those spaces, search them, and bind threads to dashboards in them, but creates and updates content only in `writeSpaceUuids`. See [Add charts from other spaces](/embed/reference#add-charts-from-other-spaces). See [Embedding AI agents](/embed/embed-ai-agents) for the full guide and [AI agent token](/embed/reference#ai-agent-token) for the complete JWT structure. ### Lightdash.MetricsCatalog Embed the Lightdash [metrics catalog](/semantic-layer/metrics) so embedded users can browse the metrics defined in a project, preview them, and — when the JWT allows it — continue into Explore without leaving your app. When a viewer clicks **Explore from here** on a metric, the SDK swaps in an embedded Explore view; a **Back** action returns them to the catalog. #### Props ```typescript theme={null} type MetricsCatalogProps = { // Required instanceUrl: string; // Your Lightdash instance URL token: string | Promise; // JWT with content.type: 'metricsCatalog' // Optional theme?: 'light' | 'dark'; // Force light or dark color scheme styles?: { backgroundColor?: string; // Background color or 'transparent' fontFamily?: string; // Font family for all text }; hiddenFilters?: MetricsCatalogFilter[]; // Built-in filter controls to hide onEvent?: LightdashEventHandler; onError?: (error: SdkError) => void; }; type MetricsCatalogFilter = 'tables' | 'owners' | 'categories'; ``` `Lightdash.MetricsCatalog` does not accept `filters`, `contentOverrides`, `uiOverrides`, or `onExplore`. The catalog and the embedded Explore it launches are managed inside the component. #### Hide filter controls Use `hiddenFilters` to remove built-in filter controls that don't mean anything to your viewers. It only hides the controls; the metadata behind them, such as each metric's owner, stays in the catalog. ```tsx theme={null} ``` #### Basic usage ```tsx theme={null} import Lightdash from '@lightdash/sdk'; function MyMetricsCatalog() { return ( ); } ``` #### Token generation for the metrics catalog Metrics catalog embeds require a JWT with `content.type: 'metricsCatalog'` and a `projectUuid`. Set `content.canExplore` to `true` to let embedded users open Explore from a metric, and include a `writeActions` claim if you want them to save the resulting charts back to Lightdash. ```javascript theme={null} // Backend API endpoint import jwt from 'jsonwebtoken'; export function generateMetricsCatalogToken() { return jwt.sign({ content: { type: 'metricsCatalog', projectUuid: 'your-project-uuid', canExplore: true, }, writeActions: { serviceAccountUserUuid: 'service-account-user-uuid', writeSpaceUuids: ['destination-space-uuid'], }, userAttributes: { tenant_id: 'tenant-abc', }, }, process.env.LIGHTDASH_EMBED_SECRET, { expiresIn: '1h' }); } ``` Omit `canExplore` (or set it to `false`) to publish a read-only browse experience. See [Embedding the metrics catalog](/embed/embed-metrics-catalog) for the full guide and [Metrics catalog token](/embed/reference#metrics-catalog-token) for the complete JWT structure. ## API hooks ### Lightdash.useLightdashContent Use `useLightdashContent` when you want your own app to list Lightdash content instead of embedding the Lightdash home page. A common pattern is to let customers choose a space in your UI, show the dashboards and charts in that space, then render the selected object with `Lightdash.Dashboard` or `Lightdash.Chart`. The hook calls the Lightdash content API and returns metadata only. It does not render the selected chart or dashboard, and it does not replace the chart or dashboard embed token you pass to the render component. #### Backend: generate an API access token Generate the token on your backend with your Lightdash embed secret. Never expose the embed secret in browser code. ```typescript theme={null} import jwt from 'jsonwebtoken'; export function generateContentCatalogToken() { return jwt.sign( { content: { type: 'apiAccess', projectUuid: 'your-project-uuid', serviceAccountUserUuid: 'service-account-user-uuid', }, user: { externalId: 'customer-user-123', email: 'customer@example.com', }, userAttributes: { tenant_id: 'tenant-abc', }, }, process.env.LIGHTDASH_EMBED_SECRET, { expiresIn: '1h' }, ); } ``` The service account controls what the hook can list. If the service account cannot view a private space, content from that space is not returned. #### Frontend: list content in a space ```tsx theme={null} import Lightdash from '@lightdash/sdk'; function ContentCatalog({ instanceUrl, projectUuid, token, spaceUuid, }: { instanceUrl: string; projectUuid: string; token: string; spaceUuid: string; }) { const { data, error, isLoading, refetch } = Lightdash.useLightdashContent( { instanceUrl, projectUuid, auth: { type: 'embedToken', token, }, }, { spaceUuids: [spaceUuid], contentTypes: ['dashboard', 'chart'], page: 1, pageSize: 50, sortBy: 'name', sortDirection: 'asc', }, ); if (isLoading) return

Loading content...

; if (error) return

Unable to load content

; return (
{data?.data.map((item) => ( ))}
); } ``` #### Options ```typescript theme={null} type ListContentOptions = { projectUuids?: string[]; spaceUuids?: string[]; parentSpaceUuid?: string; contentTypes?: Array<'space' | 'dashboard' | 'chart' | 'data_app'>; page?: number; pageSize?: number; search?: string; sortBy?: 'name' | 'space_name' | 'last_updated_at'; sortDirection?: 'asc' | 'desc'; }; ``` > [!WARNING] > > Use the `spaceUuids` option as a filter, not as an authorization boundary — authorization comes from the API access token's service account permissions. `apiAccess` tokens are for API reads such as content listing; to let embedded users save charts or dashboards, use an embed token that supports `writeActions`. ### Lightdash.useLightdashAiAgentThreads Use `useLightdashAiAgentThreads` when you want to show your users a list of their previous AI agent conversations — for example a "Recent chats" sidebar next to a `Lightdash.AiAgent` embed. The hook calls the AI agent threads endpoint with the embed JWT, so it returns only the threads for the token's agent, write actor, and first write space. Viewers whose tokens share those see the same threads; `user.externalId` doesn't separate them. Pair it with `Lightdash.AiAgent`'s `threadUuid` and `onThreadChange` props to let users resume any past conversation. #### Options ```typescript theme={null} type ListAiAgentThreadsOptions = { agentUuid: string; // The agent whose threads should be listed projectUuid?: string; // Falls back to the projectUuid on LightdashApiClientConfig }; ``` The hook takes the same `LightdashApiClientConfig` as `useLightdashContent`, with `auth.type: 'embedToken'` and the AI agent embed JWT as the token. #### Types ```typescript theme={null} type LightdashAiAgentThreadResults = LightdashAiAgentThread[]; // One entry per thread the embed user can see. Full shape lives in // @lightdash/common's ApiAiAgentThreadSummaryListResponse; the useful fields // for building thread history UIs are: type LightdashAiAgentThread = { uuid: string; title?: string; firstMessage: { uuid: string; message: string } | null; // null for a thread created without a prompt binding: { type: 'dashboard'; dashboardUuid: string; displayName: string | null; // null once the dashboard is deleted } | null; threadContext: string | null; // always null for embed tokens // ...additional metadata such as timestamps }; ``` #### Example: thread history + resume ```tsx theme={null} import Lightdash, { useLightdashAiAgentThreads, type LightdashApiClientConfig, } from '@lightdash/sdk'; import { useState } from 'react'; const STORAGE_KEY = 'acme-shop:lightdash-ai-thread'; function ShopInsightsAgentWithHistory({ token, projectUuid, agentUuid, }: { token: string; projectUuid: string; agentUuid: string; }) { const apiConfig: LightdashApiClientConfig = { instanceUrl: 'https://app.lightdash.cloud', projectUuid, auth: { type: 'embedToken', token }, }; const threads = Lightdash.useLightdashAiAgentThreads(apiConfig, { agentUuid, projectUuid, }); const [threadUuid, setThreadUuid] = useState( () => localStorage.getItem(STORAGE_KEY) ?? undefined, ); return (
{ setThreadUuid(nextThreadUuid); localStorage.setItem(STORAGE_KEY, nextThreadUuid); // Refresh the sidebar so new threads show up immediately. threads.refetch(); }} />
); } ``` `useLightdashAiAgentThreads` uses the same embed JWT you pass to `Lightdash.AiAgent`. The token's `content.agentUuid` and first write space are what scope the returned threads — the hook cannot list threads from a different agent or space, even if you pass a different `agentUuid` argument. ## Generating embed tokens All SDK components require JWTs generated server-side, signed with the embed secret from [embed setup](/embed/set-up-embedding). Here's a complete example, including [user attributes](/workspace-admin/user-attributes) for row-level filtering: ### Backend API endpoint ```typescript theme={null} // server/api/embed-token.ts import jwt from 'jsonwebtoken'; export async function generateEmbedToken(req, res) { // Authenticate user const userId = req.user.id; const user = await getUserFromDatabase(userId); // Generate token with user-specific attributes const token = jwt.sign({ content: { type: 'dashboard', dashboardUuid: 'your-dashboard-uuid', dashboardFiltersInteractivity: { enabled: 'all', }, canExportCsv: true, canExplore: true, }, userAttributes: { tenant_id: user.tenantId, // Row-level filtering }, user: { externalId: user.id, email: user.email, }, }, process.env.LIGHTDASH_EMBED_SECRET, { expiresIn: '1h' }); res.json({ token }); } ``` ### Frontend React component ```tsx theme={null} import Lightdash from '@lightdash/sdk'; import { useState, useEffect } from 'react'; function EmbeddedDashboard() { const [token, setToken] = useState(null); useEffect(() => { // Fetch token from your backend fetch('/api/embed-token') .then(res => res.json()) .then(data => setToken(data.token)); }, []); if (!token) return
Loading...
; return ( ); } ``` > [!WARNING] > > To ensure security, JWT generation code must run **in your backend**, and the **Lightdash embed secret** must never be exposed in frontend code. This prevents unauthorized access and protects sensitive data. ### Rotating tokens Self-hosted instances need Lightdash `2.137.0` or later to replace a token at runtime. On earlier versions the component keeps sending the first token it was given. Short-lived tokens are the safer default. To keep a long-lived embed working, mint a new token before the current one expires and pass it to the same component. The `token` prop can change at any time: the component stays mounted, dashboard filters, Explore state and chart edit mode are kept, and every request from then on carries the new token. Do not change the component's React `key` to swap tokens; that remounts it and resets its state. ```tsx theme={null} import Lightdash from '@lightdash/sdk'; import { useState, useEffect } from 'react'; function EmbeddedDashboard() { const [token, setToken] = useState(null); useEffect(() => { let timer: ReturnType; const refresh = async () => { // Your backend returns the JWT and how long it is valid for const { token, expiresInSeconds } = await fetch('/api/embed-token') .then(res => res.json()); setToken(token); // Mint the next token a minute before this one expires timer = setTimeout(refresh, (expiresInSeconds - 60) * 1000); }; void refresh(); return () => clearTimeout(timer); }, []); if (!token) return
Loading...
; return ( ); } ``` This applies to `Lightdash.Dashboard`, `Lightdash.DashboardBuilder`, `Lightdash.Chart`, `Lightdash.Explore`, and `Lightdash.MetricsCatalog`. * Refresh before expiry. A request that already failed on an expired token is not retried with the new one. * Each component sends its own token, so components with different tokens, such as a dashboard and a chart, can share a page. Replacing one component's token doesn't affect the others. * In iframe mode, `Lightdash.AiAgent` reads the token from the iframe URL when it loads, so an open agent doesn't pick up a replaced token. Mint AI agent tokens that outlive the session instead. ## Listen to events Pass `onEvent` to `Lightdash.Dashboard`, `Lightdash.DashboardBuilder`, `Lightdash.Chart`, `Lightdash.Explore`, `Lightdash.MetricsCatalog`, or `Lightdash.AiAgent` to react to what viewers, or the agent, do in the embed, for example to confirm a save in your own UI or link to the new chart. ```tsx theme={null} import Lightdash, { type LightdashEvent } from '@lightdash/sdk'; { if (event.type === 'chartSaved' && event.payload.action === 'created') { showToast(`Chart saved`, { link: `/charts/${event.payload.chartUuid}` }); } if (event.type === 'notification') { showToast(event.payload.title ?? '', { variant: event.payload.variant }); } }} /> ``` Each event has a `type` and a `payload`: | `type` | `payload` | Sent when | | - | - | - | | `chartSaved` | `{ chartUuid: string; action: 'created' \| 'updated' }` | A viewer saves a new chart, or a new version of an existing one, from Explore, chart edit mode, or a dashboard tile, or the AI agent creates or edits a chart | | `dashboardSaved` | `{ dashboardUuid: string; action: 'created' \| 'updated' }` | A viewer saves a dashboard in edit mode, or the AI agent creates or edits a dashboard | | `filterChanged` | `{ hasFilters: boolean; filterCount: number }` | Dashboard filters change. Filter values aren't included | | `tabChanged` | `{ tabIndex: number }` | A viewer switches dashboard tab | | `allTilesLoaded` | `{ tilesCount: number; loadTimeMs: number }` | Every tile on the dashboard has loaded, including tiles that failed. It's sent again each time the tiles reload, for example after a tab or filter change | | `contentHeightChanged` | `{ height: number }` | The dashboard's rendered height changes, in CSS pixels. Sent once when the dashboard renders, then at most once every 150 ms while the height changes. Only dashboards send it | | `notification` | `{ id: string; variant: 'success' \| 'error' \| 'info' \| 'warning'; title: string \| null; message: string \| null }` | The embed has something to tell the viewer | The `LightdashEvent` type also lists `locationChanged` and `error`. SDK components don't send either: `locationChanged` comes only from [iframe embeds](/embed/iframe), and failures go to [`onError`](#handle-errors). SDK components don't show toast notifications themselves. Render `notification` events in your own UI, or viewers won't see save confirmations and error messages. A notification can be sent more than once with the same `id`, for example while an export goes from in progress to done; update the same message instead of adding another. ### Events from the AI agent `Lightdash.AiAgent` sends `chartSaved` and `dashboardSaved` once each time the agent creates or edits a saved chart or dashboard. Adding a chart to a dashboard sends one `dashboardSaved`. SQL charts and documents send nothing. In native mode, the agent's `notification` events reach `onEvent` too; use `onThreadChange` to follow its threads. In iframe mode, the agent posts events from the iframe to your page with `postMessage`, so your Lightdash instance must allow it: * On Lightdash Cloud, ask Lightdash support to turn on embed events with `postMessage` and add your page's origin, such as `https://app.example.com`, to the iframe embedding domains. * On self-hosted instances, set `EMBED_EVENT_SYSTEM_ENABLED` and `EMBED_EVENT_SYSTEM_POST_MESSAGE_ENABLED` to `true`, and add your page's exact origin to `LIGHTDASH_IFRAME_EMBEDDING_DOMAINS`. Wildcard entries don't match. See [embedding variables](/self-host/customize-deployment/environment-variables#embedding). Without these, the agent works but `onEvent` never fires. Native mode calls `onEvent` directly and needs no instance setup. ### Refresh a dashboard after the agent saves it An embedded `Lightdash.Dashboard` doesn't reload when the agent next to it edits the dashboard. Listen for `dashboardSaved` on the agent and remount the dashboard with a new `key`: ```tsx theme={null} import Lightdash, { type LightdashEvent } from '@lightdash/sdk'; import { useState } from 'react'; function DashboardWithAgent({ dashboardUuid, dashboardToken, agentToken }) { const [revision, setRevision] = useState(0); return ( <> { if ( event.type === 'dashboardSaved' && event.payload.dashboardUuid === dashboardUuid ) { setRevision((current) => current + 1); } }} /> ); } ``` Remounting resets the dashboard's filters and selected tab. If the agent saves a new dashboard instead, `action` is `'created'` and `dashboardUuid` is the new dashboard; mint a dashboard token for it to show it. ## Handle errors Pass `onError` to any SDK component to find out when it fails to load or a request fails, for example to show your own error screen instead of Lightdash's. ```typescript theme={null} type SdkError = { kind: | 'network' | 'token_expired' | 'invalid_token' | 'unauthorized' | 'forbidden' | 'not_found' | 'invalid_request' | 'server' | 'render' | 'unknown'; status: number | null; // HTTP status, or null when there was no response message: string; retryable: boolean; // Network errors, 429, and 5xx server errors fatal: boolean; // The component replaced its content with an error screen }; ``` `onError` only reports errors; the component still renders its own error state. A fatal error means the whole embed failed: the token couldn't be read, any request failed because the token expired or is invalid, the dashboard, chart, or explore couldn't be loaded, or the component crashed. After the first fatal error, the component stops reporting until it remounts. To retry, remount it, for example by changing its React `key`. ```tsx theme={null} import Lightdash, { type SdkError } from '@lightdash/sdk'; import { useState } from 'react'; function Dashboard({ token }: { token: string }) { const [error, setError] = useState(null); const [attempt, setAttempt] = useState(0); if (error?.fatal) { return (

We couldn't load this report.

{error.retryable && ( )}
); } return ( ); } ``` For `Lightdash.AiAgent` in iframe mode, `onError` only reports token errors; in [native mode](#render-the-agent-natively) it reports every failure. ## Applying styles Override styles within Lightdash components to match your application's design. ### Supported style overrides ```typescript theme={null} styles?: { fontFamily?: string; // Sets all fonts within the component backgroundColor?: string; // Sets the background color or 'transparent' } ``` Both properties accept normal CSS values and are set on a `styles` object passed to any component. ### Font family Sets the font family for all text within the embedded content. Font sizes and other properties are preserved. ```typescript theme={null} ``` Some charts and components set `font-family` explicitly, so the `fontFamily` style is applied with higher specificity to override these. ### Background color Sets the background for the embedded content. Can be any color value or `'transparent'`. ```typescript theme={null} ``` ### Complete example ```typescript theme={null} ``` ### CSS class overrides Beyond the `styles` prop, you can target embedded dashboard elements directly from your application's stylesheet. Each element below carries a stable, human-readable classname that is part of the SDK's public API — it won't change when internal layout does, so your overrides stay resilient across releases. | Class | Element | | - | - | | `ld-dashboard-header` | The dashboard header bar | | `ld-dashboard-filters` | The filter bar row | | `ld-dashboard-filter` | An individual filter pill | | `ld-dashboard-date-zoom` | The date-zoom control(s) | | `ld-dashboard-parameters` | The parameters row | | `ld-dashboard-parameter` | An individual parameter pill | | `ld-dashboard-filter-dropdown` | An open filter's dropdown | | `ld-dashboard-date-zoom-dropdown` | The open date-zoom menu | | `ld-dashboard-parameter-dropdown` | An open parameter's dropdown | | `ld-dashboard-guided-setup` | The guided setup card shown while [required filters or requirement groups](/explore/dashboards/filter#required-filters-and-filter-requirement-groups) are unmet | ```css theme={null} .ld-dashboard-filters { gap: 1rem; } .ld-dashboard-filter-dropdown { font-size: 1rem; min-width: 380px; } ``` The filter, date-zoom, and parameter dropdowns render in a portal at the page root — outside the dashboard container — so target them with a global selector rather than as a descendant of the embedded dashboard. ## Light and dark mode Use the `theme` prop to render embedded content in either `'light'` or `'dark'` mode. This is typically driven by the host application's own theme state, so the embedded dashboard, chart, or explore matches the surrounding UI. ```tsx theme={null} ``` The `theme` prop is supported on `Lightdash.Dashboard`, `Lightdash.Chart`, and `Lightdash.Explore`. When `theme` is set, the SDK forces the Mantine color scheme and ignores any user-toggled preference stored in the embed. Omit the prop to let the embed use its default (light) color scheme. ### Syncing with your app's theme Pass your app's current theme value directly to the SDK so the embed re-renders when it changes: ```tsx theme={null} import Lightdash from '@lightdash/sdk'; import { useState } from 'react'; function EmbeddedDashboard() { const [theme, setTheme] = useState<'light' | 'dark'>('light'); return ( ); } ``` ### Combining with `styles.backgroundColor` When `theme` is set, the embed uses the matching Mantine body background by default. If you also pass `styles.backgroundColor`, your value takes precedence: ```tsx theme={null} ``` ## Color palettes You can customize the appearance of embedded dashboards using color palettes. Define multiple color palettes in your organization settings, then apply them to embedded dashboards using the `paletteUuid` prop. For more on customizing appearance, see [customizing the appearance of your project](/workspace-admin/appearance). ### Setting up color palettes 1. Go to **Organization settings > Appearance** in Lightdash 2. Define one or more color palettes 3. Copy the palette UUID for the palette you want to use (or fetch from API `GET /api/v1/org/color-palettes`) ### Applying a palette Pass the `paletteUuid` prop to the `Lightdash.Dashboard` component: ```tsx theme={null} ``` ## Filtering data Pass `filters` to `` to filter dimensions by value. The filters in this prop combine with AND. The Chart and Explore components do not support the `filters` prop. When you pass `filters`, they replace the dashboard's saved dimension filters for that embed instead of adding to them. [Locked](/explore/dashboards/filter#locking-dashboard-filters) saved filters are the exception: they stay applied, and an SDK filter on a locked field is ignored. Each SDK filter applies to every tile that has a field with the same name and type as the `model` and `field` you pass. Any per-tile targets set on the dashboard filter's **Tiles** (or **Tabs & tiles**) tab aren't used. A tile with no matching field isn't filtered. > [!WARNING] > > For the `filters` prop to work, your JWT must have `dashboardFiltersInteractivity` set to `enabled: 'all'`. Without this configuration, filters will not be applied. ### Filter structure ```typescript theme={null} type SdkFilter = { model: string; // The model the dimension is part of field: string; // The name of the dimension to filter by operator: FilterOperator; // The filter operator (enum) value: unknown | unknown[]; // The value(s) to filter against }; ``` ### Basic example ```javascript theme={null} ``` ### Multiple filters Filters are applied as AND operations: ```javascript theme={null} ``` ### FilterOperator enum Import `FilterOperator` from the SDK: ```typescript theme={null} import Lightdash, { FilterOperator } from '@lightdash/sdk'; ``` Available operators: | Operator | Description | Value Type | | - | - | - | | `FilterOperator.IS_NULL` | Field is null | n/a | | `FilterOperator.NOT_NULL` | Field is not null | n/a | | `FilterOperator.EQUALS` | Field equals value | single value | | `FilterOperator.NOT_EQUALS` | Field does not equal value | single value | | `FilterOperator.STARTS_WITH` | Field starts with value | single value | | `FilterOperator.ENDS_WITH` | Field ends with value | single value | | `FilterOperator.INCLUDE` | Field includes any of values | array | | `FilterOperator.NOT_INCLUDE` | Field does not include values | array | | `FilterOperator.LESS_THAN` | Field is less than value | single value | | `FilterOperator.LESS_THAN_OR_EQUAL` | Field is ≤ value | single value | | `FilterOperator.GREATER_THAN` | Field is greater than value | single value | | `FilterOperator.GREATER_THAN_OR_EQUAL` | Field is ≥ value | single value | | `FilterOperator.IN_THE_PAST` | Date in the past N units | single value | | `FilterOperator.NOT_IN_THE_PAST` | Date not in past N units | single value | | `FilterOperator.IN_THE_NEXT` | Date in the next N units | single value | | `FilterOperator.IN_THE_CURRENT` | Date in current period | single value | | `FilterOperator.NOT_IN_THE_CURRENT` | Date not in current period | single value | | `FilterOperator.IN_BETWEEN` | Field between two values | array with 2 values | | `FilterOperator.NOT_IN_BETWEEN` | Field not between values | array with 2 values | ### Available fields Only fields that are available for filtering can be filtered. These are specified in the JWT passed to the SDK. To generate tokens with filterable fields, configure your embed in the Lightdash UI or include the appropriate fields in your JWT structure. ## Localization The React SDK has two translation props, split by what they translate: | Prop | Translates | Shape | | - | - | - | | `contentOverrides` | **Your content**: dashboard and chart names, tile titles, markdown, custom filter labels | `LanguageMap`, slug-keyed, generated with `lightdash download --language-map` | | `uiOverrides` | **Lightdash's UI**: filter operators and inputs, the filter popover, date zoom, tile menus, export buttons | Flat `{ key: string }` map with a fixed, typed key set | There is no locale setting and no bundled language packs. Your app owns locale state and passes the translated strings for the language it wants. Anything you don't override renders in the built-in English. Both props are accepted by `Lightdash.Dashboard`, `Lightdash.DashboardBuilder`, `Lightdash.Chart`, and `Lightdash.Explore`. They are React SDK props only; [iframe embeds](/embed/iframe) are not translatable. ### Translating your content with `contentOverrides` `contentOverrides` translates the content you author in Lightdash: dashboard names and descriptions, tile titles, chart names, axis labels, series names, markdown content, and the custom labels you've set on dashboard filters. Recommended tools: * **Translation maps** – The Lightdash CLI can generate translation maps when downloading content as code * **Runtime translation management** – Use a translation library like `i18next` * **Translation production tools** – Tools like **Locize** help manage translations efficiently #### Video overview [https://www.loom.com/embed/d664260545624198b9d4074401c6fb6f?sid=292691a9-5cd9-4504-80b3-bcd6cd874558](https://www.loom.com/embed/d664260545624198b9d4074401c6fb6f?sid=292691a9-5cd9-4504-80b3-bcd6cd874558) #### Translation maps The Lightdash CLI can produce translation maps for dashboards and charts. To include translation maps when downloading content, add the `--language-map` flag: ```bash theme={null} lightdash download --language-map ``` Alongside each downloaded dashboard and chart, there will be a `.language.map.yml` file containing translatable strings. **Example translation map:** ```yaml theme={null} dashboard: sdk-dash: name: SDK dashboard demo description: "A dashboard demonstrating SDK features" filters: labels: Completed orders: Completed orders Order period: Order period tiles: - type: markdown properties: title: SDK demo dashboard content: >- This dashboard contains various tile types for showing SDK features. - type: saved_chart properties: title: "How do payment methods vary across different amount ranges?" ``` These translation maps can be imported into tools like Locize to begin translation. **Filter labels.** If a dashboard has filters with custom labels, the map includes a `filters.labels` block mapping each source label to its translation. Replace the right-hand values with the translated strings. Entries are keyed by the source label rather than by position, so translations keep working when filters are reordered, added, or removed. Renaming a filter label in Lightdash invalidates its entry, and the filter pill falls back to the untranslated label until you regenerate the map. Filters without a custom label show the field name, which isn't translatable. > [!NOTE] > > Translations only change what viewers see. When someone saves an embedded dashboard in edit mode, Lightdash keeps the source filter labels, so the saved dashboard is unchanged for other languages. #### Runtime translation At runtime, pass a translation object to the SDK's `contentOverrides` prop. We suggest using `i18Next` to load translations: ```typescript theme={null} import i18n from 'i18next'; ``` #### Setting up i18Next with Locize ```typescript theme={null} import i18next from 'i18next'; import { initReactI18next } from 'react-i18next'; import Locize from 'i18next-locize-backend'; i18next .use(Locize) // Add Locize backend .use(initReactI18next) // Bind react-i18next .init({ // Locize configuration backend: { projectId: 'your-locize-project-id', apiKey: 'your-api-key', referenceLng: 'en', }, lng: 'en', fallbackLng: 'en', interpolation: { escapeValue: false, }, }); ``` ### Translating the Lightdash UI with `uiOverrides` `uiOverrides` translates the interface Lightdash renders around your content: filter operators and inputs, the add/edit filter popover, the date zoom control, tile menus, and dashboard export buttons. Pass a flat object mapping keys to translated strings. The key set is exported as the TypeScript type `SdkUiOverrides` from `@lightdash/sdk`, so editors autocomplete every key and unknown keys are compile errors. ```tsx theme={null} import Lightdash, { type SdkUiOverrides } from '@lightdash/sdk'; const frenchUi: SdkUiOverrides = { 'filters.addFilter': 'Ajouter un filtre', 'filters.apply': 'Appliquer', 'filters.operators.equals': 'est', 'filters.operators.inThePast': 'au cours des derniers', 'filters.unitsOfTime.days.plural': 'jours', 'filters.unitsOfTime.days.completedPlural': 'jours révolus', 'dateZoom.defaultZoom': 'Zoom par défaut', 'tileMenu.downloadData': 'Télécharger les données', }; ; ``` > [!NOTE] > > Both the `@lightdash/sdk` package and your Lightdash instance must be on a version that includes `uiOverrides`. If you self-host, upgrade your instance as well, since the strings render inside Lightdash's UI. There is no feature flag; `uiOverrides` is available wherever embedding is available. #### Available keys Keys are flat dot-paths, namespaced by the surface they translate: * `filters.*` – operator labels (including date-specific variants), units of time, filter pills, the add/edit filter popover, value inputs, autocomplete states, the collapsed filter-bar summary, cross-filtering menu items, and the required-filters flow viewers see * `dateZoom.*` – the date zoom control, granularity names, tooltips, and the per-tile zoom indicator * `tileMenu.*` – the tile menu: Explore from here, Download data, Export image, View underlying data * `dashboard.*` – dashboard-level export and print buttons * `explorer.*` – the Back button that returns from an embedded Explore to the dashboard, chart, or starting query Every key is also exported through the `SdkUiOverrides` type in `@lightdash/sdk`, so your editor autocompletes the full set. The keys for the surfaces above, with the built-in English defaults: > [accordion] All translatable keys with English defaults > > ```json theme={null} > { > "tileMenu.exploreFromHere": "Explore from here", > "tileMenu.downloadData": "Download data", > "tileMenu.exportImage": "Export image", > "tileMenu.viewUnderlyingData": "View underlying data", > "dateZoom.defaultZoom": "Default zoom", > "dateZoom.none": "None", > "dateZoom.viewModeTooltip": "Charts will display dates using their original granularity settings.", > "dateZoom.appliesToOneChart": "Applies to {n} chart not in a zoom control", > "dateZoom.appliesToManyCharts": "Applies to {n} charts not in a zoom control", > "dateZoom.noChartsUseDefault": "No charts use the default (every chart is in a zoom control)", > "dateZoom.granularities.Second": "Second", > "dateZoom.granularities.Minute": "Minute", > "dateZoom.granularities.Hour": "Hour", > "dateZoom.granularities.Day": "Day", > "dateZoom.granularities.Week": "Week", > "dateZoom.granularities.Month": "Month", > "dateZoom.granularities.Quarter": "Quarter", > "dateZoom.granularities.Year": "Year", > "dateZoom.dateZoomLabel": "Date zoom:", > "dateZoom.onLabel": "On:", > "filters.summary.filterSingular": "filter", > "filters.summary.filterPlural": "filters", > "filters.summary.parameterSingular": "parameter", > "filters.summary.parameterPlural": "parameters", > "filters.summary.dateZoomLabel": "Date Zoom:", > "filters.summary.default": "Default", > "filters.summary.showFilters": "Show filters", > "filters.operators.isNull": "is null", > "filters.operators.notNull": "is not null", > "filters.operators.equals": "is", > "filters.operators.notEquals": "is not", > "filters.operators.startsWith": "starts with", > "filters.operators.endsWith": "ends with", > "filters.operators.doesNotInclude": "does not include", > "filters.operators.include": "includes", > "filters.operators.lessThan": "is less than", > "filters.operators.lessThanOrEqual": "is less than or equal", > "filters.operators.greaterThan": "is greater than", > "filters.operators.greaterThanOrEqual": "is greater than or equal", > "filters.operators.inThePast": "in the last", > "filters.operators.notInThePast": "not in the last", > "filters.operators.inTheNext": "in the next", > "filters.operators.inTheCurrent": "in the current", > "filters.operators.notInTheCurrent": "not in the current", > "filters.operators.inBetween": "is between", > "filters.operators.notInBetween": "is not between", > "filters.operators.inPeriodToDate": "in all", > "filters.dateOperators.lessThan": "is before", > "filters.dateOperators.lessThanOrEqual": "is on or before", > "filters.dateOperators.greaterThan": "is after", > "filters.dateOperators.greaterThanOrEqual": "is on or after", > "filters.dateOperators.inBetween": "is between", > "filters.operators.inPeriodToDateDropdown": "in all periods to date", > "filters.operators.inPeriodToDateDescription": "Trims every period in the range to the same point as today — e.g. with weeks selected, if today is Thursday, you get Mon–Thu of every week. Useful for like-for-like comparisons (WTD, MTD, QTD, YTD). For just the current period so far, use \"in the current\" instead.", > "filters.nullValue": "(null)", > "filters.betweenJoiner": "and", > "filters.selectValuePlaceholder": "Select value", > "filters.selectPeriodPlaceholder": "Select period", > "filters.periodToDate.years": "year to date", > "filters.periodToDate.quarters": "quarter to date", > "filters.periodToDate.months": "month to date", > "filters.periodToDate.weeks": "week to date", > "filters.periodToDate.fallback": "period to date", > "filters.periodToDateSelect.years": "years to date", > "filters.periodToDateSelect.quarters": "quarters to date", > "filters.periodToDateSelect.months": "months to date", > "filters.periodToDateSelect.weeks": "weeks to date", > "filters.unitsOfTime.milliseconds.singular": "millisecond", > "filters.unitsOfTime.milliseconds.plural": "milliseconds", > "filters.unitsOfTime.milliseconds.completedSingular": "completed millisecond", > "filters.unitsOfTime.milliseconds.completedPlural": "completed milliseconds", > "filters.unitsOfTime.seconds.singular": "second", > "filters.unitsOfTime.seconds.plural": "seconds", > "filters.unitsOfTime.seconds.completedSingular": "completed second", > "filters.unitsOfTime.seconds.completedPlural": "completed seconds", > "filters.unitsOfTime.minutes.singular": "minute", > "filters.unitsOfTime.minutes.plural": "minutes", > "filters.unitsOfTime.minutes.completedSingular": "completed minute", > "filters.unitsOfTime.minutes.completedPlural": "completed minutes", > "filters.unitsOfTime.hours.singular": "hour", > "filters.unitsOfTime.hours.plural": "hours", > "filters.unitsOfTime.hours.completedSingular": "completed hour", > "filters.unitsOfTime.hours.completedPlural": "completed hours", > "filters.unitsOfTime.days.singular": "day", > "filters.unitsOfTime.days.plural": "days", > "filters.unitsOfTime.days.completedSingular": "completed day", > "filters.unitsOfTime.days.completedPlural": "completed days", > "filters.unitsOfTime.weeks.singular": "week", > "filters.unitsOfTime.weeks.plural": "weeks", > "filters.unitsOfTime.weeks.completedSingular": "completed week", > "filters.unitsOfTime.weeks.completedPlural": "completed weeks", > "filters.unitsOfTime.months.singular": "month", > "filters.unitsOfTime.months.plural": "months", > "filters.unitsOfTime.months.completedSingular": "completed month", > "filters.unitsOfTime.months.completedPlural": "completed months", > "filters.unitsOfTime.quarters.singular": "quarter", > "filters.unitsOfTime.quarters.plural": "quarters", > "filters.unitsOfTime.quarters.completedSingular": "completed quarter", > "filters.unitsOfTime.quarters.completedPlural": "completed quarters", > "filters.unitsOfTime.years.singular": "year", > "filters.unitsOfTime.years.plural": "years", > "filters.unitsOfTime.years.completedSingular": "completed year", > "filters.unitsOfTime.years.completedPlural": "completed years", > "filters.addFilter": "Add filter", > "filters.apply": "Apply", > "filters.isAnyValue": "is any value", > "filters.requiredFilterTooltip": "This is a required filter defined in the model configuration and cannot be removed.", > "filters.placeholders.anyValue": "any value", > "filters.placeholders.enterValue": "Enter value", > "filters.placeholders.enterValues": "Enter value(s)", > "filters.placeholders.startTyping": "Start typing to filter results", > "filters.placeholders.selectDate": "Select a date", > "filters.placeholders.selectDates": "Select date(s)", > "filters.placeholders.selectValue": "Select a value", > "filters.autocomplete.loading": "Loading...", > "filters.autocomplete.noResults": "No results found", > "filters.autocomplete.addValue": "Add \"{value}\"", > "filters.autocomplete.maxResultsContinue": "Showing first {n} results. Continue typing...", > "filters.autocomplete.maxResultsStart": "Showing first {n} results. Start typing...", > "filters.autocomplete.editValuesTooltip": "Edit filter values", > "filters.autocomplete.filterNotAvailable": "Filter not available", > "filters.values.true": "True", > "filters.values.false": "False", > "filters.config.filterSettingsTab": "Filter Settings", > "filters.config.filterSettingsTabTooltip": "Select the value you want to filter your dimension by", > "filters.config.tilesTab": "Tiles", > "filters.config.tilesTabTooltip": "Select tiles to apply filter to and which field to filter by", > "filters.config.tabsAndTilesTab": "Tabs & tiles", > "filters.config.tabsAndTilesTabTooltip": "Select which tabs and tiles this filter applies to", > "filters.config.selectField": "Select a field to filter", > "filters.config.selectFilterPlaceholder": "Select a filter", > "filters.config.searchFieldPlaceholder": "Search field...", > "filters.actions.cancel": "Cancel", > "filters.actions.clearAll": "Clear all", > "filters.config.applyRequiredTooltip": "Filter field and value required", > "filters.config.applyLockedRequiredTooltip": "A locked, required filter must have a value", > "filters.config.resetToOriginal": "Reset to original value", > "filters.config.resetToOriginalAria": "Reset filter to original value", > "filters.config.selectColumn": "Select a column to filter", > "filters.config.searchColumnPlaceholder": "Search column...", > "filters.config.noMatchingFields": "No matching fields", > "filters.config.fieldsInThisTab": "Fields in this tab", > "filters.config.otherAvailableFields": "Other available fields", > "filters.config.valueLabel": "Value", > "filters.config.clearToAnyValue": "Clear to any value", > "filters.config.alreadyAnyValue": "Already showing any value", > "filters.config.noValueToClear": "No value to clear", > "filters.config.expandTab": "Expand tab", > "filters.config.collapseTab": "Collapse tab", > "filters.config.noTilesInTab": "No tiles in this tab", > "filters.config.noFieldsMatchingType": "No fields matching filter type", > "filters.config.fieldNotAvailableInChart": "The selected field '{field}' is not available in this chart", > "filters.coverage.noMatchingCharts": "No charts have a matching field for this filter.", > "filters.coverage.reviewTileTargets": "Review tile targets", > "filters.coverage.wontAffectCurrentTab": "This filter won't affect charts on the current tab.", > "filters.coverage.appliesAutomaticallyTo": "It applies automatically to:", > "filters.coverage.reviewAndChangeTarget": "Review tile targets and change the filter target", > "filters.notAppliedToAnyTiles": "This filter is not applied to any tiles", > "filters.notAppliedToAnyTabs": "This filter is not applied to any tabs", > "filters.filterIsLocked": "Filter is locked", > "filters.filterIsLockedOnTab": "Filter is locked on this tab", > "filters.tableLabel": "Table: ", > "filters.tablesLabel": "Tables: ", > "filters.invalidFilter": "Invalid filter", > "filters.required.setValueTooltip": "Required: set a value to run this dashboard", > "filters.required.setValueGroupTooltip": "Required: set a value on this or an alternative filter to run this dashboard", > "filters.required.modalTitle": "Set filters to load this dashboard", > "filters.required.modalDescription": "Data loads automatically once the filters below are set.", > "filters.required.change": "Change", > "filters.required.setInToolbar": "Set filters in the toolbar instead", > "filters.crossFilter.menuLabel": "Filter dashboard on {field} to", > "filters.crossFilter.showOnly": "Show only", > "filters.crossFilter.exclude": "Exclude", > "filters.inputs.startDate": "Start date", > "filters.inputs.endDate": "End date", > "filters.inputs.minValue": "Min value", > "filters.inputs.maxValue": "Max value", > "filters.inputs.bothValuesRequired": "Both values are required", > "filters.inputs.minLessThanMax": "Minimum should be less than the maximum", > "filters.inputs.typeToAddValue": "Please type to add the filter value", > "filters.inputs.selectQuarter": "Select Quarter", > "filters.inputs.pasteDetected": "Multiple comma-separated values detected:", > "filters.inputs.pasteQuestion": "Would you like to add them as single or multiple values?", > "filters.inputs.singleValue": "Single value", > "filters.inputs.multipleValues": "Multiple values", > "filters.autocomplete.manageValuesTooltip": "Manage filter values", > "filters.autocomplete.refreshTooltip": "Click to refresh filter values", > "filters.autocomplete.resultsLoadedAt": "Results loaded at {time}", > "filters.manageValues.title": "Manage values", > "filters.manageValues.filterValuesTitle": "Manage filter values", > "filters.manageValues.clearAllValues": "Clear all values", > "filters.manageValues.importCsv": "Import CSV", > "filters.manageValues.importCsvAria": "Import CSV file", > "filters.manageValues.selectAllShown": "Select all shown", > "filters.manageValues.selections": "Selections", > "filters.manageValues.searchPlaceholder": "Search values…", > "filters.manageValues.valuesCount": "{n} values", > "filters.manageValues.selectedCount": "({n} selected)", > "filters.manageValues.noValuesYet": "No values yet", > "filters.manageValues.noMatches": "No matches", > "filters.manageValues.tryDifferentSearch": "Try a different search.", > "filters.manageValues.importCsvHint": "Import a CSV to populate this filter, then you can review and remove items here.", > "filters.resetAll": "Reset all filters", > "filters.unsavedFiltersTooltip": "Filters you add are not saved", > "filters.summary.hideFilters": "Hide filters", > "filters.summary.hide": "Hide", > "dashboard.exportAllTiles": "Export all tiles", > "dashboard.printPage": "Print this page", > "dashboard.exportPdf": "Export as PDF", > "explorer.back": "Back", > "explorer.backToDashboard": "Back to Dashboard", > "explorer.backToChart": "Back to Chart" > } > ``` > [accordion] Complete Spanish example > > ```json theme={null} > { > "tileMenu.exploreFromHere": "Explorar desde aquí", > "tileMenu.downloadData": "Descargar datos", > "tileMenu.exportImage": "Exportar imagen", > "tileMenu.viewUnderlyingData": "Ver datos subyacentes", > "dateZoom.defaultZoom": "Zoom predeterminado", > "dateZoom.none": "Ninguno", > "dateZoom.viewModeTooltip": "Los gráficos mostrarán las fechas con su granularidad original.", > "dateZoom.appliesToOneChart": "Se aplica a {n} gráfico fuera de un control de zoom", > "dateZoom.appliesToManyCharts": "Se aplica a {n} gráficos fuera de un control de zoom", > "dateZoom.noChartsUseDefault": "Ningún gráfico usa el predeterminado (todos están en un control de zoom)", > "dateZoom.granularities.Second": "Segundo", > "dateZoom.granularities.Minute": "Minuto", > "dateZoom.granularities.Hour": "Hora", > "dateZoom.granularities.Day": "Día", > "dateZoom.granularities.Week": "Semana", > "dateZoom.granularities.Month": "Mes", > "dateZoom.granularities.Quarter": "Trimestre", > "dateZoom.granularities.Year": "Año", > "dateZoom.dateZoomLabel": "Zoom de fecha:", > "dateZoom.onLabel": "En:", > "filters.summary.filterSingular": "filtro", > "filters.summary.filterPlural": "filtros", > "filters.summary.parameterSingular": "parámetro", > "filters.summary.parameterPlural": "parámetros", > "filters.summary.dateZoomLabel": "Zoom de fecha:", > "filters.summary.default": "Predeterminado", > "filters.summary.showFilters": "Mostrar filtros", > "filters.operators.isNull": "es nulo", > "filters.operators.notNull": "no es nulo", > "filters.operators.equals": "es", > "filters.operators.notEquals": "no es", > "filters.operators.startsWith": "empieza por", > "filters.operators.endsWith": "termina en", > "filters.operators.doesNotInclude": "no incluye", > "filters.operators.include": "incluye", > "filters.operators.lessThan": "es menor que", > "filters.operators.lessThanOrEqual": "es menor o igual que", > "filters.operators.greaterThan": "es mayor que", > "filters.operators.greaterThanOrEqual": "es mayor o igual que", > "filters.operators.inThePast": "en los últimos", > "filters.operators.notInThePast": "no en los últimos", > "filters.operators.inTheNext": "en los próximos", > "filters.operators.inTheCurrent": "en este", > "filters.operators.notInTheCurrent": "no en este", > "filters.operators.inBetween": "está entre", > "filters.operators.notInBetween": "no está entre", > "filters.operators.inPeriodToDate": "en todos", > "filters.dateOperators.lessThan": "es antes de", > "filters.dateOperators.lessThanOrEqual": "es el o antes de", > "filters.dateOperators.greaterThan": "es después de", > "filters.dateOperators.greaterThanOrEqual": "es el o después de", > "filters.dateOperators.inBetween": "está entre", > "filters.operators.inPeriodToDateDropdown": "en todos los períodos hasta la fecha", > "filters.operators.inPeriodToDateDescription": "Recorta cada período del rango al mismo punto que hoy; p. ej., con semanas seleccionadas, si hoy es jueves, obtienes de lunes a jueves de cada semana. Útil para comparaciones equivalentes (WTD, MTD, QTD, YTD). Para solo el período actual, usa «en este».", > "filters.nullValue": "(nulo)", > "filters.betweenJoiner": "y", > "filters.selectValuePlaceholder": "Seleccionar valor", > "filters.selectPeriodPlaceholder": "Seleccionar período", > "filters.periodToDate.years": "año hasta la fecha", > "filters.periodToDate.quarters": "trimestre hasta la fecha", > "filters.periodToDate.months": "mes hasta la fecha", > "filters.periodToDate.weeks": "semana hasta la fecha", > "filters.periodToDate.fallback": "período hasta la fecha", > "filters.periodToDateSelect.years": "años hasta la fecha", > "filters.periodToDateSelect.quarters": "trimestres hasta la fecha", > "filters.periodToDateSelect.months": "meses hasta la fecha", > "filters.periodToDateSelect.weeks": "semanas hasta la fecha", > "filters.unitsOfTime.milliseconds.singular": "milisegundo", > "filters.unitsOfTime.milliseconds.plural": "milisegundos", > "filters.unitsOfTime.milliseconds.completedSingular": "milisegundo completo", > "filters.unitsOfTime.milliseconds.completedPlural": "milisegundos completos", > "filters.unitsOfTime.seconds.singular": "segundo", > "filters.unitsOfTime.seconds.plural": "segundos", > "filters.unitsOfTime.seconds.completedSingular": "segundo completo", > "filters.unitsOfTime.seconds.completedPlural": "segundos completos", > "filters.unitsOfTime.minutes.singular": "minuto", > "filters.unitsOfTime.minutes.plural": "minutos", > "filters.unitsOfTime.minutes.completedSingular": "minuto completo", > "filters.unitsOfTime.minutes.completedPlural": "minutos completos", > "filters.unitsOfTime.hours.singular": "hora", > "filters.unitsOfTime.hours.plural": "horas", > "filters.unitsOfTime.hours.completedSingular": "hora completa", > "filters.unitsOfTime.hours.completedPlural": "horas completas", > "filters.unitsOfTime.days.singular": "día", > "filters.unitsOfTime.days.plural": "días", > "filters.unitsOfTime.days.completedSingular": "día completo", > "filters.unitsOfTime.days.completedPlural": "días completos", > "filters.unitsOfTime.weeks.singular": "semana", > "filters.unitsOfTime.weeks.plural": "semanas", > "filters.unitsOfTime.weeks.completedSingular": "semana completa", > "filters.unitsOfTime.weeks.completedPlural": "semanas completas", > "filters.unitsOfTime.months.singular": "mes", > "filters.unitsOfTime.months.plural": "meses", > "filters.unitsOfTime.months.completedSingular": "mes completo", > "filters.unitsOfTime.months.completedPlural": "meses completos", > "filters.unitsOfTime.quarters.singular": "trimestre", > "filters.unitsOfTime.quarters.plural": "trimestres", > "filters.unitsOfTime.quarters.completedSingular": "trimestre completo", > "filters.unitsOfTime.quarters.completedPlural": "trimestres completos", > "filters.unitsOfTime.years.singular": "año", > "filters.unitsOfTime.years.plural": "años", > "filters.unitsOfTime.years.completedSingular": "año completo", > "filters.unitsOfTime.years.completedPlural": "años completos", > "filters.addFilter": "Añadir filtro", > "filters.apply": "Aplicar", > "filters.isAnyValue": "es cualquier valor", > "filters.requiredFilterTooltip": "Este filtro es obligatorio, definido en la configuración del modelo, y no se puede eliminar.", > "filters.placeholders.anyValue": "cualquier valor", > "filters.placeholders.enterValue": "Introducir valor", > "filters.placeholders.enterValues": "Introducir valor(es)", > "filters.placeholders.startTyping": "Escribe para filtrar resultados", > "filters.placeholders.selectDate": "Seleccionar una fecha", > "filters.placeholders.selectDates": "Seleccionar fecha(s)", > "filters.placeholders.selectValue": "Seleccionar un valor", > "filters.autocomplete.loading": "Cargando...", > "filters.autocomplete.noResults": "Sin resultados", > "filters.autocomplete.addValue": "Añadir \"{value}\"", > "filters.autocomplete.maxResultsContinue": "Mostrando los primeros {n} resultados. Sigue escribiendo...", > "filters.autocomplete.maxResultsStart": "Mostrando los primeros {n} resultados. Empieza a escribir...", > "filters.autocomplete.editValuesTooltip": "Editar valores del filtro", > "filters.autocomplete.filterNotAvailable": "Filtro no disponible", > "filters.values.true": "Verdadero", > "filters.values.false": "Falso", > "filters.config.filterSettingsTab": "Configuración del filtro", > "filters.config.filterSettingsTabTooltip": "Selecciona el valor por el que filtrar tu dimensión", > "filters.config.tilesTab": "Mosaicos", > "filters.config.tilesTabTooltip": "Selecciona los mosaicos a los que aplicar el filtro y el campo por el que filtrar", > "filters.config.tabsAndTilesTab": "Pestañas y mosaicos", > "filters.config.tabsAndTilesTabTooltip": "Selecciona a qué pestañas y mosaicos se aplica este filtro", > "filters.config.selectField": "Selecciona un campo para filtrar", > "filters.config.selectFilterPlaceholder": "Selecciona un filtro", > "filters.config.searchFieldPlaceholder": "Buscar campo...", > "filters.actions.cancel": "Cancelar", > "filters.actions.clearAll": "Borrar todo", > "filters.config.applyRequiredTooltip": "Se requiere campo y valor del filtro", > "filters.config.applyLockedRequiredTooltip": "Un filtro bloqueado y obligatorio debe tener un valor", > "filters.config.resetToOriginal": "Restablecer al valor original", > "filters.config.resetToOriginalAria": "Restablecer el filtro al valor original", > "filters.config.selectColumn": "Selecciona una columna para filtrar", > "filters.config.searchColumnPlaceholder": "Buscar columna...", > "filters.config.noMatchingFields": "No hay campos coincidentes", > "filters.config.fieldsInThisTab": "Campos en esta pestaña", > "filters.config.otherAvailableFields": "Otros campos disponibles", > "filters.config.valueLabel": "Valor", > "filters.config.clearToAnyValue": "Borrar a cualquier valor", > "filters.config.alreadyAnyValue": "Ya muestra cualquier valor", > "filters.config.noValueToClear": "No hay valor que borrar", > "filters.config.expandTab": "Expandir pestaña", > "filters.config.collapseTab": "Contraer pestaña", > "filters.config.noTilesInTab": "No hay mosaicos en esta pestaña", > "filters.config.noFieldsMatchingType": "No hay campos que coincidan con el tipo de filtro", > "filters.config.fieldNotAvailableInChart": "El campo seleccionado '{field}' no está disponible en este gráfico", > "filters.coverage.noMatchingCharts": "Ningún gráfico tiene un campo que coincida con este filtro.", > "filters.coverage.reviewTileTargets": "Revisar los mosaicos de destino", > "filters.coverage.wontAffectCurrentTab": "Este filtro no afectará a los gráficos de la pestaña actual.", > "filters.coverage.appliesAutomaticallyTo": "Se aplica automáticamente a:", > "filters.coverage.reviewAndChangeTarget": "Revisar los mosaicos de destino y cambiar el destino del filtro", > "filters.notAppliedToAnyTiles": "Este filtro no se aplica a ningún mosaico", > "filters.notAppliedToAnyTabs": "Este filtro no se aplica a ninguna pestaña", > "filters.filterIsLocked": "El filtro está bloqueado", > "filters.filterIsLockedOnTab": "El filtro está bloqueado en esta pestaña", > "filters.tableLabel": "Tabla: ", > "filters.tablesLabel": "Tablas: ", > "filters.invalidFilter": "Filtro no válido", > "filters.required.setValueTooltip": "Obligatorio: establece un valor para ejecutar este tablero", > "filters.required.setValueGroupTooltip": "Obligatorio: establece un valor en este filtro o en uno alternativo para ejecutar este tablero", > "filters.required.modalTitle": "Establece filtros para cargar este tablero", > "filters.required.modalDescription": "Los datos se cargan automáticamente cuando se establecen los filtros siguientes.", > "filters.required.change": "Cambiar", > "filters.required.setInToolbar": "Establecer los filtros en la barra de herramientas", > "filters.crossFilter.menuLabel": "Filtrar el tablero por {field} para", > "filters.crossFilter.showOnly": "Mostrar solo", > "filters.crossFilter.exclude": "Excluir", > "filters.inputs.startDate": "Fecha de inicio", > "filters.inputs.endDate": "Fecha de fin", > "filters.inputs.minValue": "Valor mínimo", > "filters.inputs.maxValue": "Valor máximo", > "filters.inputs.bothValuesRequired": "Ambos valores son obligatorios", > "filters.inputs.minLessThanMax": "El mínimo debe ser menor que el máximo", > "filters.inputs.typeToAddValue": "Escribe para añadir el valor del filtro", > "filters.inputs.selectQuarter": "Seleccionar trimestre", > "filters.inputs.pasteDetected": "Se detectaron varios valores separados por comas:", > "filters.inputs.pasteQuestion": "¿Quieres añadirlos como un solo valor o como varios?", > "filters.inputs.singleValue": "Valor único", > "filters.inputs.multipleValues": "Varios valores", > "filters.autocomplete.manageValuesTooltip": "Gestionar valores del filtro", > "filters.autocomplete.refreshTooltip": "Haz clic para actualizar los valores del filtro", > "filters.autocomplete.resultsLoadedAt": "Resultados cargados a las {time}", > "filters.manageValues.title": "Gestionar valores", > "filters.manageValues.filterValuesTitle": "Gestionar valores del filtro", > "filters.manageValues.clearAllValues": "Borrar todos los valores", > "filters.manageValues.importCsv": "Importar CSV", > "filters.manageValues.importCsvAria": "Importar archivo CSV", > "filters.manageValues.selectAllShown": "Seleccionar todos los mostrados", > "filters.manageValues.selections": "Selecciones", > "filters.manageValues.searchPlaceholder": "Buscar valores…", > "filters.manageValues.valuesCount": "{n} valores", > "filters.manageValues.selectedCount": "({n} seleccionados)", > "filters.manageValues.noValuesYet": "Aún no hay valores", > "filters.manageValues.noMatches": "Sin coincidencias", > "filters.manageValues.tryDifferentSearch": "Prueba otra búsqueda.", > "filters.manageValues.importCsvHint": "Importa un CSV para poblar este filtro; después podrás revisar y eliminar elementos aquí.", > "filters.resetAll": "Restablecer todos los filtros", > "filters.unsavedFiltersTooltip": "Los filtros que añadas no se guardan", > "filters.summary.hideFilters": "Ocultar filtros", > "filters.summary.hide": "Ocultar", > "dashboard.exportAllTiles": "Exportar todos los mosaicos", > "dashboard.printPage": "Imprimir esta página", > "dashboard.exportPdf": "Exportar como PDF", > "explorer.back": "Volver", > "explorer.backToDashboard": "Volver al tablero", > "explorer.backToChart": "Volver al gráfico" > } > ``` A quick way to create a new translation: copy one of the examples above and ask an AI agent to translate the values into your target language. Keep the keys and any `{token}` placeholders unchanged, then review the output before shipping it. #### Key rules * **Every key is optional.** Partial dictionaries are fine; missing keys render in English. * **Keys are a stable, additive contract.** Existing keys are never renamed or removed across SDK versions. New UI may add keys, which fall back to English until you translate them. * **Keep `{token}` placeholders.** Some values contain placeholders that Lightdash fills at runtime, like `'filters.autocomplete.addValue': 'Add "{value}"'` or `'filters.crossFilter.menuLabel': 'Filter dashboard on {field} to'`. Keep the token, with its exact name in braces, somewhere in the translation. Its position is free. No other syntax is supported (not ICU MessageFormat). * **Plurals are one key per form.** Count-dependent strings exist as separate keys, like `filters.summary.filterSingular` / `filters.summary.filterPlural`, and units of time with `.singular` / `.plural` / `.completedSingular` / `.completedPlural` variants. There are no CLDR plural rules, so languages with more than two plural forms can only approximate. #### Using `uiOverrides` with an i18n framework Because the map is flat JSON, it drops directly into i18next-style resource files. Keep a `uiOverrides` object per locale and pass the active one: ```tsx theme={null} // locales/fr/translation.json → { "uiOverrides": { "filters.apply": "Appliquer", ... } } const uiOverrides = i18n.getResourceBundle(i18n.language, 'translation')?.uiOverrides; ; ``` Re-mounting the component on language change (the `key` prop) is the simplest way to re-render every string. ### What can be translated | Surface | Translatable with | | - | - | | Dashboard and chart names, descriptions, tile titles, axis labels, series names, markdown content, custom filter labels | `contentOverrides` | | Filter operators and inputs, the filter popover, date zoom, tile menus, export and print buttons | `uiOverrides` | Not translatable: * **Data from your warehouse** – string values in charts, dimension values, and raw table data render as they exist in your database * **Field and table names** – dimension and metric names shown in the field picker, and on filter pills without a custom label, come from your dbt schema * **Date picker internals** – month and weekday names inside calendar popups render in English * **Data formatting** – numbers, dates, and currencies render per chart config * **Editor-only UI** – dashboard edit mode is not translated ## Complete example Here's a full example integrating everything: ### Backend (Express + Node.js) ```javascript theme={null} // server.js import express from 'express'; import jwt from 'jsonwebtoken'; import cors from 'cors'; const app = express(); app.use(cors()); app.get('/api/dashboard-token', authenticateUser, async (req, res) => { const user = await getUserFromDatabase(req.user.id); const token = jwt.sign({ content: { type: 'dashboard', dashboardUuid: 'abc-123-def-456', dashboardFiltersInteractivity: { enabled: 'all' }, parameterInteractivity: { enabled: true }, canExportCsv: true, canExportImages: true, canExplore: true, canViewUnderlyingData: true, }, userAttributes: { tenant_id: user.tenantId, region: user.region, }, user: { externalId: user.id, email: user.email, }, }, process.env.LIGHTDASH_EMBED_SECRET, { expiresIn: '2h' }); res.json({ token, projectUuid: process.env.LIGHTDASH_PROJECT_UUID }); }); app.listen(3000); ``` ### Frontend (React) ```tsx theme={null} // Dashboard.tsx import { useState, useEffect } from 'react'; import Lightdash, { FilterOperator } from '@lightdash/sdk'; export function EmbeddedDashboard() { const [token, setToken] = useState(null); const [loading, setLoading] = useState(true); useEffect(() => { fetch('/api/dashboard-token') .then(res => res.json()) .then(data => { setToken(data.token); setLoading(false); }) .catch(err => { console.error('Failed to load token:', err); setLoading(false); }); }, []); if (loading) return
Loading analytics...
; if (!token) return
Failed to load dashboard
; return (
{ // Track analytics events, e.g. saves and filter changes analytics.track(`lightdash_${event.type}`, event.payload); }} />
); } ``` # Embedding reference Source: https://docs.lightdash.com/embed/reference Complete API reference for embedding Lightdash content securely using JWTs [Add-on](/support/feature-badges#add-ons) > [!NOTE] > > Embedding requires the embedding add-on for Cloud Pro or Enterprise. [Get in touch](https://lightdash.typeform.com/to/BujU5wg5) to add embedding to your plan. For self-hosted deployments, follow [embedding setup](/self-host/enterprise-features#embedding). > [!TIP] > > **Try it and see the code.** [embed.lightdash.com](https://embed.lightdash.com) is an interactive demo and helper that lets you preview embedded content and generate a JWT for your own project. For a working end-to-end example, see the [example embed app on GitHub](https://github.com/lightdash/example-embed-dashboard-with-nodejs-app) — a Node.js app that mints tokens server-side and renders a Lightdash dashboard. ## Overview This document provides complete API reference for JWT structure and configuration options used across all embedding methods. Lightdash supports two ways to embed content: * **iframe embedding** — Embed content inside your own web pages using a standard ` ``` Open the page and confirm the dashboard loads without asking for a Lightdash login. If it doesn't load, check the [iframe troubleshooting steps](/embed/iframe#troubleshooting). In your application, authenticate the viewer and check their access on your backend before generating each URL. Pass any user attributes from trusted server-side data. Return the URL to your frontend and set it as the iframe's `src`; generate another URL when the token expires. Anyone with a URL can use it until it expires. ## Configure viewer access Use the [dashboard embedding options](/embed/embed-dashboards#configure-what-viewers-can-do) to enable filters, exports, and Explore. For tenant-specific data, configure [user attributes](/embed/reference#user-attributes). To let viewers save or edit content, configure [write actions](/embed/reference#write-actions). # How to translate embedded dashboards Source: https://docs.lightdash.com/embed/translate-embedded-dashboards Serve an embedded dashboard in each viewer's own language, including the values inside the cells [Add-on](/support/feature-badges#add-ons) > [!NOTE] > > Embedding requires the embedding add-on for Cloud Pro or Enterprise. [Get in touch](https://lightdash.typeform.com/to/BujU5wg5) to add embedding to your plan. For self-hosted deployments, follow [embedding setup](/self-host/enterprise-features#embedding). A fully translated dashboard is two jobs rather than one. Everything a dashboard **labels** is translated in the browser by the React SDK. That covers chart titles, column headers, axis names, tile titles, filter labels and Lightdash's own buttons and menus. Everything a dashboard **shows** is translated in your warehouse. The status words inside the cells arrive at the SDK as query results rather than as text it can override, so no amount of SDK configuration will reach them. If you do the first job and not the second, your charts and headers read correctly in every language while your tables stay full of English values. This guide covers both halves and how to drive them from one language setting. The props themselves are documented in the [React SDK reference](/embed/react-sdk#localization). ## The surfaces you need to cover | What the viewer reads | Where it is translated | How | | - | - | - | | Chart names, descriptions, tile titles, tab names, column headers, axis names, filter labels | Browser | [`contentOverrides`](/embed/react-sdk#translating-your-content-with-contentoverrides) | | Dashboard parameter labels | Browser | `contentOverrides.parameters`, written by hand | | Filter operators, the filter popover, date zoom, tile menus, export buttons | Browser | [`uiOverrides`](/embed/react-sdk#translating-the-lightdash-ui-with-uioverrides) | | The values inside the cells, such as `PRE_INVOICED` | Warehouse | A dictionary column resolved by a dimension | | Your own navigation around the embed | Your app | Your app's existing translation setup | ## Getting the viewer's language to both halves The browser half and the warehouse half need the same answer to "which language is this viewer reading in", and they reach it by different routes. You can store the language as a [user attribute](/workspace-admin/user-attributes) in Lightdash and assign it to users or groups. That works well for people who open Lightdash directly. For embedded viewers, your own application usually already knows the answer, because the viewer picked a language there. Passing that value through avoids a second language setting that drifts out of step with the first. Put the locale in the embed token as a user attribute, which is the channel that carries it into warehouse queries. ```ts theme={null} { content: { type: 'dashboard', dashboardUuid: '...' }, user: { externalId: 'user-42' }, userAttributes: { language: locale }, expiresIn: '1 hour' } ``` Then pass the matching translations to the SDK, and include the locale in the React `key`. ```tsx theme={null} ``` A user attribute is baked into the token when it is minted, so changing language has to mint a new token. Keying the component on the locale is what makes the component remount and pick the new token up. > [!WARNING] > > Give the `language` attribute a [default value](/workspace-admin/user-attributes#setting-a-default-value-for-your-user-attribute). A dimension that reads an attribute the viewer does not have raises an error, and anyone signing in to Lightdash directly has no embed token to supply one. ## Translating your content The CLI generates a translation map for each chart and dashboard, which you fill in per locale and pass as `contentOverrides`. The format, the `--language-map` flag and the i18next workflow are covered in the [React SDK reference](/embed/react-sdk#translation-maps). Three things about the map are worth planning for before you translate 100 charts. **The download covers charts and dashboards, and nothing else.** The `uiOverrides` key set ships as the `SdkUiOverrides` type in `@lightdash/sdk` rather than in the download, and the `parameters` section is not generated at all. If your build regenerates the map from the download on every run, carry those sections over explicitly, otherwise a build will quietly drop them. **Only labels that are saved on the chart or dashboard can be overridden.** A column that nobody has renamed has no entry in the map, because the map is built from the names your content actually stores. Setting a label in your dbt YAML and saving the chart with it gives the column an entry to translate. **Some keys are positional and some are keyed by the English string.** Filter labels are keyed by their source label, so renaming a filter in Lightdash invalidates its translation until you regenerate the map. Tiles and tabs are positional, so reordering them shifts the titles. Regenerating the map after structural edits keeps both correct. ### Parameter labels Dashboard parameters are translated through a `parameters` section that you write by hand, since no download produces it. This needs Lightdash 2.96.0 or later for the override to be read. The key is the parameter name as Lightdash resolves it. A model-level parameter is `model_name.parameter_name`, matching the reference syntax in [parameters](/semantic-layer/parameters#how-to-reference-parameters-in-sql). ```json theme={null} { "parameters": { "orders.resource_view": { "label": "Trip profitability" } } } ``` A key that matches no parameter is ignored without an error, so a typo costs you the translation silently. Adding a parameter to a model means adding its label here too. > [!NOTE] > > Only `label` is read. A parameter's `description`, which appears in its tooltip, and its `options` values stay in English in every locale. Translating option values is tracked in [#29356](https://github.com/lightdash/lightdash/issues/29356). ## Translating the values in your warehouse Values arrive as query results, so they are translated where they are produced. The approach below keeps translations in your dbt project, which is also where your dashboards and language maps live. Start with a seed holding one row per raw value, with a column per locale. ```csv theme={null} enum_key,en,nl,fr PRE_INVOICED,Pre-invoiced,Voorgefactureerd,Pré-facturé TO_PLAN,To plan,Te plannen,À planifier ``` Join it in your model to expose a dictionary for the column, then add a visible dimension that picks the viewer's language out of it. ```yaml theme={null} columns: - name: order_status label: "Order status (raw)" config: meta: dimension: type: string additional_dimensions: order_status_translated: type: string label: "Order status" sql: >- COALESCE( ${TABLE}.order_status_dict[${lightdash.attributes.language}], ${TABLE}.order_status_dict['en'], ${TABLE}.order_status ) ``` The two fallbacks matter. The first catches a locale you have not translated yet, and the second catches a value that is not in the seed, so a new status shows its raw value rather than an empty cell. Keep the raw column in the explore and label it so people can tell the two apart. Charts and filters use the translated dimension, while the raw column stays available for anyone writing SQL against stable values. > [!WARNING] > > Assign the `language` attribute in one place, either on the user or on the group, rather than both. Lightdash treats a user's own values and their groups' values as [one set](/workspace-admin/user-attributes#how-user-and-group-attribute-values-interact), so assigning it twice substitutes two literals where your SQL expects one. ### Filters on a translated dimension Interactive filters work on the translated dimension, because the viewer picks from values that are already in their language. Saved filter presets do not. A preset stores the value that was current when it was saved, so it matches only the viewers reading in that language. For a preset that should apply to everyone, filter on something language independent instead, such as the raw column or a boolean flag on the model. The same reasoning applies to a pivoted chart. The legend comes from a value saved on the chart, so it is translated through the language map, while the filter pill beside it resolves through the warehouse dictionary. Generating those language map entries from the same seed keeps the two in step. ## What is not translatable yet * Parameter descriptions * Parameter option values ([#29356](https://github.com/lightdash/lightdash/issues/29356)) * The "No data available" text on a chart with no results ([#29607](https://github.com/lightdash/lightdash/issues/29607)) * Field labels that live only on the explore rather than on a saved chart ([#27759](https://github.com/lightdash/lightdash/issues/27759)) * Any content in an [iframe embed](/embed/iframe), since both translation props are React SDK only * The Lightdash app itself. People who sign in to Lightdash directly see its interface in English, with no language setting # Explore your data Source: https://docs.lightdash.com/explore Query, visualize, and share your data in Lightdash This is where you put your semantic layer to work day to day: run queries, build charts and dashboards, and share results with your team. You'll find every chart type, filters and table calculations for shaping results, and the metrics catalog for browsing what's available to query. Spaces keep your saved charts and dashboards organized, while alerts and scheduled deliveries push results to you and your team automatically, in Lightdash or over email and Slack. # Configure your charts Source: https://docs.lightdash.com/explore/configure-charts Layout, series, axes, display, and data options shared by most chart types Most chart types have very similar configuration options, so we put them all together below. ## Layout This is where you can pick the columns from your results table that you want to plot on your x and y axes or that you want to group by. You can group by up to 3 fields in your chart. For bar charts, this is also where you have the option to stack your bars, or leave them unstacked (grouped). ![The Layout tab of the chart config, with x-axis, y-axis and group-by field pickers and the bar stacking toggle](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/configure-charts/chart-config-layout.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=f446e186b8d2c2b79e7a4e951273e94f) ## Series The series tab is where you can adjust how your chart shows each data series. A **data series** is a set of related data points plotted on a chart. For example, the number of new users created each day over a set of dates is a series. In a bar chart, a series is represented by bars of the same color; in a line chart, a series is represented by a single line. You can see a list of the series for your chart in the **Series** menu, and on the chart legend. ![The Series tab listing each data series in the chart, with per-series colour, label and type controls](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/configure-charts/chart-config-series.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=bfbfa84d10a0c97b586dbadd3b14c938) The options available in here will depend on the data in your chart. But, in here you can: * Set the chart type for each series * Change series labels or colors * Put series on a left or right y-axis * Show value labels or group totals on data points * Hide a series from your chart * Mark the chart's current, unfinished period so it isn't mistaken for a drop ### Incomplete periods When the x-axis is a truncated date or time dimension — year, quarter, month, week, day, hour, or minute — and the chart's results include the period that hasn't finished yet (for example, the current week, before the week is over), the Series tab shows an **Incomplete periods** section with an **Indicate incomplete periods** checkbox. Turn it on to mark that period so a partial period isn't misread as a drop: line and area series draw it with a dashed line, and bar series fill it with a hatched pattern instead of a solid color. New charts have this on by default, whether you create them in the UI, through the API, from chart-as-code, or with an agent. A chart you already saved keeps its stored setting instead of picking up that default, so tick **Indicate incomplete periods** to turn it on for an existing chart. ### Series order The **Series** tab lists series in draw order, from **Back** to **Front**: a series lower in the list is drawn on top of the ones above it. On a stacked chart, the first series sits at the bottom of each stack. Drag a series by its handle to move it, and expand a group to drag the series inside it. With more than one y-axis field, hover a field and select **Bring to front** to move it to the end, or select **Reverse** to flip the order. Save the chart to keep the order. When the results are [sorted](/explore/explore-view#sort-results) by the **Group** field or by a y-axis field, the series follow that sort and can't be dragged. To put the group with the largest values at the bottom of each stack, sort the results by the metric, descending. ### Value label position Use the **Value labels** dropdown on a series to choose where its labels sit: **Hidden**, **Top**, **Bottom**, **Left**, **Right**, or **Inside**. **Hidden** turns the labels off. The position is set per series, so different series on the same chart can use different positions. For a grouped series, the dropdown on the group sets every series in it, and shows **Mixed** when the series in the group use different positions. Expand the group to set the position of one series. ### Value label colors When you show value labels on bar, line, area, or pie charts, Lightdash chooses a label color automatically: * Labels on lines and areas, labels outside bars, and labels outside pie slices use the series or slice color. * Labels inside bars and pie slices use black or white, depending on which has better contrast with the fill color. To use a fixed color instead, select the color next to **Value labels** for a cartesian series. On pie charts, use **Label color** to set one color for the whole chart, or expand an individual slice in the **Series** section to override it. Select **Use automatic color** to return to the contrast-aware default. Value label color overrides are saved with the chart and included in chart-as-code downloads. ### Value label content Once a series shows value labels, select the gear icon next to its **Value labels** to choose what each label shows: **Show value** (on by default), **Show label**, and **Show metric name**. **Show label** adds the series name, or the group value on a grouped chart, and **Show metric name** adds the metric name in parentheses. Labels always use the format `Name (Metric): Value`, for example `Outdoor (Revenue): 1,200`. You can't change the separator or the order of the parts. ### Stack totals On a stacked bar chart with a **Group** field, turn on **Total** under the group's **Value labels** to show each stack's total above it. To show only the totals, set the group's **Value labels** to **Hidden** and leave **Total** on. The **Total** switch only appears for a metric split by a group, so a stack built from several metrics without a group doesn't have it. In chart-as-code YAML, **Total** sets `stackLabel.show` on every series in the group: ```yaml theme={null} series: - type: bar stack: orders_total_revenue label: show: false stackLabel: show: true ``` ### Custom colors (conditional formatting) On bar charts, toggle **Apply custom colors** in the Series tab to recolor bars based on rules you define. Each rule targets a specific metric via the **Target metric** picker and only recolors that metric's bars — other metrics keep their default colors, even where their values match the same condition. For example, on a chart with `revenue` and `orders` bars grouped by product category, you can add one rule that turns `revenue` bars red when revenue is below `1000`, and a second rule that turns `orders` bars orange when orders are below `50`. Categories where only revenue is below the threshold keep the default color on their `orders` bar, and vice versa. **When to use it** * **Conditional formatting** — highlight bars whose value matches a rule (e.g. below target, above threshold). Available on bar charts with one or more metrics, including stacked and 100% stacked bar charts when the stack is built from multiple metrics. Every series on the chart must be a bar; mixed bar/line charts are not supported. * **Color by category** — assign a fixed color to each x-axis category. Only available on single-metric, non-stacked bar charts. When both modes are available, use the Category / Conditional formatting toggle at the top of the section to switch between them. **Stacked and 100% stacked bar charts** On stacked and 100% stacked bar charts, all rules share a single **Target metric** — changing the target on any rule retargets every rule together, and new rules follow the existing target. Matching segments get a fill override on the chart, while the legend swatch keeps the base series color so the series remains identifiable. On 100% stacked bar charts, rules evaluate the raw metric value, not the normalized percentage. Two segments with near-identical rendered heights can therefore color differently if their raw values straddle the threshold — for example, a rule `revenue is less than 1000` colors a `$900` segment even when it renders at the same height as an `$1,100` segment in a different category. Not yet supported: pivoted (grouped) stacks, and color by category on any stacked layout. **Configuring a rule** 1. In the Series tab, toggle **Apply custom colors** on. A new rule opens expanded so its inputs are immediately visible. 2. Pick the **Target metric** the rule applies to. On stacked and 100% stacked charts this target is shared across all rules. 3. Add one or more conditions (for example, `revenue is less than 1000`) and choose a color. A rule with no condition filled in shows **No condition set** until you add one. 4. Add more rules for other metrics or other thresholds as needed. ## Axes In this section you have options to: * Override the default text for your axes labels * Adjust sort order of your x-axis * Space a numeric x-axis evenly with **Treat as category** * Rotate x-axis labels * Set the min and max axis values for your y-axes (or keep the default auto y-axis range) * Set a minimum tick interval on numeric axes * Show x-axis and y-axis grid lines * Hide x-axis completely * Hide y-axis completely * Enable a scrollable chart for charts with many x-axis values ![The Axes tab, with axis name fields, min and max range inputs, tick interval, and grid line and axis visibility toggles](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/configure-charts/chart-config-axes.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=9ee954d1081ff3a6773ac8fcb8eeaa76) ### X-axis sort Use **Sort** under the x-axis label to order the x-axis: * **Default** uses the order of your query results on a category axis, and the values' own order on a date or number axis. **Default (reversed)** flips it. * **Ascending** and **Descending** sort by the x-axis values. On a category axis, values are sorted as text. * **Bars ascending** and **Bars descending** sort by each bar's total, adding up stacked segments. They're only available on bar charts with a category x-axis, and only reorder text values. On a horizontal bar chart, the category axis is the one labelled **Y-axis label**, and its **Sort** sits there. Build a horizontal bar chart by picking **Horizontal bar chart** as the chart type, or with **Flip Axes** on a bar chart. If you instead put the metric in the x-axis field of a plain bar chart, the x-axis is a number, so **Bars ascending** and **Bars descending** are unavailable. ### Treat a numeric x-axis as categories A number x-axis plots values on a continuous scale, so the bars at either end are centred on the first and last values and can overlap the y-axis. Turn on **Treat as category** under the x-axis label to space the values evenly, with padding at both ends. While it's on, the x-axis range and **Min tick interval** settings don't apply. The switch only appears when the x-axis is a number field and the axes aren't flipped. ### Auto y-axis range With **Auto** on, Lightdash doesn't always zoom the axis in on your data — it only drops 0 as the axis minimum when your lowest value sits far clear of the rest of the data, specifically when the lowest value is more than 3 times the spread between your lowest and highest values. Data that sits closer to 0 relative to its spread keeps 0 as the axis minimum even with Auto on — for example, percentages that range roughly between 30% and 80% still start at 0. The same rule applies to the axis maximum when your values are entirely negative. This behavior applies to left/right y-axes with line, area, or scatter series. An axis with a bar series always starts at 0 when Auto is on, since a bar's height represents its value. To zoom in on a narrower range than Auto gives you, turn **Auto** off and set a manual **Min** and/or **Max** instead. ### Min tick interval Use **Min tick interval** to force a minimum step between ticks on a numeric axis. This is useful when the auto-scaled ticks show duplicate or decimal labels — for example, a count that only produces the values `0, 1, 2` can otherwise render as `0, 0.5, 1, 1.5, 2`. Setting the min tick interval to `1` forces integer-only ticks. The control is available on each numeric axis (left/right y-axis, and top/bottom x-axis for scatter charts). Leave the field blank (or set it to `0`) to let Lightdash pick the interval automatically. ### Crowded x-axis labels When there isn't room for every x-axis label, such as on a daily chart over several months, the chart leaves some labels out so the rest stay readable. Every bar or point is still drawn: hover over one to see its x-axis value in the tooltip. ### Axis label format On charts built in the Explore view, axis tick labels use the format of the field on that axis, the same format its values have in tooltips and the results table. There's no separate format setting for an axis, so [compacting a field](/explore/formatting-your-fields#compacting-big-numbers) to show `1.5M` on the axis also compacts its tooltips and table values. Charts built in the [SQL runner](/explore/sql-runner) have a **Format** setting under each y-axis that sets how its tick labels are rendered: * **None** — show the raw numeric value. * **Percent** — format the value as a percentage. * **SI** — apply dynamic compact formatting. Values are automatically scaled and suffixed with `K`, `M`, `B`, or `T` based on their magnitude, so `1,500` becomes `1.50K` and `2,300,000` becomes `2.30M` in the same axis. ### Reverse a y-axis To flip a y-axis so the smallest value is at the top, for example to plot rankings with rank 1 at the top, set `inverse: true` on the axis in [chart-as-code](/workflow/content-as-code) YAML. There's no switch for this in the chart editor. `yAxis` is a list: the first entry is the left axis and the second is the right axis, and each series moves with the axis its `yAxisIndex` points to. On a chart with flipped axes, these entries control the bottom and top axes instead. ```yaml theme={null} eChartsConfig: yAxis: - inverse: true # left axis, reversed - inverse: false # right axis, unchanged ``` ### Referencing the active granularity in axis and series labels Axis names and series names support a `${table_field.granularity}` placeholder that resolves to the active date granularity (for example `day`, `week`, `month`) — including the granularity selected via [date zoom](/explore/dashboards/date-zoom). This lets a label like `Orders per ${orders_order_date.granularity}` render as `Orders per week` when viewers zoom to a weekly granularity. See [Referencing the granularity in chart labels](/explore/dashboards/date-zoom#referencing-the-granularity-in-chart-labels) for the full syntax and the complete list of supported labels. ### Scrollable chart For bar, line, and area charts with many x-axis values, turn on **Enable scrollable chart** to display a fixed-size window of data points that viewers can scroll through, instead of squeezing every value into the chart. When enabled, you can configure: * **Initial scroll position** — Choose whether the chart opens anchored to the **Start** (oldest or first values) or **End** (newest or last values) of the data. Use **End** for time series where the most recent values matter most. * **Visible items** — Set how many x-axis items appear in the window at once (between 2 and 100, default 10). Both settings are saved with the chart and are also respected when the chart is defined as code. ## Display This tab is where you're able to control the legend, reference lines, and [custom tooltips](/explore/configure-custom-tooltip) in your chart. ### Reference lines You can add reference lines to your charts to easily visualize goals or thresholds. ![A chart with a horizontal reference line drawn across it at a target value, labelled with that value](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/configure-charts/add-reference-line.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=5a537a07bbc42a6fed1f77485d7cf574) To add a reference line, click `+ Add` under Display -> Reference lines. You have these options in the settings: * Select a field you want to linke to your reference line (Page views in the image above) * Set a static value (50,000 in the image above) * Add a label (`Halfway to our goal!` in the image above) * Change the line color (green in the image above) Most reference lines are static values, but you can also use these key words to plot a dynamic value: `min`, `max`, `median`, `average`. That way your reference line will automatically update to the global min, max, median, or average of the field you selected. See image below for examples. ![dynamic reference lines example](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/configure-charts/chart-config-dynamic-reference.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=0435409ecf59cdae4547f4e57cf485be) If you select a field plotted on your x-axis, then your line will be vertical. If you select a field plotted on your y-axis, then your line will be horizontal. > [!TIP] > > If your reference line label is cropped off your chart, try adjusting your [right margin](#margins). ### Legend You can add and adjust the legend in your chart to help people understand what data's been plotted. * Show or hide the legend * Choose a **Placement** for the legend: * **Chart area** overlays the legend on top of the plot. You can fine-tune its `position`, scroll behavior, and orientation (see below). * **Outside right** or **Outside left** renders the legend beside the plot and reserves space in the chart grid so the legend never overlaps your data. When you pick an outside placement, set the **Legend area width** (in `%` or `px`) to control how much horizontal space is reserved for the legend. * When **Placement** is set to **Chart area**: * Adjust the position of the legend on your chart. The values in `position` are the coordinates of the legend on your chart. They can either be numbers or percent. We suggest using %. * If you want the position to be in the bottom right, you would set: Right = 0%, Bottom = 0%. For the legend to be in the middle of the chart, you'd set: Top = 50%, Left = 50%. * Set your legend to scroll (if you have so many groups that they overlap your chart). * Orient the values in your legend to form a list vertically, or horizontally. When a chart has two or more y-axis fields and a group, the legend lists one entry per field and group pair, labelled `[group] Field name`. For example, two metrics grouped by four statuses give eight entries. There's no option to collapse the legend to one entry per group. To get one, plot a single y-axis field with the group, or build the chart as a [custom chart type](/visualizations/custom-charts) in [Chart Studio](/visualizations/chart-studio). ![The legend section of the Display tab, with the show toggle, placement options and position coordinate fields](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/configure-charts/chart-config-legend.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=bf67ecb87f3bc68ca150f31d6740dd36) #### Saving the default legend selection On cartesian charts (bar, line, area, scatter, mixed), the legend entries you toggle off in the chart editor are saved with the chart. When someone opens the chart again — in the explore view, a saved chart, or a dashboard — the same series start greyed out. Disabled series stay listed in the legend so viewers can still click them back on for their session; those ephemeral toggles are not written back to the saved chart. To change the default: 1. Open the chart in the editor. 2. Click legend entries to disable or re-enable series. For example, on a chart pivoted by `product_category`, click **Apparel** and **Home Goods** in the legend to focus on **Electronics**. 3. Click **Save**. The next time anyone opens the chart, only **Electronics** is plotted, with **Apparel** and **Home Goods** greyed out in the legend. Pie and funnel charts do not persist legend selection — toggling their legend entries stays ephemeral. **In chart-as-code YAML**, the saved selection lives on `eChartsConfig.legend.selected`. It's an optional map from legend entry name to boolean, and only entries set to `false` are stored — series that don't appear in the map default to visible, so new series (for example a new quarter added to a pivoted chart) show up automatically. Re-enabling every series in the editor and saving removes the `selected` field entirely. ```yaml theme={null} eChartsConfig: legend: show: true selected: Apparel: false Home Goods: false ``` ## Data The **Data** and **Column limit** sections at the bottom of the **Layout** tab let you trim what gets shown on the chart without changing the underlying query. Both controls run client-side on the already-fetched results, so totals, exports and underlying data are unaffected. ### Limit displayed rows Toggle **Limit displayed rows** to show or hide a slice of rows from the top or bottom of your results. ![The Limit displayed rows control in the Layout tab, reading as a sentence with drop-downs for showing the first or last N rows](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/configure-charts/chart-config-row-limit.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=88e749b49bb07ab19c854eeede779a57) The control reads as a sentence: * **Show / Hide** — keep only the targeted rows, or remove them. * **First / Last** — anchor to the top or bottom of the results. * **N** — how many rows to target (default 50). Examples: | Setting | Effect | | - | - | | Show the first 50 rows | Plot only the top 50 rows; ignore the rest | | Hide the last 1 row | Drop the bottom row (useful when the trailing period is incomplete) | | Show the last 12 rows | Plot only the most recent 12 rows of a time series | > [!NOTE] > > The row limit only affects what's drawn on the chart. Your query still returns the full result set, totals are calculated against all rows, and CSV exports include every row. ### Column limit When your chart has a pivot dimension, the **Column limit** controls how many pivot groups (and therefore series) are drawn. Lightdash keeps the first N pivot groups in display order and drops the rest. Dropped groups aren't combined into an "other" series. Enter a whole number from 1 to 200. To keep the groups with the largest values, sort the results by the metric, descending. The limit is saved with the chart, as `columnLimit` under `chartConfig.config` in chart-as-code YAML. ![The Column limit field in the Layout tab, capping how many pivot groups are drawn as series](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/configure-charts/chart-config-column-limit.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=eff7798e160bc34f7e5175172b27fe70) This is useful when a pivot dimension has many values and the chart becomes hard to read. Leave the field blank for no per-chart limit (the system-wide pivot limit still applies — see [the pivot table column limits reference](/visualizations/table#column-limits)). The column limit field only appears when a dimension is configured in the **Group** field. ## Margins The Margin tab is where you're able to add or remove margin around the grid. Removing margin means that your chart will fill more of the space in the chart tab. Adding margin will shrink your chart into a smaller space. You can either add numbers (e.g. 50) or percent values (e.g. 50%) to the margin settings listed. The default margin is set to `top` = 70, `bottom` = 30, `left` = 5%, `right` = 5% ![The Margin tab with top, bottom, left and right margin fields set to their defaults](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/configure-charts/chart-config-margins.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=3d4dd1e0ded53cb65c62973fe1e2f113) # Custom tooltips Source: https://docs.lightdash.com/explore/configure-custom-tooltip Show extra metrics, notes, links, and custom HTML in chart tooltips using field variables By default, tooltips will show the x-axis value, the y-axis field name, and the y-axis value, like this: ![Standard Tooltip Pn](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/configure-custom-tooltip/standard-tooltip.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=a877a7645d47e3630444652c5d24e181) You can customize tooltips to show additional metrics or table calculations that are included in your chart (on any of the axes). You can even include notes, links, or custom formatting for additional context. To use this feature, go to **Configure chart > Display > Custom Tooltip**. HTML is allowed in the Custom tooltip code, but Javascript is disabled. You can also select variables from your chart, from any of the axes, even on grouped charts. Start typing the name of the field, and we'll autocomplete with the right variable. A variable resolves to the field's value at the point you hover, not to the field's description from your `.yml`. To explain what a metric means, type the definition into the tooltip. It won't update when the `.yml` description changes. [Table charts](/visualizations/table) show each field's `.yml` description when you hover its column header. ![Custom Tooltip Variable Gi](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/configure-custom-tooltip/custom-tooltip-variable.gif?s=e0abdf9408aa13cc278537e7667b4418) Here is an example code block for a custom tooltip: ``` 💰 Profit this month: ${dbt_orders_sum_of_profit}
🛒 Average basket this month: ${dbt_orders_average_of_basket_total}
💳 Total Orders this month: ${dbt_orders_count_distinct_order_id}

Additional resources:

Check out the Sales Dashboard and the Notion doc about Orders and Revenue KPIs. ``` The above code will look like this in the tooltip: ![Custom Tooltip Example Pn](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/configure-custom-tooltip/custom-tooltip-example.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=bb09f9ea14504546abcd8734baed1917) Custom tooltips will show up on saved charts, dashboards, and the code will be included in [dashboards as code downloads](/workflow/content-as-code). > [!TIP] > > If you need to show some data that is not included in the chart (eg: a dynamic URL, or an ID) , you can even create a table calculation, and include it on on the chart as an extra axis to use this variable on the tooltip. ## Repeated tooltip entries If a tooltip lists the same field several times for one x-axis value, check the query for dimensions that aren't used on the x-axis, y-axis, or group. Each extra dimension splits a category into several result rows, and the chart plots one point per row. Lightdash flags this with a yellow warning icon on the chart that names the unused dimensions. Remove them from the query to get one entry per series. ## Tooltips on grouped charts Which fields a tooltip can use depends on whether the chart has a group set in **Layout**. Without a group, every dimension, metric, and table calculation in the query results is available as a variable, whether or not it's plotted. With a group, only fields plotted on the chart are offered when you type `$` and resolve in the tooltip, so a table calculation that appears only in the results table renders blank. To use an unplotted field on a grouped chart, add it as an extra y-axis field. If you don't want it drawn, click the eye icon next to its series in **Configure chart** → **Series** to hide it. A hidden series still resolves in the tooltip. ### Reference a specific group On a grouped chart, `${field_id}` resolves to the value for the group you're hovering. When the tooltip covers every group at once, such as when you hover a whole stacked column, it has no single group to use and shows the first group's value. To show each group, reference it explicitly as `${field_id.group_field_id.group value}`: ```html theme={null} % Completed: ${orders_percent_of_total.orders_status.completed}
% Returned: ${orders_percent_of_total.orders_status.returned} ``` These references also appear in the `$` autocomplete. > [!NOTE] > > Explicit references don't resolve for group values that contain `&`. Group by a [custom dimension](/explore/create-custom-fields#custom-dimensions) that replaces the `&` instead. # Alerts Source: https://docs.lightdash.com/explore/create-alerts Get notified in email or Slack when a saved chart's values meet conditions you set At the scheduled time, Lightdash will run the query and check the results. If the value in the first row of the chart's results, in the chart's sort order, meets the alerting condition, the alert will be sent. Other rows aren't checked. To alert when any row meets the condition, sort the chart by the alert field, descending for **is greater than** or ascending for **is less than**, so the first row holds the most extreme value. This notification will continue to be sent if the condition is true until it is manually disabled or deleted. You can create or select an existing saved chart, add an alert to it, and tell Lightdash when you’d like the send out your update. You can set up as many alerts to a saved chart as you like, and if you make any changes to the content, Lightdash will update the alert the next time they’re sent. Alerts can be sent to an email address or into Slack (assuming your org has [added Slack](/integrations/slack)). For security reasons, delivered files expire after 3 days. Images in older emails and Slack shares break once they expire and there's no way to retrieve them, so download anything you want to keep from the alert itself. > [!TIP] > > **Self-hosted: fix broken images in emails behind firewalls** > > If your Lightdash instance is behind a firewall, email clients like Gmail may not be able to load images from your internal URLs. Set `EMAIL_SMTP_IMAGE_INLINE_CID=true` to embed images directly into emails as attachments. See [SMTP configuration](/self-host/customize-deployment/environment-variables#smtp) for details. ## Enabling alerts Email alerts are available on all Lightdash Cloud plans. To set up Slack, an organization admin will have to [add the Slack integration](/integrations/slack). ## Creating an alert Only users with [admin, developer or edit access](/workspace-admin/roles) can create alerts. To create an alert, click on the three-dot menu in the top-right corner of your chart, then click on `Alerts`. ![The three-dot menu open in the top-right corner of a saved chart, with the Alerts option in the list](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/create-alerts/alert-three-dot-menu.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=d1cb7bab6e67feb1539becef9225bad1) You'll get a modal that pops up and shows you the list of existing alerts for your saved chart, and gives you the option to `Create new`. ![The alerts modal for a saved chart, listing existing alerts with a Create new button](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/create-alerts/alert-create-new-modal.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=69a0f086a49a7ff2495145c879de0b15) Once you click on `Create new`, you'll be brought to a configuration screen for your new alert. ![The alert configuration screen, with fields for name, condition, run frequency and where to send the alert](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/create-alerts/configure-alert.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=c87a6190a3e889cc1663f5695f735b18) Here, you can configure your alert. The options are: * **Alert name**: this is the name of your alert. * **Conditions**: Configure the condition that is going to be evaluated against the first result(s). * `Alert field` The numeric field is going to be evaluated * `Condition`: Operator we are going to use to evaluate your value. * **is greater/less than**: Check if the `first` value in your results is greater/less than your threshold value. * **increased/decreased by**: Verify whether the percentage change in the first value relative to the second value exceeds the specified threshold, either by increasing or decreasing. * **Notify me only once**: send the alert the first time the condition is met, then pause it. The alert shows as paused in your list of alerts until you turn its toggle back on. Leave this unticked to be notified every time the condition is met. * **Run frequency**: This is the frequency at which Lightdash runs a query to check your data for changes. (You will be notified if the conditions on the latest value are met) . All times for the scheduler are in UTC. * **Send to**: here, you can pick if you want to send your alert to Slack, email, or both. You can add as many Slack channels and email addresses as you'd like to here. You can send an alert to a person in Slack using `@persons-name` or to a channel using `#channel-name`. The Lightdash app needs to already be a member of any Slack channel you add — see [Saved chart alerts in Slack](/integrations/slack#saved-chart-alerts-in-slack) for how to invite it. Alerts don't have a custom message. Email and Slack alerts name the chart and list the condition that was met. The field in the condition is named from its field ID rather than its label in the chart, so `orders_total_revenue` appears as **Orders total revenue**. Each alert also includes an image of the chart. ## Editing and deleting your alerts To edit an alert, click on the pencil-icon next to the alert you want to edit. This will bring you back to the configuration screen for your alert, where you can make any changes you'd like. In case you want to delete a alert, click on the trash-icon next to the alert you want to delete. ![The alerts list, each row with a pencil icon to edit, a trash icon to delete, and a toggle to pause it](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/create-alerts/edit-delete-alert.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=23feeddefde7ac20e18993674302be6a) You can also pause alerts by clicking the toggle button on the list of alerts. Lightdash also pauses an alert when an error means it can't run until someone fixes it, for example when the alert field is no longer in the chart's results, the warehouse credentials are wrong or the warehouse can't be reached, the alert has no recipients, or it sends to Slack and your organization's Slack integration was removed. Fix the cause, then turn the alert's toggle back on. ## Sending to private Slack channels You must add the Lightdash Slack bot to a private Slack channel before it can post there. To send to a private Slack channel, type the channel name exactly as it appears in Slack into the destination field, then click it to confirm. ## Sending to Microsoft Teams You can send Lightdash deliveries directly to Microsoft Teams using incoming webhooks, keeping your team updated with key metrics right inside your Teams channels. The legacy Office 365 Connector webhooks are deprecated. Microsoft now recommends using **Power Automate Workflows** to create incoming webhooks for Teams. ### Creating a webhook with Power Automate Workflows 1. Go to [Power Automate](https://make.powerautomate.com/) 2. Select **Templates** 3. Filter by "webhook" 4. Select the **Post to a channel when a webhook request is received** template ![The Power Automate template gallery showing the "Send webhook alerts to a channel" Microsoft Teams template](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/create-scheduled-deliveries/msteams-select-template.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=dd246181034e56404959ff73a8ceb514) 5. Select your Microsoft account and target Teams channel 6. Once added, click **Edit** on the workflow 7. Select the **When a Teams webhook request is received** trigger 8. Copy the **HTTP URL** ![The Power Automate flow editor with the Teams webhook trigger selected and its HTTP URL field ready to copy](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/create-scheduled-deliveries/msteams-template-flow.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=e4a902136c735149b0d67e7a6738b822) 9. Use that HTTP URL in the webhook field in Lightdash For more details, see the [official Microsoft documentation](https://support.microsoft.com/en-us/office/create-incoming-webhooks-with-workflows-for-microsoft-teams-8ae491c7-0394-4861-ba59-055e33f75498). Add the webhook to the list of destinations in your delivery, then test how it looks in Teams by pressing **Send now**. # Using custom fields Source: https://docs.lightdash.com/explore/create-custom-fields Create custom dimensions and metrics on the fly for quick calculations and binning ## Custom metrics Custom metrics are only saved in the chart they're used in and will not be saved in the list of `metrics` available if you open the same Table to build a new chart. Metrics written to your dbt project (or YAML metrics) are reusable by everyone in your project and will always show up in the side bar of available metrics for a Table. We recommend [writing back custom metrics](/integrations/dbt/write-back#write-back-metrics-from-custom-metrics) that you're using/creating frequently so they become reusable, governed and available for everyone else to build from. To create a custom metric: 1. Click on the dimension's three-dot `options` menu 2. Click on one of the options available (e.g. `Count Distinct`) 3. Confirm your changes ![A dimension's three-dot options menu open in the results table, listing aggregations like Count distinct that create a custom metric](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/create-custom-fields/custom-metric-creating.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=8e4302fc62a1406ccbd15fcc2c5dd82a) Then, your new metric will be added to your results table automatically and will appear in the `custom metrics` space in your sidebar. ![The new custom metric as a column in the results table and listed under Custom metrics in the sidebar](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/create-custom-fields/custom-metric-added.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=4161d89422c90fcd60d926a6362a4f89) If you want to delete the custom metric, you can just click on the three-dot `options` menu and hit `Remove custom metric` ![The custom metric's three-dot options menu open, with Remove custom metric in the list](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/create-custom-fields/custom-metric-deleting.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=64d84ec6aa46cec7b2de2e048c6e50d5) ### Custom metric types To learn more about the custom metric types, read the [metrics reference documentation here](/semantic-layer/metrics). Only aggregate metric types are available as custom metrics. ### Creating a custom metric from an existing metric You can also start a custom metric from an existing YAML metric in the Explorer. This is useful when you want to reuse the base metric's SQL and settings but tweak one thing — most commonly, adding a filter to narrow the aggregation (for example, cloning `orders.total_revenue` and filtering it to a single product category). Only aggregate metric types (`sum`, `count`, `count_distinct`, `min`, `max`, `average`, `median`, `percentile`) can be cloned into a custom metric. Non-aggregate and derived metric types — including `sum_distinct` and `average_distinct` — do not show the `Create custom metric` action. To create a custom metric from an existing metric: 1. In the field tree sidebar or in the results table's column header menu, open the metric's three-dot `options` menu. 2. Click `Create custom metric`. 3. In the modal, edit the label, filters, and formatting, then click `Create`. The clone starts with the same values as the base metric, so it returns the same numbers until you change something. Specifically, the following are copied from the base metric and are editable in the modal: * The metric's `sql`, type (and `percentile`, where applicable). * The base metric's YAML `filters`, as editable filter rules. * The base metric's formatting (`formatOptions`, or legacy `format` / `round` / `compact` / `separator`, normalized to structured format options). Clones of `min` / `max` metrics over `date` or `timestamp` columns inherit the base column's date or timestamp format automatically, and the numeric Format section is hidden for them. The custom metric modal also displays the source metric (read-only) at the top so you can see where the clone came from when you edit it later. When you add a new filter rule inside the modal, it defaults to the base metric's underlying column (its `dimensionReference`). This matters in explores that join tables with same-named columns (for example, an `amount` column on both `orders` and `payments`) — the filter targets the same table the base metric aggregates, rather than whichever `amount` column happens to appear first in the explore. > [!NOTE] > > Custom metrics record their source metric internally, but they are not automatically re-synced when the base YAML metric changes. If the base metric is updated in dbt, edit the custom metric (or recreate it) to pick up the new definition. ### Adding filters to your custom metric You can add filters to limit the rows included in your metric aggregation. You can add filters when: 1. You create a custom metric: ![The custom metric creation modal with a filter rule added, narrowing which rows the aggregation covers](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/create-custom-fields/custom-metric-add-filter-while-creating.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=9f9a32fe639daf3129e8946c9be00ff0) 2. You edit an existing custom metric: ![The edit modal for an existing custom metric, with its filter rules listed and an option to add another](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/create-custom-fields/custom-metric-add-filter-while-edting.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=e32b521922d566a6fbcd01d4a035e8db) ## Custom dimensions Dimensions are used to group results in your query, or filter values from your results. Sometimes, a group or filter that you need hasn't been added to your project, so you can use a custom dimension to create a grouping or filter on-the-fly. These dimensions are not saved to the table permanently. They are only available in the saved chart or query that they were created in, so you can filter that chart on them but can't add them as a [dashboard filter](/explore/dashboards/filter). To use one as a dashboard filter, [write it back to dbt](/integrations/dbt/write-back#write-back-dimensions-from-custom-dimensions) so it becomes a dimension in your project. If your team can't edit the model's YAML, for example because another team owns it, define the dimension in a downstream dbt model that `ref`s it, with its own YAML file. ### Using custom dimensions in table calculations You can reference custom dimensions in your table calculations without needing to qualify them with a table name. Simply use the custom dimension name directly in your calculation formula, just as you would with any other dimension. ### Bin Bins are used to split out values of a numeric dimension into custom sets of ranges. Bins can only be used with dimensions that are numeric. Fixed bins (fixed number and fixed width) will update automatically if the min or max values of your dimension change. To create a bin custom dimension, you just need to: 1. Click on a dimension's three-dot `options` menu 2. Click on the `bin` option 3. Setup + create your dimension ![A numeric dimension's three-dot options menu open, with the Bin option that starts a binned custom dimension](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/create-custom-fields/custom-dimension-creating.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=c0908214469d973e7989d5018ac9d90f) Then, your new dimension will be added to your results table automatically and will appear in the `custom dimensions` space in your sidebar. ![The binned dimension as a column of value ranges in the results table, listed under Custom dimensions in the sidebar](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/create-custom-fields/custom-dimension-bins.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=df87830363d6f9f172035f3ab0381734) There are three ways that you can set up your bins: **1. Fixed number of bins** You pick the number of bins that you want to group your dimension into and Lightdash automatically defines the ranges for your bins. The ranges that Lightdash generates for the bins are equal to the range of the values in your dimension divided by the number of bins you selected. **2. Fixed width** You pick the width (a.k.a. ranges) for your bins and Lightdash automatically defines a set of bins with those widths. The number of bins that Lightdash generates is equal to the range of values in your dimension divided by the fixed width that you picked for your bins. **3. Custom range** You manually define the min and max values for each bin. The custom range option is the only binning option that will not automatically update if the min or max values of your dimension change (you would need to manually adjust your custom bins or some values could not be included in your bins). ### Custom SQL Custom SQL dimensions let you pull in new data directly from your database, which means they can sometimes be used to bypass access restrictions. **Only users with admin or developer permissions can create custom SQL dimensions** — or, on Enterprise plans, any user assigned a [custom role](/workspace-admin/custom-roles) that includes the **Manage Custom Fields** scope (*Create and edit custom dimensions*). Other users will not see authoring options for custom SQL dimensions, but can still use existing ones in their queries. > [!WARNING] > > **Security note:**\ > Custom SQL dimensions can query any data from your warehouse, so they should only be created by trusted users (admins and developers). For most cases, it's safer and more reusable to define dimensions in your dbt files. If you want to make a custom SQL dimension reusable, use the [dbt write-back](/integrations/dbt/write-back#write-back-dimensions-from-custom-dimensions) feature to move it into your dbt project. #### When to use custom SQL dimensions * **Quickly create new groupings or calculations** that aren't yet available in your project. * **Group a chart by derived values**, such as bucketing many sales channels into a few categories with a `CASE` statement. A chart's **Group** setting only accepts dimensions and custom dimensions, not [table calculations](/explore/table-calculations). * **Reference other dimensions** from the main table and joined tables in your explore. * **Prototype new logic** before moving it to your dbt project. #### When *not* to use custom SQL dimensions * If you need the dimension to be **reusable** or **governed** for your whole team. * If you want to ensure **consistent access control** and security. * If the SQL uses an **aggregate function** such as `SUM`, `COUNT`, or `AVG`. Lightdash adds every dimension to the query's `GROUP BY`, and the warehouse rejects aggregates there, with an error such as `GROUP BY clause cannot contain aggregations` (`EXPRESSION_NOT_SCALAR` on Athena and Trino). Use a [custom metric](#custom-metrics) instead, or for a ratio, create a custom metric for each side and divide them in a [table calculation](/explore/table-calculations). #### Example: Categorizing order totals In this example, let's explore the `orders` table and create a custom dimension that categorizes my orders' totals into three categories: `low`, `medium`, and `high`. You can click on the button to add a custom dimension on the sidebar: ![The sidebar button that adds a custom dimension, with the option to write one in SQL](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/create-custom-fields/custom-dimension-sql-add.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=ee9612a823bf7f9d0f1ef5ebf4184e28) Then you can write your SQL query to create your custom dimension: ```sql theme={null} CASE WHEN ${orders.subtotal} < 100 THEN 'low' WHEN ${orders.subtotal} < 500 THEN 'medium' ELSE 'high' END ``` ![The custom SQL dimension form, with a name field and a SQL editor holding a CASE statement over order subtotals](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/create-custom-fields/custom-dimension-sql-form.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=5c8bffb3d73a9bdc62720c9562b824a7) When AI is available in your project, the form also has **Generate and improve your custom dimension with AI**. Describe the dimension in plain language, such as "group `customers.country` into Europe, Americas and APAC", and it fills in the SQL, label and dimension type for you to review. And after you run your query, you will see your new custom dimension categorising your orders' totals: ![The results table with the new SQL dimension column labelling each order low, medium or high](https://mintcdn.com/lightdash/U8EXy8LiPYA5IqN1/images/explore/create-custom-fields/custom-dimension-sql-result.png?fit=max\&auto=format\&n=U8EXy8LiPYA5IqN1\&q=85\&s=ad7f9c44614eb9da1c6c769843d9876c) # Scheduled deliveries Source: https://docs.lightdash.com/explore/create-scheduled-deliveries Send a dashboard or chart and its results to people on a schedule via email or Slack If your Lightdash organization has [Slack](/integrations/slack) set up, you can create or select an existing saved chart or dashboard, add a scheduled delivery to it, and tell Lightdash when you’d like the send out your update. You can set up as many scheduled deliveries to a saved chart or dashboard as you like, and if you make any changes to the content, Lightdash will update the scheduled deliveries the next time they’re sent. For security reasons, delivered files expire after 3 days by default. Images in older emails and Slack shares break once they expire and there's no way to retrieve them, so download anything you want to keep from the scheduled delivery itself. Organization admins can [configure download link expiration](#configuring-download-link-expiration) globally or per channel. > [!TIP] > > **Self-hosted: fix broken images in emails behind firewalls** > > If your Lightdash instance is behind a firewall, email clients like Gmail may not be able to load images from your internal URLs. Set `EMAIL_SMTP_IMAGE_INLINE_CID=true` to embed images directly into emails as attachments. See [SMTP configuration](/self-host/customize-deployment/environment-variables#smtp) for details. ## Enabling scheduled deliveries Emailed scheduled deliveries are available on all Lightdash Cloud plans. To set up Slack, an organization admin will have to [add the Slack integration](/integrations/slack). ## Creating a scheduled delivery Only users with [admin, developer, editor or interactive viewer roles](/workspace-admin/roles) can create and edit scheduled deliveries. Developer, editor and interactive viewer can only create and edit their *own* scheduled deliveries; only admin has edit access over scheduled deliveries created by other users. > [!TIP] > > **Starting from an AI agent conversation?** You can [schedule a recurring delivery directly from an agent conversation](/agents/use-ai-agents#schedule-a-recurring-delivery-from-a-conversation) — Lightdash re-runs the agent on your chosen frequency and sends the refreshed chart, plus an AI-written summary, to Slack, email, or Microsoft Teams. The form opens pre-filled from the conversation, so you get the same style of answer on a schedule without rebuilding anything. To create a scheduled delivery, click on the three-dot menu in the top-right corner of your chart or dashboard, then click on `scheduled deliveries`. ![The three-dot menu open in the top-right corner of a chart, with Scheduled deliveries in the list](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/create-scheduled-deliveries/scheduled-deliveries-three-dot-menu-922af4a879c906642fe00d5660fc0b9b.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=42fb02186160fd53352917d4bb9c2f05) You'll get a modal that shows you the list of existing scheduled deliveries for your saved chart or dashboard, and gives you the option to start a new one. ![The scheduled deliveries modal with no deliveries yet, offering a New delivery button](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/create-scheduled-deliveries/scheduled-delivery-empty-state.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=e33bb38c26827343c444f757e38b3f74) Click `New delivery` to open the scheduled delivery configuration. The sidebar splits everything into a **Delivery** section (when and where it's sent) and a **Content** section (what's inside it and how it's written), with a live preview and your next few send dates always visible on the right. ### Setup Under `Delivery > Setup`, name your delivery, set how often it runs (hourly, daily, weekly, monthly, or a custom Cron expression), and pick a time zone — deliveries follow your project's default time zone unless you override it here. Add recipients as email addresses or Slack channels; you can target a person in Slack with `@persons-name` or a channel with `#channel-name`. The Lightdash app needs to already be a member of any Slack channel you add — see [Scheduled deliveries](/integrations/slack#scheduled-deliveries) for how to invite it. Google Chat and Microsoft Teams also show up here as destinations. On a self-hosted instance, Microsoft Teams shows only when `MICROSOFT_TEAMS_ENABLED` is `true` (see [environment variables](/self-host/customize-deployment/environment-variables#microsoft-teams-integration)). A delivery can go to several destinations at once, and a channel or email address can receive any number of deliveries, from the same chart or dashboard or from different ones. ![The Delivery > Setup panel with name, frequency, time zone and recipient fields, and the next send dates listed beside it](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/create-scheduled-deliveries/scheduled-delivery-setup.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=27a99e923e2143037d7e843f37cc1500) ### Data & format Under `Content > Data & format`, choose how the content is delivered — `Image`, `CSV`, `.xlsx`, or `PDF` — and adjust the [filters](#filters) so different recipients can get a different cut of the same chart or dashboard without you having to duplicate it. Row and cell limits for CSV/XLSX exports are covered in [Export limits](/workspace-admin/export-limits). In Slack, `Image` shows the chart or dashboard in the message itself, so a table chart delivered as `Image` shows its rows without a download; with **Also include image as PDF attachment**, the PDF goes in the message's thread. `PDF` posts the message and then the PDF as a file, which recipients open to view. > [!NOTE] > > `Image` and `PDF` capture the chart or dashboard as it's rendered on screen, not a re-flowed document. A table, or any tile with scrollable content, that doesn't fit its space shows only the rows visible without scrolling; the rest are cut off. To fit the content, resize the tile or limit the table with [Limiting displayed rows](/visualizations/table#limiting-displayed-rows). For the full data, deliver as `CSV` or `.xlsx` and tick [Attach the file to the delivery](#attach-the-file-to-the-delivery) to post it in the Slack thread, where Slack shows it as a table. #### Filters The `Filters` block lists the filters already saved on the content: a dashboard's [saved filters](/explore/dashboards/filter#saved-filters), or the filters saved on a chart. Each delivery keeps its own values for them, so one chart can feed several deliveries that each show a different slice. You can change a filter's operator and value, reset it to the saved value, or remove it so the delivery uses the saved default; you can't add filters the content doesn't already have. Removed filters stay listed so you can re-add them later, and filters that no longer exist on the content show up under a notice so you can clear them out. ![The Data & format panel for a chart delivery, with the chart's Status filter changed from completed to shipped and marked as an unsaved change](https://mintcdn.com/lightdash/T6MpLoV8fA1FA9qo/images/explore/create-scheduled-deliveries/scheduled-delivery-chart-filters-light.png?fit=max\&auto=format\&n=T6MpLoV8fA1FA9qo\&q=85\&s=9f1f8d45fbb6e465cfbe43e339a7c502) The values you set here apply to everything the delivery produces: the image or PDF, and the CSV or `.xlsx` file. A [Google Sheets sync](/integrations/google-sheets) is a separate schedule from a delivery and always uses the filters saved on the chart, with no per-sync override. For charts, changing a saved filter needs the same explore access you'd need to run that query yourself; [roles](/workspace-admin/roles) that can create deliveries but not explore see the chart's filters without being able to change them. Every recipient of a delivery gets the same filter values. The delivery runs as its owner, so [user attributes](/workspace-admin/user-attributes) such as `${lightdash.user.email}` resolve to the owner, not to each recipient. To send each person their own cut, create one delivery per person with its own filter values. Relative date filters, such as `in the current day`, are worked out when the delivery runs, which can be a few minutes after its scheduled time. A delivery scheduled just before midnight can land on the new day and show no data; schedule it earlier, or use `in the last 1 completed days` to send the previous day. > [!NOTE] > > If the content has [required filters or filter requirement groups](/explore/dashboards/filter#required-filters-and-filter-requirement-groups), you can't save or send the delivery until the `Filters` block satisfies every rule. #### Attach the file to the delivery For `CSV` and `.xlsx` deliveries, tick **Attach the file to the delivery** to send the results file itself rather than only a download link. The checkbox becomes available once the delivery has an email or Slack recipient. Emails get the file as an attachment; Slack channels get the delivery message as usual, with the file posted in its thread, where Slack shows the results as a table. Dashboards deliver one file per chart, or a single workbook when the `.xlsx` layout is set to one workbook. ![The Data & format panel with CSV selected and the Attach the file to the delivery checkbox ticked, with a data.csv chip in the preview](https://mintcdn.com/lightdash/-PR_JtBe4z07XymN/images/explore/create-scheduled-deliveries/scheduled-delivery-attach-file.png?fit=max\&auto=format\&n=-PR_JtBe4z07XymN\&q=85\&s=e8d2e71d154a27bace2490b137344523) ![A Slack thread under a delivery message showing the delivered CSV rendered as a table](https://mintcdn.com/lightdash/-PR_JtBe4z07XymN/images/explore/create-scheduled-deliveries/scheduled-delivery-slack-thread.png?fit=max\&auto=format\&n=-PR_JtBe4z07XymN\&q=85\&s=386b5bef13e227ec1c0a6ab90d3408c2) #### Choose which tabs to include For dashboards with more than one [tab](/explore/dashboards#add-tabs), **Include all dashboard tabs** is ticked by default. Untick it and pick the tabs you want: only tiles on those tabs go into the delivery, whatever the format. [Required filters](/explore/dashboards/filter#required-filters-and-filter-requirement-groups) apply only to tiles on the tabs you include. #### One PDF page per tab For dashboards that use [tabs](/explore/dashboards#add-tabs), a **Each tab on its own page (with dashboard and tab title)** checkbox appears when the format is `PDF`, or `Image` with **Also include image as PDF attachment** enabled. Turn it on to render each tab as its own PDF page — every page includes the dashboard title and the tab name, and hidden tabs are skipped. Tiles that aren't assigned to any tab (from dashboards created before tabs existed) render on the first exported tab's page. #### Render width For dashboard deliveries in `Image` or `PDF` format, the **Render width** menu under the preview sets how wide the dashboard is laid out before Lightdash captures it: Tablet (1000px), Laptop Screen (1400px, the default), External Monitor (1500px), TV Screen (1600px), Large Monitor (1920px), or Ultra-wide Monitor (2560px). Dashboards are responsive, so a different width changes how tiles wrap and how much of the image each tile fills. The size an email client or Slack displays the image at is set by that client, not by this setting. There's no zoom setting: a wider render width fits more columns but makes text smaller in the image, so pick the narrowest width that fits your widest tile. To use a width that isn't in the menu, set it in pixels as `customViewportWidth` in the delivery's YAML with [content as code](/workflow/content-as-code): download with `lightdash download --include-scheduled-deliveries`, edit the file under `lightdash/scheduled-deliveries/`, then run `lightdash upload --scheduled-deliveries `. Changing **Render width** in the app afterwards replaces the custom width. **Delivering a [data app](/data-apps)?** Scheduling, recipients, and message options are the same, but what lands in the delivery isn't: an app doesn't declare its queries, so Lightdash captures every query the app runs and sends one file per query. Available formats, row limits, and how you pin a filtered cut all differ — see [Scheduled deliveries and syncs for data apps](/data-apps/deliveries-and-syncs). ### Message Under `Content > Message`, write the static message that goes out with every delivery. If you'd rather Lightdash write it for you from the data itself, turn on an [AI agent](#ai-agent) instead. Two switches above the message control what else the delivery carries: * **Include link to Lightdash** is on by default and adds links back to the chart or dashboard, such as the **Open in Lightdash** button in Slack. Turn it off to send the delivery without them. * **Send as plain text** sends emails as plain text, with no Lightdash branding, buttons or footer. Your message is the whole body; with no message, the email has a one-line intro naming the chart or dashboard. Attached files, such as a PDF, stay attached, and an image or a file that isn't attached is listed as a download link. It needs at least one email recipient, and Slack and webhook deliveries aren't affected. ## AI agent [Pro](/support/feature-badges#pro) [Enterprise](/support/feature-badges#enterprise) AI-enhanced messages use [AI agents](/agents). Instead of a static message, Lightdash can write the delivery message from your data on **every send** — summarizing the results and calling out notable changes or trends, so recipients get the headline before they even open the attachment. ![The Content > AI agent panel with AI-enhanced message toggled on, an Instructions box, and an agent picker](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/create-scheduled-deliveries/scheduled-delivery-ai-agent.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=bb9cb9e98f2f6c3df17cc5b614b19567) Under `Content > AI agent`, toggle on **AI-enhanced message** and edit the **Instructions** to tell Lightdash what to focus on. You can optionally pick an **AI agent** to write the message using that agent's tools, context, and knowledge instead of a plain summary. A picked agent starts from the delivered results, with the delivery's filters applied, and can also query any other explore it [has access to](/agents/data-access#limiting-access-to-specific-explores-and-fields). To have the message draw on data outside the delivered content, such as an incident log or refunds, model that data as a table in your dbt project, give the agent access to it, and say in the **Instructions** what to compare it with. ## Editing and deleting your scheduled deliveries Selecting a scheduled delivery from the list shows its details: schedule and format, next and last run, recipients, and an AI summary preview if you've turned one on. From here you can toggle the delivery active or inactive, jump to `Edit` to change its configuration, run it immediately with `Send now`, view its run history, or delete it with the trash icon. Pausing a delivery stops manual runs too: while a delivery is inactive, `Send now` (and the equivalent API call) still accepts the request, but the delivery itself is skipped until you set it back to active. ![A scheduled delivery's detail view showing its schedule, format, next and last run, recipients, and the Edit, Send now and delete controls](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/create-scheduled-deliveries/scheduled-deliveries-list-detail.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=a9dcd3569d0471d92c34aaeff175c4a8) ## Overview of your scheduled deliveries Users who have an admin role in your project can access an overview of your scheduled deliveries in the project settings. In the scheduled deliveries overview page, you can see a list of all of your scheduled deliveries, their most recent delivery status, and a history of all of the previous scheduled deliveries in your project. To access the overview page, just head to your project settings, then to the `Syncs & Scheduled Deliveries` tab. ![The Syncs & Scheduled Deliveries tab in project settings, listing every delivery in the project with its most recent status](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/create-scheduled-deliveries/scheduled-deliveries-overview.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=6f70cc01b2eff775f2c65c5e458c723d) On the **All schedulers** tab, **Owner** is the delivery's current owner and **Created** is the date it was created, without a time. When you [reassign a delivery](#reassigning-scheduled-delivery-owners), **Owner** changes to the new owner and the original creator is no longer shown. The **Run history** tab lists runs newest first and can't be re-sorted, so to find a delivery's first run, search for its name and scroll to the oldest entry. ### Delivery status Each scheduled delivery displays a clear status indicator showing its current state: * **Completed successfully** - All jobs in the delivery completed without errors * **Failed** - The delivery encountered an error and did not complete * **Partial failure** - Some jobs completed successfully while others failed * **Running** - The delivery is currently in progress * **Scheduled** - The delivery is queued and waiting to run ### Run details Click on any scheduled delivery run to open the **Run Details** modal. This shows: * The job configuration including delivery target and schedule * A list of all sub-jobs with their individual status, timing, and any error details * For failed jobs, detailed error information to help with troubleshooting ![The Run Details modal showing the job configuration and a list of sub-jobs with their status, timing and error details](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/create-scheduled-deliveries/run-details-modal.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=d34b6e7b0d1223b194a46c56768ddfaa) ### Reassigning scheduled delivery owners You can transfer ownership of scheduled deliveries to another user in your organization. This is useful when team members change roles or leave the organization. On a project that requires [personal warehouse credentials](/personal-settings/personal-warehouse-connections), each delivery queries the warehouse with its owner's personal credentials. If the owner has none for the project, or their sign-in has expired, the delivery fails, and deliveries owned by a service account always fail. To keep deliveries running, reassign them to one owner who keeps their credentials current. #### Reassigning a single delivery 1. In the scheduled deliveries overview, find the delivery you want to reassign 2. Click the three-dot menu next to the delivery 3. Select **Reassign owner** 4. Search for and select the new owner from the dropdown 5. Click **Reassign** to confirm ![The three-dot menu on one delivery row with Reassign owner selected, and a dropdown for searching the new owner](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/create-scheduled-deliveries/reassign-owner-single.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=b5ae88e228087de5e567b466d23722c1) #### Bulk reassignment To reassign multiple scheduled deliveries at once: 1. Use the checkboxes to select the deliveries you want to reassign 2. A selection counter will appear showing how many deliveries are selected 3. Click the **Reassign owner** button that appears in the toolbar 4. Select the new owner and confirm ![Several delivery rows selected by checkbox, with a selection counter and a Reassign owner button in the toolbar](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/create-scheduled-deliveries/reassign-owner-bulk.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=d2306caa22688ece612debce4212e52b) The new owner must have permission to create scheduled deliveries in the project. Users with viewer roles cannot be assigned as owners. ## Sending to private Slack channels You must add the Lightdash Slack bot to a private Slack channel before it can post there. To send to a private Slack channel, type the channel name exactly as it appears in Slack into the destination field, then click it to confirm. ## Sending to Microsoft Teams You can send Lightdash deliveries directly to Microsoft Teams using incoming webhooks, keeping your team updated with key metrics right inside your Teams channels. The legacy Office 365 Connector webhooks are deprecated. Microsoft now recommends using **Power Automate Workflows** to create incoming webhooks for Teams. ### Creating a webhook with Power Automate Workflows 1. Go to [Power Automate](https://make.powerautomate.com/) 2. Select **Templates** 3. Filter by "webhook" 4. Select the **Post to a channel when a webhook request is received** template ![The Power Automate template gallery showing the "Send webhook alerts to a channel" Microsoft Teams template](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/create-scheduled-deliveries/msteams-select-template.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=dd246181034e56404959ff73a8ceb514) 5. Select your Microsoft account and target Teams channel 6. Once added, click **Edit** on the workflow 7. Select the **When a Teams webhook request is received** trigger 8. Copy the **HTTP URL** ![The Power Automate flow editor with the Teams webhook trigger selected and its HTTP URL field ready to copy](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/create-scheduled-deliveries/msteams-template-flow.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=e4a902136c735149b0d67e7a6738b822) 9. Use that HTTP URL in the webhook field in Lightdash For more details, see the [official Microsoft documentation](https://support.microsoft.com/en-us/office/create-incoming-webhooks-with-workflows-for-microsoft-teams-8ae491c7-0394-4861-ba59-055e33f75498). Add the webhook to the list of destinations in your delivery, then test how it looks in Teams by pressing **Send now**. ## Sending to Google Chat You can send your Lightdash scheduled deliveries directly to a Google Chat space using an incoming webhook. 1. In Google Chat, open the space you want to send deliveries to 2. [Create a webhook](https://developers.google.com/workspace/chat/create-webhook) for that space and copy its URL 3. Paste the webhook URL into the Google Chat destination field in the scheduled deliveries form You can test how it looks in Google Chat by pressing `send now`. ## Configuring the default time zone Project admins can set the default time zone used for scheduled deliveries across the project in the `Project settings` --> `Syncs & Scheduled deliveries`. ![The default time zone setting in the project's Syncs & Scheduled deliveries settings](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/create-scheduled-deliveries/project-default-time-zone-6934eca82e7b3a4e03ee345cf461d782.jpg?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=57c43ab832ddc244cc7b7b2e71a95d69) Scheduled deliveries will be set to the project's default time zone that you pick here. If you update the project's default time zone, then scheduled deliveries where the time zone hasn't been customized will automatically be translated to use the new default time zone. Users can customize the time zone used in a scheduled delivery. This will override the project default for that scheduled delivery. For example: * my project default time zone is set to UTC * I have a scheduled delivery set to `Weekly on Monday at 15:00` * I change the project default time zone to `(UTC -5:00) America/New York` * my scheduled delivery will now be set to `Weekly on Monday at 10:00` ## Configuring download link expiration By default, download links in scheduled deliveries expire after 3 days. Organization admins can change this from **Settings → Organization → Exporting**. ### Settings * **Download link expiry (days)** — the base expiry that applies to every channel. Accepts 1–365 days. * **Set a different expiry for specific channels** — when enabled, you can override the base for individual channels you have set up: Email, Slack, Microsoft Teams, and Google Chat. Leave a channel blank (or click the ✕ in the input) to inherit the base. Only channels your organization has configured appear in the per-channel section. If a channel is later disabled, any saved override is preserved but hidden. ### How expiry is resolved For each delivery, Lightdash picks the first value that is set, in this order: ``` organization channel override → organization base → environment channel default → environment base default ``` The environment defaults come from the `PERSISTENT_DOWNLOAD_URL_EXPIRATION_SECONDS*` variables on self-hosted instances and ship with sensible defaults on Lightdash Cloud. ### Long-lived links (more than 7 days) AWS presigned S3 URLs cannot live longer than 7 days. When you set an expiry above 7 days, Lightdash transparently switches that channel to a persistent download URL — a stable app link that mints a fresh short-lived S3 URL on each access. No additional configuration is required, and shorter expiries continue to use direct S3 links as before. Self-hosted instances can still set instance-wide defaults with the [persistent download URL environment variables](/self-host/customize-deployment/environment-variables#persistent-download-urls). Organization settings override those defaults when present. # Dashboards Source: https://docs.lightdash.com/explore/dashboards Arrange related charts, text, and video into one view your team can filter together A dashboard is a single view that arranges related charts alongside explanatory text and video. Charts on a dashboard can be filtered together, drilled into, and re-zoomed to a different date granularity without anyone editing the underlying charts. This page covers building one: [planning](#plan-before-you-build), [creating the dashboard](#create-a-dashboard), [adding charts](#add-charts), [markdown and Loom tiles](#add-markdown-and-video-tiles), [data app tiles](#add-data-app-tiles), [saving](#save-your-dashboard), [owners](#assign-an-owner), [filters](#add-filters), [tabs](#add-tabs), [tile titles](#rename-a-tile), [hiding tile headers](#hide-tile-headers), [duplicating](#duplicate-a-dashboard), and [sharing](#share-your-dashboard). For what viewers can do once it's built, see [interacting with dashboards](/explore/dashboards/interact). ## Plan before you build A dashboard is easier to build — and much easier to read — if you can answer three questions first. **Who is this dashboard for?** Does your audience already know the subject, or do they need context to reach your point? Add whatever context they'll need: acronyms that want clarifying, or a note about whether a rising number is good or bad. **What is this dashboard trying to accomplish?** Do you want your audience to take an action, or to know something they didn't know before, and what information do they need to do it? Write a clear summary of the purpose and put it in the dashboard's description, then outline the questions each tile should answer. **How will you build it?** Match the data you have to that outline of questions, and work out which metrics and dimensions you'll use — including whether they exist yet. ## Create a dashboard On the nav bar, click **New** to create a new dashboard. ![The New menu in the nav bar with the Dashboard option](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/create-a-new-dashboard.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=fcb184cc4b00e839f0ea0ce1410b895d) Fill out the details and hit **Create**. You'll be redirected to your new dashboard page. ![An empty dashboard ready for its first tile](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/start-building-your-dashboard.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=59c734b287f63a7d16c9a8841866f7a0) From here you add content with the **Add tile** button. ## Add charts You can create a new chart from within your dashboard, or add an existing one. ### Create a new chart Creating charts from within a dashboard keeps your spaces and projects free of charts that are only used once. Click **Add tile**, then **New chart**, and you'll be taken to the chart builder. Once you save the chart it appears at the bottom of your dashboard. ![Creating a new chart from inside a dashboard](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/create-chart-within-dashboard.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=b5f1a633839e7301e536346d099c9285) Charts created this way are exclusive to the dashboard: they can't be reused in other dashboards, and they don't appear in global search or in any space. To make one reusable, detach it from the dashboard and save it to a space with the **Move to space** option in the chart's three-dot menu. ![The Move to space option on a dashboard chart](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/move-chart-to-space.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=c0c9cc6709fedf5259903dcd1091e12e) ### Add an existing chart Click **Add tile**, then **Saved chart**. Clicking any chart adds it at the bottom of your dashboard. ![Adding a saved chart as a dashboard tile](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/dashboard-add-saved-chart.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=102bb8b44a152c57f8dfd8880a111370) Resize a chart by dragging its lower-right corner, and position it by dragging its center. A tile always shows its chart's saved visualization. To show the same results two ways, such as a bar chart and a table, add two charts: duplicate the saved chart and change the copy's chart type, or build the second version as a [new chart](#create-a-new-chart) from the dashboard. ## Add markdown and video tiles Alongside charts, you can add markdown tiles and embedded Loom videos to explain the dashboard to the people using it. ### Markdown tiles Markdown tiles take text with headers and formatting, code blocks, and images. The built-in editor provides most of the formatting you'll need. Their content is static: dashboard filters don't change it. > [!TIP] > > You can paste IFRAME embed codes to embed things like Notion pages, CRMs, web analytics — anything that offers IFRAME embedding. To add an image hosted on the web, such as your company logo, paste the image URL into the tile using standard markdown image syntax: ```markdown theme={null} ![image alt text here](https://placehold-url.com/image.png) ``` ![A markdown tile displaying a company logo](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/dashboard-logo.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=9bb7cc68fcf1a365c1929d8024f58801) #### Responsive images To keep images scaling properly as the dashboard resizes, use inline CSS with responsive properties so they aren't stretched or distorted on different screen sizes. ```html theme={null} ``` For more control over sizing: ```html theme={null} ``` The supported responsive CSS properties are `max-width` and `min-width` for width bounds, `max-height` and `min-height` for height bounds, `height:auto` to maintain aspect ratio, and `object-fit` to control how images fit (for example `contain` or `cover`). #### Backgrounds and inline HTML You can add background colors to markdown tiles to emphasize sections or titles. ![A markdown tile with a purple background and a welcome heading](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/markdown-background.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=eacf059796041578c7c212150271b13c) The tile above is built with this code: ```html theme={null}
⚡

Welcome to your Lightdash Dashboard

``` A number of other inline HTML options are available. Copy these into a markdown tile to try them out. > [accordion] Other HTML markdown tile options > > ```markdown theme={null} > Check out this bold word. > You can do italics. > And underline. > Or maybe you want to strikethrough. > > Show code snippets like Hello World!. > Or highlight something important. > > Add links like this! > > Use subscript or superscript > >

Easily colour your text.

>

Or change the size.

>

Center your text.

>

Or align it to the right.

>

You can even justify a line of text if you are trying to communicate a point that is particularly long, perhaps something like this example sentence?

>

Change the word spacing. 👏

>

> Or combine a whole bunch of styles together. >

> >

It supports headings

>

Here's an H2 heading in red

> > You can include images and apply options and styles. Here's one I centered earlier: > > Centered Image > ``` ### Loom tiles Click the Loom video option, then enter a URL and a title for the tile. ## Add data app tiles A [data app](/data-apps) can sit on a dashboard as a tile beside your charts. Click **Add tile**, then **Data app**, enter a **Title**, and pick the app. Only apps that have been moved into a space are listed, and the **Data app** option only shows when data apps are available to your organization. For how dashboard filters reach the queries a data app tile runs, see [data apps](/data-apps). ## Save your dashboard When you're happy with the layout, hit **Save**. You can see every saved dashboard in your project under **Browse → All dashboards**. ## Assign an owner A dashboard can have one owner: the person responsible for keeping it accurate and maintained. The owner is shown wherever people find the dashboard, so anyone with a question knows who to ask. To assign or change the owner, open the dashboard's three-dot menu, choose **Edit details**, and pick a person in the **Owner** field. Clear the field to leave the dashboard without an owner. The same form opens from **Rename** on a dashboard's row under **Browse → All dashboards**. ![The Update Dashboard form with an Owner field set to a team member](https://mintcdn.com/lightdash/hFiiwKKzUawgZw6s/images/explore/dashboards/owner-assign-light.png?fit=max\&auto=format\&n=hFiiwKKzUawgZw6s\&q=85\&s=09582cac4407cc22b7aff3290609588f) Anyone who can rename or delete the dashboard can change its owner: project editors and above, and space editors and admins. Only individual users can own a dashboard, not groups. The owner appears in the dashboard's info popover, next to its title. Dashboards have no category or tier field like the [categories](/explore/metrics-catalog/curate-the-catalog#assigning-categories-to-metrics) you can assign to metrics. To mark the dashboards your team should trust, [verify them](/explore/verified-content). ![The dashboard info popover listing the owner alongside last modified, views, and space](https://mintcdn.com/lightdash/hFiiwKKzUawgZw6s/images/explore/dashboards/owner-info-popover-light.png?fit=max\&auto=format\&n=hFiiwKKzUawgZw6s\&q=85\&s=af74fbe6e58e6ff934b3036bc7bd7784) ### Find dashboards by owner **Browse → All dashboards** has an **Owner** column, and the **Filter by owner** picker in the toolbar narrows the list to one person's dashboards. Use it to review everything a teammate is responsible for, or to reassign their dashboards one by one from each row's three-dot menu. ![The All dashboards page filtered by owner, with the Owner column showing the same person on every row](https://mintcdn.com/lightdash/hFiiwKKzUawgZw6s/images/explore/dashboards/owner-filter-all-dashboards-light.png?fit=max\&auto=format\&n=hFiiwKKzUawgZw6s\&q=85\&s=d84760170462a4271b4ab409d9a1d6a5) ### When an owner leaves When an admin deletes a user from **Settings → Users & groups**, the confirmation shows how many dashboards that person owns, broken down by project. The admin can transfer all of them to another member in the same step, or leave them without an owner and reassign later from **All dashboards**. ![The Delete user confirmation showing the number of dashboards the user owns and an option to transfer ownership to another user](https://mintcdn.com/lightdash/hFiiwKKzUawgZw6s/images/explore/dashboards/owner-transfer-on-delete-user-light.png?fit=max\&auto=format\&n=hFiiwKKzUawgZw6s\&q=85\&s=167e22de081280f4063260b75f3555b7) Ownership also travels with the dashboard: promoting it to another project keeps the owner, and [dashboards as code](/workflow/content-as-code#dashboards) carry it as an `ownerEmail` field. ## Add filters Dashboard filters let you change the data in every tile at once. In edit mode, click **Add filter**, pick a field and a value, and hit **Apply**; save the dashboard to keep the filter for everyone who opens it. Filters do a lot more than that — temporary filters that only you see, filters that viewers must fill in before the dashboard loads, and per-tile control over which fields a filter applies to. See [dashboard filters](/explore/dashboards/filter) for the full behavior. ## Add tabs As a dashboard grows it may end up supporting multiple teams and use cases. Tabs organize it. Reach for them to: * **Break up high level goals or themes**, e.g. Revenue, Retention, Engagement * **Separate views for different audiences**, e.g. Executive Summary vs. Team-level detail * **Avoid clutter and performance issues in dashboards with lots of tiles**, e.g. split 30+ charts into three tabs based on priority or groupings like the first and second bullets above Tiles on a tab load only when someone opens that tab, so the queries behind other tabs don't run until a viewer switches to them. While editing, click **Add tile**, then **Add tab**. ![The Add tab option in the Add tile menu](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/tabs-new.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=63ec038b1c58868d5022a8b634560973) Give the tab a unique name. ![Naming a new dashboard tab](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/tabs-name.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=7cc0fbcf38c701d91127dead725d82e5) Once created, the tab is a fresh canvas you fill just like any other dashboard. ![A dashboard with two tabs](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/tabs-added.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=4b7de2c468dfd825d3f05ec10dd5880f) A tab, or a dashboard without tabs, holds up to 50 tiles of any type, and a dashboard holds up to 20 tabs. When a tab is full, **Add tile** is disabled and an **Add tab** button appears beside it; add a tab to keep adding tiles. Self-hosted instances can change both limits with `LIGHTDASH_DASHBOARD_MAX_TILES_PER_TAB` and `LIGHTDASH_DASHBOARD_MAX_TABS_PER_DASHBOARD` (see [environment variables](/self-host/customize-deployment/environment-variables#query-limits-and-behavior)). ### Editing and removing tabs To edit a tab, click the edit icon to the right of its name while in dashboard edit mode. From there you can rename the tab or remove it. ![The tab edit menu with rename and remove options](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/tabs-edit.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=9a1b78b9da5b7e1b26ea407ed7bfec69) If the tab has content in it, you get the option to transfer that content to another tab, so you can remove the tab and keep the tiles. ![Choosing a destination tab when removing a tab that has content](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/tabs-transfer-content.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=755da17339842692070011351d084a7a) ### Sharing tabs Tab content shares just like a regular dashboard. A shareable link navigates straight to the tab that was active when you created it. ### Embedding dashboards with tabs When you embed a dashboard that has tabs, every tab is appended into a single dashboard, so the embed shows the content of all tabs at once. ## Rename a tile A chart tile shows the chart's name unless you give the tile its own title. A tile title only changes this dashboard: the chart keeps its name in spaces, search, and other dashboards. 1. Enter edit mode by clicking **Edit dashboard**. 2. Open the tile's three-dot menu and select **Edit tile content**. 3. Enter a **Title**, or clear it to go back to the chart's name. **Edit tile content** has no description field. To rename the chart itself or change its description, open the chart, click **Edit chart**, then click the pencil icon next to its name. The description shows as a tooltip when you hover over the tile's title. ## Hide tile headers Hiding a tile's header gives a cleaner look and more space to the chart content. 1. Enter edit mode by clicking **Edit dashboard**. 2. Click the tile you want to modify and select **Edit tile content**. 3. Click the eye icon next to the tile title to hide it. The tile now displays without its header. Repeat the steps and click the eye icon again to bring it back. ## Duplicate a dashboard To copy a dashboard, open its three-dot menu and select **Duplicate**. Charts that [belong to the dashboard](#create-a-new-chart) are copied with it, so you can change them without touching the original. Charts saved to a space aren't copied: the new dashboard's tiles use the same saved charts, so editing one changes it on every dashboard that shows it. To give the copy different values, use [dashboard filters](#add-filters), which are saved per dashboard, or duplicate those charts and swap them in with **Edit tile content**. ## Share your dashboard Copy the URL, or press the 🔗 button, to send the dashboard to people who already have access — a URL copied at any screen size opens the interactive dashboard for everyone. To grant users or groups access to this dashboard, use [Direct access](/workspace-admin/direct-access), including its rules for dashboard-owned and reusable charts. To share it with a particular set of filter values applied, see [sharing a dashboard with filter overrides](/explore/dashboards/filter#sharing-a-dashboard-with-filter-overrides). # Date zoom Source: https://docs.lightdash.com/explore/dashboards/date-zoom Change the time granularity of charts on your dashboard without editing them Date zoom lets viewers change the date granularity of time-based charts on a [dashboard](/explore/dashboards) without editing them. This is useful for zooming in to see daily patterns or zooming out to identify long-term trends. Date zoom works through **controls**, which behave like dashboard filters: each control is a pill in the dashboard toolbar that sets a granularity, and editors choose which charts each control governs. A dashboard has one built-in **Default zoom** plus any number of named controls you add. ![Date zoom controls on a dashboard](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/date-zoom/date-zoom-controls-light.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=be8c2f3c88228be6de98abac9feb2298) ## How date zoom works When viewing a dashboard, open a date zoom control and pick a granularity (Day, Week, Month, Quarter, Year, or a custom granularity). Every chart governed by that control updates to show data at the chosen granularity. Pick **None** to restore the charts' original granularity. **Key behaviors:** * A control only affects charts that have a date dimension in their results. * The **Default zoom** governs every date-zoomable chart that isn't attached to a named control. It's hidden from viewers when every chart belongs to a named control. * Each named control governs only the charts you attach to it, using a specific date field per chart. * A chart can belong to at most one control. Charts already attached elsewhere show an **In *\[control name]*** badge and can't be selected by another control. * Changes made by viewers are temporary. Refreshing the dashboard restores the configured defaults. ## Configuring available granularities The granularities offered by **every** control on the dashboard are set on the **Default zoom** pill. Named controls can only offer granularities you've enabled here. ![Configuring available date zoom granularities](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/date-zoom/date-zoom-settings-light.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=13fd4a1c4a7d0f028501d0bc114702d0) ### Setting available granularities 1. Open the dashboard in edit mode 2. Open the **Default zoom** dropdown 3. Use the checkboxes to enable or disable granularities 4. At least one granularity must remain enabled 5. Save the dashboard to persist your changes ### Setting a default granularity You can pin a granularity as the default that's automatically applied when the dashboard loads: 1. In the **Default zoom** dropdown, click the pin icon next to a granularity 2. The pinned granularity becomes the default 3. Click the pin again to remove the default When a default is set, the dashboard automatically applies that granularity on load (unless overridden by a URL parameter). New controls also start at this granularity. Default granularities don't apply when the dashboard is loaded with a granularity already specified in the URL. ## Creating date zoom controls Named controls let you point different charts at different granularities, or scope a single zoom to a chosen set of charts (including charts on other tabs). 1. Open the dashboard in edit mode 2. Click **Add date zoom** 3. In the **Settings** tab, give the control a name and pick its default granularity 4. In the **Chart tiles** tab, select the charts this control should govern. For each selected chart, choose the **date field** the zoom applies to. Charts are grouped by tab, and you can use **Select all** or a tab's checkbox to attach many at once. 5. A control must target at least one chart before you can save. Click **Save changes**, then save the dashboard. ![Date zoom control settings](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/date-zoom/date-zoom-control-settings-light.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=de7df061a2825eedff954c84561d161c) ![Attaching charts to a date zoom control](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/date-zoom/date-zoom-control-charts-light.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=cc31d0f1ffa3db58abd6757f3f15bb3b) To edit an existing control, open its pill and choose **Configure**; to delete it, choose **Remove**. Viewers can change a control's granularity from its pill, or pick **Reset to default** to return it to its configured granularity. Only charts with a date or timestamp dimension in their results are eligible to be attached to a control. A chart with no zoomable date field won't appear in the **Chart tiles** list. ## Using custom granularities Custom granularities defined in your `lightdash.config.yml` appear in date zoom dropdowns alongside standard options, below a visual divider. This is useful for business-specific time periods like fiscal quarters or custom week definitions. See the [dimensions reference](/semantic-layer/dimensions#using-custom-granularities) for how to create and configure custom granularities. ## Hiding or showing date zoom on a dashboard You can control date zoom visibility at two levels: * **Hide the whole date zoom section:** in edit mode, click the **eye icon** on the date zoom section chip in the dashboard toolbar. When hidden, no date zoom controls are shown to viewers. * **Hide an individual control:** in edit mode, click the **eye icon** next to a control's pill. A hidden control isn't shown to viewers, but its granularity still applies to the charts it governs. Hiding the whole section also stops the Default zoom's pinned granularity from applying on load, so charts that aren't attached to a named control render at the granularity they were saved with. Named controls keep applying their granularity to their charts, and a `dateZoom` parameter in the dashboard URL still overrides the saved granularity of unattached charts. Share the dashboard link without that parameter if every chart should keep its own granularity. In [dashboards as code](/workflow/content-as-code), hiding the whole section is `isDateZoomDisabled: true` in the dashboard's `config`. Save the dashboard to persist visibility changes. You can show a section or control again at any time by toggling the eye icon back on in edit mode. ## Referencing the date zoom in custom SQL The currently selected date zoom granularity is exposed as a built-in [reserved parameter](/semantic-layer/parameters#reserved-parameters) called `date_zoom`. You can reference it in custom SQL anywhere parameters are supported: ```sql theme={null} ${ld.parameters.date_zoom} ``` It resolves to the granularity name in lowercase (for example `day`, `week`, `month`, `quarter`, `year`, or a [custom granularity](/semantic-layer/lightdash-config-yml#custom-granularities-configuration) name). When no date zoom is selected, the value is an empty string. ![Custom SQL editor autocomplete listing \$\{ld.parameters.date\_zoom} as a System variable](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/date-zoom/date-zoom-reserved-parameter-light.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=418874baae62d596e5b2d464b9414e87) This is useful for adapting your SQL to the granularity the viewer picked on the dashboard, without defining a user parameter: ```sql theme={null} CASE WHEN ${ld.parameters.date_zoom} = 'week' THEN 'Weekly' WHEN ${ld.parameters.date_zoom} = 'month' THEN 'Monthly' WHEN ${ld.parameters.date_zoom} = '' THEN 'No date zoom applied' ELSE 'Other' END ``` See [Reserved parameters](/semantic-layer/parameters#reserved-parameters) for the full list and behavior. ## Referencing the granularity in chart labels You can also reference the active granularity directly in chart labels — useful for axis names, series names and slice labels that should update when a viewer changes the date zoom (or when a chart is saved at a fixed granularity). Use the following placeholder in any supported label, where `table_field` is the base date dimension on the chart (for example `orders_order_date`): ```text theme={null} ${table_field.granularity} ``` At render time the placeholder is replaced with the granularity actually used to compile the query, lowercased — for example `day`, `week`, `month`, `quarter`, `year`, or a [custom granularity](/semantic-layer/lightdash-config-yml#custom-granularities-configuration) label. For example, a y-axis label of `Orders per ${orders_order_date.granularity}` renders as `Orders per week` when the dashboard is zoomed to a weekly granularity. When you type `$` in an axis name, big-value label, or gauge label, autocomplete lists every base date dimension on the chart so you can insert the placeholder without remembering the exact field id. You don't need to remember the exact field id — Lightdash will insert the placeholder for you: * **Cartesian axis names, big-value labels, and gauge labels** — type `$` in the label field and autocomplete lists every base date dimension on the chart. * **Pie group labels and funnel step labels** — click the **insert date granularity** icon inside the editable label field to insert the placeholder for the matching date dimension. **Supported labels:** * [**Big value**](/visualizations/big-value) — label and comparison label * [**Bar, line, area, scatter, and mixed charts**](/explore/configure-charts) — x-axis name, y-axis name, and series names * [**Pie chart**](/visualizations/pie-chart) — group labels * [**Gauge**](/visualizations/gauge) — custom value label and custom percentage label * [**Funnel chart**](/visualizations/funnel-chart) — step labels If the referenced dimension isn't on the chart, the placeholder is left untouched so you can see what's missing. > [!WARNING] > > Pie group labels and funnel step labels are per-category overrides — each custom label is keyed to a specific slice or step value. Because date zoom re-buckets dates (for example, the monthly `2024-07` slice becomes a weekly `2024-07-15` slice), an override set at one granularity stops matching after a viewer zooms to another and the custom label silently falls back to the raw value. If you need a label that survives date zoom, prefer the cartesian, big-value, or gauge labels above. ## Date zoom in embedded dashboards Date zoom can be enabled or disabled in embedded dashboards using the `canDateZoom` option in your JWT token: ```javascript theme={null} { content: { type: 'dashboard', dashboardUuid: 'your-dashboard-uuid', canDateZoom: true, // Enable date zoom in embed } } ``` When `canDateZoom` is enabled, embedded dashboards render the dashboard's configured date zoom controls (the Default zoom plus any named controls), not just a single global control. This applies to both JWT embeds and the React SDK, which share the same embedded dashboard rendering. See the [embedding reference](/embed/reference#date-zoom) for complete details. # Dashboard filters Source: https://docs.lightdash.com/explore/dashboards/filter Filter every tile on a dashboard at once with temporary, saved, required, and URL filters A dashboard filter sits at the top of the dashboard and changes the data in the tiles below it. One filter can drive every chart on the dashboard, or just the tiles you choose, and viewers can adjust it without editing anything. Two kinds exist: [temporary filters](#temporary-filters), which only you see, and [saved filters](#saved-filters), which everyone who opens the dashboard sees. Beyond that, this page covers [SQL runner charts](#filtering-charts-created-in-the-sql-runner), [how dashboard filters override chart filters](#how-dashboard-filters-interact-with-chart-filters), [required filters](#required-filters-and-filter-requirement-groups), [locked filters](#locking-dashboard-filters), [sections](#group-filters-into-sections), [empty defaults](#empty-default-dashboard-filters), [sharing with overrides](#sharing-a-dashboard-with-filter-overrides), [which tiles a filter hit](#seeing-which-tiles-have-filters-applied), [value autocomplete](#filter-value-autocomplete), and [filtering from the URL](#filtering-a-dashboard-from-the-url). For filter types and operators, see the [filters reference](/explore/filters-reference). For filtering a single chart as you build it, see [filtering in the Explore view](/explore/explore-view/filter). A dashboard filter restricts a field's values. To change the SQL logic behind tiles instead, such as the currency amounts are shown in, use a [parameter](/semantic-layer/parameters#parameters-vs-dashboard-filters). ## Temporary filters A temporary filter applies only to your session: you won't change the dashboard for anyone else who comes to look at it. To make a filter stick for everyone, use a [saved filter](#saved-filters). To restrict access to temporary filters, hide the `Add filters` button on a dashboard. In edit mode, toggle the **eye icon** next to the `Add filters` dropdown. When hidden, viewers are restricted to the filters set up in dashboard edit mode. 1. Open your dashboard. 2. Click `Add filter`, then specify the field to filter on and the value to filter by. ![Adding a new filter to a dashboard](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/filter/dashboard-temporary-filter-add-new-de0bc7bd337efb6669034882acf22249.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=5621f3bdc80c26047d81ff72ec5a46ec) 3. To adjust which tiles the filter applies to, open the `Tiles` tab. ![The Tiles tab of a dashboard filter](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/filter/dashboard-temporary-filter-add-tile-272b8237fca39deed799c9911dfead73.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=c17da8ac2cbff63fae9decc674f7b259) You can remove the filter from a tile, or change which field it's applied to on that tile. The filter starts out applied to tiles that have the same field (the same table and field name). Tiles from other explores without that field start unticked: tick each one and pick the field to filter on, for example `event_date` for a filter on `order_date`. The list only shows fields of the same type, best name matches first, and a tile with no field of that type can't be ticked. **Select all** only ticks tiles that have the same field. ![Changing the field a filter applies to on one tile](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/filter/dashboard-temporary-filter-add-tile-edit-5b99bc520ea2f5c75926a2dd374eafc4.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=f13957728221c530a977319c7cc8f7a2) This per-tile mapping is for dashboard filters only; parameters can't be mapped per tile. For how parameter controls apply to tiles, see [Parameters on dashboards](/semantic-layer/parameters#parameters-on-dashboards). 4. Your filters appear at the top of the dashboard. ![Applied filters shown at the top of a dashboard](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/filter/dashboard-temporary-filter-view-224e1eec6ee51e6a34496e07428fd51e.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=ca112884487593126bc7deac042d364e) Values for temporary and overridden saved filters are reverted when entering dashboard edit mode. You can also create a temporary filter by clicking a value in a chart tile, which is called [cross-filtering](/explore/dashboards/interact#cross-filtering-from-a-chart). ## Saved filters A saved filter is part of the dashboard: anyone who opens it sees the filter applied. 1. Open your dashboard. 2. Make sure you're in edit mode — if you're not, you'll see the `Edit dashboard` button. ![The Edit dashboard button](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/filter/edit-dashboard-243a6491ee8a29a8c824195bbc31e2bf.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=8956561ee62c7b72c7eaf156d1b6514a) 3. Click `Add filter`, then specify the dimension or metric to filter on. ![Choosing a field for a saved dashboard filter](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/filter/dashboard-temporary-filter-add-new-de0bc7bd337efb6669034882acf22249.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=5621f3bdc80c26047d81ff72ec5a46ec) 4. Leave the value blank, or specify one. Leaving the value blank applies no filter to the tiles, and gives viewers a control they can fill in to tailor results to their own needs. ![A dashboard filter saved with no default value](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/filter/add-filter-dashboard-empty-value-a1f50ba890bd490b55a27c2e6f9e0398.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=bc96ed4809e6fa571d9de2c94a55361d) To specify a value, toggle **Default value** so the filter applies to the tiles. ![Setting a default value on a dashboard filter](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/filter/add-filter-dashboard-default-value-765a13d8e7bfc6e72418e845d1dedef2.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=ff19a63fbc74fa7cac6c9e2c3495722d) 5. To adjust which tiles the filter applies to, open the `Tiles` tab. ![The Tiles tab listing every tile the filter can apply to](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/filter/filter-tiles-tab-4e0da6245fbdaef681413eaede8c6a7a.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=359102d4dffe0a8708501e0ce9a3c9d0) Here too you can remove the filter from a tile, or change which field it applies to on that tile. On a dashboard with [tabs](/explore/dashboards#add-tabs), a filter only shows on the tabs that have a tile it applies to. To give each tab its own value for the same field, add one filter per tab on that field, give each its own default value, and in each filter's `Tiles` tab keep only that tab's tiles. In [dashboard YAML](/workflow/content-as-code#dashboards), the same scoping lives in each filter's `tileTargets`: map a tile's slug to `false` to leave that tile out. Tiles that aren't listed get the filter whenever they have its field, and slugs that don't match a tile on the dashboard are ignored on upload, so copy the slugs from `lightdash download`. ```yaml theme={null} filters: dimensions: - target: fieldId: orders_region tableName: orders tileTargets: revenue-by-month: false top-customers: false ``` Whether a filter applies to a tile depends on the fields in that tile's explore, so a model change, such as a new join in a [preview project](/workflow/preview-projects), can make a filter show on more tabs. A filter that applies to no tiles at all shows on every tab, greyed out with a tooltip saying so, so you can fix or remove it. ![Changing the field a saved filter applies to on one tile](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/filter/dashboard-temporary-filter-add-tile-edit-5b99bc520ea2f5c75926a2dd374eafc4.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=f13957728221c530a977319c7cc8f7a2) 6. Click `Apply`, and the filter appears at the top of your dashboard. ![A dashboard filter applied but not yet saved](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/filter/dashboard-filters-ready-to-be-saved-361a01d7027a59f41c9422149fc92edf.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=625fbe26d7f554e37016a7a3ecb640f1) 7. Once you have all the filters you want, hit `Save`. ![Saving a dashboard with its new filters](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/filter/save-new-filters-dashboard-2883937f3e63c018e926b12aa964ade6.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=968f45f53f078df9b23c2caa335f2f0f) Now anyone who opens the dashboard sees your saved filters applied. ![A saved dashboard filter as viewers see it](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/filter/dashboard-filters-saved-517f21a3d5aebe75b0635e30955f342a.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=05f59a52c9c31186a4fa6ff697769ee1) Viewers can still adjust the values by clicking the filter, which lets them cut the data their own way without changing the dashboard. ![A viewer changing the value of a saved filter](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/filter/dashboard-filters-view-mode-37a66c4f684eda3919d6023439d6215a.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=0409608240c108c499baada2a26c83df) In edit mode, **Filter label** sets the bold name at the start of the filter in the bar, followed by the operator and value. Without a label, the field's name is shown. The label stays the same when a viewer picks a different value, so name what the filter is, like "Order date", rather than its default value, like "Last 28 days". In edit mode, a string or number filter using **is**, **is not**, **starts with**, **ends with**, **includes** or **does not include** has a **Multiple values** button beside the operator. Click it to switch to **Single value**, so viewers can pick only one value. Date and boolean filters don't have this option. To add saved filters to a dashboard, you must be an `editor` or an `admin` for your project. ## Filtering charts created in the SQL runner Dashboard filters apply to [SQL runner](/explore/sql-runner) charts as well as charts from the Explore view. How you create them depends on what's on the dashboard. On a dashboard with both Explore and SQL runner charts, create filters exactly as above — choose a field and create the filter. Then, in the **Chart tiles** tab, apply the filter to a SQL chart tile and choose the column it should apply to. On a dashboard with **only** SQL runner tiles, filters work from columns rather than semantic fields: 1. Choose a column from the list of all columns available across all charts. 2. Choose a filter label to give the filter a recognizable name. 3. Choose the filter operator and values as you would for any other filter. The filter is applied to every column on the dashboard with the same name as the filtered column. In the **Chart tiles** tab of the filter dropdown you can pick exactly which tiles and columns it applies to instead. As with Explore-chart filters, filters only apply to dimensions — in this case, non-aggregated columns. ## How dashboard filters interact with chart filters Dashboard filters override filters applied in a saved chart on the same field. For example, a chart for Sales in Asia is filtered to `country` **is** `China`, `India`, `Japan`. On the dashboard you add a filter `country` **is** `India`. The saved chart's filter is removed and the dashboard filter applies instead, so the tile is filtered to `country` **is** `India`. Dates work the same way. If the saved chart includes only orders completed on or after April 3rd 2024, and you add a dashboard filter for orders completed on or after August 1st 2024, the dashboard filter wins and the tile shows orders completed on or after August 1st 2024. A dashboard filter on a date also overrides chart filters on other time intervals of the same date dimension, so a dashboard filter on `order_date_day` replaces a chart filter on `order_date_month`. There's no per-chart setting to keep a chart's own condition on the same field alongside the dashboard filter. Chart filters on other fields are always combined with dashboard filters, so to keep an extra condition, put it on a different field. For example, filter the chart on a [custom SQL dimension](/explore/create-custom-fields#custom-sql) or a [table calculation](/explore/table-calculations) that flags the rows to exclude, instead of on the date itself. To stop the dashboard filter changing a chart at all, remove the filter from that tile in the `Tiles` tab. This carries into exploring: * **Explore from here** on a dashboard tile keeps the filters you saw on the dashboard. Filters overridden in the dashboard stay overridden; filters the dashboard didn't touch are the same as in the original chart. * **Edit** on the chart instead shows the original chart filters. ## Required filters and filter requirement groups Dashboard filters can be marked as **required**, so the dashboard won't load any data until a viewer picks a value. You can also combine several filters into a **requirement group**: viewers must set *at least one* of them, but any will do. Take a Sales overview dashboard that queries all historic orders, where loading it unfiltered is slow and expensive. We want viewers to always pick a **Payment method**, plus at least one of **Order status** or **Order date**, before any queries run. ### Marking a single filter as required While editing the dashboard, open the `Payment method` filter's popover and switch on the **Required** toggle. Required filters must start empty, so the toggle can't be combined with a default value. ![A dashboard filter popover in edit mode with the Required toggle switched on for the Payment method filter](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/filter/filter-requirements-required-toggle-light.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=0ecca163438e11eb6419488e898504b0) ### Combining filters into a requirement group The "Order status *or* Order date" half of the example needs a requirement group. Open the **Filter rules** popover next to the filter bar, where every rule is managed in one place: 1. Click **Add another rule**, pick `Order status`, then add `Order date` to the same rule. One filter makes a plain required filter; more make an "at least one of" group. Filters with a default value, or already in another rule, can't be picked. 2. Optionally, write a **Note for viewers** explaining why the filters are required. Ours says: "Pick a payment method, plus an order status or date range, to keep this dashboard fast." 3. Click **Save** in the popover, then save the dashboard. ![The Filter rules popover on the Sales overview dashboard, showing a required Payment method filter and an at-least-one-of group with Order status and Order date](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/filter/filter-requirements-rules-popover-light.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=7a45a325ac2053668bd72b3af0c8a0af) Filters that are part of a rule are marked with an asterisk in the filter bar, and the **Filter rules** button shows how many rules the dashboard has. ### What viewers see While any rule is unmet, chart tiles stay locked. The dashboard shows a **guided setup card** with a picker for each filter and your note as its subtitle. On the example dashboard, viewers get one picker for `Payment method`, an "at least one of" section for `Order status` and `Order date`, and a progress indicator showing how many rules are still unmet: ![The guided setup card on the Sales overview dashboard, prompting viewers to set Payment method plus at least one of Order status or Order date, with locked tiles behind it](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/filter/filter-requirements-guided-setup-light.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=3e4d5888cee39d14cf046b72d0fa8d9a) Everything loads the moment the rules are met, and locks again if a viewer clears a value a rule needed. Viewers can also dismiss the card and use the filter bar instead. A rule counts as met when one of its filters has a value or uses an operator that needs none (`is null`, `is not null`, `in the current`, `not in the current`, `in all periods to date`). On dashboards with [tabs](/explore/dashboards#add-tabs), a rule only locks the tabs its filters apply to. ### Required filters in dashboards-as-code Here's the same example in dashboard YAML: a required filter has `required: true`, filters sharing a `requiredGroupId` form an "at least one of" group, and the viewer note lives on the dashboard config as `requiredFiltersNote`. ```yaml theme={null} config: requiredFiltersNote: "Pick a payment method, plus an order status or date range, to keep this dashboard fast." filters: dimensions: - id: payment-method-filter label: Payment method required: true # ... - id: order-status-filter label: Order status requiredGroupId: status-or-date # ... - id: order-date-filter label: Order date requiredGroupId: status-or-date # ... ``` ## Locking dashboard filters Lock a saved dashboard filter to guarantee that the dashboard always runs with a specific value — a region, a tenant, or a date range that every viewer should stay inside. A locked filter behaves the same way for everyone: viewers see what's filtered, but they can't change the value, and [URL](#filtering-a-dashboard-from-the-url) or [embed](/embed/reference#dashboard-filters-interactivity) overrides targeting the same field are ignored. Use a locked filter when you want to: * Ship a dashboard that is permanently scoped (for example, "EMEA Sales") and stop viewers from accidentally changing the scope. * Prevent someone from sharing a link with an override that hides or changes a filter you rely on. * Enforce a filter value on an embedded dashboard regardless of what the embedding application passes in `externalFilters`. ### How to lock a filter You need to be an `editor` or `admin` to lock a filter. 1. Open the dashboard and click **Edit dashboard**. 2. Hover over the filter chip you want to lock. An open padlock button appears next to the **x**. 3. Click the padlock. The icon switches to a closed lock and stays visible at rest. 4. Click **Save** on the dashboard to persist the change. To unlock a filter, hover over the locked chip in edit mode and click the closed padlock. ### What viewers see In view mode, a locked filter chip shows a closed-lock indicator on the right. Clicking the chip does nothing, and a tooltip explains that the filter is locked. The locked value still applies to every tile that uses the filter's field, exactly like a normal saved filter. ### How locking interacts with overrides Locked filters take precedence over every override mechanism: * **URL overrides.** When a link contains `?filters=` or `?tempFilters=` targeting a locked field, Lightdash drops the override on load, cleans up the URL, and shows the viewer a one-time toast explaining that the override was ignored. * **Embed `externalFilters`.** When an [embed JWT](/embed/reference#dashboard-filters-interactivity) passes `externalFilters` targeting a locked field, Lightdash uses the dashboard's saved locked value and ignores the override. * **Required and locked together.** A filter that is both `Required` and `locked` must have a value in edit mode. Clearing the value disables **Apply** with the message "A locked, required filter must have a value". The override-stripping behaviour runs regardless of whether the feature flag is on, so dashboards with locked filters stay safe even if the flag is later turned off. ### Locked filters on hidden fields A filter chip can also show locked without anyone locking it. This happens when the field a saved filter uses is later set to `hidden: true` ([dimensions](/semantic-layer/dimensions#dimension-configuration), [metrics](/semantic-layer/metrics#metric-configuration)) and no tile on the dashboard offers that field in its filter picker any more. Lightdash can't show a picker for a field nothing exposes, so it locks the chip instead, with the same closed-padlock icon and a tooltip reading "This filter applies to your charts. You cannot change it here." The filter still applies to every tile that used it — hiding the field doesn't remove the filter, it only stops anyone changing its value from the dashboard. Viewers can't edit or remove it, even though no one set it as a deliberate lock. To replace it with a filter on the new field: 1. Open the dashboard and click **Edit dashboard**. 2. Hover over the locked chip and click its **x** to remove it. 3. Click **Add filter** and pick the field that replaced the hidden one. 4. Click **Save**. ## Group filters into sections [Experimental](/support/feature-badges#experimental) > [!NOTE] > > Sections are off by default. They need the `dashboard-controls` feature flag, which Lightdash support turns on for Cloud organizations on request. [Self-hosted instances](/self-host/customize-deployment/environment-variables#feature-flags) add it to `LIGHTDASH_ENABLE_FEATURE_FLAGS`. Group related dashboard controls under named sections, such as **Orders** and **Customers**, so viewers can find the controls they need and collapse the rest. ![Dashboard filter bar with an open Orders section, a collapsed Customers section showing 2 filters, and two filters outside any section](https://mintcdn.com/lightdash/ovPHSlsMHhZb9E9h/images/explore/dashboards/filter/sections-view-bar-light.png?fit=max\&auto=format\&n=ovPHSlsMHhZb9E9h\&q=85\&s=afa1f206701e83b7ff7c5b5468de570c) An open Orders section, a collapsed Customers section, and two filters outside any section Each section belongs to one dashboard and can hold [saved filters](#saved-filters) and [parameter controls](/explore/dashboards/parameter-controls#group-controls-and-hide-a-control-from-viewers). ### Create a section 1. Open the dashboard and click **Edit dashboard**. 2. Click **New section**, the dashed button at the end of the filter bar. It shows once the dashboard has a filter. 3. Type a name and press Enter, or click the check. Press Escape or click the **X** to cancel. You can also drag a filter onto **New section**. Once you name the section, the filter moves into it. New sections go after the existing ones. ![Filter bar in edit mode with two sections that each have add and menu buttons, and the dashed New section button at the end of the bar](https://mintcdn.com/lightdash/ovPHSlsMHhZb9E9h/images/explore/dashboards/filter/sections-edit-bar-light.png?fit=max\&auto=format\&n=ovPHSlsMHhZb9E9h\&q=85\&s=f802120f6002080d1efe82c700c95237) To rename a section, click its name in edit mode. To reorder sections, drag a section by its name. ### Put filters in a section In edit mode, use whichever fits: * **Add a filter straight into a section:** click the section's **+**. * **Drag a filter:** drag its chip onto a section. A blue line shows where it lands. To take a filter out of its section, drop it on **Add filter** or on an empty part of the bar. * **From the filter editor:** click the filter, then pick a section in **Section**. Pick **None** to take it out. The filter you're editing shows a pencil badge on its chip. ![Filter editor panel with a Section dropdown set to Orders](https://mintcdn.com/lightdash/ovPHSlsMHhZb9E9h/images/explore/dashboards/filter/sections-rail-light.png?fit=max\&auto=format\&n=ovPHSlsMHhZb9E9h\&q=85\&s=1fc08f8caa77a1479a7cbb5e2f8635dd) ### Move or remove several filters at once 1. In edit mode, ⌘ click each filter you want (Ctrl click on Windows and Linux). Shift click selects a range. 2. In the bar that appears, click **Move to new section** to group them under a new name, or **Move to** to pick an existing section or **No section**. 3. To delete the selected filters instead, click **Remove**. The button then shows how many filters it removes; click it again to confirm. Press Escape or click the **X** to clear the selection. Dragging one selected filter moves the whole selection. ![Two selected filters with the selection bar showing Move to new section, Move to and Remove, and the Move to menu listing sections](https://mintcdn.com/lightdash/ovPHSlsMHhZb9E9h/images/explore/dashboards/filter/sections-select-move-light.png?fit=max\&auto=format\&n=ovPHSlsMHhZb9E9h\&q=85\&s=b6d7296606c80003ca9fd18905d59ada) ### Collapse or remove a section In edit mode, a section's chevron sets how it opens for viewers: collapsed or expanded. The choice is saved with the dashboard. Until you set it, a section with more than 6 filters starts collapsed. To remove a section, open its **...** menu and click **Remove, keep filters**. The section's filters stay on the dashboard, outside any section. An empty section shows **Remove section** instead. Click **Cancel** on the dashboard to undo a removal you haven't saved. ![Orders section menu open with the option Remove, keep filters](https://mintcdn.com/lightdash/ovPHSlsMHhZb9E9h/images/explore/dashboards/filter/sections-section-menu-light.png?fit=max\&auto=format\&n=ovPHSlsMHhZb9E9h\&q=85\&s=63fd15b9167934a1bcabe983edc97d6c) ### What viewers see Viewers see the sections and can collapse or expand them with the chevron. Their choice isn't saved: each visit starts from the section's default. A collapsed section shows how many filters it holds, or how many the viewer changed. Sections with no filters on the current tab are hidden. [Embedded dashboards](/embed) show the filters without sections. ### Sections in dashboards-as-code Define sections in `config.controlSections`, each with a unique `slug`. Set a filter's `sectionSlug` to place it in that section, or omit it to keep the filter outside sections. Keep the slug when renaming a section. Uploads reject unknown section slugs. Set `collapsed: true` to save a section collapsed. ```yaml theme={null} config: controlSections: - slug: orders name: Orders - slug: customers name: Customers collapsed: true filters: dimensions: - id: order-date-filter label: Order date sectionSlug: orders # ... - id: first-name-filter label: First name sectionSlug: customers # ... ``` ## Empty default dashboard filters You can save a dashboard filter that is active but has no value picked yet — for example a `country` **is** filter with no country selected. This is an "unset default": a filter control that appears in the dashboard filter bar so viewers can fill it in, without pre-committing to a value. Empty non-required filters behave like this: * They render in the filter bar as `is any value`. * They do **not** override chart-level filters on the same field. If a saved chart is filtered to `country` **is** `India` and the dashboard has an empty `country` filter, tiles keep the `India` filter until a viewer picks a value in the dashboard. As soon as a viewer selects a value, normal [dashboard-overrides-chart behavior](#how-dashboard-filters-interact-with-chart-filters) resumes. * They survive `lightdash upload` and are not flagged by `lightdash lint` — an empty active filter in dashboard YAML is a valid configuration. Value-less relative-date operators (`in the current`, `not in the current`) are **not** treated as empty, because they get their period from a unit-of-time setting rather than a value. They apply to tiles like any other configured filter. To strip a chart-level filter from a tile, mark the dashboard filter as required, give it an explicit default value, or remove the filter from the saved chart. An empty dashboard filter won't do it. ## Sharing a dashboard with filter overrides To share a dashboard with custom filters applied, you have to be in *view mode*. From there, either apply temporary filters and share the link with those filters applied, or save the filter changes for everybody and share the link with the new defaults. The rules for sharing dashboards with filters applied: * When adding a temporary filter in view mode, you can change the filter's values — field, value, operator, and which tiles it applies to — but not the filter type, so a temporary filter can't become a saved filter. * When overriding a saved filter in view mode, you can only change the value and operator; the field and tile configuration stay as they are. * In edit mode, when you change a saved filter to override its default value, the 'override' status is removed once you click **Apply**. The same behavior applies when exporting dashboards or sending them to email or Slack in [scheduled deliveries](/explore/create-scheduled-deliveries). ## Seeing which tiles have filters applied A tile with filters shows a filter icon in its header. Click it to see the dashboard filters applied to that tile and the chart's own filters; a chart filter the dashboard overrides is struck through. **Edit chart** opens the chart without dashboard filters, so its numbers can differ from the tile's. Check this list to see which dashboard filters account for the difference. ![A dashboard tile showing the dashboard filter applied label](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/filter/dashboard-filter-applied-849b4b24b8ab77215ddb46bcd6735720.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=494c1ede97f6f923fb0b76c7b8d43a06) ## Filter value autocomplete When determining possible values for a dashboard filter, Lightdash takes into account all relevant filters, including those applied to fields from joined tables. Take these payments, orders, and customers models: ```yaml dbt v1.10+ theme={null} - name: customers --- - name: orders config: meta: joins: - join: customers sql_on: ${customers.customer_id} = ${orders.customer_id} --- - name: payments config: meta: joins: - join: orders sql_on: ${orders.order_id} = ${payments.order_id} - join: customers sql_on: ${customers.customer_id} = ${orders.customer_id} ``` ```yaml dbt v1.9 and earlier theme={null} - name: customers --- - name: orders meta: joins: - join: customers sql_on: ${customers.customer_id} = ${orders.customer_id} --- - name: payments meta: joins: - join: orders sql_on: ${orders.order_id} = ${payments.order_id} - join: customers sql_on: ${customers.customer_id} = ${orders.customer_id} ``` ```yaml Lightdash YAML theme={null} # customers.yml type: model name: customers --- # orders.yml type: model name: orders joins: - join: customers sql_on: ${customers.customer_id} = ${orders.customer_id} --- # payments.yml type: model name: payments joins: - join: orders sql_on: ${orders.order_id} = ${payments.order_id} - join: customers sql_on: ${customers.customer_id} = ${orders.customer_id} ``` Following this example: * Filtering on a field from the `payments` model considers filters applied to fields from the `payments`, `orders`, and `customers` models. * Filtering on a field from the `orders` model considers filters applied to fields from the `orders` and `customers` models. * Filtering on a field from the `customers` model considers filters applied to fields from the `customers` model. ## Filtering a dashboard from the URL A dashboard URL can carry values for its saved filters, so a link opens the dashboard already filtered. You can set up a dimension so that clicking a value sends the reader to a dashboard filtered by what they clicked — a sales dashboard listing your most profitable partners, for instance, where clicking a partner name opens a second dashboard showing that partner's KPIs. Here's what it looks like once it's set up: [https://cdn.loom.com/sessions/thumbnails/2afb9990e3d7407dadcf53d8db2719c8-644f09eaf407adac.mp4](https://cdn.loom.com/sessions/thumbnails/2afb9990e3d7407dadcf53d8db2719c8-644f09eaf407adac.mp4) And here's the setup: [https://cdn.loom.com/sessions/thumbnails/aa6b7aa3001d4b1fa86a2c98a7fe044c-1341cb311f5a956d.mp4](https://cdn.loom.com/sessions/thumbnails/aa6b7aa3001d4b1fa86a2c98a7fe044c-1341cb311f5a956d.mp4) 1. Open the dashboard you want to filter dynamically. 2. Add a value to the filter you want to drive from the URL. 3. Copy the URL shown after applying the filter. It looks like this: ![A dashboard URL containing an encoded filters parameter](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/filter/dashboard-url-filter-4eb115b7e180529d7a5d50343d500743.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=c70aa093e6769582b1189f38eb831fae) The `?filters=` key in the URL is followed by a URL-encoded JSON object. To read it, run it through a URL decoder. 4. Replace the filter value you chose in step 2 with `${ value.formatted | url_encode }` to make it dynamic. In the example, the value is `Plant+Paradise` (highlighted in the image). 5. Paste that URL into the YAML file for the model you're working in. See an [example in our demo project](https://github.com/lightdash/lightdash-demo-data-gardening/blob/5632406cb5b43fdf066a2086142dc3e86a41e947/dbt/models/dbt%5Forders.yml#L31-L32). If the target dashboard has a [locked filter](#locking-dashboard-filters) on the field you're driving from the URL, Lightdash drops the override on load and the dashboard's saved locked value is used instead. # Interacting with dashboards Source: https://docs.lightdash.com/explore/dashboards/interact Filter, re-zoom, cross-filter, and drill into the charts on a dashboard without editing them Everything on this page is something a viewer can do to a dashboard without editing it: narrow it with filters, change the time granularity of its charts, filter the whole dashboard by clicking a value in one chart, look at the rows behind a data point, break a metric out by a dimension, and discuss a tile — or the whole dashboard — with your team in its comments. It also covers what changes [on phones and tablets](#on-phones-and-tablets). ## Filter the dashboard Filters sit at the top of a dashboard and change the data in the tiles below. Click a filter to change its value, or click `Add filter` to add your own — the filters you add yourself are temporary, so nobody else's view changes. Editors can save filters into the dashboard, require viewers to pick a value before anything loads, and control which tiles each filter reaches. See [dashboard filters](/explore/dashboards/filter) for all of it. ## Change the date granularity Date zoom changes the granularity of time-based charts — Day, Week, Month, and so on — without editing them. Editors set up controls that govern every chart at once, or just a chosen subset. ![A date zoom control in a dashboard toolbar](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/interact/date-zoom-indicator.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=d0357e5ce3d2857b6293d3607cebb0bb) See [date zoom](/explore/dashboards/date-zoom) for creating controls, configuring granularities, and setting defaults. ## Refresh the dashboard Click the refresh icon in the dashboard header to re-run every tile. To keep a dashboard current while it's open, open the menu next to it and pick an interval under **Auto-refresh while viewing**: **5m**, **15m**, **30m**, **1h**, or **2h**. Each refresh skips cached results and sends fresh queries to your warehouse. Auto-refresh is yours alone and isn't saved with the dashboard: it runs in your browser until you set it to **Off** or leave the dashboard, including while the tab is in the background. Every viewer with auto-refresh on adds their own queries, so pick a longer interval on dashboards with heavy tiles. To measure the load, look for the `autorefreshedDashboard` [query context](/workspace-admin/usage-analytics#query-contexts) in your warehouse's query history. ## Cross-filtering from a chart Clicking a value in a chart — a bar in a bar chart, say — lets you filter on that value and update every other relevant chart in the dashboard. Filtering a dashboard from one of its own charts is called cross-filtering. ![Choosing to filter the dashboard by a value clicked in a chart](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/interact/cross-filtering-63382ed7d03de05338666c7b353b8c59.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=05d176fc3b48b104b33d268ba94505b2) Every tile in the dashboard that has the filtered field is filtered to the value you picked. Hover over a tile and then over the funnel icon to see which filter it got. ![Hovering a tile to see which dashboard filter was applied to it](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/interact/cross-filtering-applied.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=569f3e11545cd674a930e8af62a6441e) A cross-filter is a [temporary filter](/explore/dashboards/filter#temporary-filters): it belongs to your session until you save it into the dashboard. ## View underlying data Click any point on a chart or any cell in a results table and pick **View underlying data** in the action menu to see the records that make up that number. For example, clicking the bar for a month in a `Sales stats per partner, per month` chart shows every row in the underlying table that adds up to that month's total. ![The underlying data for a point on a dashboard chart](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/interact/underlying-chart-data-a0e12f23869f743416d5171473196d4d.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=051b1ccdf38e44d6abeb75204a11bb8c) From there you can export the rows as a CSV, or click **Explore from here** to open [the Explore view](/explore/explore-view) with that underlying data as the starting point. ### Choosing which fields appear By default, underlying data shows every dimension from the table, plus every field from any joined table included in your results. To show a narrower set instead, specify the fields on the metric in your table's `.yml` file — see [show underlying values](/semantic-layer/metrics#show-underlying-values) in the metrics reference. Those same fields are pre-selected when someone clicks **Explore from here** from the underlying data table, so they don't land in an empty results table. ## Drill into a metric Drilling breaks a metric out by a dimension — total revenue segmented by product type, for example — so you can see where a number came from. **Drill into** works on metrics only, not on dimensions or table calculations, and isn't available on [charts saved from the SQL runner](/explore/sql-runner#explore-only-chart-features). Take a chart of **Sum of basket total** per partner, per month, with a conspicuous spike in sales for one partner in May. To find out why, click the data point and then click **Drill into** in the action menu. ![The Drill into option in a chart's action menu](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/interact/drill-into-dashboard-chart-004fed51a421665d0117c29ae4c6fe21.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=927e9802e578cf41f0e2e7c7ddb18f32) Then pick the dimension to segment the metric by. Here that's **Shipping country**, to see where the orders came from. ![Choosing a dimension to drill a metric into](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/interact/drill-into-modal-007439f50eddd908ece58e2fb553a737.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=e639093956d1bd44ddfca8291929c744) Click **Open in new tab** for a chart of the metric grouped by `Shipping country`, which shows where the spike came from. ![The drilled chart, showing the metric grouped by shipping country](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/dashboards/interact/drill-into-result-day-eeb57dc6490792f406ae2d218e172706.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=2dac4fece5f7bd62d1a5a8dd1975a6d3) You drill from one data point by one dimension at a time. The chart opens in the Explore view filtered to the values of the point you clicked, so add more dimensions or filters there to break it down further. ## Comment on a tile Every chart, markdown, Loom, and data app tile carries its own comment thread. Hover over a tile and click the speech-bubble icon in its header to open the comments panel — on tiles that already have comments, the icon stays visible with a count, and the badge turns red when there are comments you haven't seen. Type `@` while writing a comment to mention someone; you can mention anyone who has access to the space the dashboard lives in. Replies sit under the comment they answer, one level deep. Who can do what follows your role: * Everyone who can see the dashboard can read its comments — there are no private comments. * Interactive viewers and above can post, reply, and delete their own comments. * Editors and above can resolve or unresolve a thread and delete anyone's comment. Resolving hides the whole thread behind the `Show resolved` toggle at the top of the panel. When someone mentions you, or comments on a tile you've commented on before, you get an in-app notification on the bell icon in the navigation bar. Clicking it opens the dashboard with that tile's comments panel open. There are no email notifications for comments. ## See every comment on a dashboard Rather than opening each tile's comments in turn, the dashboard header has a single entry point to every thread on the dashboard. When the dashboard has open threads, it shows as a **Comments** button with the open thread count, and a red dot when any of them are unread. When there are no open threads, or the header is too narrow to show the button, find it instead as **Comments** in the dashboard's actions menu. Opening it lists every open comment thread, grouped by tile and, on a dashboard with tabs, by tab too. Click a thread's tile to jump straight to it — Lightdash switches tabs first if the tile is on a different one from the one you're viewing. Toggle **Show resolved** to bring resolved threads back into the list. > [!NOTE] > > Self-hosted deployments can turn dashboard comments off for everyone by setting `DISABLE_DASHBOARD_COMMENTS=true` on the backend. ## On phones and tablets Lightdash is responsive at every window width, so a dashboard on a phone or a tablet is the same dashboard you get on a desktop: the filter bar, date zoom, cross-filtering, drilling, underlying data, and comments all work. The navigation bar and the dashboard header collapse into compact controls as the window narrows, and tiles stack into a single column. Creating and editing content is the exception. On a phone, the chart and dashboard editors, Explore, and the SQL runner are unavailable — open Lightdash on a tablet or a desktop to author. This is a device restriction, not a width one, so a narrow browser window on a desktop still lets you edit. Links behave the same everywhere. A dashboard URL copied on a phone opens the interactive dashboard for everyone who follows it, at any screen size. > [!NOTE] > > A URL whose path starts with `/minimal/` renders the dashboard's tiles and nothing else — no navigation bar, no filter bar, no tile action menus. Lightdash uses it to capture [scheduled deliveries](/explore/create-scheduled-deliveries), Slack link previews, and image and PDF exports, because it has no chrome to crop out. Delete that segment from the path and reload to get the interactive dashboard back. # Dashboard parameter controls Source: https://docs.lightdash.com/explore/dashboards/parameter-controls Set parameter values for selected dashboard tiles and save the controls as code [Experimental](/support/feature-badges#experimental) > [!NOTE] > > Requires the `dashboard-controls` feature flag. For Cloud, contact [support](/support). For self-hosted instances, add `dashboard-controls` to [`LIGHTDASH_ENABLE_FEATURE_FLAGS`](/self-host/customize-deployment/environment-variables#feature-flags). Dashboard controls are the filters and parameter controls at the top of a dashboard. [Filters](/explore/dashboards/filter) narrow the data. Parameter controls set values used by your [chart queries](/semantic-layer/parameters). The examples follow a **Revenue comparison** dashboard: * Two **Order revenue** tiles compare the same chart in different currencies. * A **Payment revenue** tile uses a currency parameter from another model. * An **Order status** filter limits the comparison to completed orders. Both charts' currency parameters offer `USD`, `EUR`, and `GBP`. ## Set different values on two copies of a chart Give each copy its own control to compare `USD` and `EUR` side by side. **1. Add the first control** Open **Edit dashboard** → **Add** → **Parameter** and choose **Reporting currency**. Set **USD** and use **Rename** to name it **Primary currency**. Both order tiles now use USD. ![Dashboard Add menu offering Filter to narrow tile data and Parameter to set a value used by tiles](https://mintcdn.com/lightdash/jiY_Laufpjl2r2j4/images/explore/dashboards/parameter-controls/add-parameter-light.png?fit=max\&auto=format\&n=jiY_Laufpjl2r2j4\&q=85\&s=5f589d01a3e27531678830007551cf57) **2. Choose its tiles** Click **Choose tiles**. On the comparison **Order revenue** tile, clear the selected parameter, then click **Apply**. That tile stops using **Primary currency**. ![Primary currency assigned to the first Order revenue tile, with the comparison tile and Payment revenue not assigned](https://mintcdn.com/lightdash/jiY_Laufpjl2r2j4/images/explore/dashboards/parameter-controls/targets-light.png?fit=max\&auto=format\&n=jiY_Laufpjl2r2j4\&q=85\&s=fe853d5eef85c6c0d85fea6f5cf88bc9) **3. Add the comparison control** Add another **Reporting currency** control, set **EUR**, and name it **Comparison currency**. In **Choose tiles**, click **Set this tile** on the comparison tile, then select **Orders Reporting currency**. Click **Apply** → **Save changes**. ![Primary currency set to USD and Comparison currency set to EUR, with the two copies of Order revenue showing their respective currencies](https://mintcdn.com/lightdash/jiY_Laufpjl2r2j4/images/explore/dashboards/parameter-controls/two-controls-light.png?fit=max\&auto=format\&n=jiY_Laufpjl2r2j4\&q=85\&s=1a5d1bd03b76c60be23f91443c7acdc6) The first control for a parameter targets all relevant tiles, including those added later, even after you exclude all current tiles. Additional controls for that parameter start with no tiles assigned. ## Clear a value or exclude a tile A control's value and tile assignments are independent. In edit mode, open the control: * To clear its value, click the input's clear button. Tile assignments stay in place. * To exclude a tile, open **Choose tiles** and clear that tile's selected parameter. **Clear all tiles** excludes all current tiles. Click **Apply** → **Save changes**. The **Order revenue** chart is saved with `EUR`, and its parameter has a `GBP` model default. These give different results: | Action | Value used by Order revenue | | - | - | | Clear the control value | `GBP` — the model default, then the chart-saved value if there is no default | | Exclude the tile | `EUR` — the chart-saved value, then the model default if the chart has no saved value | ![Primary currency editor set to USD, with a GBP model default and one of three tiles assigned](https://mintcdn.com/lightdash/jiY_Laufpjl2r2j4/images/explore/dashboards/parameter-controls/editor-light.png?fit=max\&auto=format\&n=jiY_Laufpjl2r2j4\&q=85\&s=1e3cbaed5e3aa925db7c773c96f6cfef) > [tab] Cleared value > > After clearing **Primary currency**, the first order tile uses the model default, `GBP`. > > ![Order revenue primary showing GBP and revenue of 1,917.60 after clearing the assigned control value](https://mintcdn.com/lightdash/jiY_Laufpjl2r2j4/images/explore/dashboards/parameter-controls/clear-result-light.png?fit=max\&auto=format\&n=jiY_Laufpjl2r2j4\&q=85\&s=785ad2a4a22399b8efa398ae8fc7de1a) > [tab] Excluded tile > > After excluding the first order tile, it uses the chart-saved value, `EUR`. > > ![Order revenue primary showing EUR and revenue of 2,157.30 after excluding the tile from the control](https://mintcdn.com/lightdash/jiY_Laufpjl2r2j4/images/explore/dashboards/parameter-controls/exclude-result-light.png?fit=max\&auto=format\&n=jiY_Laufpjl2r2j4\&q=85\&s=1ceb7174ee4af49703bb5bbcd41ef3e9) To continue the comparison, restore **Primary currency** to `USD` and include the first order tile. ## Set parameters across models Use **Primary currency** to change the order and payment charts together, even though their parameters belong to different models. Parameters can share a control when their type, single or multiple selection, and allowed values match. **1. Choose the payment parameter** Open **Primary currency** → **Choose tiles**. On **Payment revenue**, click **Set this tile** and select **Payments Settlement currency**. **2. Save the assignment** Click **Apply** → **Save changes**. **Primary currency** now sets both models' parameters. **Comparison currency** still sets only the second order tile. ![Primary currency mapped to Orders Reporting currency and Payments Settlement currency, with the second order tile assigned to Comparison currency](https://mintcdn.com/lightdash/jiY_Laufpjl2r2j4/images/explore/dashboards/parameter-controls/tile-picker-light.png?fit=max\&auto=format\&n=jiY_Laufpjl2r2j4\&q=85\&s=0ab986169d11e62d2364ca4c4de51d04) ## Group controls and hide a control from viewers Keep related inputs together, and hide the fixed comparison value from viewers. **1. Group the controls** [Create a section](/explore/dashboards/filter#group-filters-into-sections) called **Currency comparison** and move **Order status** into it. For each parameter control, open **Settings** → **Section**, choose **Currency comparison**, and click **Apply**. **2. Hide the comparison input** In **Comparison currency** → **Settings**, turn off **Show to viewers**. Click **Apply** → **Save changes**. Its `EUR` value still applies to the comparison tile. ![Comparison currency settings in Currency comparison, with Show to viewers switched off while the value still applies to its tiles](https://mintcdn.com/lightdash/jiY_Laufpjl2r2j4/images/explore/dashboards/parameter-controls/visibility-light.png?fit=max\&auto=format\&n=jiY_Laufpjl2r2j4\&q=85\&s=cc159d0421c7f6a6a48f04634b9b2037) Viewers can change **Primary currency** for the first order tile and the payment tile. The comparison tile stays in EUR. ![Currency comparison section with Primary currency visible. The first order tile and payment tile show USD, while the comparison order tile shows EUR.](https://mintcdn.com/lightdash/jiY_Laufpjl2r2j4/images/explore/dashboards/parameter-controls/viewer-light.png?fit=max\&auto=format\&n=jiY_Laufpjl2r2j4\&q=85\&s=7f21e3b8b033a6406a2b0bc11b831d39) ## Save the dashboard as code The YAML below saves the same dashboard, including its filter, section, and control assignments. Save it as `lightdash/dashboards/revenue-comparison.yml`, adapting the chart and space slugs, parameter keys, and filter field references to your project. Use the standard [download](/workflow/content-as-code#lightdash-download) and [upload](/workflow/content-as-code#lightdash-upload) commands. With `dashboard-controls` enabled, downloads use these references: * A section's `slug` identifies it. A filter or control's `sectionSlug` places it in that section. * Each `tileSlug` identifies one tile, so copies of the same chart can receive different values. Keep a section's slug when renaming it so uploads update the same section. ```yaml Revenue comparison [expandable] theme={null} contentType: dashboard version: 1 name: Revenue comparison slug: revenue-comparison spaceSlug: jaffle-shop tabs: [] tiles: - tileSlug: order-revenue-primary type: saved_chart x: 0 y: 0 w: 12 h: 4 properties: chartSlug: order-revenue title: Order revenue (primary) hideTitle: false - tileSlug: order-revenue-comparison type: saved_chart x: 12 y: 0 w: 12 h: 4 properties: chartSlug: order-revenue title: Order revenue (comparison) hideTitle: false - tileSlug: payment-revenue type: saved_chart x: 24 y: 0 w: 12 h: 4 properties: chartSlug: payment-revenue title: Payment revenue hideTitle: false filters: dimensions: - label: Order status sectionSlug: currency-comparison target: fieldId: orders_status fieldName: status tableName: orders operator: equals values: [completed] disabled: false tileTargets: {} config: isDateZoomDisabled: false controlSections: - slug: currency-comparison name: Currency comparison collapsed: false parameterControls: - slug: primary-currency label: Primary currency sectionSlug: currency-comparison value: USD valueType: type: string multiple: false parameters: orders.reporting_currency: except: [order-revenue-comparison] payments.settlement_currency: all - slug: comparison-currency label: Comparison currency sectionSlug: currency-comparison hidden: true value: EUR valueType: type: string multiple: false parameters: orders.reporting_currency: only: [order-revenue-comparison] ``` Use `all` for every matching tile, `except` to exclude named tiles, or `only` for an exact list. `only: []` assigns no tiles. # Default user spaces Source: https://docs.lightdash.com/explore/default-user-spaces Give every eligible user a personal space in a project Default user spaces (also called **personal user spaces** or **personal spaces**) give each eligible user a personal space inside a project, so they have a dedicated place to create and manage their own charts, dashboards, and nested spaces without needing an admin to set one up for them. *Default user spaces* and *personal user spaces* refer to the same feature and are used interchangeably throughout the docs. When the feature is enabled, Lightdash provisions a personal space for each eligible user. The space is created under a parent space called `Default User Spaces`, and is named after the user: ``` Default User Spaces / ``` If the user has no first or last name on their profile, the space is named `User` followed by the first 8 characters of their user ID instead, such as `User 13fe2c58`. To see who owns a space like this, open its **Share** settings, where the owner is listed by email. The name is set when the space is created and doesn't change if the user adds a name to their profile later, so rename the space to update it. The user is set as an admin of their own default space, so they can self-manage it - creating charts and dashboards, nesting child spaces inside it, and managing access for other users. ## Enabling the feature Default user spaces are configured per project and are **off by default**. 1. Go to **Project Settings** → **Default user spaces** 2. Toggle on **Default user spaces** When you turn the setting on, Lightdash creates a space for every eligible active member of the organization in the background, so users don't need to log in first. Members who join or become eligible later get their space when they next log in, or when they're provisioned through [SCIM](/workspace-admin/sso/scim). Turning the setting back off stops new spaces from being provisioned, but does not delete any personal spaces that have already been created. ## Who gets a default user space A user is eligible for a default user space if they have either: * A project or organization role of **Interactive Viewer** or higher (Interactive Viewer, Editor, Developer, or Admin), or * A [custom role](/workspace-admin/custom-roles) that includes at least the **Manage Saved Chart** and **Manage Explore** permissions. Viewers and Members are not eligible, since they can't create charts and dashboards in the first place. See the [roles and permissions reference](/workspace-admin/roles) for the full list of project and organization roles. ## What users can do in their space Because each user is an admin of their own default space, they can: * Create charts, dashboards, and nested spaces inside it * Move existing content they own into it * Manage access - invite other users or groups, or switch the space between Inherited Access and Restricted Access * Submit their work for review, so it can be promoted to a shared space (and optionally verified) once approved - see [Review requests](/explore/review-requests) An admin can also move content into a user's personal space on their behalf - for example to restore content uploaded through the CLI - using the Move dialog's **Admin Content View**. See [Moving items between Spaces](/explore/spaces#moving-items-between-spaces). For more on how space permissions work, see [Spaces](/explore/spaces). ## Moving work out of a personal space Personal spaces are where work starts, not where it has to end. When something a user built is worth sharing, they can request a review from the chart or dashboard's **...** menu. A reviewer checks it and, on approval, the content moves into the chosen shared space - picking up a [verified badge](/explore/verified-content) on the way if the reviewer chooses. See [Review requests](/explore/review-requests) for the full flow. # Documents Source: https://docs.lightdash.com/explore/documents Write up an analysis as a readable report, with live charts placed between your text A document is a written report with live charts inside it. Use one when the story matters as much as the numbers: a monthly review, the findings of an investigation, or a proposal that needs its evidence next to the argument. Charts in a document run against your data every time someone opens it, so the figures stay current. Documents live in [spaces](/explore/spaces) alongside charts and dashboards, and follow the same space access. ![A document titled Monthly orders review, with its section headings in the left rail, the author and last edited time under the title, and a bar chart of orders by status between paragraphs](https://mintcdn.com/lightdash/2FkC2mg17gEvohcS/images/explore/documents/reading-view.png?fit=max\&auto=format\&n=2FkC2mg17gEvohcS\&q=85\&s=8980b4d68da3fe0409730e808cb2fa52) ## Read a document A document opens in its reading view. The rail on the left lists the document's top-level headings; click one to jump to that section. The line under the title shows who created the document and when it was last edited. Each chart shows live results. Click **Explore from here** on a chart to open its query in the [Explore view](/explore/explore-view), where you can change it without affecting the document. ## Create a document 1. On the nav bar, click **New**, then **Document**. You can also use **Add** → **Create new document** in a space, which saves it there, or the **All documents** page under **Browse**. 2. Enter a name, an optional description, and the space to save it in. 3. Click **Create**. The document opens in edit mode, ready for you to write. ![The Create document dialog with the name Quarterly revenue review and the Jaffle shop space selected](https://mintcdn.com/lightdash/2FkC2mg17gEvohcS/images/explore/documents/create-document.png?fit=max\&auto=format\&n=2FkC2mg17gEvohcS\&q=85\&s=624346e2e46fe40c6c9a96dbbbe11718) To create a document you need edit access to at least one space. ## Edit a document Click the pencil icon next to the title to edit. The document stays in place and an **Editing** badge appears beside the byline. You edit the text and charts exactly where they appear when reading. ![A document in edit mode, with an Editing badge beside the byline, Cancel, Add chart, and Save icons next to the title, and move, edit, and remove controls on the chart](https://mintcdn.com/lightdash/2FkC2mg17gEvohcS/images/explore/documents/edit-document.png?fit=max\&auto=format\&n=2FkC2mg17gEvohcS\&q=85\&s=aba7c19ae3957faf522d7b79afc74b0d) While editing you can: * **Rename the document** by clicking its title. * **Format text** with markdown shortcuts as you type, such as `#` for a heading, `-` for a list, or `**` for bold. * **Insert blocks** by typing `/` on an empty line, then choosing text, headings, lists, a quote, a code block, a divider, a table, or a chart. * **Write around charts** by clicking the space above, between, or below charts. You can also move there with the arrow keys. Click the check icon to save, or the cross to cancel. If someone else saved the document while you were editing, Lightdash keeps your changes on screen and asks you to reopen the editor to load the latest version. A table cell holds a single line. If you press Enter or add a line break inside a cell, the text is saved on one line with a space in between. ## Add and arrange charts Type `/chart` and press Enter, or click the chart icon next to the title. The **Add chart** dialog is a full [Explore view](/explore/explore-view): pick a table, choose metrics and dimensions, configure the chart, and click **Apply to Document**. The chart is inserted where your cursor was. Charts can use [custom chart types](/visualizations/custom-charts) installed in the project, from the [chart library](/visualizations/chart-library) or [Chart Studio](/visualizations/chart-studio). A document keeps the chart type version each chart was saved with, so a new version of the chart type doesn't change the document's charts. ![The slash menu filtered by typing /chart, showing the Chart option under a paragraph](https://mintcdn.com/lightdash/2FkC2mg17gEvohcS/images/explore/documents/slash-chart.png?fit=max\&auto=format\&n=2FkC2mg17gEvohcS\&q=85\&s=0bfe05d94ccb66809f0f8d110ff711e7) ![The Add chart dialog with the Orders table open, Status and Unique order count selected, and a bar chart preview above the results](https://mintcdn.com/lightdash/2FkC2mg17gEvohcS/images/explore/documents/add-chart.png?fit=max\&auto=format\&n=2FkC2mg17gEvohcS\&q=85\&s=9d48885dd707731f68cd7ff91c43a1fd) The chart icon and `/chart` always build a new chart. To add a chart that's already saved in a space, type `/` on an empty line and choose **Saved chart**, then pick the chart and choose how to add it: * **Link** shows the saved chart as it is now and updates when it changes. Readers need access to the chart. * **Copy** opens a copy in the chart editor, which you can change without affecting the saved chart. SQL runner charts can only be linked. Charts saved inside a dashboard aren't listed. Each chart in edit mode has three controls: * **Move**: drag the grip icon to a new position, or focus it and press the up and down arrow keys. With a chart selected, Cmd+Shift+↑ or ↓ (Ctrl on Windows and Linux) also moves it. * **Edit**: click the pencil icon, or select the chart and press Enter, to reopen it in the chart editor. * **Remove**: click the trash icon, or select the chart and press Backspace. Charts sit between blocks of text; they can't be placed inside a list, quote, or table. Adding or editing a chart needs permission to explore data in the project. Editors without it can still move and remove charts. ## Create and edit with AI [AI agents](/agents/enable-content-tools) with content editing turned on, and [Lightdash MCP](/agents/lightdash-mcp#editing-content) clients such as Claude or Cursor, can write a new document or rewrite an existing one when you ask them to. Their changes are saved as new versions, like edits made in the editor, and appear in the document's [version history](#version-history). AI agents can also use the project's custom chart types in the charts they add. ## Manage a document Use the icons next to the title to add the document to your favorites or copy its link. The **⋯** menu holds the rest: ![The document actions menu open, listing Share, Pin to homepage, Duplicate, Version history, View as code, and Delete](https://mintcdn.com/lightdash/2FkC2mg17gEvohcS/images/explore/documents/actions-menu.png?fit=max\&auto=format\&n=2FkC2mg17gEvohcS\&q=85\&s=403cc20f762e518dbd277841b1fb30cc) * **Share** gives specific people or groups access to the document through [direct access](/workspace-admin/direct-access), where it's available. * **Pin to homepage** adds the document to the project [homepage](/explore/homepage). * **Duplicate** saves a copy, with its current content, into a space you choose. * **Version history** opens the document's saved versions. * **View as code** shows the document's content, including every chart's query and configuration, as JSON. * **Export PDF** queues a PDF of the document, with its written content and live charts rendered as they appear, and downloads it once it's ready. If a chart can't be rendered, that chart shows an error in the PDF instead of blocking the rest of the export. * **Delete** removes the document. When soft delete is enabled, it moves to **Recently deleted** in project settings, where it can be restored. ## Version history Every save creates a new version. Open **⋯** → **Version history** to see them, newest first, with who saved each one and when. The first entry is the current version. ![Version history for a document, with four saved versions listed in the left rail and version 2, saved by Editor User, shown read-only](https://mintcdn.com/lightdash/2FkC2mg17gEvohcS/images/explore/documents/version-history.png?fit=max\&auto=format\&n=2FkC2mg17gEvohcS\&q=85\&s=cd9773c4b337c2b98039a19699fa01a5) Click a version to preview it read-only, charts included; the charts run their saved queries against current data. The address bar updates, so you can share a link to a specific version. Click the cross next to the title to return to the document. Version history is for reviewing past versions. To bring back earlier content, copy it from the version preview into the document and save. ## Download and upload with the CLI The [Lightdash CLI](/workflow/cli/reference) downloads and uploads documents as code, alongside your charts and dashboards. Each document is one YAML file named by its slug, in the same format as **View as code**. ```bash theme={null} # Download every document you can view lightdash download --include-documents # Download specific documents lightdash download --documents quarterly-review churn-deep-dive # Upload edited documents lightdash upload --documents quarterly-review ``` Documents are written to `lightdash/documents/.yml`: ```yaml theme={null} content: cells: - content: markdown: "# Findings" type: markdown description: "" name: Quarterly review schemaVersion: 1 slug: quarterly-review spaceSlug: reports/finance ``` On upload, each file is matched to a document by its slug: * A new slug creates a document in the space named by `spaceSlug`. The space must already exist — upload it first. * An unchanged file is skipped. * A changed file saves a new version, so the previous content stays in [version history](#version-history). Changing `spaceSlug` moves the document. * If someone saves the document while the upload runs, the upload fails for that document instead of overwriting their change. Downloading needs permission to use content as code in the project, which Editors, Developers, and Admins have. Uploading also needs permission to edit the document, or to create documents in its space. # The Explore view Source: https://docs.lightdash.com/explore/explore-view Query a table, sort and chart the results, and save the chart A **Table** is the starting point for querying data in Lightdash. It groups related dbt models with the [dimensions](/semantic-layer/dimensions) and [metrics](/semantic-layer/metrics) defined on them, and you query it in the **Explore view**. To start a query, click `[+] New` → `Query from tables`, then pick the table you want to explore. ![The Query from tables option in the New menu](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/explore-view/new-query-from-tables.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=ebc7daefdc34ca6594d73e073a9965d7) ## The Explore page The Explore page is made up of five areas: 1. **Metrics and dimensions** available on the table you selected 2. **Filters**, which restrict the data in your query 3. **Chart**, where you visualize the results 4. **Results**, the raw data returned from your database 5. **SQL**, the generated SQL that produced the results ![The five areas of the Explore page](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/explore-view/explore-areas.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=b40f6db560b047339d17cad750202bf7) ## Select your fields To run a query: 1. Select a metric to calculate. 2. Select one or more dimensions to split the metric into groups. 3. Hit **Run query** in the top right. For "number of orders per month split by partner", that's the `Order count` metric with the `Order month` and `Partner name` dimensions. ![Selecting a metric and two dimensions in the Explore sidebar](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/explore-view/select-fields.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=ba2ab5ccf0d5f23ed98993be728a55d2) ## Filter results Filters restrict the rows your query returns. You can add them from the **Filters** section, from a column header in the results table, or from the field list in the sidebar — see [filtering in the Explore view](/explore/explore-view/filter). ## Sort results Click the arrow in the table header for the field you want to sort by. ![Sorting the results table by a column header](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/explore-view/sort-results.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=d815ddc4ba1d73ac39c937fdff830c9d) To sort by multiple fields, click the blue pill showing the current sort, then choose `+ Add sort`. ![The sort menu with multiple sort rules](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/explore-view/sort-multiple.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=e18da7fbd8c04dc7ffc9c84cab16e83d) The sort menu behaves like this: 1. Adding a sort by clicking a column header overwrites any previous rules. 2. Once you're sorting by multiple columns, you can drag and drop them to rearrange the order. 3. Remove a sort by clicking the `X` to its right. 4. Change the direction of a column's sort with the toggle next to its field name. ### Sorting NULL values You can specify whether NULL values appear first, last, or follow your database's default. ![The NULL sorting control in the sort menu](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/explore-view/sort-null-values.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=73ed3dd5e47854aa8ab7aebdc1f174ed) 1. Open the sort menu by clicking the blue pill that displays the current sort. 2. For each sort field, use the NULL sorting control to pick **Nulls first**, **Nulls last**, or **Default**. The choice is applied to the generated SQL as a `NULLS FIRST` or `NULLS LAST` clause in the `ORDER BY` statement. ## Auto-fetch results Next to the **Run query** button is a dropdown with three settings: **Auto-fetch results**, **Row limit**, and **Timezone** (see [Choosing a chart timezone](/personal-settings/timezone#choosing-a-chart-timezone)). **Auto-fetch results** is off by default. Turn it on and the query re-runs automatically whenever you add or remove a field, change a filter, or change the sort — you don't need to click **Run query** again. Each of those changes issues a new query against your warehouse, so leaving it on while you make several quick edits can add up to many extra queries; most teams leave it off and only switch it on when they need it. It's useful for building a raw-data table: select your dimensions, click **Run query** once, then turn on **Auto-fetch results** so every filter and sort change after that refreshes the table instantly. ## Build a chart Once the query runs, your data appears in the results table. Open the **Chart** section and choose a chart type — see [chart types and configurations](/visualizations). ![Choosing a chart type for query results](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/explore-view/build-chart.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=f49ad666994defe14920da890c4b7b34) ## Save your chart Saving a chart lets you share it, add it to a dashboard, or come back to it later. A saved chart re-runs its query every time you open it, so it always shows the latest data in your database. ![The Save chart button in the Explore view](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/explore-view/save-your-chart.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=a5aea554040b0e98d6cbc00ece09f98a) Click **Save chart** at the top of the page, then give the chart a useful name and description. You'll have the option to save it to a dashboard or a space. Once a chart is saved, it unlocks: * [Version history](/explore/version-history) * [Scheduled deliveries](/explore/create-scheduled-deliveries) * [Google Sheets syncs](/integrations/google-sheets) * [Alerts](/explore/create-alerts) ### Saving to a dashboard Most charts in Lightdash are saved directly to a dashboard. This is the better option when a chart is only ever going to be used on one dashboard, and it keeps your spaces free of long lists of charts that only make sense in one context. A chart saved to a dashboard lives only in that dashboard. To reuse it, move it to a space, or click **Explore from here** and save a new version of the chart. ### Saving to a space A chart saved to a [space](/explore/spaces) can be shared on its own and reused across multiple dashboards. It's also the only way to [pin a single chart to your project homepage](/explore/homepage#pin-content). You get a saved chart view you can share with others. ![The saved chart view](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/explore-view/saved-chart.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=5847e47ba0b6deb219d91b60d474bc98) ## Explore from an existing chart Saved charts and dashboard tiles make good starting points for exploration. **Explore from here** gives you a copy of the same chart to play with, and nothing you do to it affects the original — so you can explore without worrying about breaking anything. ## Changing the explore of an existing chart Once a chart is saved, you can switch the explore (table) it's built on without recreating it. Open the saved chart, open the **Change explore** dialog, and pick the new explore; all field references are remapped to it. ![The Change explore dialog on a saved chart](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/explore-view/change-chart-explore.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=f0d37b82340174bca9cb3eb826f83676) Tick **Also update all other charts using this explore** to remap every chart built on the current explore in one go — useful when an entire model is being replaced. Fields that exist on the new explore with the same field IDs are kept; anything that doesn't exist there is dropped, and you'll need to re-pick the missing fields before saving. > [!TIP] > > A handy use case is **migrating charts from one model to another** — for example, when you rename a dbt model or replace it with a different version. Instead of rebuilding the charts from scratch, point them at the new explore and keep the configuration that still applies. # Filtering in the Explore view Source: https://docs.lightdash.com/explore/explore-view/filter Add filters from the Filters tab, the field sidebar, or the results table, and nest them into groups Filters restrict the data a query returns. Filtering a chart in the Explore view changes that chart alone — to filter every tile on a dashboard at once, see [dashboard filters](/explore/dashboards/filter). For the filter types and operators available on each field type, see the [filters reference](/explore/filters-reference). There are three places to add a filter, and they all produce the same thing. ## From the Filters tab Open the `Filters` toggle, then click `Add filter`. ![Adding a filter from the Filters tab in the Explore view](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/explore-view/filter/adding-filters-from-toggle-1-ce5fc6c2ad6259dcae43a9ff16937ffc.jpg?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=bf5eb1bf77723543e74f3f9395bec08c) Select the field to filter from the drop-down list, then choose the filtering options. ## From the sidebar Click the `options` for a field in the sidebar list, then click `add filter`. The filter icon that appears when you hover over a dimension or metric does the same thing. ![Adding a filter from a field in the Explore sidebar](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/explore-view/filter/add-filter-sidebar-32d08090746e3cd362b982a7238b9b6f.jpg?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=fa1d6c908960d3bf80fbeff34217882d) ## From the results table Once you have results, click the three-dot menu of the column you want to filter on and choose `Filter by [field name]`, or click a value in the table to filter by that value. ![Adding a filter from the results table column menu](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/explore-view/filter/add-filter-results-table-52825577533d8ee37e5b9031e7bd54d0.jpg?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=dcfeed6c678801f633be9a8847a0f1cc) ![The filter added from the results table showing in the Filters section](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/explore-view/filter/add-filter.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=f9e3e613c493115ee6ae37af73cb3409) ## Nested filters To nest filters, click the options button on the right-hand side of a filter and choose `convert to group`. ![Converting a filter into a filter group](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/explore-view/filter/convert-to-filter-group-c9f2d2a4a0260d5f8b869c9d156b07a9.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=6700fb362199927c919c792298553ae7) Then add a filter to the group by clicking `add filter`. ![A nested filter group with two conditions](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/explore-view/filter/nested-filters-eae25b7df33e4f47b1408d8a7bfd8ce5.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=912ff83a756b594a348f98cabdecc3e9) # External sources Source: https://docs.lightdash.com/explore/external-sources Upload a CSV or connect a Google Sheet, then query it next to your warehouse data [Experimental](/support/feature-badges#experimental) > [!NOTE] > > External sources are available to design partners behind the `external-sources` feature flag, and the flow, limits and wording on this page may change between releases. Contact [Lightdash support](mailto:support@lightdash.com) to enable it for your organization. Self-hosted instances also need an Enterprise license and the [setup below](#self-hosted-setup). An external source brings data that lives outside your warehouse into a project: an uploaded CSV, or a tab of a Google Sheet. Lightdash reads it once, stores a typed copy, and turns it into a table you can explore, chart, put on dashboards and join to your warehouse data. Nothing changes in your dbt project. Use it for small, hand-maintained data that never made it into the warehouse, such as monthly targets, a mapping of regions to owners, or a list of accounts to watch. ![The Channel targets table from a Google Sheet, with Target month and Sum of Revenue target (USD) selected and the results by month](https://mintcdn.com/lightdash/62Z0MJZvjjE2f5RM/images/explore/external-sources/06-sheet-explore.png?fit=max\&auto=format\&n=62Z0MJZvjjE2f5RM\&q=85\&s=9857614ec48673bb06b127d46ecac6b7) A Google Sheet of monthly targets, explored like any other table ## Before you start * **Editor role or above.** Editors, developers and admins can add, refresh, rename and delete external sources. Everyone else in the project sees the tables, and the charts built on them follow normal [space permissions](/explore/spaces). * **A header row.** The first row names the columns. Every following row is data. * **For Google Sheets, access to the sheet.** The first time you connect a sheet, Lightdash asks your Google account for access to Google Sheets and to the Drive files you pick. * **Size limits.** Up to 100 MB per file, 1,000,000 rows per table and 5 GB per organization. > [!WARNING] > > Everyone in the project can see an imported table, whatever the Google Sheet's own sharing settings. Lightdash reads the sheet with the Google access of the person who connected it and stores a copy. User attributes and row-level filters don't apply to external sources, so only import data that every project member may see. ## Upload a CSV **1. Open Add data** In the Tables sidebar, select **Add data**. ![The Tables sidebar with the Add data button next to its heading](https://mintcdn.com/lightdash/62Z0MJZvjjE2f5RM/images/explore/external-sources/01-add-data-button.png?fit=max\&auto=format\&n=62Z0MJZvjjE2f5RM\&q=85\&s=b1eb1a9bb2dfbe71d358293f1dadc6c0) **2. Drop your file** Drop a CSV on the upload area, or click it to pick a file. ![The Upload a CSV dialog with a drop area and a link to connect a Google Sheet instead](https://mintcdn.com/lightdash/62Z0MJZvjjE2f5RM/images/explore/external-sources/02-upload-csv.png?fit=max\&auto=format\&n=62Z0MJZvjjE2f5RM\&q=85\&s=38d89a60d49af476b7e59636b1081a4d) **3. Name the table and its columns** Give the table a name and check the type detected for each column. Rename any column whose name reads oddly, then select **Create table**. Lightdash opens the new table as soon as it's ready. ![The CSV preview with the table name sales\_targets and editable names for each column, with the month column renamed to Target](https://mintcdn.com/lightdash/62Z0MJZvjjE2f5RM/images/explore/external-sources/03-csv-preview.png?fit=max\&auto=format\&n=62Z0MJZvjjE2f5RM\&q=85\&s=62a6e5ed715ae3c85dfd42d070954ed4) ## Connect a Google Sheet **1. Paste the sheet link** Select **Add data**, then **Connect a Google Sheet instead**. Paste the sheet's URL from your browser and name the table. Lightdash reads the tab the link points to. Open the tab you want before copying the URL, so the link ends in `#gid=…`. A link without a tab reads the first tab. ![The Connect a Google Sheet dialog with a sheet URL and the table name channel\_targets](https://mintcdn.com/lightdash/62Z0MJZvjjE2f5RM/images/explore/external-sources/04-connect-sheet.png?fit=max\&auto=format\&n=62Z0MJZvjjE2f5RM\&q=85\&s=cfe62873fa312f0f3a732a233039402e) **2. Connect your Google account** Select **Connect sheet**. If you haven't connected Google before, select **Connect Google account**, approve access in the pop-up, then select **Connect sheet** again. If it fails with `Failed to refresh token: invalid_grant: Token has been expired or revoked`, your stored Google authorization expired or was revoked, and the dialog doesn't show a **Connect Google account** button for this error. Sign in to Lightdash, open `/api/v1/login/gdrive`, and approve access to Sheets and Drive with the Google account that can open the sheet. Then select **Connect sheet** again. **3. Review the table** Once the import finishes, rename the table or any column, then select **Open table**. ![The Review your table step listing seven imported columns with editable names, types and an Open table button](https://mintcdn.com/lightdash/62Z0MJZvjjE2f5RM/images/explore/external-sources/05-review-table.png?fit=max\&auto=format\&n=62Z0MJZvjjE2f5RM\&q=85\&s=c9626ba096c4b5e3abeebdb3555908e1) ## What the table contains Each column becomes a dimension with a detected type: string, number, date, timestamp or boolean. Date columns also get day, week, month, quarter and year breakdowns. Lightdash adds a **Total rows** metric, plus a sum and an average for every number column. Column names are tidied into SQL-safe names, so `Região` becomes `regiao` and a column called `month` becomes `_month`. The name you see in the sidebar is the one you gave it while importing, or a readable version of the SQL name. ## Join with warehouse data Select **Join with your warehouse data** under the table name to combine it with an explore from your dbt project, such as targets next to actual orders by month. Lightdash suggests a join on a matching field. The result is a [merge query](/explore/merge-queries), which you can save, add to dashboards and schedule like any other chart. ![A merge query joining Channel targets Target month to Orders Order date month, with revenue targets next to total order amounts](https://mintcdn.com/lightdash/62Z0MJZvjjE2f5RM/images/explore/external-sources/09-join-warehouse.png?fit=max\&auto=format\&n=62Z0MJZvjjE2f5RM\&q=85\&s=228b355491c89b66f0ffcff76e96ff9c) Monthly targets from a Google Sheet joined to warehouse orders by month The join belongs to the chart, so each chart that needs targets next to actuals sets it up again. ## Keep the table up to date An external source is a copy taken when you import it, and edits to the sheet or file don't show up until you refresh it. The menu next to the table name holds the source actions: * **Refresh from Google Sheets** reads the sheet again. Column names you set are kept. * **Replace file** uploads a new version of a CSV. * **Reconnect Google account** makes your Google access the one used for future refreshes, for example when the person who connected the sheet leaves. * **Rename table** changes the table and column names. Saved charts keep working. * **View source details** previews the columns and the first rows. * **Delete** removes the table. Charts built on it stop working. > [!NOTE] > > If a refresh fails with `invalid_grant`, re-authorize Google as described in [Connect a Google Sheet](#connect-a-google-sheet), then select **Reconnect Google account** so the source uses the new grant. **Reconnect Google account** on its own doesn't open a Google prompt. ![The source menu next to the Channel targets table name, listing Merge another query, Refresh from Google Sheets, Reconnect Google account, Rename table, View source details and Delete](https://mintcdn.com/lightdash/62Z0MJZvjjE2f5RM/images/explore/external-sources/07-source-menu.png?fit=max\&auto=format\&n=62Z0MJZvjjE2f5RM\&q=85\&s=1d5b1dc21a78331cc30d35170b2d9e5d) ![The Rename table dialog with the table name and an editable name for every column, with channel renamed to Sales channel](https://mintcdn.com/lightdash/62Z0MJZvjjE2f5RM/images/explore/external-sources/08-rename-table.png?fit=max\&auto=format\&n=62Z0MJZvjjE2f5RM\&q=85\&s=160c441e41217815ed367575646e19fb) Renaming a column from Rename table ## Self-hosted setup External sources run on the same DuckDB engine and object storage as pre-aggregates, but they don't need pre-aggregate workers or NATS. You need: * **An Enterprise license.** Set `LIGHTDASH_LICENSE_KEY`. See [enterprise features](/self-host/enterprise-features). * **A bucket for the imported data.** Set the `PRE_AGGREGATE_RESULTS_S3_*` variables listed under [pre-aggregates](/self-host/customize-deployment/environment-variables#pre-aggregates). Lightdash stores each table under `external-sources/` in that bucket. Without them, adding a source fails with `External sources need the pre-aggregates DuckDB configuration (PRE_AGGREGATE_RESULTS_S3_*)`. * **The feature flag.** Add `external-sources` to `LIGHTDASH_ENABLE_FEATURE_FLAGS`. See [feature flags](/self-host/customize-deployment/environment-variables#feature-flags). * **For Google Sheets, a Google OAuth client.** Follow [configure a Google Sheets integration](/self-host/customize-deployment/configure-google-sheets-integration). Enable the Google Sheets API and the Google Drive API on the same Google Cloud project, and add `/api/v1/oauth/redirect/google` to the client's authorized redirect URIs. To change the size limits, set `EXTERNAL_SOURCES_MAX_FILE_SIZE_BYTES`, `EXTERNAL_SOURCES_MAX_ROWS` or `EXTERNAL_SOURCES_MAX_ORGANIZATION_BYTES`. # Filters reference Source: https://docs.lightdash.com/explore/filters-reference How filters combine, plus every filter type and operator and the SQL each one compiles to Filters change the data pulled into your charts. A chart showing revenue over time becomes revenue from France with a filter for `country is equal to France`. This page covers [how filters combine](#working-with-filters), the [filter types](#filter-types) available on each kind of field, and the SQL that [timestamp](#timestamp-filter-examples) and [date](#date-filter-examples) filters compile to. For adding filters, see [filtering in the Explore view](/explore/explore-view/filter) and [dashboard filters](/explore/dashboards/filter). ## Working with filters These behaviors are the same wherever you're filtering. ### Adding more than one filter Click `+ Add filter` to add another condition. In the Explore view: ![Adding a second filter in the Explore view](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/filters-reference/add-filter-db38c3ba85a83efe38708f015da29b7a.jpg?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=2eee8fa4a9d659e2a03fd7b8334581b1) Or on a dashboard: ![Adding a second filter to a dashboard](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/filters-reference/add-more-filters-dashboard-9b7893b070973350a1fb286723636696.jpg?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=f6458adff67df140d42d58fff5891d9f) ### Matching ALL or ANY of the conditions With multiple filters, the drop-down menu at the top-left chooses whether all conditions must match or any of them can. ![The ALL or ANY selector above a set of filters](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/filters-reference/multiple-filter-options-dd52d4c5666ef4e346b5dda73024ab80.jpg?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=0e770b7616946a6926d0367e38ba443d) `ALL` puts an `AND` between your conditions in the compiled SQL: ```sql theme={null} WHERE ( (pages.source) IN ('lightdash_demo', 'lightdash_documentation') AND (pages.path) = '/20%crunchbase' ``` `ANY` puts an `OR` between them: ```sql theme={null} WHERE ( (pages.source) IN ('lightdash_demo', 'lightdash_documentation') OR (pages.path) = '/20%crunchbase' ``` To mix the two, open a filter's three-dot menu and select **Convert to group**. The filter moves into a nested group with the opposite setting, and **Add group rule** adds more conditions to it. For example, to show the last three full months plus the current month so far, put `in the last 3 completed months` and `in the current month` on the same date field in an `ANY` group. The menu appears once a chart has two or more filters. Dashboard filters always combine with `AND`. They have no `ANY` option and can't be grouped, so build `OR` logic into the chart's own filters instead. ### Filtering on multiple values Hit `enter` between each value to include several in one filter. ![A filter holding several values](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/filters-reference/screenshot-multiple-values-filter-2c1e6691eb63a8d80378314cfaa398c7.jpg?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=c2626cbcdab763aa1de6b868d939ba4d) The listed values are separated by an `OR` in the compiled SQL, so the filter above gives: ```sql theme={null} WHERE ( (pages.source) = 'lightdash_demo' OR (pages.source) = 'lightdash_documentation' ) ``` ### Uploading a CSV of filter values For a long list of values on a string filter — hundreds or thousands of customer IDs or product SKUs — upload a CSV instead of typing each one: 1. Open the filter dropdown for a string field. 2. Click **Upload CSV**. 3. Select a CSV containing your filter values, one value per row or a single column. The values from your CSV are added to the filter. Developers can add permanent filters to tables with the `sql_filter` YAML option. See [table configuration](/semantic-layer/tables#sql-filter-row-level-security). ## Filter types ### Numeric filters | Filter | logic | | :- | :- | | is null | Only pulls in rows where the values are null for the field selected. | | is not null | Only pulls in rows where the values are not null for the field selected. | | is | Only pulls in rows where the values are equal to the values listed. | | is not | Only pulls in rows where the values are not equal to the values listed. | | is less than | Only pulls in rows where the values for the field selected are strictly less than the value listed. | | is greater than | Only pulls in rows where the values for the field selectedare strictly greater than the value listed. | ### String filters | Filter | logic | | :- | :- | | is null | Only pulls in rows where the values are null for the field selected. | | is not null | Only pulls in rows where the values are not null for the field selected. | | is | Only pulls in rows where the values are equal to the values listed. To also match NULL values, pick **(null)** in the value list. | | is not | Only pulls in rows where the values are not equal to the values listed. This filter explicitly includes NULL values. To exclude NULLs, add a separate `is not null` filter. | | starts with | Only pulls in rows where the values for the field selected start with characters you've entered. | | includes | Only pulls in rows where the values for the field selected includes the characters you've entered. | | ends with | Only pulls in rows where the values for the field selected end with the characters you've entered. | ### Boolean filters | Filter | logic | | :- | :- | | is null | Only pulls in rows where the values are null for the field selected. | | is not null | Only pulls in rows where the values are not null for the field selected. | | is | Only pulls in rows where the values are equal to the values listed. | ### Date filters | Filter | logic | | :- | :- | | is null | Only pulls in rows where the values are null for the field selected. | | is not null | Only pulls in rows where the values are not null for the field selected. | | is | Only pulls in rows where the values are equal to the values listed. | | is not | Only pulls in rows where the values are not equal to the values listed. | | in the last | Only pulls in rows where the dates for the field selected are in the last time period you entered: "in the last 3 days", "in the last 2 completed weeks", "in the last 3 quarters" etc. | | not in the last | Only pulls in rows where the dates for the field selected are not in the last time period you entered. | | in the next | Only pulls in rows where the dates for the field selected are in the next time period you entered: "in the next 3 days", "in the next 2 completed weeks", "in the next 3 quarters" etc. | | in the current | Only pulls in rows where the dates for the field selected are in the current time period you entered: "in the current day", "in the current week", "in the current quarter" etc. | | not in the current | Only pulls in rows where the dates for the field selected are not in the current time period you entered. | | in all periods to date | Trims every period in the range to the same point as today, so you can compare like-for-like across periods. For example, with "weeks to date" selected, if today is Thursday you get Mon–Thu of every week in the field's data. Useful for WTD, MTD, QTD, and YTD comparisons. Today is always included. The filter also applies to the prior period of a [period comparison](/explore/period-over-period#period-comparison), so both sides cover the same days. To include only the current period so far, use `in the current` instead. | | is before | Only pulls in rows where the dates for the field selected are strictly before the date you entered. | | is on or before | Only pulls in rows where the dates for the field selected are on or before the date you entered. | | is after | Only pulls in rows where the dates for the field selected are strictly after the date you entered. | | is on or after | Only pulls in rows where the dates for the field selected are on or after the date you entered. | | is between | Only pulls in rows where the dates for the field selected are on or between the dates you entered: "between 2001-12-23 and 2003-01-02". | For week, month, quarter, and year, the "in the current" and "not in the current" filters can switch the period to a **to date** variant — "week to date", "month to date", and so on — that runs from the start of the period up to today. In this mode, an **Include today** checkbox (checked by default) controls whether today is part of the range; uncheck it to end the range at yesterday. For "in the last", "not in the last", and "in the next", picking a **completed** unit, such as `completed months`, lines the range up with whole calendar periods and leaves out the current, partial one. Completed means whole, not already past: `in the last 3 completed months` is the three full months before this one, and `in the next 3 completed months` is the three full months after it. To leave out the most recent periods, combine two filters with `ALL`: `in the last 54 completed weeks` and `not in the last 2 completed weeks` give the 52 full weeks before the last two. Use completed units on both filters, or the cutoff moves day by day instead of falling on a week boundary. ## Date/Timestamp Filter Reference Guide The below examples show possible date/timestamp filter combinations and their corresponding SQL outputs. All examples use BigQuery syntax and assume: * Current timestamp: `2025-10-24 15:30:00` * Example field: `orders.created_at` * Timezone: UTC * Week starts on Monday ### Timestamp filter examples #### Current Period Filters ##### Current (In The Current) | Filter | SQL Output | | - | - | | Current minute | `orders.created_at >= TIMESTAMP('2025-10-24 15:30:00') AND orders.created_at < TIMESTAMP('2025-10-24 15:31:00')` | | Current hour | `orders.created_at >= TIMESTAMP('2025-10-24 15:00:00') AND orders.created_at < TIMESTAMP('2025-10-24 16:00:00')` | | Current day | `orders.created_at >= TIMESTAMP('2025-10-24 00:00:00') AND orders.created_at < TIMESTAMP('2025-10-25 00:00:00')` | | Current week | `orders.created_at >= TIMESTAMP('2025-10-21 00:00:00') AND orders.created_at < TIMESTAMP('2025-10-28 00:00:00')` | | Current month | `orders.created_at >= TIMESTAMP('2025-10-01 00:00:00') AND orders.created_at < TIMESTAMP('2025-11-01 00:00:00')` | | Current quarter | `orders.created_at >= TIMESTAMP('2025-10-01 00:00:00') AND orders.created_at < TIMESTAMP('2026-01-01 00:00:00')` | | Current year | `orders.created_at >= TIMESTAMP('2025-01-01 00:00:00') AND orders.created_at < TIMESTAMP('2026-01-01 00:00:00')` | #### Past Period Filters ##### Last N Periods (in the last) | Filter | SQL Output | | - | - | | Last 1 minute | `orders.created_at >= TIMESTAMP('2025-10-24 15:29:00') AND orders.created_at <= TIMESTAMP('2025-10-24 15:30:00')` | | Last 1 hour | `orders.created_at >= TIMESTAMP('2025-10-24 14:30:00') AND orders.created_at <= TIMESTAMP('2025-10-24 15:30:00')` | | Last 1 day | `orders.created_at >= TIMESTAMP('2025-10-23 15:30:00') AND orders.created_at <= TIMESTAMP('2025-10-24 15:30:00')` | | Last 1 week | `orders.created_at >= TIMESTAMP('2025-10-17 15:30:00') AND orders.created_at <= TIMESTAMP('2025-10-24 15:30:00')` | | Last 1 month | `orders.created_at >= TIMESTAMP('2025-09-24 15:30:00') AND orders.created_at <= TIMESTAMP('2025-10-24 15:30:00')` | | Last 1 quarter | `orders.created_at >= TIMESTAMP('2025-07-24 15:30:00') AND orders.created_at <= TIMESTAMP('2025-10-24 15:30:00')` | | Last 1 year | `orders.created_at >= TIMESTAMP('2024-10-24 15:30:00') AND orders.created_at <= TIMESTAMP('2025-10-24 15:30:00')` | ##### Last N Completed Periods (in the last, Completed) | Filter | SQL Output | | - | - | | Last 1 completed minute | `orders.created_at >= TIMESTAMP('2025-10-24 15:29:00') AND orders.created_at < TIMESTAMP('2025-10-24 15:30:00')` | | Last 1 completed hour | `orders.created_at >= TIMESTAMP('2025-10-24 14:00:00') AND orders.created_at < TIMESTAMP('2025-10-24 15:00:00')` | | Last 1 completed day | `orders.created_at >= TIMESTAMP('2025-10-23 00:00:00') AND orders.created_at < TIMESTAMP('2025-10-24 00:00:00')` | | Last 1 completed week | `orders.created_at >= TIMESTAMP('2025-10-13 00:00:00') AND orders.created_at < TIMESTAMP('2025-10-20 00:00:00')` | | Last 1 completed month | `orders.created_at >= TIMESTAMP('2025-09-01 00:00:00') AND orders.created_at < TIMESTAMP('2025-10-01 00:00:00')` | | Last 1 completed quarter | `orders.created_at >= TIMESTAMP('2025-07-01 00:00:00') AND orders.created_at < TIMESTAMP('2025-10-01 00:00:00')` | | Last 1 completed year | `orders.created_at >= TIMESTAMP('2024-01-01 00:00:00') AND orders.created_at < TIMESTAMP('2025-01-01 00:00:00')` | #### Future Period Filters ##### Next N Periods (In The Next) | Filter | SQL Output | | - | - | | Next 1 minute | `orders.created_at >= TIMESTAMP('2025-10-24 15:30:00') AND orders.created_at <= TIMESTAMP('2025-10-24 15:31:00')` | | Next 1 hour | `orders.created_at >= TIMESTAMP('2025-10-24 15:30:00') AND orders.created_at <= TIMESTAMP('2025-10-24 16:30:00')` | | Next 1 day | `orders.created_at >= TIMESTAMP('2025-10-24 15:30:00') AND orders.created_at <= TIMESTAMP('2025-10-25 15:30:00')` | | Next 1 week | `orders.created_at >= TIMESTAMP('2025-10-24 15:30:00') AND orders.created_at <= TIMESTAMP('2025-10-31 15:30:00')` | | Next 1 month | `orders.created_at >= TIMESTAMP('2025-10-24 15:30:00') AND orders.created_at <= TIMESTAMP('2025-11-24 15:30:00')` | | Next 1 quarter | `orders.created_at >= TIMESTAMP('2025-10-24 15:30:00') AND orders.created_at <= TIMESTAMP('2026-01-24 15:30:00')` | | Next 1 year | `orders.created_at >= TIMESTAMP('2025-10-24 15:30:00') AND orders.created_at <= TIMESTAMP('2026-10-24 15:30:00')` | ##### Next N Completed Periods (In The Next, Completed) | Filter | SQL Output | | - | - | | Next 1 completed minute | `orders.created_at >= TIMESTAMP('2025-10-24 15:31:00') AND orders.created_at < TIMESTAMP('2025-10-24 15:32:00')` | | Next 1 completed hour | `orders.created_at >= TIMESTAMP('2025-10-24 16:00:00') AND orders.created_at < TIMESTAMP('2025-10-24 17:00:00')` | | Next 1 completed day | `orders.created_at >= TIMESTAMP('2025-10-25 00:00:00') AND orders.created_at < TIMESTAMP('2025-10-26 00:00:00')` | | Next 1 completed week | `orders.created_at >= TIMESTAMP('2025-10-27 00:00:00') AND orders.created_at < TIMESTAMP('2025-11-03 00:00:00')` | | Next 1 completed month | `orders.created_at >= TIMESTAMP('2025-11-01 00:00:00') AND orders.created_at < TIMESTAMP('2025-12-01 00:00:00')` | | Next 1 completed quarter | `orders.created_at >= TIMESTAMP('2026-01-01 00:00:00') AND orders.created_at < TIMESTAMP('2026-04-01 00:00:00')` | | Next 1 completed year | `orders.created_at >= TIMESTAMP('2026-01-01 00:00:00') AND orders.created_at < TIMESTAMP('2027-01-01 00:00:00')` | ##### Within Custom Range | Filter | SQL Output | | - | - | | Between 2 dates | `orders.created_at >= TIMESTAMP('2025-10-01 00:00:00') AND orders.created_at <= TIMESTAMP('2025-10-31 23:59:59')` | | On exact date | `orders.created_at >= TIMESTAMP('2025-10-24 00:00:00') AND orders.created_at < TIMESTAMP('2025-10-25 00:00:00')` | #### Notes 1. **Completed periods** always: * Start at the beginning of a period (00:00:00) * End at the beginning of the next period * Don't include partial periods 2. **Rolling periods** (non-completed): * Use the current time as the reference point * Look backward/forward the specified amount * Include partial periods 3. **Current periods**: * Always start at the beginning of the current period * End at the beginning of the next period * Example: Current month starts at 1st of the month 4. **Week handling**: * By default, weeks start on the default day configured in your database * You can configure this to a different day in your database connection settings * Week boundaries are always at midnight (00:00:00) ## Date filter examples #### Current Period Filters ##### Current (In The Current) | Filter | SQL Output | | - | - | | Current day | `orders.created_date = DATE('2025-10-24')` | | Current week | `orders.created_date >= DATE('2025-10-21') AND orders.created_date < DATE('2025-10-28')` | | Current month | `orders.created_date >= DATE('2025-10-01') AND orders.created_date < DATE('2025-11-01')` | | Current quarter | `orders.created_date >= DATE('2025-10-01') AND orders.created_date < DATE('2026-01-01')` | | Current year | `orders.created_date >= DATE('2025-01-01') AND orders.created_date < DATE('2026-01-01')` | #### Past Period Filters ##### Last N Periods (in the last) | Filter | SQL Output | | - | - | | Last 1 day | `orders.created_date >= DATE('2025-10-23') AND orders.created_date <= DATE('2025-10-24')` | | Last 7 days | `orders.created_date >= DATE('2025-10-17') AND orders.created_date <= DATE('2025-10-24')` | | Last 30 days | `orders.created_date >= DATE('2025-09-24') AND orders.created_date <= DATE('2025-10-24')` | | Last 90 days | `orders.created_date >= DATE('2025-07-26') AND orders.created_date <= DATE('2025-10-24')` | | Last 365 days | `orders.created_date >= DATE('2024-10-24') AND orders.created_date <= DATE('2025-10-24')` | ##### Last N Completed Periods (in the last, Completed) | Filter | SQL Output | | - | - | | Last 1 completed day | `orders.created_date = DATE('2025-10-23')` | | Last 1 completed week | `orders.created_date >= DATE('2025-10-13') AND orders.created_date < DATE('2025-10-20')` | | Last 1 completed month | `orders.created_date >= DATE('2025-09-01') AND orders.created_date < DATE('2025-10-01')` | | Last 1 completed quarter | `orders.created_date >= DATE('2025-07-01') AND orders.created_date < DATE('2025-10-01')` | | Last 1 completed year | `orders.created_date >= DATE('2024-01-01') AND orders.created_date < DATE('2025-01-01')` | #### Future Period Filters ##### Next N Periods (In The Next) | Filter | SQL Output | | - | - | | Next 1 day | `orders.created_date >= DATE('2025-10-24') AND orders.created_date <= DATE('2025-10-25')` | | Next 7 days | `orders.created_date >= DATE('2025-10-24') AND orders.created_date <= DATE('2025-10-31')` | | Next 30 days | `orders.created_date >= DATE('2025-10-24') AND orders.created_date <= DATE('2025-11-23')` | | Next 90 days | `orders.created_date >= DATE('2025-10-24') AND orders.created_date <= DATE('2026-01-22')` | | Next 365 days | `orders.created_date >= DATE('2025-10-24') AND orders.created_date <= DATE('2026-10-24')` | ##### Next N Completed Periods (In The Next, Completed) | Filter | SQL Output | | - | - | | Next 1 completed day | `orders.created_date = DATE('2025-10-25')` | | Next 1 completed week | `orders.created_date >= DATE('2025-10-27') AND orders.created_date < DATE('2025-11-03')` | | Next 1 completed month | `orders.created_date >= DATE('2025-11-01') AND orders.created_date < DATE('2025-12-01')` | | Next 1 completed quarter | `orders.created_date >= DATE('2026-01-01') AND orders.created_date < DATE('2026-04-01')` | | Next 1 completed year | `orders.created_date >= DATE('2026-01-01') AND orders.created_date < DATE('2027-01-01')` | ##### Within Custom Range | Filter | SQL Output | | - | - | | Between 2 dates | `orders.created_date >= DATE('2025-10-01') AND orders.created_date <= DATE('2025-10-31')` | | On exact date | `orders.created_date = DATE('2025-10-24')` | #### Notes 1. **Key differences from timestamp filters**: * No time components in any filters * Single day comparisons use equality (`=`) instead of ranges * `DATE()` function used instead of `TIMESTAMP()` 2. **Completed periods** always: * Start at the beginning of a period * End at the beginning of the next period * Don't include partial periods * For single days, use equality instead of ranges 3. **Rolling periods**: * Use the current date as the reference point * Count in full days (N days forward/backward) * Include the current date in the range 4. **Current periods**: * For single day: use equality * For longer periods: use standard ranges * Example: Current month is all days from 1st to last day 5. **Week handling**: * Weeks start on Monday by default * Can be configured to start on Sunday * Full days only, no time components # Formatting your fields Source: https://docs.lightdash.com/explore/formatting-your-fields Hide, group, relabel, and number-format your fields in YAML or in the UI ## Formatting your fields in your .yml files Sometimes the format of things in your dbt project is different to how you want it to look in Lightdash. That's okay! We've built a bunch of features to help you to format the fields in your dbt project so that the data in your Lightdash project looks exactly like you want it to 🥸 ### The [metrics](/semantic-layer/metrics#metric-configuration) and [dimensions](/semantic-layer/dimensions#dimension-configuration) reference docs We're going to go through formatting your fields in more detail below, but you can see a list of these configurations and all of the other properties you can customize for your fields in the [dimensions reference doc](/semantic-layer/dimensions#dimension-configuration) and [metrics reference doc](/semantic-layer/metrics#metric-configuration). ### Hiding fields Sometimes, we have a bunch of columns in our YAML files that we might not want to include in Lightdash. For example, columns with PII data, or the same date data, but at different levels of date granularity. It's easy to hide columns from Lightdash. All you need to do is add two words to your column: `hidden: true`. In your dbt YAML file, it'll look something like this: ```yaml dbt v1.10+ theme={null} models: - name: users columns: - name: first_name config: meta: dimension: hidden: true ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: users columns: - name: first_name meta: dimension: hidden: true ``` ```yaml Lightdash YAML theme={null} type: model name: users dimensions: - name: first_name hidden: true ``` The same thing goes for metrics: ```yaml dbt v1.10+ theme={null} models: - name: users columns: - name: first_name config: meta: metrics: count_unique_first_names: type: count_distinct hidden: true ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: users columns: - name: first_name meta: metrics: count_unique_first_names: type: count_distinct hidden: true ``` ```yaml Lightdash YAML theme={null} type: model name: users dimensions: - name: first_name metrics: count_unique_first_names: type: count_distinct sql: ${TABLE}.first_name hidden: true ``` By default, all of your dimensions and metrics have been set to `hidden: false`. ### Grouping fields in the sidebar You can group related metrics and dimensions together using the model meta `group_details` block in combination with the `groups` property in your .yaml files. You can as well add descriptions to your groups using the property `description` that will be displayed when hovering over the group label. **Max grouping levels.** There is a max of 2 levels of grouping in the sidebar. For example you might want to group the percentile metrics into two sub categories one being for over 40 percentiles and the other for under 40 percentiles. You can do this by adding the `group` property to your metrics like so: ```yaml dbt v1.10+ theme={null} models: - name: events config: meta: group_details: events: label: Events description: Event-related fields. percentile: label: Percentiles description: Grouping of percentiles sub: label: Percentiles under 40 description: Grouping of percentiles under 40 over: label: Percentiles over 40 description: Grouping percentiles over 40 columns: - name: event_id description: '' config: meta: dimension: type: number groups: ['events'] metrics: percentile_25: type: percentile percentile: 25 groups: ['percentile', 'sub'] percentile_50: type: percentile percentile: 50 groups: ['percentile', 'over'] percentile_75: type: percentile percentile: 75 groups: ['percentile', 'over'] ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: events meta: group_details: events: label: Events description: Event-related fields. percentile: label: Percentiles description: Grouping of percentiles sub: label: Percentiles under 40 description: Grouping of percentiles under 40 over: label: Percentiles over 40 description: Grouping percentiles over 40 columns: - name: event_id description: '' meta: dimension: type: number groups: ['events'] metrics: percentile_25: type: percentile percentile: 25 groups: ['percentile', 'sub'] percentile_50: type: percentile percentile: 50 groups: ['percentile', 'over'] percentile_75: type: percentile percentile: 75 groups: ['percentile', 'over'] ``` ```yaml Lightdash YAML theme={null} type: model name: events group_details: events: label: Events description: Event-related fields. percentile: label: Percentiles description: Grouping of percentiles sub: label: Percentiles under 40 description: Grouping of percentiles under 40 over: label: Percentiles over 40 description: Grouping percentiles over 40 dimensions: - name: event_id description: '' type: number groups: ['events'] metrics: percentile_25: type: percentile percentile: 25 sql: ${TABLE}.event_id groups: ['percentile', 'sub'] percentile_50: type: percentile percentile: 50 sql: ${TABLE}.event_id groups: ['percentile', 'over'] percentile_75: type: percentile percentile: 75 sql: ${TABLE}.event_id groups: ['percentile', 'over'] ``` ![The sidebar field tree with metrics nested under a Percentile group and further split into Sub and Over subgroups](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/formatting-your-fields/sub-group-label.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=7db30bcfa35d2017ed9db43a1fb758a5) You can use groups across metrics and dimensions. In the sidebar, your metrics will get grouped together under your label in the `metrics` section, and your dimensions will get grouped together under your label in the `dimensions` section. ### Adding custom descriptions #### Dimensions By default, Lightdash pulls in the descriptions you've included for your dimensions. But, you can override the description you see in Lightdash using the `description` property. ```yaml dbt v1.10+ theme={null} models: - name: users columns: - name: user_id description: "Id generated by the Lightdash API on user's first login. On legacy systems, SHA64. On new systems since 2012, FARM_FINGERPRINT()" config: meta: dimension: description: 'Unique identifier for a user' ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: users columns: - name: user_id description: "Id generated by the Lightdash API on user's first login. On legacy systems, SHA64. On new systems since 2012, FARM_FINGERPRINT()" meta: dimension: description: 'Unique identifier for a user' ``` ```yaml Lightdash YAML theme={null} type: model name: users dimensions: - name: user_id description: 'Unique identifier for a user' ``` You can see the descriptions of your dimensions when you hover over the fields in Lightdash. ![A field in the sidebar hovered, showing its YAML description in a tooltip](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/formatting-your-fields/description-on-hover.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=a6cb3a41d20de2aadfc06cf91fc65101) #### Metrics If you don't add a custom description for your metric, Lightdash will show a description for you in the app, by default. To override this default description, you can use the `description` property. ```yaml dbt v1.10+ theme={null} models: - name: users columns: - name: user_id description: "Id generated by the Lightdash API on user's first login. On legacy systems, SHA64. On new systems since 2012, FARM_FINGERPRINT()" config: meta: metrics: count_unique_users: type: count_distinct description: 'Count the unique number of user IDs' ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: users columns: - name: user_id description: "Id generated by the Lightdash API on user's first login. On legacy systems, SHA64. On new systems since 2012, FARM_FINGERPRINT()" meta: metrics: count_unique_users: type: count_distinct description: 'Count the unique number of user IDs' ``` ```yaml Lightdash YAML theme={null} type: model name: users dimensions: - name: user_id metrics: count_unique_users: type: count_distinct sql: ${TABLE}.user_id description: 'Count the unique number of user IDs' ``` Check out [this doc](/semantic-layer/metrics#metric-configuration) to see all of the other properties you can customize for metrics. ### Renaming fields Sometimes, the labels we use for the fields in our dbt project aren't very user friendly. We might want to change these in Lightdash, and we can! To change the name you'll see for your field in Lightdash, you just use the `label` property. So, if I had a field `user_id_sha64`, I could relabel it to `User ID`. ```yaml dbt v1.10+ theme={null} models: - name: users columns: - name: user_id_sha64 config: meta: dimension: label: 'User ID' ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: users columns: - name: user_id_sha64 meta: dimension: label: 'User ID' ``` ```yaml Lightdash YAML theme={null} type: model name: users dimensions: - name: user_id_sha64 label: 'User ID' ``` Same thing goes for metrics! Relabelling a metric will not break any saved charts that use the old metric name. Instead, your saved charts will just use the new metric name in their results tables. ```yaml dbt v1.10+ theme={null} models: - name: users columns: - name: user_id_sha64 config: meta: metrics: count_unique_user_ids: type: count_distinct label: 'Total users' ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: users columns: - name: user_id_sha64 meta: metrics: count_unique_user_ids: type: count_distinct label: 'Total users' ``` ```yaml Lightdash YAML theme={null} type: model name: users dimensions: - name: user_id_sha64 metrics: count_unique_user_ids: type: count_distinct sql: ${TABLE}.user_id_sha64 label: 'Total users' ``` Check out [this doc](/semantic-layer/dimensions#dimension-configuration) to see all of the other properties you can customize for dimensions, and [this one](/semantic-layer/metrics#metric-configuration) for all of the other properties you can customize for your metrics. The `format` property accepts spreadsheet-style format strings to round, compact, add locale separators, and attach currency or unit symbols. These options apply to dimensions, metrics, and table calculations. The full option tables and format-expression examples live in the [metrics](/semantic-layer/metrics#format) and [dimensions](/semantic-layer/dimensions#format) references; the sections below walk through the common cases. ### Rounding Rounding your metrics is easy to do using the `format` property in your YAML file. #### Rounding dimensions Like this: ```yaml dbt v1.10+ theme={null} models: - name: sales columns: - name: revenue config: meta: dimension: format: '0.00' ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: sales columns: - name: revenue meta: dimension: format: '0.00' ``` ```yaml Lightdash YAML theme={null} type: model name: sales dimensions: - name: revenue format: '0.00' ``` #### Rounding metrics Like this: ```yaml dbt v1.10+ theme={null} models: - name: sales columns: - name: revenue config: meta: metrics: total_revenue: type: sum format: '0.00' ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: sales columns: - name: revenue meta: metrics: total_revenue: type: sum format: '0.00' ``` ```yaml Lightdash YAML theme={null} type: model name: sales dimensions: - name: revenue metrics: total_revenue: type: sum sql: ${TABLE}.revenue format: '0.00' ``` Check out [this doc](/semantic-layer/metrics#metric-configuration) to see all of the other properties you can customize for metrics. ### Compacting big numbers You can compact big numbers with the `format` property so a value like `1,500` shows as `1.50K`. #### Compact dimensions Like this: ```yaml dbt v1.10+ theme={null} models: - name: sales columns: - name: revenue config: meta: dimension: format: '0," K"' ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: sales columns: - name: revenue meta: dimension: format: '0," K"' ``` ```yaml Lightdash YAML theme={null} type: model name: sales dimensions: - name: revenue format: '0," K"' ``` As an example, this option will compact the number value from 1,500 to 1.50K. Check out [this doc](/semantic-layer/dimensions#format) to see all the other compact values. to see all the other formatting options. #### Compact metrics Like this: ```yaml dbt v1.10+ theme={null} models: - name: sales columns: - name: revenue config: meta: metrics: total_revenue: type: sum format: '0.00,,," B"' ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: sales columns: - name: revenue meta: metrics: total_revenue: type: sum format: '0.00,,," B"' ``` ```yaml Lightdash YAML theme={null} type: model name: sales dimensions: - name: revenue metrics: total_revenue: type: sum sql: ${TABLE}.revenue format: '0.00,,," B"' ``` As an example, this option will compact the number value from 1,500,000,000 to 1.50B. Check out [this doc](/semantic-layer/metrics#format) to see all the other formatting options. ### Add units to your values Some columns need a special format to convey what units they're in. For example, if you're a global company, and you have a `revenue` field. Is that in GBP? USD? In Lightdash, you can use the `format` label to add units to your fields. #### Add units to dimensions You can add a `format` to your dimensions this: ```yaml dbt v1.10+ theme={null} models: - name: sales columns: - name: revenue config: meta: dimension: format: '[$£]#,##0.00' ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: sales columns: - name: revenue meta: dimension: format: '[$£]#,##0.00' ``` ```yaml Lightdash YAML theme={null} type: model name: sales dimensions: - name: revenue format: '[$£]#,##0.00' ``` To see which format types are available for dimensions, [check the reference docs here.](/semantic-layer/dimensions#format). Check out [this doc](/semantic-layer/dimensions#dimension-configuration) to see all of the other properties you can customize for dimensions. #### Add units to metrics You can add a `format` to your metrics this: ```yaml dbt v1.10+ theme={null} models: - name: sales columns: - name: revenue config: meta: metrics: total_revenue: type: sum format: '[$£]#,##0.00' ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: sales columns: - name: revenue meta: metrics: total_revenue: type: sum format: '[$£]#,##0.00' ``` ```yaml Lightdash YAML theme={null} type: model name: sales dimensions: - name: revenue metrics: total_revenue: type: sum sql: ${TABLE}.revenue format: '[$£]#,##0.00' ``` To see which format types are available for metrics, [check the reference docs here.](/semantic-layer/metrics#format)Check out [this doc](/semantic-layer/metrics#metric-configuration) to see all of the other properties you can customize for metrics. ### Conditional formatting using parameters You can make your field formatting dynamic by using [parameters](/semantic-layer/parameters) in your format strings. This allows the format to change based on user selections without needing to reconfigure your charts. #### Simple parameter substitution You can reference parameter values directly in your format strings using the syntax `${ld.parameters.parameterName}`. For example, if you have a parameter called `currency_symbol`, you can use it in your format like this: **Step 1: Define your parameter** In your `lightdash.config.yml` file: ```yaml theme={null} parameters: currency_symbol: label: "Currency symbol" description: "Conditional formatting for currency symbol" default: "$" options: - "$" - "€" ``` **Step 2: Use the parameter in your format string** In your model YAML file: ```yaml dbt v1.10+ theme={null} models: - name: sales columns: - name: revenue config: meta: metrics: total_revenue: type: sum format: '${ld.parameters.currency_symbol}0,0.00' ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: sales columns: - name: revenue meta: metrics: total_revenue: type: sum format: '${ld.parameters.currency_symbol}0,0.00' ``` ```yaml Lightdash YAML theme={null} type: model name: sales dimensions: - name: revenue metrics: total_revenue: type: sum sql: ${TABLE}.revenue format: '${ld.parameters.currency_symbol}0,0.00' ``` The format `'${ld.parameters.currency_symbol}0,0.00'` will substitute the selected currency symbol value directly into the format. When users select `$` from the parameter dropdown, numbers will display as `$1,234.56`. When they select `€`, numbers will display as `€1,234.56`. #### Conditional formatting with ternary expressions For more complex formatting logic, you can use ternary expressions in your format strings. The syntax is: ``` ${ld.parameters.parameterName=="value"?"format_if_true":"format_if_false"} ``` Here's an example that displays different currency symbols based on a `currency` parameter: **Step 1: Define your parameter** In your `lightdash.config.yml` file: ```yaml theme={null} parameters: currency: label: "Currency" description: "Conditional formatting for currency" default: "usd" options: - "usd" - "eur" - "gbp" ``` **Step 2: Use the parameter in your format string with conditional logic** In your model YAML file: ```yaml dbt v1.10+ theme={null} models: - name: sales columns: - name: revenue config: meta: metrics: total_revenue: type: sum format: '${ld.parameters.currency=="usd"?"$":""}${ld.parameters.currency=="eur"?"€":""}${ld.parameters.currency=="eur"?"£":""}0,0.00' ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: sales columns: - name: revenue meta: metrics: total_revenue: type: sum format: '${ld.parameters.currency=="usd"?"$":""}${ld.parameters.currency=="eur"?"€":""}${ld.parameters.currency=="eur"?"£":""}0,0.00' ``` ```yaml Lightdash YAML theme={null} type: model name: sales dimensions: - name: revenue metrics: total_revenue: type: sum sql: ${TABLE}.revenue format: '${ld.parameters.currency=="usd"?"$":""}${ld.parameters.currency=="eur"?"€":""}${ld.parameters.currency=="eur"?"£":""}0,0.00' ``` The format uses multiple ternary expressions to check the parameter value: * When `currency` is `"usd"`, displays `$1,234.56` * When `currency` is `"eur"`, displays `€1,234.56` * When `currency` is `"gbp"`, displays `£1,234.56` **Another example: Controlling decimal places** You can use conditional formatting to toggle between different precision levels. Define your parameter in `lightdash.config.yml`: ```yaml theme={null} parameters: decimals: label: "Decimals" description: "Conditional formatting for decimals" default: "true" options: - "true" - "false" ``` Then use it in your model YAML file: ```yaml dbt v1.10+ theme={null} models: - name: sales columns: - name: revenue config: meta: metrics: total_revenue: type: sum format: '0,0${ld.parameters.decimals=="true"?".00":""}' ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: sales columns: - name: revenue meta: metrics: total_revenue: type: sum format: '0,0${ld.parameters.decimals=="true"?".00":""}' ``` ```yaml Lightdash YAML theme={null} type: model name: sales dimensions: - name: revenue metrics: total_revenue: type: sum sql: ${TABLE}.revenue format: '0,0${ld.parameters.decimals=="true"?".00":""}' ``` When `decimals` is `"true"`, numbers display as `$1,234.56`. When `decimals` is `"false"`, numbers display as `$1,235`. ## Formatting your fields in the Lightdash UI You can also format your fields in the Lightdash UI. This is useful if you want to format your fields quickly without having to change your YAML files. Currently you can format 2 types of fields in the Lightdash UI: * Custom metrics ([reference](/explore/create-custom-fields#custom-metrics)) * Table calculations ([reference](/explore/table-calculations)) ### Formatting metrics Metrics formatting is currently only available for numeric metric types. You can adjust the formatting of your pre-defined metrics from the results table. ![The formatting panel for a YAML metric opened from the results table, with type, round and compact options](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/formatting-your-fields/yaml-metric-formatting.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=c5e3286d48c583a354ac0f7c2947aa77) You can customize the formatting of your custom metrics when you create them, and later on from the results table. ![The Format section of the custom metric modal, with format type, rounding, compact and prefix or suffix fields](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/formatting-your-fields/custom-metric-format.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=55e8f8c1dc5027b25767bb2e6be30a33) These are the formatting options available: * `percent`: Formats your metric as a percentage, with the following options: * `round` value to your metric to round it to a certain number of decimal places * `separator`, e.g. from `.` to `,` * `currency`: Formats your metric as a currency * `round` value to your metric to round it to a certain number of decimal places * `separator`, e.g. from `.` to `,` * `currency` symbol, e.g. from `$` to `£` * `compact` value to compact your metric to a certain unit, e.g. from `1,000,000` to `1M` * `number`: Formats your metric as a number * `round` value to your metric to round it to a certain number of decimal places * `separator`, e.g. from `.` to `,` * `compact` value to compact your metric to a certain unit, e.g. from `1,000,000` to `1M` * `prefix` value to add a prefix to your metric, e.g. `+` or `-` * `suffix` value to add a suffix to your metric, e.g. `%` ### Formatting table calculations On the results table, you can add a table calculation by clicking on the button on the right hand side of the section. ![The results table header with the button on the right that adds a table calculation](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/formatting-your-fields/table-calculation-create.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=3dcf38443eab5b01d683d3dfe2069630) Once you've created your table calculation, you can format it by clicking on the `Format` tab: ![The Format tab of the table calculation editor, with the formatting type options](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/formatting-your-fields/table-calculation-format.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=10c9802bead77e728ff06551fe9fdc90) Set the data type selector next to **Format** to match the value your table calculation returns: **Number**, **String**, **Date**, **Timestamp**, or **Boolean**. For example, a calculation that returns a timestamp needs **Timestamp** selected before a custom date format can apply. > [!NOTE] > > Switching between numeric and date-like data types resets the display format. Set the data type before choosing a format. The available formats depend on the selected data type: | Data type | Formats | | - | - | | **String** or **Boolean** | Values display as-is, with no formatting options. | | **Date** or **Timestamp** | **Default**, or **Custom** with a spreadsheet-style date expression such as `yyyy-mm-dd`. | | **Number** | **Plain**, **Number**, **Currency**, **Percent**, **Bytes**, or **Custom**. | For **Number**, you can set decimal places, separators, compact units, prefixes, and suffixes. **Currency** adds a currency symbol; **Percent** offers decimal places and separators. **Bytes** supports **SI** (KB, MB, GB) and **IEC** (KiB, MiB, GiB) units and compact display. For **Custom**, enter a spreadsheet-style expression such as `#,##0.00` for numbers or `dddd hh:mm AM/PM` for timestamps. See [custom format expressions](/semantic-layer/metrics#format) for more examples. # Homepage Source: https://docs.lightdash.com/explore/homepage Build and publish project homepages with curated blocks and audience-specific layouts [Enterprise](/support/feature-badges#enterprise) Homepage is the curation layer for a Lightdash project. It turns the most useful data, workflows, and team context into a deliberate starting point, combining AI, key metrics, curated content, personal shortcuts, data announcements, and resources outside Lightdash. ![A published Lightdash homepage with an Ask AI composer, a curated Start here collection, recently viewed content, and popular content](https://mintcdn.com/lightdash/gsIJLAEBHiy6dp7x/images/explore/homepage/published-homepage.jpg?fit=max\&auto=format\&n=gsIJLAEBHiy6dp7x\&q=85\&s=c7f8007259187233a8eeb05dfc7b36b4) Homepages belong to a project. You can create multiple homepages in one project and publish different versions to everyone, selected organization groups, or selected project roles. Use Homepage to curate the project experience at three levels: * **What matters now:** spotlight trusted metrics, important launches, and timely updates. * **Where to go next:** guide people to dashboards, Spaces, data apps, learning materials, and external tools. * **What matters to each audience:** publish a focused starting point for a team, group, or project role while personal blocks adapt to each viewer. ## Homepage inspiration * **Executive pulse:** lead with key Metrics, a verified dashboard Collection, and short data announcements. * **Team launchpad:** publish by group or role with focused quick actions, Spaces, and each viewer's favorites and recent work. * **Data onboarding:** combine a hand-picked **Start here** Collection with Data Apps, videos, Claude Artifacts, documentation, and a glossary banner. * **Launch or campaign hub:** pair a call to action with curated dashboards, supporting resources, and a scheduled announcement that also notifies Slack. ## Enable Homepage Homepage is enabled by default on licensed instances. If your organization has switched to the classic homepage, an organization admin can select the Homepage invitation, choose an opening, and turn it back on for all projects in the organization: ![The Meet the new Homepage modal comparing Ask first, which opens on the Ask AI composer, with Content first, which opens on a greeting and quick actions](https://mintcdn.com/lightdash/gsIJLAEBHiy6dp7x/images/explore/homepage/homepage-opt-in-openings.jpg?fit=max\&auto=format\&n=gsIJLAEBHiy6dp7x\&q=85\&s=b1018bbb0b7c336e64ee79d77ff7c03c) * **Ask first** opens with the Ask AI composer. This choice is available when AI is configured. * **Content first** opens with a greeting and quick actions. The choice controls the opening experience, not which features the homepage can contain. Ask first still places curated content below the composer; Content first can still offer Ask AI as a quick action. It seeds each project's starter homepage and can be changed later in the builder. Turning Homepage on applies to every project in the organization. Switching back to the classic homepage disables it organization-wide but keeps published homepages and drafts. Turning Homepage on again restores them. ## Build a homepage Project admins, organization admins, and custom roles with **Manage project homepage** can select **Customize homepage** from the project homepage. ![The Homepage builder with the block library on the left, a live editing canvas, draft status, Preview, and Publish controls](https://mintcdn.com/lightdash/gsIJLAEBHiy6dp7x/images/explore/homepage/homepage-builder.jpg?fit=max\&auto=format\&n=gsIJLAEBHiy6dp7x\&q=85\&s=916e780d4ef02288e046863664250d2b) The builder uses the same layout as the published page. Changes save automatically as a draft, but viewers continue to see the last published version until you publish again. In the builder, you can: * Click a block to add it, or drag it to a specific position. * Drag existing blocks between rows, or move them up and down. * Add a second block to a row using the column control. A row supports up to two blocks. * Edit each block directly on the canvas. * Duplicate a block unless it is a singleton block. * Remove blocks, revert unpublished changes to the published version, or delete the homepage. * Preview the draft as everyone, a specific user, a group, or a project role. Drafts are protected from conflicting edits. If another editor saves the homepage after you opened it, Lightdash asks you to reload instead of overwriting their work. ### Create more than one homepage Open the homepage selector beside **Editing**, then select **New homepage**. Give it a name and start with a blank page or duplicate any existing homepage in the project. The same selector switches between homepages and identifies the project's live default. There is no fixed application-level limit on the number of project homepages. ## Blocks The block library provides 11 block types. Blocks whose content resolves to nothing are hidden on the published page, and a row containing only empty blocks collapses without leaving a gap. | Block | What it shows | Main options | | - | - | - | | **Ask AI** | A working AI composer with live suggestions and an optional personalized greeting | Show or hide the greeting; Auto, Compact, or Full screen opening size. Available when the project has an AI agent. One per homepage. | | **Greeting** | A time-of-day greeting personalized with the viewer's first name | Editable subtitle; Auto, Compact, or Full screen opening size. | | **Quick actions** | Shortcuts into Lightdash | Ask AI, Run a query, Browse dashboards, Browse spaces, or a specific dashboard. Reorder actions and emphasize one as primary. | | **Call to action** | One prominent banner or button | Optional title and description; Lightdash destination or custom URL; brand, accent, dark, neutral, or custom theme; background and alignment. One per homepage. | | **Metrics** | KPI cards from the Metrics Catalog | Custom title and up to four metrics. Each card compares the current month with the previous period and shows a sparkline, so each metric needs a default time dimension. One per homepage. | | **Collection** | Charts, dashboards, spaces, and data apps | Hand-picked or live source; Cards or List layout; content-type and verified-content filters; up to 24 visible items. | | **Resources** | Internal data apps and external resources | Data apps, Claude artifacts, YouTube, docs, videos, and links; Cards or List layout; optional descriptions. | | **Announcements** | Updates from the data team | Launch, Update, and Heads up categories; Markdown, images, content mentions, pinning, scheduling, and optional Slack notification. One per homepage. | | **Favorites** | Each viewer's starred content | Personal to the viewer; five items initially, with the remainder expandable. | | **Recently viewed** | Charts, dashboards, and data apps the viewer has opened. A data app appears when that viewer opens it. | Personal to the viewer; four items from the last 90 days. One per homepage. | | **Text / banner** | Free-form Markdown | Rich editing, image upload, slash commands, and `{name}` to insert the viewer's first name. | Ask AI, Greeting, Call to action, and Announcements always occupy a whole row. Other blocks can share a two-column row. When Ask AI or Greeting leads the page, Lightdash treats it as the opening hero and sizes the rest of the page around it. ### Ask AI and Greeting Ask AI is a working composer, not a static shortcut. Viewers can start a conversation from Homepage, choose an available agent, use live suggestions, and access controls such as CSV attachment or deep research when those features are enabled for the project. The composer is intentionally inactive while editing in the builder. You can show or hide the personalized greeting above the composer and choose its opening size: * **Auto** keeps following content visible when the page has more blocks. * **Compact** always uses the content-sized opening. * **Full screen** fills the opening view and moves following content below the fold. The standalone Greeting block uses the viewer's first name and local time of day, adds an editable supporting line, and provides the same opening-size controls. If a published Ask AI block cannot run for a viewer, it falls back to the content-first Greeting experience instead of leaving an empty hero. ### Quick actions Quick actions are compact navigation chips for **Ask AI**, **Run a query**, **Browse dashboards**, **Browse Spaces**, a specific dashboard, a specific Space, or **My space**. Add, remove, and reorder actions, and emphasize one as the primary action. Ask AI actions are hidden automatically for viewers without AI access. **My space** opens each viewer's own personal Space. ### Call to action Use a Call to action for one prominent next step. The whole banner is clickable and can lead to **Ask AI**, **Run a query**, **Browse dashboards**, **Browse Spaces**, or a custom URL. External URLs open in a new tab. ![The Homepage builder customizing a Call to action with a title, supporting line, button label, custom URL, accent theme, and themed background](https://mintcdn.com/lightdash/gsIJLAEBHiy6dp7x/images/explore/homepage/call-to-action-customization.jpg?fit=max\&auto=format\&n=gsIJLAEBHiy6dp7x\&q=85\&s=54a6865cb5d815c2dcd15800eb8c445d) Customize the optional title and supporting line, button label, and visual treatment: * Choose **Brand**, **Accent**, **Dark**, **Neutral**, or a custom color from the project palette. Brand and Accent follow the organization's colors in **Settings → Appearance**, so a rebrand updates the CTA automatically. * Apply the theme to the button only with **None**, place it on a neutral **Card**, or paint the whole surface with **Themed**. Lightdash chooses contrasting text and button colors automatically. * Leave the title empty for a button-only CTA, then align it left, middle, or right. A homepage has one Call to action. For more visual banners, add [Text / banner](#text-and-banners) blocks, which you can repeat and which support uploaded images and links, or emphasize a primary [Quick action](#quick-actions). ### Metrics Use the Metrics block to curate a shared KPI pulse directly on Homepage. Select up to four metrics from the Metrics Catalog and give the block a title that matches the audience or workflow. ![A Homepage Metrics block titled KPIs with Revenue, Order Volume, Support Tickets, and Average Order Value cards, trend sparklines, and previous-period comparisons](https://mintcdn.com/lightdash/Lrh54rpTVtecO1ms/images/explore/homepage/metrics-block.png?fit=max\&auto=format\&n=Lrh54rpTVtecO1ms\&q=85\&s=b1c89837caa1c062287b32c6a8e03227) Each card shows the current metric value, its change against the previous period, and a sparkline. The comparison needs a time dimension, so give each metric a [default time dimension](/explore/metrics-catalog/curate-the-catalog#configuring-default-time-settings-in-yml) on the metric or its table. Without one, the card shows **Couldn't load this metric**, even though the metric opens in the Metrics Catalog. Viewers can open a metric to continue exploring it with the same access controls used elsewhere in Lightdash. ### Collections Collections are the main content-curation primitive on Homepage. Use a stable hand-picked list when order and editorial intent matter, or a live rule that refreshes whenever someone opens the page. ![The Homepage builder configuring a hand-picked Start here Collection with card or list layout, an item limit, a verified-only filter, a selected Space, and an Add content control](https://mintcdn.com/lightdash/gsIJLAEBHiy6dp7x/images/explore/homepage/collection-curation.jpg?fit=max\&auto=format\&n=gsIJLAEBHiy6dp7x\&q=85\&s=e57970d8494edbf503643a45da9f0987) | Source | Behavior | | - | - | | **Hand-picked** | Shows exactly the charts, dashboards, spaces, and data apps you select. Items can be reordered. | | **Most viewed** | Shows charts, dashboards, and data apps people in the project open most often, ranked by view count. The starter homepage titles this collection **Most popular**. | | **Pinned** | Follows the project's pin list. New pins appear without republishing the homepage. Admins with **Manage pinned items** can drag to reorder, mixing charts, dashboards, data apps, and spaces in any order; the new order saves right away. | | **Favourites** | Shows each viewer's own starred content. | | **Recently viewed** | Shows charts, dashboards, and data apps each viewer has opened. | | **Recently updated** | Shows project content that changed most recently. | Live sources can be limited to charts, dashboards, data apps, or spaces, and can show only [verified content](/explore/verified-content). Collections show six items by default and can be configured to show up to 24. For a hand-picked Collection, select **Add content** to browse charts and dashboards by Space or search data apps. You can also import the project's current pins as a starting point. #### Pin content Editors, developers, admins, and custom roles with **Manage pinned items** can pin a saved chart, dashboard, space, or data app from its three-dot menu or header action menu. Select **Pin to homepage** or **Unpin from homepage**. Pins appear on Homepage only when its layout includes a Collection with **Pinned** as the source, or when they were imported into a hand-picked Collection. The live Pinned source tracks later changes automatically; importing pins creates a fixed snapshot. In the homepage builder, drag items within a Pinned Collection block to reorder them, mixing charts, dashboards, data apps, and spaces in any order. The new order saves right away, without publishing the homepage. Reordering needs the same **Manage pinned items** permission as pinning. ### Resources Use Resources to curate the tools and learning material that help people act on the data. A single block can mix saved Lightdash Data Apps with Claude Artifacts, YouTube videos, documentation, and other external links. ![A Getting started Resources block containing a Lightdash Data Apps video, a Lightdash engineering video, and an interactive Claude Artifact](https://mintcdn.com/lightdash/yphEm6CmyHq-ODaW/images/explore/homepage/resources-data-apps.png?fit=max\&auto=format\&n=yphEm6CmyHq-ODaW\&q=85\&s=e9b6c2260653ee8b3fc4090edd441016) Paste one or several URLs into the block. Lightdash retrieves titles, descriptions, and images for supported HTTPS Claude Artifact and YouTube links; other URLs remain editable links. Select saved Data Apps through the searchable picker to add their live thumbnails without copying a URL. External links open in a new tab. Data apps open inside Lightdash. Resource cards can show or hide descriptions and use either a visual Cards layout or a compact List layout. ### Data announcements The Announcements block adds the narrative layer around the data: what launched, what changed, and what needs attention. Updates are authored and managed directly on Homepage. Announcements belong to the project, not to one homepage, so every homepage in the project with an Announcements block shows the same announcements. #### Configure an announcement ![The Edit announcement dialog with a title, rich body, mentioned revenue chart, Update category, and scheduled publication controls](https://mintcdn.com/lightdash/gsIJLAEBHiy6dp7x/images/explore/homepage/data-announcements.jpg?fit=max\&auto=format\&n=gsIJLAEBHiy6dp7x\&q=85\&s=fc7d3f1c6e5031ce071e248887b59da0) Homepage managers can: * Create **Launch**, **Update**, or **Heads up** announcements. * Add Markdown, links, and uploaded images. Type `@` to mention a project chart or dashboard so readers can open the referenced content directly. * Pin one announcement to the top, collapse older items, edit, or delete an announcement. * Publish immediately or schedule publication for a future date and time. * Choose a Slack channel to notify when the announcement publishes, when Slack is connected. #### Preview published announcements Select **Preview** to check the complete announcement layout. Published announcements appear without a Draft label, keep their **Launch**, **Update**, or **Heads up** styling, and render `@` mentions as links to the referenced content. ![Homepage preview showing four published Data Announcements across Launch, Update, and Heads up categories, including a linked revenue chart mention](https://mintcdn.com/lightdash/gsIJLAEBHiy6dp7x/images/explore/homepage/data-announcements-preview.jpg?fit=max\&auto=format\&n=gsIJLAEBHiy6dp7x\&q=85\&s=0f62c89a08a267c86c371114e1e6e961) #### Publish draft announcements Draft announcements are visible only to homepage managers. Publishing the homepage also publishes all draft announcements in the project and sends any queued Slack notifications. The Publish dialog reports these pending actions before confirmation. ![The Publish homepage dialog warning that publishing will also make one draft announcement live](https://mintcdn.com/lightdash/gsIJLAEBHiy6dp7x/images/explore/homepage/publish-draft-announcements.jpg?fit=max\&auto=format\&n=gsIJLAEBHiy6dp7x\&q=85\&s=aac2af6a3fcd55e522584b4db58aafc8) Announcement bodies support up to 8,000 characters. Homepage and announcement images can be PNG, JPEG, GIF, or WebP files up to 5 MB. #### Post announcements from the API To post an announcement from a script or CI job, for example after a failed `dbt test` run, send a `POST` request to `/api/v1/projects/{projectUuid}/announcements` with a `title`, `body`, and `category` (`launch`, `update`, or `heads_up`). Authenticate with a [personal access token](/personal-settings/create-personal-tokens) for a user who can manage the project homepage. Set `publishNow: true` to publish immediately, or `scheduledPublishAt` to a future time to schedule it; with neither, the announcement is created as a draft. Add `slackChannelId` to notify a Slack channel when it publishes. ### Text and banners Use Text / banner blocks for editorial context that does not belong in a data object: explain a workflow, add definitions, welcome a team, or divide the page into sections. The rich Markdown editor supports headings, bulleted and numbered lists, quotes, code blocks, dividers, links, and uploaded images. Type `/` to open the block menu, and use `{name}` to insert each viewer's first name. ### Personal blocks Favorites, Recently viewed, and Collections sourced from Favourites or Recently viewed are resolved separately for every viewer. In the builder, Lightdash shows the editing admin's personal content as a sample. When previewing another user or audience, personal blocks become placeholders. Preview resolves which homepage that audience would receive without revealing another person's favorites or browsing history. If the published layout does not contain a Favorites block, Lightdash adds a compact personal Favorites strip above the opening hero when that viewer has favorites. ## Preview and publish Select **Preview** to see the draft on the real homepage surface. Use **Viewing as** to check the result for: * Everyone * A specific user * An organization group * A built-in project role Previewing a target checks the audience rules that would apply to that target. It is not user impersonation and does not expose the target's personal content. Select **Publish** and choose an audience: ![The Publish homepage dialog with Everyone, By group, and By role audiences and the built-in project roles listed](https://mintcdn.com/lightdash/gsIJLAEBHiy6dp7x/images/explore/homepage/publish-audiences.jpg?fit=max\&auto=format\&n=gsIJLAEBHiy6dp7x\&q=85\&s=46d36691cfb3482d940322eec849645e) | Audience | Result | | - | - | | **Everyone** | Makes this homepage the project's default landing page, replacing the previous default. | | **By group** | Assigns the homepage to one or more organization groups. Reassigning a group moves it from its previous homepage. | | **By role** | Assigns the homepage to Viewer, Interactive viewer, Editor, Developer, or Admin project roles. Reassigning a role moves it from its previous homepage. | When more than one homepage could apply, Lightdash resolves the landing page in this order: 1. The viewer's highest-priority assigned group. 2. The viewer's built-in project role. 3. The project's default homepage. Group assignments always take priority over role assignments. Homepage managers can reorder assigned groups to control which homepage wins when someone belongs to more than one group. Publishing saves the entire current draft as the published version. Future edits remain in the draft until the next publication. ## Manage homepages as code Published homepage layouts can be downloaded as YAML with the [Lightdash CLI](/workflow/cli/reference), reviewed in Git, and uploaded to another project as a draft or published straight to the same audience. Download with `lightdash download --include-homepages`, then upload with `lightdash upload --publish`. See [Homepages as code](/workflow/content-as-code#homepages-as-code) for the file format, how content links are resolved between projects, and what stays behind. ## Permissions and content access | Action | Required access | | - | - | | View the resolved published homepage | Access to the project | | Create, edit, preview, delete, and publish homepages | Project Admin, organization Admin, or a custom role with **Manage project homepage** | | Enable or disable Homepage for the organization | Organization Admin | | Pin and unpin project content | Editor, Developer, Admin, or a custom role with **Manage pinned items** | | Create and manage announcements | The same **Manage project homepage** permission used by the builder | Publishing to an audience chooses which homepage its members land on. It does not grant access to the project or to content referenced by the page. Lightdash checks each viewer's existing permissions when resolving Collection items. Inaccessible or deleted content is omitted, so two people assigned the same homepage can see different cards. Links to charts, dashboards, spaces, data apps, metrics, and AI also keep their normal feature and content permissions. # Learn Source: https://docs.lightdash.com/explore/learn Guided walkthroughs that teach Lightdash features on a sample project you can change freely [Beta](/support/feature-badges#beta) > [!NOTE] > > If you don't see **Learn** in the top bar, it isn't turned on for your organization yet. Self-hosted instances turn it on with a feature flag; see [Enable Learn on a self-hosted instance](#enable-learn-on-a-self-hosted-instance). Learn is a library of guided walkthroughs inside Lightdash. Each walkthrough teaches one feature, such as building a chart, creating a dashboard, sharing a space, or pinning content to a homepage, by having you click through the real product on sample data. ## Open Learn Click the **Learn** icon (a graduation cap) in the top bar, beside notifications and help. The library opens with the walkthroughs available to you. The first time anyone in your organization opens Learn, it asks for an organization admin to enable it. Once an admin has, every walkthrough is open to everyone in the organization who has access to Learn. Every built-in organization role has access; on a custom organization role, access needs the [`view:Learn` scope](/workspace-admin/custom-roles#learn-scope). ## Enable Learn for your organization An organization admin opens Learn and clicks **Enable Learn**. Enabling does three things: * Creates a project named **Training (sample data)**, on a small built-in dataset. * Gives everyone in the organization the permissions to practise in that project, and only there. * Makes the admin who enabled it that project's admin. People who aren't organization admins see **Ask an admin to enable Learn** until it's enabled. ## How walkthroughs work Every walkthrough runs in your own fresh copy of the Training (sample data) project. Anything you create, change, or break happens in that copy, never in your real projects or in anyone else's copy. The copy is removed when the walkthrough ends, and expires after 24 hours if you leave one unfinished. Starting a new walkthrough replaces any copy you already have. The walkthrough highlights the next control to click and moves on when you click it, so you learn where things are in the product rather than reading about them. When you finish a walkthrough you started from the library, you return to the library. In the training project, everyone can explore data, save charts, build dashboards, create spaces, and use the other features a project admin has, whatever their role in your real projects. Actions that would change the project for everyone, or reach outside Lightdash, are not available there: changing project settings or the warehouse connection, deleting the project, deploying, and sending scheduled deliveries. ## The library The library groups walkthroughs by subject, starting with **Foundations**, the basics every Lightdash user needs. Use the group tabs or **Search the library** to find a walkthrough, and the **Up next** card to resume one you started or begin the next recommended one. By default the library shows **What you can do**: walkthroughs for the features you hold in your real projects, through your organization role, your project roles, and any groups you belong to. To see walkthroughs for features beyond your current access, open **Filter** and choose **Extra modules**. Each extra module names the lowest role that includes it, for example **Editor and above**. Choose **Coming soon** in the same menu to show or hide features that don't have a walkthrough yet. Your progress is saved to your Lightdash user, so it follows you across browsers and devices. ## Control who sees Learn with custom roles [Enterprise](/support/feature-badges#enterprise) Every built-in organization role can use Learn. A [custom organization role](/workspace-admin/custom-roles) can use it only if it includes the `view:Learn` scope (**View and use Learn walkthroughs**, under **Organization Management**). Users whose custom role doesn't include it don't see the **Learn** icon. To show Learn to only some people, give the scope to the custom roles that should see it. You can only grant scopes that your own role holds. If saving the role fails with "Cannot grant permissions exceeding your own", ask an admin whose role includes `view:Learn` to make the change. ## Remove the training project Only an organization admin can delete the Training (sample data) project. Deleting it also removes every learner's copy. ## Enable Learn on a self-hosted instance Add `enable-learn` to the `LIGHTDASH_ENABLE_FEATURE_FLAGS` environment variable and restart Lightdash. See [feature flags](/self-host/customize-deployment/environment-variables#feature-flags). Learn needs Lightdash v2.238.0 or later. An organization admin then [enables Learn for the organization](#enable-learn-for-your-organization). # Merge queries Source: https://docs.lightdash.com/explore/merge-queries Combine two or more explores into one result by joining them on a shared field A merge query puts two or more explores side by side in one result. You pick the fields you want from each explore, say which field lines them up, and run. The merged result behaves like any other chart: you can configure it, save it, add it to dashboards, schedule it, and filter it from a dashboard. Use it when a question spans two explores that share a field at the same grain, such as review sentiment next to return rates for the same product, or orders next to payments for the same month. ![Screen recording of adding a second explore to a query, choosing the join field and running the merged query](https://mintcdn.com/lightdash/NSqFrk0onSkMurhz/images/explore/merge-queries/merge-flow.gif?s=2711a9bab18a50c97f0134dd015c4e50) Merging Orders with Payments by month, from an explore to merged results ## Before you start Each source of a merge is a normal explore query with its own metrics, dimensions and filters. All explores must be in the same project, and the same explore can be used more than once. You need: * **A shared field.** A dimension that exists in every source with matching values, such as a product code or a month. This becomes the join key. A merge can join on more than one field. * **Matching grain.** Every dimension you select from a source must be one of the join keys. This keeps each source to one row per key, so the join never multiplies rows. See [how the join stays honest](#how-the-join-stays-honest). Anyone who can run queries in the explore can merge. There is nothing to install and no change to your dbt project. [AI agents](/agents) can't build a merge or change what one runs, and dashboards they generate leave out merged charts. On a saved merged chart, an agent can change only its name, description, chart, table and pivot settings, field formatting and space. ## Merge two explores **1. Build the first side as usual** Open an explore and pick the fields you want from it. Filters you add here apply to this side only. ![The Orders explore with Order date month and Total order amount selected](https://mintcdn.com/lightdash/NSqFrk0onSkMurhz/images/explore/merge-queries/explore-with-fields.png?fit=max\&auto=format\&n=NSqFrk0onSkMurhz\&q=85\&s=a83e02b438394ee7fd03fecb8ed72aea) **2. Choose Merge another query** Open the query options menu, the `···` button next to the explore name at the top of the field panel, and choose **Merge another query**. ![The query options menu with the Merge another query item](https://mintcdn.com/lightdash/NSqFrk0onSkMurhz/images/explore/merge-queries/merge-another-query-menu.png?fit=max\&auto=format\&n=NSqFrk0onSkMurhz\&q=85\&s=a3299a32639c1f71cbf20ae5afc62a61) **3. Choose the second explore** The field panel switches to a **Data sources** view. Your first explore is listed with its selected fields, and a new card asks you to choose data to combine. Search the table list and pick the second explore. ![The Data sources panel listing Orders and a Choose data to combine card above a searchable table list](https://mintcdn.com/lightdash/NSqFrk0onSkMurhz/images/explore/merge-queries/choose-data-to-combine.png?fit=max\&auto=format\&n=NSqFrk0onSkMurhz\&q=85\&s=6e497e3a74808a7bd31861345f47d522) **4. Pick fields from the second side** You see the second explore's field tree. Add at least one metric. The **Relationship** card tells you what is still missing. ![Payments chosen as the second source, with the Relationship card asking for at least one metric from Payments](https://mintcdn.com/lightdash/NSqFrk0onSkMurhz/images/explore/merge-queries/second-source-chosen.png?fit=max\&auto=format\&n=NSqFrk0onSkMurhz\&q=85\&s=3644c165ec73b5fae2a98b1cb27f01fa) **5. Set the join field on each side** In the **Relationship** card, each side has a field picker that offers dimensions only. The first side is prefilled with the dimension you already selected. Choose the matching field on the second side. Use **Add join condition** when the sides match on more than one field. ![The Payments join field picker open, offering Order date month](https://mintcdn.com/lightdash/NSqFrk0onSkMurhz/images/explore/merge-queries/join-field-picker.png?fit=max\&auto=format\&n=NSqFrk0onSkMurhz\&q=85\&s=d7e2329b839e44cc6d2b00c8101ff1b7) **6. Add more sources (optional)** To merge a third explore or more, choose **Add source** and repeat the previous two steps for it. Every source maps to the same join key, and one join type applies to the whole merge. **7. Choose the join type** The summary next to **Relationship** reads the join back in words. The default is **All rows**. See [which join type to choose](#which-join-type-to-choose). ![The Relationship card with both join fields set to Order date month and the Left join type selected](https://mintcdn.com/lightdash/NSqFrk0onSkMurhz/images/explore/merge-queries/relationship-card.png?fit=max\&auto=format\&n=NSqFrk0onSkMurhz\&q=85\&s=270629775c71c4fecae1781157122db9) **8. Run the query** Results arrive as one table. The join key has a key icon, and every other column carries the name of the explore it came from. Configure the chart the way you would for any explore. Table calculations added to a merged result can reference fields from every source and have the usual format options. Drill-down and underlying data on a merged column open the source explore that column came from. ![Merged results with Order date month, Total order amount from Orders and Unique payment count from Payments](https://mintcdn.com/lightdash/NSqFrk0onSkMurhz/images/explore/merge-queries/merged-results.png?fit=max\&auto=format\&n=NSqFrk0onSkMurhz\&q=85\&s=bfb853cbe9d1f289d743657ba8013805) **9. Save the chart** **Save chart** works as it does for any chart. The saved chart shows the relationship at the top and can be added to dashboards and [scheduled deliveries](/explore/create-scheduled-deliveries). ![A saved merged chart with a header reading Orders + Payments, matched on Order date month](https://mintcdn.com/lightdash/NSqFrk0onSkMurhz/images/explore/merge-queries/saved-merged-chart.png?fit=max\&auto=format\&n=NSqFrk0onSkMurhz\&q=85\&s=86fedca1baae307f6a1323e1b4fd91bc) ## Which join type to choose The three options answer one question: when a key exists in only some sources, what happens to it? | Option | SQL equivalent | Keeps | Use when | | - | - | - | - | | **Matches only** | Inner join | Only keys found in every source. Anything unmatched is dropped. | A row missing any measure would be misleading. | | **From** *first explore* | Left join | Every key from the first explore. Other sources' columns are blank where they have no match. | The first explore is the list you report on. | | **All rows** | Full outer join | Every key from any source. Blanks wherever a source has nothing. | You want to spot keys that exist in some sources only. | ## How the join stays honest A merge is only safe when each source has exactly one row per join key. Because an explore query groups by its dimensions, that comes down to one rule: **every dimension you select in a source must be a join key.** Metrics are already one value per key, so any number of them is fine. When a selection breaks the rule, the query refuses with a message rather than multiplying rows. Either add that dimension as another join condition in every source, or remove it. For example, reviews by `product` merged with returns by `product`, joined on product, works. Reviews by `product` and `month` merged with returns by `product`, joined on product only, refuses, because the review side has many rows per product. Add `month` to both sides and to the join conditions and it works again. ### Repeat values Sometimes the extra rows are what you want, such as a product's return rate shown on every month of its reviews. The refusal message offers to repeat the other sources' values on every row of the finer-grained source. Their values then appear once per matching row, and their columns have no totals, because a sum would count each value once per repeat. Only one source can keep dimensions that are not join keys. Choose **Stop repeating** to go back. ## Filters Filters on a source apply to that source before the join. A [dashboard filter](/explore/dashboards/filter) on a merged chart is pushed into every source that has the field, so a date filter narrows every explore rather than only the merged output. A dashboard filter on a column that exists only in the merged result, such as a merge table calculation, is refused, because merges have no filter step after the join. ## How a merge runs A merge runs in two stages. Each source runs as its own query against your warehouse, with that source's filters and row limit. Lightdash then joins the results in its own query engine, so the join needs no relationship in your dbt project and behaves the same on every warehouse. The SQL view of a merged chart shows both stages. You can run each source's SQL in the [SQL Runner](/explore/sql-runner), but not the final merge step: it reads the source results as `merge_source_0`, `merge_source_1`, and so on, and those tables exist only inside Lightdash, not in your warehouse. ## Current limits | Area | Today | | - | - | | Join key formatting | The merged key column shows its underlying value. A month key shows as a full date rather than a month label. | | Grain | A merged result has one row per join key value, and there's no step that aggregates after the join. To total across keys, such as a monthly total of orders matched on an order ID, define the relationship as a [join](/semantic-layer/joins) in your model and query that explore instead. | | Row limits | Each source runs with its own row limit. If a source is cut off by its limit, the merge refuses instead of returning a partial answer. Narrow that source with a filter or raise its limit. | | Dashboards | Date zoom and dashboard sort overrides are not applied to merged chart tiles. | | Sources | Explores from the same project. | # Metrics catalog Source: https://docs.lightdash.com/explore/metrics-catalog Browse and explore your metrics in the catalog, and map how they relate with Saved Trees ## Getting Started The Metrics page uses your existing [Lightdash semantic layer](/semantic-layer) and metrics definitions, so you can get started today. Head to **Metrics** in the navigation bar to start exploring. The Metrics page has two views, switched with the toggle in the top-right corner: * **Catalog** — A searchable, filterable table of all your project metrics. Browse metrics by category, owner, or popularity, explore any metric over time in the Metrics Explorer, and curate what your business users see through `.yml` configuration. * **Saved Trees** — Shareable diagrams of how your metrics relate to each other. [Build them on a canvas](/explore/metrics-catalog/build-saved-trees) by connecting metrics with edges, or let [drivers](/explore/metrics-catalog/drivers) defined in your `.yml` draw the relationships automatically. ## The `spotlight` config `spotlight` is the YAML namespace that covers everything about how your metrics show up across the Metrics experience — visibility in the catalog (`visibility`), grouping (`categories`), ownership (`owner`), and explorer behavior like default time dimensions, filters, and segments. It works at two levels: * **Project level** — defaults for the whole project, set in [`lightdash.config.yml`](/semantic-layer/lightdash-config-yml#metrics-catalog-configuration) (e.g. `default_visibility`, available `categories`) * **Metric/model level** — per-metric overrides, set under `meta.spotlight` in your dbt model `.yml` (see [curating the catalog](/explore/metrics-catalog/curate-the-catalog#curating-metrics-catalog-for-your-business-users)) Whenever you see `spotlight` in YAML, it's configuring something on this page. ## View catalog column configuration The metrics catalog table has a **Manage column visibility** control (the eye icon). Open it to see which columns are shown and the order they appear in. The **Metric** column is pinned: it cannot be hidden or moved. You can toggle the other columns or drag their handles to reorder them for your current view. **Discard** returns to the saved project configuration. Reading the project's saved column configuration uses the **View spotlight table configuration** permission. ## Save catalog column configuration Users with **Configure spotlight table settings** permission can save the catalog's column visibility and order for everyone in the project. Open **Manage column visibility**, adjust the columns, and select **Save for everyone**. If there are unsaved changes, **Discard** restores the saved configuration. With no unsaved changes, **Reset** removes the project's saved configuration and restores the default columns for everyone. These controls configure the catalog table's columns; metric visibility, categories, and time defaults are configured separately through [the spotlight YAML namespace](#the-spotlight-config). # Saved Trees Source: https://docs.lightdash.com/explore/metrics-catalog/build-saved-trees Build shareable diagrams that show how your metrics relate to each other **Saved Trees** are persistent, shareable diagrams of how your metrics relate to each other. Each tree stores its full layout — every node position and every edge — so you can return to the same view next session and share the link with teammates. Saved Trees are shared across your team: anyone with access to the project can view them, and users with the right permissions can create, edit, and delete them. You build and view Saved Trees on a canvas: switch to the canvas view using the toggle in the top-right corner of the Metrics page. The **Saved Trees** sidebar on the left lists every tree in the project. ![Saved Trees on the canvas](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/metrics-catalog/canvas-saved-trees.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=2b881539d0dbb8fe3ecd7a675712279f) ### Creating a Saved Tree 1. **Start a new tree**: In the **Saved Trees** sidebar, click **New** to enter edit mode, and type a name in the text input at the top of the canvas. 2. **Find your metrics**: Use the search bar, categories, or table filters to narrow down the metrics sidebar. Click **Load more** at the bottom to pull additional metrics from the catalog. 3. **Add metrics**: Click the plus button beside a metric in the sidebar to add it to the canvas, or drag the metric onto the canvas. 4. **Create connections**: Drag between node handles to draw edges representing relationships and dependencies. Metrics with [drivers](/explore/metrics-catalog/drivers) defined in `.yml` get their edges drawn automatically. 5. **Remove nodes**: Select a node and press **Backspace** to delete it. 6. **Save**: Click **Save**. The button is disabled until you provide a name and add at least one node. When you save, the tree name, node positions, edges, and metric references are all persisted. Click **Cancel** to discard your work. If you have unsaved changes, a confirmation dialog will appear. [Driver edges](/explore/metrics-catalog/drivers) are not stored with the tree — they are injected automatically whenever matching nodes are present. To make changes later, open the tree from the sidebar and enter edit mode. Viewers can see trees and connections but cannot make edits. To chart a metric from a tree, click the info icon on its node and click **Explore**. The metric opens in the [Metrics Explorer](/explore/metrics-catalog/curate-the-catalog#exploring-a-metric), where **Save chart** saves it to a space or dashboard. A tree can't be added to a dashboard as a whole, so save a chart for each metric you want to show. ### Collaborative locking Only one user can edit a Saved Tree at a time. When you start editing, the tree is locked to you. The lock stays active while you work — if you stop editing for more than 2 minutes, the lock is automatically released so others can make changes. When a tree is locked by another user, you'll see an **"Editing by "** badge in the header, and the Edit and Delete options are disabled until the lock is released. Your changes are automatically saved as a draft while you edit, so if you accidentally close the tab or refresh the page, your work-in-progress can be recovered when you return. ### Permissions | Action | Admin | Developer | Editor | Interactive Viewer | Viewer | | :- | :-: | :-: | :-: | :-: | :-: | | View a Saved Tree | | | | | | | Create a Saved Tree | | | | | | | Edit a Saved Tree | | | | | | | Delete a Saved Tree | | | | | | # Catalog Source: https://docs.lightdash.com/explore/metrics-catalog/curate-the-catalog Browse, explore, and curate your metrics in the Metrics Catalog ## Browsing the catalog Browse all the project metrics you have access to (based on permissions and user-attributes) in the **Metrics Catalog**. ![The Metrics Catalog listing metrics with their descriptions, categories and popularity, and a search bar above](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/metrics-catalog/browsing-the-catalog-a9520c871903cedd96eb7923a1b3ae4e.webp?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=991f07aacdedf7ba57cb46428b32f02e) 1. **Search**: Easily find metrics by their names or .yml descriptions using the searchbar. 2. **View .yml descriptions**: Click on any description to expand and view the full content, including rendered Markdown. 3. **Categories**: Use categories to streamline your metrics and KPIs. Filter metrics by category and add new ones directly in the UI. ***Users with editor permissions and above*** can click on any category cell to edit, rename, change its color, or delete it. 4. **View popularity**: Discover a metric's popularity and see where it's being used. Click to explore a complete list of charts which use the metric. Metrics are sorted by default to highlight the most used ones first. 5. **Explore**: ***Interactive viewers and above*** can dive deeper by clicking *Explore* to visualize the metric in a chart format. ## Exploring a metric Visualize your metrics in the **Metrics Explorer**. ![The Metrics Explorer with a metric plotted as a line over time, and controls for date range, granularity, dimension filter, segment-by and comparison](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/metrics-catalog/exploring-a-metric.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=6944f6bb50c7006d1614f55ef5c43321) 1. **Plot over time**: View your selected metric plotted over a time dimension as a line chart. You can adjust this dimension or set a default time dimension in your `.yml` to simplify the process for users. [See how](#configuring-default-time-settings-in-yml) 2. **Filter by date**: Use the date picker with convenient presets for quick selection. [See how default presets work based on the granularity](#faqs) 3. **Adjust the time granularity**: Refine your view by choosing the desired level of date granularity. 4. **Filter by a dimension:** Filter your metric by any string or boolean dimension from the same table. 5. **Segment-by**: Break down the metric by any non-time dimension from the same table. 6. **Compare to:** * **'This time last year'**: Compare the selected time period to the same period last year * **'Another metric':** Compare to another metric **from the same table** that has a default time dimension specified in the `.yml`. [See how](#configuring-default-time-settings-in-yml) 7. **Drag to zoom:** Click and drag across the chart to highlight the desired time range or data points, then release to zoom in on that segment. Hit 'Reset Zoom' to reset chart. The dimension filter and segment-by only list dimensions from the metric's own table, not from tables joined to it. To filter or group by a joined table's dimensions, click **Explore from here** to open the metric in the full [Explore view](/explore/explore-view), where joined dimensions are available. ## Curating Metrics Catalog for your business users Metrics Catalog is designed to be a tool for your business users to explore and understand your data. To make Metrics Catalog more useful for your business users, you can curate the metrics they can see and explore. To do this, you can: * Control the visibility of metrics in the catalog * Add categories to your metrics * Add default time settings to your metrics All through your Lightdash `.yml` files. Metrics curation is configured under the `spotlight` key — see [the `spotlight` config](/explore/metrics-catalog#the-spotlight-config) for an overview of what it covers. ### Configuring global visibility of metrics You can control the visibility of metrics in the catalog by creating a new file called `lightdash.config.yml` in the root of your dbt project. If you're new to lightdash.config.yml, check out our [getting started guide](/semantic-layer/lightdash-config-yml#getting-started) to learn how to create and set up this file. See this video for an example on how to set this up: [https://www.loom.com/embed/1cedbf73be24445abecde95132284e91?sid=67cf36bd-f81e-40a8-b64e-972bbcfc836a](https://www.loom.com/embed/1cedbf73be24445abecde95132284e91?sid=67cf36bd-f81e-40a8-b64e-972bbcfc836a) **Step-by-step guide** 1. Add the following to your `lightdash.config.yml` file: ```yml theme={null} spotlight: default_visibility: show ``` **The default visibility can be set to `show` or `hide`.** If you don't set this, the default visibility will be `show`, so all metrics will be visible in the catalog by default (but other settings like user attributes will still apply). This will set the default visibility of metrics in the catalog to `show` for all metrics in your project. You can also set this to `hide` if you prefer to hide metrics by default and then override this on a per-model/metric basis. 2. Now that you've set the default visibility, you can override this on a per-model/metric basis. ```yml dbt v1.10+ theme={null} models: - name: events config: meta: spotlight: visibility: hide ``` ```yml dbt v1.9 and earlier theme={null} models: - name: events meta: spotlight: visibility: hide ``` ```yml Lightdash YAML theme={null} type: model name: events spotlight: visibility: hide ``` This will hide the events model from the catalog. 3. If there are metrics in the events model that you want to make visible, you can override the default visibility for those metrics. ```yml dbt v1.10+ theme={null} models: - name: events config: meta: spotlight: visibility: hide metrics: event_count: type: count spotlight: visibility: show ``` ```yml dbt v1.9 and earlier theme={null} models: - name: events meta: spotlight: visibility: hide metrics: event_count: type: count spotlight: visibility: show ``` ```yml Lightdash YAML theme={null} type: model name: events spotlight: visibility: hide metrics: event_count: type: count spotlight: visibility: show ``` 4. Once you compile your project, you'll see the `event_count` metric in the catalog, even though the events model is hidden. ### Assigning categories to metrics Categories are a great way to organize your metrics in the catalog. You can create a new category by adding a new `categories` field to your `lightdash.config.yml` file. Here's a video showing how to set this up: [https://www.loom.com/embed/16690385fac04d97963d0dc36aba5f87?sid=7119a8aa-b4d2-4ba4-859c-0d76a6fe081b](https://www.loom.com/embed/16690385fac04d97963d0dc36aba5f87?sid=7119a8aa-b4d2-4ba4-859c-0d76a6fe081b) **Step-by-step guide** 1. Add the following to your `lightdash.config.yml` file: ```yml theme={null} spotlight: categories: revenue: # Required, this is the name of the category, and how it will be referenced in the catalog. It must be unique. label: Revenue # Required, this is what will be displayed in the catalog color: "orange" # Optional, defaults to "gray", with the option to choose from a range of colors: "gray", "violet", "red", "orange", "green", "blue", "indigo", "pink", "yellow" ``` 2. Now that you've added a category, you can assign metrics to it by adding a `categories` field to your models `.yml` file. ```yml dbt v1.10+ theme={null} models: - name: events config: meta: spotlight: visibility: show categories: - revenue ``` ```yml dbt v1.9 and earlier theme={null} models: - name: events meta: spotlight: visibility: show categories: - revenue ``` ```yml Lightdash YAML theme={null} type: model name: events spotlight: visibility: show categories: - revenue ``` This will add the `revenue` category to all metrics in the events model. If you want to add another category to a specific metric, you can do so by adding the `categories` field to the metric's `.yml` file. And remember, you can only add categories that have been defined in the `lightdash.config.yml` file. 3. Now you can add the `marketing` category to the `event_count` metric: So in your `lightdash.config.yml` file, you need to have another category. Let's call it `marketing` and add it to the `event_count` metric, like so: ```yml theme={null} spotlight: categories: marketing: label: Marketing color: "blue" revenue: label: Revenue color: "orange" ``` Now you can add the `marketing` category to the `event_count` metric: ```yml dbt v1.10+ theme={null} models: - name: events config: meta: spotlight: visibility: show categories: - revenue metrics: event_count: type: count spotlight: categories: - marketing ``` ```yml dbt v1.9 and earlier theme={null} models: - name: events meta: spotlight: visibility: show categories: - revenue metrics: event_count: type: count spotlight: categories: - marketing ``` ```yml Lightdash YAML theme={null} type: model name: events spotlight: visibility: show categories: - revenue metrics: event_count: type: count spotlight: categories: - marketing ``` In this example, the `event_count` metric will have both the `marketing` and `revenue` categories, it's cumulative. 4. Once you compile your project, you'll see the `event_count` metric in the catalog with both the `marketing` and `revenue` categories and you can use this to filter your metrics in the catalog. **The categories you define need to be unique, so you can't have two categories with the same name.** If you try to add a category with the same name as an existing category, you'll get an error. This error will be displayed in the UI and in the terminal (if you use the Lightdash CLI) when you compile your project. ### Remove categories Compiling removes any category you've deleted from `lightdash.config.yml`. Categories created in the catalog UI aren't in your YAML, so compiling doesn't touch them, and they stay in the project even after you remove them from every metric. To delete one, open the category's edit menu in the catalog and click the trash icon, or call the API: list the project's categories with `GET /api/v1/projects/{projectUuid}/tags`, then delete one with `DELETE /api/v1/projects/{projectUuid}/tags/{tagUuid}`. To keep categories managed only in code, leave **Manage Tags** out of every role assigned to those users. In the custom role editor, it's in the **Content Management** group. Permissions are [additive](/workspace-admin/custom-roles#how-additive-permissions-work), so a custom project role can't remove this permission when an organization role grants it. Users without **Manage Tags** can still see and filter by categories, but can't create, edit, or delete them in the UI. ## Assigning owners to metrics You can assign owners to metrics using the `spotlight.owner` property. The owner displays in the metrics catalog with their name and avatar. ### Set an owner at the metric level ```yaml dbt v1.10+ theme={null} models: - name: orders columns: - name: amount config: meta: metrics: total_revenue: type: sum spotlight: owner: alice@yourcompany.com ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: orders columns: - name: amount meta: metrics: total_revenue: type: sum spotlight: owner: alice@yourcompany.com ``` ```yaml Lightdash YAML theme={null} type: model name: orders dimensions: - name: amount metrics: total_revenue: type: sum sql: ${TABLE}.amount spotlight: owner: alice@yourcompany.com ``` ### Set a default owner at the model level You can set a default owner for all metrics in a model. Metric-level owners override the model-level default. ```yaml dbt v1.10+ theme={null} models: - name: orders config: meta: spotlight: owner: bob@yourcompany.com # default for all metrics in this model columns: - name: amount config: meta: metrics: total_revenue: type: sum spotlight: owner: alice@yourcompany.com # overrides model owner avg_revenue: type: average # inherits bob@yourcompany.com from model ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: orders meta: spotlight: owner: bob@yourcompany.com # default for all metrics in this model columns: - name: amount meta: metrics: total_revenue: type: sum spotlight: owner: alice@yourcompany.com # overrides model owner avg_revenue: type: average # inherits bob@yourcompany.com from model ``` ```yaml Lightdash YAML theme={null} type: model name: orders spotlight: owner: bob@yourcompany.com # default for all metrics in this model dimensions: - name: amount metrics: total_revenue: type: sum sql: ${TABLE}.amount spotlight: owner: alice@yourcompany.com # overrides model owner avg_revenue: type: average sql: ${TABLE}.amount # inherits bob@yourcompany.com from model ``` * Use the email address of a Lightdash user in your organization. * Metric-level owner takes precedence over model-level. * You can filter by owner in the Metrics Catalog UI. * If the email doesn't match a Lightdash user, the metric shows as "Unassigned". ## Controlling filtering and segmentation options You can control which dimensions appear in the filter and segment-by dropdowns when exploring metrics. This helps users focus on relevant dimensions. You can also pre-apply a default segment and filter so users land on the most useful view as soon as they open a metric. ### Hide a dimension from all metrics Use boolean values at the dimension level to hide a dimension from filter or segment-by dropdowns for all metrics in that model: ```yaml dbt v1.10+ theme={null} models: - name: orders columns: - name: internal_tracking_id config: meta: dimension: spotlight: filter_by: false # hide from filter dropdown segment_by: false # hide from segment-by dropdown ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: orders columns: - name: internal_tracking_id meta: dimension: spotlight: filter_by: false # hide from filter dropdown segment_by: false # hide from segment-by dropdown ``` ```yaml Lightdash YAML theme={null} type: model name: orders dimensions: - name: internal_tracking_id spotlight: filter_by: false # hide from filter dropdown segment_by: false # hide from segment-by dropdown ``` ### Allowlist specific dimensions for a metric Use an array of dimension names at the metric level to create an allowlist of dimensions for that specific metric: ```yaml dbt v1.10+ theme={null} models: - name: orders columns: - name: amount config: meta: metrics: total_revenue: type: sum spotlight: filter_by: - status - region - order_date segment_by: - status - customer_segment ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: orders columns: - name: amount meta: metrics: total_revenue: type: sum spotlight: filter_by: - status - region - order_date segment_by: - status - customer_segment ``` ```yaml Lightdash YAML theme={null} type: model name: orders dimensions: - name: amount metrics: total_revenue: type: sum sql: ${TABLE}.amount spotlight: filter_by: - status - region - order_date segment_by: - status - customer_segment ``` ### Set a default segment and filter for a metric While `segment_by` and `filter_by` control which dimensions are *available*, `default_segment` and `default_filter` control which are *pre-selected* when a metric is opened. Use them when a metric is almost always viewed the same way (e.g., revenue segmented by region, or active users filtered to a specific status), so users don't have to set it up themselves every time. ```yaml dbt v1.10+ theme={null} models: - name: orders columns: - name: amount config: meta: metrics: total_revenue: type: sum spotlight: segment_by: - status - customer_segment filter_by: - status - region default_segment: customer_segment default_filter: status: completed ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: orders columns: - name: amount meta: metrics: total_revenue: type: sum spotlight: segment_by: - status - customer_segment filter_by: - status - region default_segment: customer_segment default_filter: status: completed ``` ```yaml Lightdash YAML theme={null} type: model name: orders dimensions: - name: amount metrics: total_revenue: type: sum sql: ${TABLE}.amount spotlight: segment_by: - status - customer_segment filter_by: - status - region default_segment: customer_segment default_filter: status: completed ``` Now when someone opens the `total_revenue` metric in the Metrics Explorer, it's segmented by `customer_segment` and filtered to completed orders right away. `default_filter` uses the same syntax as [metric filters](/semantic-layer/metrics#available-filter-types), so you can express: ```yaml theme={null} default_filter: status: completed # is ``` ```yaml theme={null} default_filter: status: [completed, shipped] # is one of ``` ```yaml theme={null} default_filter: status: "!cancelled" # is not ``` * Defaults are just a starting point: users can change or remove them while exploring, and their choices always take precedence. The defaults re-apply the next time the metric is opened. * `default_segment` must be a segmentable dimension (string or boolean) and, if you've set a `segment_by` allowlist, must be one of those dimensions. * `default_filter` accepts a single dimension and, if you've set a `filter_by` allowlist, that dimension must be in it. Only the `is` and `is not` operators are supported. ### How it works * **Dimension-level (boolean, default `true`)**: Controls whether a dimension appears in dropdowns for all metrics in that model. * **Metric-level (array of dimension names)**: Creates an allowlist of dimensions for that specific metric. * **Metric-level allowlists override dimension-level settings**: If a dimension has `filter_by: false` but a metric includes it in its `filter_by` array, it will still be available for that metric. * **Defaults pre-select, allowlists restrict**: `default_segment` and `default_filter` choose the starting view, while `segment_by` and `filter_by` control what users can switch to. ### Use cases * Hide internal/technical dimensions that aren't useful for analysis. * Curate the exploration experience per metric (e.g., revenue metrics only filterable by business dimensions). * Land users on the most useful view by default (e.g., revenue is always segmented by region, active users are always filtered to `status: active`). * Reduce clutter in models with many dimensions. ## Configuring default time settings in .yml We recommend setting up default time fields to make it easier for your business users and save them time. To pre-select a time field in the explore view, simply define the default settings in your Lightdash `.yml` files. ### Set a table-level default time dimension 1. Create or modify your table configuration in the .yml file. For example, to set a default time dimension on the events table: ```yml dbt v1.10+ theme={null} models: - name: events columns: - name: event_date description: "Event date" config: meta: dimension: label: "Event date" type: date time_intervals: - DAY - name: event description: "Event" config: meta: dimension: type: string metrics: count: type: count ``` ```yml dbt v1.9 and earlier theme={null} models: - name: events columns: - name: event_date description: "Event date" meta: dimension: label: "Event date" type: date time_intervals: - DAY - name: event description: "Event" meta: dimension: type: string metrics: count: type: count ``` ```yml Lightdash YAML theme={null} type: model name: events dimensions: - name: event_date description: "Event date" label: "Event date" type: date time_intervals: - DAY - name: event description: "Event" type: string metrics: count: type: count sql: ${TABLE}.event ``` 2. Add the default time dimension at the table level: ```yaml dbt v1.10+ theme={null} models: - name: events config: meta: default_time_dimension: field: event_date interval: DAY columns: # ... your column definitions here ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: events meta: default_time_dimension: field: event_date interval: DAY columns: # ... your column definitions here ``` ```yaml Lightdash YAML theme={null} type: model name: events default_time_dimension: field: event_date interval: DAY dimensions: # ... your dimension definitions here ``` 3. [Compile your project](/integrations/dbt/projects) 4. Navigate to the metrics catalog 5. Open any metrics from the events table 6. All metrics with that default time set will be plotted against the `event date` with day granularity `in the last 30 days` ### Set a metric-level default time dimension This will override the time dimension defined on the table level. 1. Modify your existing table configuration to add a metric-level default time dimension: ```yaml dbt v1.10+ theme={null} models: - name: events config: meta: default_time_dimension: field: event_date interval: DAY columns: - name: event description: "Event" config: meta: metrics: count: type: count # This will override the table level default time dimension default_time_dimension: field: event_date interval: MONTH ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: events meta: default_time_dimension: field: event_date interval: DAY columns: - name: event description: "Event" meta: metrics: count: type: count # This will override the table level default time dimension default_time_dimension: field: event_date interval: MONTH ``` ```yaml Lightdash YAML theme={null} type: model name: events default_time_dimension: field: event_date interval: DAY dimensions: - name: event description: "Event" metrics: count: type: count sql: ${TABLE}.event # This will override the table level default time dimension default_time_dimension: field: event_date interval: MONTH ``` 2. [Compile your project](/integrations/dbt/projects) 3. Navigate to the metrics catalog 4. Explore the Events' count metric 5. The metric will be plotted against the `event date` with **month** granularity, instead of the default **day** granularity applied to the table ## FAQs **a. What time intervals are supported?** Currently, we only support: DAY, WEEK, MONTH, YEAR **b. What pre-filled filters are applied?** * Time grain Year -> past 3 years * Time grain Month -> past 12 months * Time grain Week -> past 12 weeks * Time grain Day -> past 30 days So if one of your business users explores a metric with a default time grain of DAY, metrics will be shown for the past 30 days with granularity of days with the default time dimension prefilled. **c. Which other metrics can I compare my selected metric by?** The "Compare to another metric" dropdown shows metrics **from the same table** as your selected metric that meet the following criteria: 1. **Metrics with defaults in `.yml`:** Metrics with a default time dimension specified in the `.yml` file will appear. 2. **Metrics with a single time dimension:** Metrics from tables with only one time dimension will appear as it's assumed to be the most relevant. **d. Why does the same metric appear more than once?** The catalog lists each metric once per table it's defined in, so a metric defined in several models shows as several rows, each with its own **Table**. The catalog doesn't merge metrics with the same name across tables. To cut the noise, [hide](#configuring-global-visibility-of-metrics) models your business users don't need, such as pre-aggregated daily or weekly tables, with `visibility: hide`. Where several versions should stay visible, such as one for finance and one for marketing, [assign each a category](#assigning-categories-to-metrics) so users can filter between them. **e. Can I add notes to a metric or mark it as verified?** The catalog shows a metric's `description` and has no separate notes field. Descriptions render as Markdown, so you can use headings to separate a short summary from technical notes. Metrics can't be verified: [verification](/explore/verified-content) applies to content such as charts and dashboards. To show business users who to ask about a metric, [assign an owner](#assigning-owners-to-metrics). **f. How can I be sure that my yml changes are correct?** If you use VSCode, you can use our Lightdash schema validation to check your yml files are correct. 1. Install this YAML extension for VSCode: [https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) 2. Open your user settings in JSON format and add the following: ```json theme={null} "[yaml]": { "editor.defaultFormatter": "redhat.vscode-yaml" }, "yaml.schemas": { "https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/common/src/schemas/json/lightdash-dbt-2.0.json": [ "*.yml", "/**/models/**/*.yml", "/**/models/**/*.yaml", "!lightdash.config.yml", "!dbt_project.yml" ], "https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/common/src/schemas/json/lightdash-project-config-1.0.json": [ "lightdash.config.yml" ] } ``` This will add schema validation to your model yml files and your lightdash.config.yml file. 3. Reload VSCode 4. You'll see a red squiggly line under any errors in your yml files as well as suggestions for how to fix them and what is allowed. ![A YAML file in VS Code with a red squiggle under an invalid key and a tooltip listing the allowed values](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/metrics-catalog/vscode-schema-validation-example.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=00c3f28e1d70c5ed59fd7460be646e0f) ## Roles and permissions | **Action** | **Project Admin** | **Project Developer** | **Project Editor** | **Project Interactive Viewer** | **Project Viewer** | | :- | :-: | :-: | :-: | :-: | :-: | | Browse the 'Metrics catalog' | | | | | | | Add/edit /delete 'Categories' | | | | | | | Open the 'Metrics Explorer' | | | | | | # Drivers Source: https://docs.lightdash.com/explore/metrics-catalog/drivers Declare which metrics feed into another and see those relationships in Saved Trees **Drivers** are metrics that directly influence or feed into another metric. By defining drivers in your `.yml` files, you can automatically visualize how metrics relate to each other in [Saved Trees](/explore/metrics-catalog/build-saved-trees) — no manual drawing needed. For example, `total_order_amount` is a driver of `total_revenue`, `average_order_size`, and `total_completed_order_amount` — because each of those metrics is influenced by the total order amount. On the canvas, this creates a tree where `total_order_amount` fans out to the metrics it drives. ### Defining drivers Add a `drivers` property to any metric listing the metrics that flow into it. You can reference metrics from the same table by name, or from other tables using the `table.metric` syntax: ```yaml dbt v1.10+ theme={null} models: - name: orders columns: - name: order_amount config: meta: metrics: total_revenue: type: sum drivers: - total_order_amount average_order_size: type: average drivers: - total_order_amount total_completed_order_amount: type: sum drivers: - total_order_amount ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: orders columns: - name: order_amount meta: metrics: total_revenue: type: sum drivers: - total_order_amount average_order_size: type: average drivers: - total_order_amount total_completed_order_amount: type: sum drivers: - total_order_amount ``` ```yaml Lightdash YAML theme={null} type: model name: orders dimensions: - name: order_amount metrics: total_revenue: type: sum sql: ${TABLE}.order_amount drivers: - total_order_amount average_order_size: type: average sql: ${TABLE}.order_amount drivers: - total_order_amount total_completed_order_amount: type: sum sql: ${TABLE}.order_amount drivers: - total_order_amount ``` This creates edges on the canvas pointing from each driver to the current metric (e.g., `total_order_amount` → `total_revenue`, `total_order_amount` → `average_order_size`, etc.). #### Cross-table drivers Drivers don't have to live in the same table as the metric they drive. Use the `table.metric` syntax to reference a metric from another table: ```yaml theme={null} metrics: conversion_rate: type: number sql: ${signups} / ${visits} drivers: - signups # same-table metric - marketing.ad_spend # cross-table: 'table.metric_name' ``` ### How drivers appear on the canvas * **Automatic**: Driver edges appear as soon as both the driver and target metrics are on the canvas. * **Read-only**: You cannot delete or modify driver edges from the UI — they are managed through your `.yml` configuration. In Saved Trees, driver edges are displayed alongside manually-created edges, giving you a complete picture of both the relationships you've drawn and the ones defined in your data model. While editing a Saved Tree, click **Add drivers from YAML** on a metric to add its missing driver metrics to the canvas. Their driver edges appear automatically. Driver edges cannot be removed from a Saved Tree. If you don't want a driver edge to appear, remove one of its endpoint nodes from the canvas. # Period-over-period comparisons Source: https://docs.lightdash.com/explore/period-over-period Compare a metric against its previous period, and the ways Lightdash can calculate the shift ## Period comparison Add a period comparison to a metric to plot it against a previous period. You can customize the comparison's series type, label, value labels, and more. To add a period comparison: 1. Select a time/date dimension 2. Select a metric 3. On the results table, click on a metric's column and select **Add period comparison** 4. Choose the time dimension and offset, then hit save 5. Add the generated metric to your chart Lightdash queries the prior period separately from your results, so a date filter on the comparison's time dimension limits which rows you see, not the prior-period values they're compared with. The exception is an [`in all periods to date`](/explore/filters-reference#date-filters) filter, which also applies to the prior period: with a month comparison on the 15th, days 1–15 of this month are compared with days 1–15 of last month. Other date filters compare against the whole prior period. The offset counts periods of the time dimension's granularity (day, week, month, quarter, or year) and stays fixed. It doesn't follow the length of a dashboard date filter: a comparison with a 14-day offset still looks back 14 days when a viewer switches the filter to the last 28 days. To compare against a prior period that matches whatever range the viewer picks, use a [custom date range parameter](#custom-date-range-example). Comparison metrics are left blank in the table's totals row. To show the comparison on a **Big Value** chart, select the base metric, turn on **Show comparison**, set **Compare to** to **Same row**, and pick the generated metric as the **Field**. This works even when your query returns a single row, unlike **Previous row**, which needs at least two. > [!TIP] > > You can also ask an [AI agent](/agents/use-ai-agents#period-over-period-comparisons) for comparisons in natural language — for example, *"compare revenue to last month"* or *"year-over-year orders by week"*. Watch a walkthrough of the new period comparison experience: [https://www.loom.com/embed/e6d1a0442f6442ac8a5f0343d35b73d7](https://www.loom.com/embed/e6d1a0442f6442ac8a5f0343d35b73d7) *** Period-over-period analysis is one of the most common ways to evaluate how metrics change over time. Whether you're looking at **month-over-month growth**, **year-over-year comparisons**, or **week-over-week performance**, Lightdash makes it easy to build these analyses directly in your dashboards. This guide walks through several examples of how to build period-over-period comparisons manually using chart types, table calculations, and parameters. You can also watch the manual walkthrough video below if you'd prefer a visual demo. [https://www.loom.com/embed/be15f8023f754123a177aa1f928477e6?t=116](https://www.loom.com/embed/be15f8023f754123a177aa1f928477e6?t=116) *** ## Big Value Charts: Simple Comparisons The fastest way to get started is with the **Big Value** chart type. ### Month-over-month * Pull two months of data. * Use the Big Value chart and select **Compare to previous row** * Lightdash automatically shows the comparison. That's it! ### Same month, previous Year * Pull \~13 months of data with `MONTH` and `MONTH_NUM` time dimensions and your metric. * Create a table calculation to filter only the current month and the same month last year: ```sql theme={null} (extract(month from current_date) - 1) = ${tracks.timestamp_month_num} ``` *This table calculation relies on the `MONTH_NUM` [time interval](/semantic-layer/dimensions#numeric-options).* * Filter where the value of this table calculation is `true`. * Then use the Big Value chart with **Compare to previous row** ## Trend line comparisons Sometimes you need more than a single value—you want to see how trends evolve. ### By week of year * Add **week of year** [time dimension](/semantic-layer/dimensions#numeric-options) (1-52) on the X-axis. * Plot the metric (e.g. `event_count`). * Group by **year**. * This allows you to compare trends across years. Check minute 1:45 in the Loom video for an example. Bonus: if you want a more business-user-friendly version you can use the table calculation below to add descriptions for each week number to get a chart like this. ![A chart comparing years, with one line per year plotted against week of year and the x-axis labelled with week descriptions rather than numbers](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/period-over-period/period-over-period-week-of-year.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=9f05b8e97770051dc2f6b1fe2399c686) > [accordion] Table calculation for week of year descriptions > > ```sql theme={null} > case ${dbt_orders.order_date_week_num} > when 0 then '0: late Dec/early Jan' > when 1 then '1: early Jan' > when 2 then '2: early/mid Jan' > when 3 then '3: mid Jan' > when 4 then '4: late Jan/early Feb' > > when 5 then '5: early Feb' > when 6 then '6: early/mid Feb' > when 7 then '7: mid/late Feb' > when 8 then '8: late Feb/early Mar' > > when 9 then '9: early Mar' > when 10 then '10: early/mid Mar' > when 11 then '11: mid Mar' > when 12 then '12: mid/late Mar' > when 13 then '13: late Mar/early Apr' > > when 14 then '14: early Apr' > when 15 then '15: early/mid Apr' > when 16 then '16: mid Apr' > when 17 then '17: late Apr/early May' > > when 18 then '18: early May' > when 19 then '19: early/mid May' > when 20 then '20: mid May' > when 21 then '21: mid/late May' > when 22 then '22: late May/early Jun' > > when 23 then '23: early Jun' > when 24 then '24: early/mid Jun' > when 25 then '25: mid Jun' > when 26 then '26: late Jun/early Jul' > > when 27 then '27: early Jul' > when 28 then '28: early/mid Jul' > when 29 then '29: mid Jul' > when 30 then '30: late Jul/early Aug' > > when 31 then '31: early Aug' > when 32 then '32: early/mid Aug' > when 33 then '33: mid Aug' > when 34 then '34: mid/late Aug' > when 35 then '35: late Aug/early Sep' > > when 36 then '36: early Sep' > when 37 then '37: early/mid Sep' > when 38 then '38: mid Sep' > when 39 then '39: late Sep/early Oct' > > when 40 then '40: early Oct' > when 41 then '41: early/mid Oct' > when 42 then '42: mid Oct' > when 43 then '43: late Oct/early Nov' > > when 44 then '44: early Nov' > when 45 then '45: early/mid Nov' > when 46 then '46: mid Nov' > when 47 then '47: mid/late Nov' > when 48 then '48: late Nov/early Dec' > > when 49 then '49: early Dec' > when 50 then '50: early/mid Dec' > when 51 then '51: mid Dec' > when 52 then '52: late Dec' > when 53 then '53: late Dec/early Jan' > end > > ``` ### By day of month with running totals * Compare June vs July (or any two months). * Use **day of month** [time dimension](/semantic-layer/dimensions#numeric-options) (1-31) on the X-axis, grouped by month. * Add a running total table calculation. * Optionally, use bars in the background to show cumulative progress. Check minute 2:30 in the Loom video for an example. ## Compare arbitrary weeks You can also compare arbitrary weeks side by side. * Select specific weeks (e.g. 2, 8, 12). * Use **week of year** as the grouping dimension. * Apply a running total to see how each week accumulates. * This shows how different weeks trend across the same range. Check minute 3:00 in the Loom video for an example. ## Year-over-year by month For a full year-over-year comparison across months: 1. Pull two years worth of monthly data. 2. Add a [formula table calculation](/explore/table-calculations/formulas) that uses the [`LAG` window function](/explore/table-calculations/formulas#window) to pull the same month last year, offset by 12 rows: `=LAG(event_count, 12)`. 3. Add a second formula for the percent change, following the [period-over-period growth pattern](/explore/table-calculations/formulas#examples): `=(event_count - LAG(event_count, 12)) / LAG(event_count, 12) * 100`. 4. Filter out rows where the previous year's value is `null`. Table calculations only see the rows in your results, so a date filter that cuts the query to the last 12 months leaves `LAG` nothing to look back to. Keep both years in the query, or use a [period comparison](#period-comparison), which queries the prior period separately. Check minute 3:45 in the Loom video for an example. ## Using parameters for period-over-period analysis Parameters let you create dynamic period-over-period comparisons in your charts and dashboards. Users can easily toggle between different date ranges to see how metrics are tracking over time — no need to rebuild charts or manually adjust filters. For more on working with parameters, check out our [parameters reference guide](/semantic-layer/parameters). This guide walks through an example of how to do period-over-period analysis in Lightdash using parameters, alternatively you can watch our demo tutorial below. [https://www.loom.com/embed/048e5b84f44e495dba6a3664e98ff037](https://www.loom.com/embed/048e5b84f44e495dba6a3664e98ff037) Say you want users to select a time period like yesterday, last 7 days, or last 30 days, and then compare the current period to both the previous period and the same period a year ago. To do this, you: **1. Set up your date range / period parameter** #### Date range period parameter syntax ```yaml dbt v1.9 and earlier theme={null} models: - name: dbt_orders description: 'This table contains information on all the confirmed orders and their status' meta: parameters: date_range: label: "Date Range" description: "Choose a date range" options: - "yesterday" - "last 7 days" - "last 30 days" default: "last 7 days" ``` ```yaml dbt v1.10+ and Fusion theme={null} models: - name: dbt_orders description: 'This table contains information on all the confirmed orders and their status' config: meta: parameters: date_range: label: "Date Range" description: "Choose a date range" options: - "yesterday" - "last 7 days" - "last 30 days" default: "last 7 days" ``` ```yaml Lightdash YAML theme={null} type: model name: dbt_orders description: 'This table contains information on all the confirmed orders and their status' parameters: date_range: label: "Date Range" description: "Choose a date range" options: - "yesterday" - "last 7 days" - "last 30 days" default: "last 7 days" ``` You can also take a look at the `Date Range` parameter setup in our demo dbt project [here](https://github.com/lightdash/lightdash-demo-data-gardening/blob/06ec6e4a87286ec7504d20b10f4b919bd267ebae/dbt-bigquery/models/dbt_orders.yml#L15-L22). **2. Create a dimension to categorize date periods** Next, you need to create an additional dimension inside the `dbt_orders` model that calculates the period selected in the `date_range` parameter using conditional case statements. #### Additional dimension syntax ```yaml dbt v1.9 and earlier theme={null} models: - name: dbt_orders description: 'This table contains information on all the confirmed orders and their status' meta: parameters: date_range: label: "Date Range" description: "Choose a date range" options: - "yesterday" - "last 7 days" - "last 30 days" default: "last 7 days" label: Orders columns: - name: order_date description: 'Timestamp of order placement by user.' meta: dimension: time_intervals: [ 'HOUR', 'MINUTE_OF_HOUR_NUM', 'HOUR_OF_DAY_NUM', 'DAY', 'DAY_OF_WEEK_INDEX', 'DAY_OF_MONTH_NUM', 'DAY_OF_YEAR_NUM', 'DAY_OF_WEEK_NAME', 'WEEK', 'WEEK_NUM', 'MONTH', 'MONTH_NUM', 'MONTH_NAME', 'QUARTER', 'QUARTER_NUM', 'QUARTER_NAME', 'YEAR' ] type: timestamp additional_dimensions: order_date_period: description: Date period (current period or previous period or previous year or out of range) chosen by the date_range parameter type: string sql: > case -- current period when ( (${lightdash.parameters.dbt_orders.date_range} = 'yesterday' and date(${order_date}) = date_sub(current_date(), interval 1 day)) or (${lightdash.parameters.dbt_orders.date_range} = 'last 7 days' and date(${order_date}) between date_sub(current_date(), interval 7 day) and date_sub(current_date(), interval 1 day)) or (${lightdash.parameters.dbt_orders.date_range} = 'last 30 days' and date(${order_date}) between date_sub(current_date(), interval 30 day) and date_sub(current_date(), interval 1 day)) ) then 'current period' -- previous period when ( (${lightdash.parameters.dbt_orders.date_range} = 'yesterday' and date(${order_date}) = date_sub(current_date(), interval 2 day)) or (${lightdash.parameters.dbt_orders.date_range} = 'last 7 days' and date(${order_date}) between date_sub(current_date(), interval 14 day) and date_sub(current_date(), interval 8 day)) or (${lightdash.parameters.dbt_orders.date_range} = 'last 30 days' and date(${order_date}) between date_sub(current_date(), interval 60 day) and date_sub(current_date(), interval 31 day)) ) then 'previous period' -- previous year when ( (${lightdash.parameters.dbt_orders.date_range} = 'yesterday' and date(${order_date}) = date_sub(date_sub(current_date(), interval 1 year), interval 1 day)) or (${lightdash.parameters.dbt_orders.date_range} = 'last 7 days' and date(${order_date}) between date_sub(date_sub(current_date(), interval 1 year), interval 7 day) and date_sub(date_sub(current_date(), interval 1 year), interval 1 day)) or (${lightdash.parameters.dbt_orders.date_range} = 'last 30 days' and date(${order_date}) between date_sub(date_sub(current_date(), interval 1 year), interval 30 day) and date_sub(date_sub(current_date(), interval 1 year), interval 1 day)) ) then 'previous year' else 'out of range' end ``` ```yaml dbt v1.10+ and Fusion theme={null} models: - name: dbt_orders description: 'This table contains information on all the confirmed orders and their status' config: meta: parameters: date_range: label: "Date Range" description: "Choose a date range" options: - "yesterday" - "last 7 days" - "last 30 days" default: "last 7 days" label: Orders columns: - name: order_date description: 'Timestamp of order placement by user.' config: meta: dimension: time_intervals: [ 'HOUR', 'MINUTE_OF_HOUR_NUM', 'HOUR_OF_DAY_NUM', 'DAY', 'DAY_OF_WEEK_INDEX', 'DAY_OF_MONTH_NUM', 'DAY_OF_YEAR_NUM', 'DAY_OF_WEEK_NAME', 'WEEK', 'WEEK_NUM', 'MONTH', 'MONTH_NUM', 'MONTH_NAME', 'QUARTER', 'QUARTER_NUM', 'QUARTER_NAME', 'YEAR' ] type: timestamp additional_dimensions: order_date_period: description: Date period (current period or previous period or previous year or out of range) chosen by the date_range parameter type: string sql: > case -- current period when ( (${lightdash.parameters.dbt_orders.date_range} = 'yesterday' and date(${order_date}) = date_sub(current_date(), interval 1 day)) or (${lightdash.parameters.dbt_orders.date_range} = 'last 7 days' and date(${order_date}) between date_sub(current_date(), interval 7 day) and date_sub(current_date(), interval 1 day)) or (${lightdash.parameters.dbt_orders.date_range} = 'last 30 days' and date(${order_date}) between date_sub(current_date(), interval 30 day) and date_sub(current_date(), interval 1 day)) ) then 'current period' -- previous period when ( (${lightdash.parameters.dbt_orders.date_range} = 'yesterday' and date(${order_date}) = date_sub(current_date(), interval 2 day)) or (${lightdash.parameters.dbt_orders.date_range} = 'last 7 days' and date(${order_date}) between date_sub(current_date(), interval 14 day) and date_sub(current_date(), interval 8 day)) or (${lightdash.parameters.dbt_orders.date_range} = 'last 30 days' and date(${order_date}) between date_sub(current_date(), interval 60 day) and date_sub(current_date(), interval 31 day)) ) then 'previous period' -- previous year when ( (${lightdash.parameters.dbt_orders.date_range} = 'yesterday' and date(${order_date}) = date_sub(date_sub(current_date(), interval 1 year), interval 1 day)) or (${lightdash.parameters.dbt_orders.date_range} = 'last 7 days' and date(${order_date}) between date_sub(date_sub(current_date(), interval 1 year), interval 7 day) and date_sub(date_sub(current_date(), interval 1 year), interval 1 day)) or (${lightdash.parameters.dbt_orders.date_range} = 'last 30 days' and date(${order_date}) between date_sub(date_sub(current_date(), interval 1 year), interval 30 day) and date_sub(date_sub(current_date(), interval 1 year), interval 1 day)) ) then 'previous year' else 'out of range' end ``` ```yaml Lightdash YAML theme={null} type: model name: dbt_orders description: 'This table contains information on all the confirmed orders and their status' label: Orders parameters: date_range: label: "Date Range" description: "Choose a date range" options: - "yesterday" - "last 7 days" - "last 30 days" default: "last 7 days" dimensions: - name: order_date description: 'Timestamp of order placement by user.' type: timestamp time_intervals: [ 'HOUR', 'MINUTE_OF_HOUR_NUM', 'HOUR_OF_DAY_NUM', 'DAY', 'DAY_OF_WEEK_INDEX', 'DAY_OF_MONTH_NUM', 'DAY_OF_YEAR_NUM', 'DAY_OF_WEEK_NAME', 'WEEK', 'WEEK_NUM', 'MONTH', 'MONTH_NUM', 'MONTH_NAME', 'QUARTER', 'QUARTER_NUM', 'QUARTER_NAME', 'YEAR' ] additional_dimensions: order_date_period: description: Date period (current period or previous period or previous year or out of range) chosen by the date_range parameter type: string sql: > case -- current period when ( (${lightdash.parameters.dbt_orders.date_range} = 'yesterday' and date(${order_date}) = date_sub(current_date(), interval 1 day)) or (${lightdash.parameters.dbt_orders.date_range} = 'last 7 days' and date(${order_date}) between date_sub(current_date(), interval 7 day) and date_sub(current_date(), interval 1 day)) or (${lightdash.parameters.dbt_orders.date_range} = 'last 30 days' and date(${order_date}) between date_sub(current_date(), interval 30 day) and date_sub(current_date(), interval 1 day)) ) then 'current period' -- previous period when ( (${lightdash.parameters.dbt_orders.date_range} = 'yesterday' and date(${order_date}) = date_sub(current_date(), interval 2 day)) or (${lightdash.parameters.dbt_orders.date_range} = 'last 7 days' and date(${order_date}) between date_sub(current_date(), interval 14 day) and date_sub(current_date(), interval 8 day)) or (${lightdash.parameters.dbt_orders.date_range} = 'last 30 days' and date(${order_date}) between date_sub(current_date(), interval 60 day) and date_sub(current_date(), interval 31 day)) ) then 'previous period' -- previous year when ( (${lightdash.parameters.dbt_orders.date_range} = 'yesterday' and date(${order_date}) = date_sub(date_sub(current_date(), interval 1 year), interval 1 day)) or (${lightdash.parameters.dbt_orders.date_range} = 'last 7 days' and date(${order_date}) between date_sub(date_sub(current_date(), interval 1 year), interval 7 day) and date_sub(date_sub(current_date(), interval 1 year), interval 1 day)) or (${lightdash.parameters.dbt_orders.date_range} = 'last 30 days' and date(${order_date}) between date_sub(date_sub(current_date(), interval 1 year), interval 30 day) and date_sub(date_sub(current_date(), interval 1 year), interval 1 day)) ) then 'previous year' else 'out of range' end ``` You can also take a look at the `order_date_period` dimension setup in our demo dbt project [here](https://github.com/lightdash/lightdash-demo-data-gardening/blob/06ec6e4a87286ec7504d20b10f4b919bd267ebae/dbt-bigquery/models/dbt_orders.yml#L57-L87). **3. Build your chart with the period dimension** To create a chart that uses your period parameter, you would need to: * select the `Order date period` additional dimension and the `Order count` metric * specify that `order_date_period` is not `out of range` * you can optionally filter out other date range groups e.g. you might want to filter out `previous year` if you want to create a big value chart that compares current period to previous period. ![A chart of order count grouped by the Order date period dimension, with the out of range group filtered out so only the current and previous periods show](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/period-over-period/period-over-period-example.jpg?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=dcc59697e4f3a66f34bd5cd9ffb72210) **4. Add your chart to a dashboard** You can then add this chart to a dashboard. Users can select an option from the `Date Range` parameter and the charts will automatically update to display the selected period. ### Custom date range example Similar to above, you can also set up a custom date range parameter that allows users to select specific start and end dates for their analysis. Below is the code needed for the parameter and the additional dimension to categorize the date periods for a custom date range: #### Custom date range parameter configuration ```yaml dbt v1.10+ theme={null} models: - name: dbt_orders config: meta: parameters: custom_range_start: label: "Start of custom date range" description: "The start of the custom date range" type: date custom_range_end: label: "End of custom date range" description: "The end of the custom date range" type: date ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: dbt_orders meta: parameters: custom_range_start: label: "Start of custom date range" description: "The start of the custom date range" type: date custom_range_end: label: "End of custom date range" description: "The end of the custom date range" type: date ``` ```yaml Lightdash YAML theme={null} type: model name: dbt_orders parameters: custom_range_start: label: "Start of custom date range" description: "The start of the custom date range" type: date custom_range_end: label: "End of custom date range" description: "The end of the custom date range" type: date ``` #### Custom date range additional dimension code ```yaml dbt v1.10+ theme={null} columns: - name: order_date description: 'Date of order placement by user.' config: meta: dimension: type: date additional_dimensions: order_date_custom_period: description: Date period bucket based on custom Start date and End date parameters type: string sql: | case --invalid date range when ${lightdash.parameters.dbt_orders.custom_range_start} is null or ${lightdash.parameters.dbt_orders.custom_range_end} is null or ${lightdash.parameters.dbt_orders.custom_range_start} > ${lightdash.parameters.dbt_orders.custom_range_end} then 'invalid date range' --current period when ${order_date_day} >= ${lightdash.parameters.dbt_orders.custom_range_start} and ${order_date_day} <= ${lightdash.parameters.dbt_orders.custom_range_end} then 'current period' --previous period when ${order_date_day} between date_sub( ${lightdash.parameters.dbt_orders.custom_range_start}, interval (date_diff( ${lightdash.parameters.dbt_orders.custom_range_end}, ${lightdash.parameters.dbt_orders.custom_range_start}, day ) + 1) day ) and date_sub( ${lightdash.parameters.dbt_orders.custom_range_end}, interval (date_diff( ${lightdash.parameters.dbt_orders.custom_range_end}, ${lightdash.parameters.dbt_orders.custom_range_start}, day ) + 1) day ) then 'previous period' --previous year when date(${order_date_day}) between date_sub(${lightdash.parameters.dbt_orders.custom_range_start}, interval 1 year) and date_sub(${lightdash.parameters.dbt_orders.custom_range_end}, interval 1 year) then 'previous year' else 'out of range' end ``` ```yaml dbt v1.9 and earlier theme={null} columns: - name: order_date description: 'Date of order placement by user.' meta: dimension: type: date additional_dimensions: order_date_custom_period: description: Date period bucket based on custom Start date and End date parameters type: string sql: | case --invalid date range when ${lightdash.parameters.dbt_orders.custom_range_start} is null or ${lightdash.parameters.dbt_orders.custom_range_end} is null or ${lightdash.parameters.dbt_orders.custom_range_start} > ${lightdash.parameters.dbt_orders.custom_range_end} then 'invalid date range' --current period when ${order_date_day} >= ${lightdash.parameters.dbt_orders.custom_range_start} and ${order_date_day} <= ${lightdash.parameters.dbt_orders.custom_range_end} then 'current period' --previous period when ${order_date_day} between date_sub( ${lightdash.parameters.dbt_orders.custom_range_start}, interval (date_diff( ${lightdash.parameters.dbt_orders.custom_range_end}, ${lightdash.parameters.dbt_orders.custom_range_start}, day ) + 1) day ) and date_sub( ${lightdash.parameters.dbt_orders.custom_range_end}, interval (date_diff( ${lightdash.parameters.dbt_orders.custom_range_end}, ${lightdash.parameters.dbt_orders.custom_range_start}, day ) + 1) day ) then 'previous period' --previous year when date(${order_date_day}) between date_sub(${lightdash.parameters.dbt_orders.custom_range_start}, interval 1 year) and date_sub(${lightdash.parameters.dbt_orders.custom_range_end}, interval 1 year) then 'previous year' else 'out of range' end ``` ```yaml Lightdash YAML theme={null} dimensions: - name: order_date description: 'Date of order placement by user.' type: date additional_dimensions: order_date_custom_period: description: Date period bucket based on custom Start date and End date parameters type: string sql: | case --invalid date range when ${lightdash.parameters.dbt_orders.custom_range_start} is null or ${lightdash.parameters.dbt_orders.custom_range_end} is null or ${lightdash.parameters.dbt_orders.custom_range_start} > ${lightdash.parameters.dbt_orders.custom_range_end} then 'invalid date range' --current period when ${order_date_day} >= ${lightdash.parameters.dbt_orders.custom_range_start} and ${order_date_day} <= ${lightdash.parameters.dbt_orders.custom_range_end} then 'current period' --previous period when ${order_date_day} between date_sub( ${lightdash.parameters.dbt_orders.custom_range_start}, interval (date_diff( ${lightdash.parameters.dbt_orders.custom_range_end}, ${lightdash.parameters.dbt_orders.custom_range_start}, day ) + 1) day ) and date_sub( ${lightdash.parameters.dbt_orders.custom_range_end}, interval (date_diff( ${lightdash.parameters.dbt_orders.custom_range_end}, ${lightdash.parameters.dbt_orders.custom_range_start}, day ) + 1) day ) then 'previous period' --previous year when date(${order_date_day}) between date_sub(${lightdash.parameters.dbt_orders.custom_range_start}, interval 1 year) and date_sub(${lightdash.parameters.dbt_orders.custom_range_end}, interval 1 year) then 'previous year' else 'out of range' end ``` The code examples above will give you the following parameter options in the Lightdash UI that will output the custom period labels shown in the chart: ![The parameter picker in the Lightdash UI listing the custom date range options, with the chart beside it labelled with those period names](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/period-over-period/custom_range_pop.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=51d70e4778add2e467c925440f407cb9) # How to promote content Source: https://docs.lightdash.com/explore/promote-content Copy charts and dashboards from a development or preview project into production ## How promoting works If you are promoting a chart, from a `development` project to a `production` project, this will happen: * If the chart exists in both the `development` project and the `production` project, the chart in `production` will be updated with the changes from `development`. You can always revert this chart to a previous version using [version history](/explore/version-history). Lightdash matches charts based on the name used when you first created them. Even if you change the names later, the two charts will still be linked. * If the chart is new, we will replicate the `development` chart into the `production` project. We will also create a new space if a space does not exist with the same name. ## Configure upstream project Before you can start promoting content, you need to configure your upstream project. To do this, on your `development` project go to settings > Data ops. Select the project where you want to copy the content to. ![The Data ops tab of the development project's settings, with a picker for the upstream project to promote content into](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/promote-content/promote-select-project-e07e66d0992c66cd8a80aa622806b523.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=54bc66113aa7758b1864e7d75ee5b8db) ## Promote charts **You must be a `developer` and have access to the chart and space in both the `development project` and the `upstream project`.** If the chart is in a space that doesn't exist in the `upstream project`, then this space will be created with the same user access and the content will be put in this space. If the chart is in a space that exists in the `upstream project`, the access to this space will not be updated. You can promote charts from the `chart` in view mode or from any listing (like home page or all charts), click on the `...` button and then select `promote chart`. ![A chart in view mode with its three-dot menu open and Promote chart in the list](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/promote-content/promote-view-chart-ff272b8342757176cf677682227d3918.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=31329d21e3b7bd06d8f8dc4bcc45e8a1) ![A chart row in a listing page with its three-dot menu open and Promote chart in the list](https://mintcdn.com/lightdash/y8j5qvbhHoP381ni/images/explore/promote-content/promote-list-chart-a7c351011bd6338d9b830465d69d133e.png?fit=max\&auto=format\&n=y8j5qvbhHoP381ni\&q=85\&s=b5f7b01e961435a02550d3e21b99c3a2) Once the chart is promoted, you can click on the `success` banner to open a new tab into this chart in the `production project` ## Promote dashboards **You must be a `developer` and have access to the dashboard and space in both the `development project` and the `upstream project` as well as have access to all the charts in the dashboard.** If the dashboard is in a space that doesn't exist in the `upstream project`, then this space will be created with the same user access and the content will be put in this space. If the dashboard is in a space that exists in the `upstream project`, the access to this space will not be updated. You can promote dashboards from the `dashboard` in view mode or from any listing (like home page or all dashboards), click on the `...` button and then select `promote dashboard`. This will promote the dashboard to the `upstream` project as well as all the charts in this dashboard (for both charts within spaces and charts within this dashboard), any embedded [data app](/data-apps) tiles, and all other non-chart tiles like markdown. If the dashboard, charts or data apps are in a space that doesn't exist in the upstream project, then these spaces will be created and the content will be put in these spaces. ![A dashboard in view mode with its three-dot menu open and Promote dashboard in the list](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/promote-content/promote-view-dashboard-44e664c3f7633a87b468d99911290f11.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=590e598fd6fa39fd5c88b02565ba9333) ![A dashboard row in a listing page with its three-dot menu open and Promote dashboard in the list](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/promote-content/promote-list-dashboard-6b6b69ab8ca0bae35b47307d316ecb36.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=8be61594b8d0431d6248ce1469f66ff5) Once the dashboard is promoted, you can click on the `success` banner to open a new tab into this dashboard in the `production project`. ## Promote data apps You can also promote data apps from a preview project into their upstream project. See [Promoting an app](/data-apps#promoting-an-app) in the data apps guide for details. # Review requests Source: https://docs.lightdash.com/explore/review-requests Submit charts and dashboards from your personal space for review, promotion, and verification > [!NOTE] > > Review requests are available on all paid plans. On self-hosted deployments you'll need version 2.209.0 or later. The feature builds on [default user spaces](/explore/default-user-spaces), so make sure those are enabled for the project first. ![Reviewer decision view showing a pending review request with the Verify on approve option and Approve and move / Reject buttons](https://mintcdn.com/lightdash/WLXBk-kxTAbWGYvv/images/explore/review-requests/reviewer-decision.png?fit=max\&auto=format\&n=WLXBk-kxTAbWGYvv\&q=85\&s=d68ed32895921d1da3ea34f87f626033) Review requests give people who build in their [personal space](/explore/default-user-spaces) a built-in path to share their work. Instead of DMing someone with edit access or circulating links to personal-space content, a user submits their chart or dashboard for review. A reviewer checks it, and on approval the content moves into a shared space — optionally picking up a [verified badge](/explore/verified-content) at the same time. This closes the loop on personal spaces: create → request review → approve → promote and verify. ## Set up review requests There is no switch to flip. Once [default user spaces](/explore/default-user-spaces) are enabled for a project, everyone with a personal space can request a review, and requests go to whoever can edit the target space. Project admins decide who reviews and where new requests are announced under **Project settings** → **Review requests**. The same panel opens from **Review settings** on the Review requests page. ![Review requests panel in project settings, with a reviewer group selected, the Verify content when approving switch on, and an empty Slack channel field](https://mintcdn.com/lightdash/LgfjWBBqFvN2ZoSe/images/explore/review-requests/review-settings.png?fit=max\&auto=format\&n=LgfjWBBqFvN2ZoSe\&q=85\&s=484693e7fb9f70aa920a0b62843434e1) 1. **Choose who reviews requests.** Pick **Editors of the target space** to route each request to the editors and admins of the space it's going to, or pick an [organization group](/workspace-admin/manage-groups) to send every request to the same people regardless of target space. The group needs access to the project, and its members still need edit access to the target space, since approval moves content into it. 2. **Set the default for verification.** With **Verify content when approving** on, the **Verify on approve** box is ticked on every request. Reviewers can untick it for individual requests. 3. **Pick a Slack channel for new requests.** New requests post to this channel. Leave it empty to use the organization's notification channel from the [Slack integration](/integrations/slack#select-a-notification-channel). Approvals and rejections go to the requester as a Slack direct message. This field only appears once Slack is connected. 4. **Save**, then use **Open the review queue** to see requests as they arrive. Reviewers and requesters are also notified in Lightdash and by email, so Slack is optional. ## Requesting a review Anyone with content in their personal space can request a review: 1. Open the chart or dashboard in your personal space 2. Choose **Request review** from the **...** menu (also available from the content's row in listings) 3. Pick the shared space the content should move into. The target must be a shared space in the same project, and you need at least view access to it. 4. Add a note for reviewers — what it shows, and who it's for 5. Submit the request ![Request review modal with a searchable select of target shared spaces](https://mintcdn.com/lightdash/WLXBk-kxTAbWGYvv/images/explore/review-requests/request-modal.png?fit=max\&auto=format\&n=WLXBk-kxTAbWGYvv\&q=85\&s=9f05f257a8a0713d3ec91ef09f64318c) Each chart or dashboard can have one pending request at a time. While a request is pending, the content shows a **Review pending** badge, and you can cancel the request yourself and resubmit later. ![Review pending badge on a chart, with a popover explaining the chart moves to the shared space once a reviewer approves](https://mintcdn.com/lightdash/WLXBk-kxTAbWGYvv/images/explore/review-requests/review-pending.png?fit=max\&auto=format\&n=WLXBk-kxTAbWGYvv\&q=85\&s=81263057422dd73d1ec3fe4b8bb7924f) Submitting a dashboard brings the personal-space charts its tiles use along with it — they move together on approval, and charts saved inside the dashboard follow it automatically. ### Similar content is flagged before you submit When you pick a target space, Lightdash checks whether similar content already exists in the project's shared spaces and shows you the matches — verified matches first — before you submit. If the dashboard that answers your question already exists, you'll find it here instead of shipping a duplicate. Reviewers see the same matches next to the request, so duplicates get caught even if the requester submits anyway. ![Similar charts found nudge inside the request review modal, listing existing content that may already answer the same question](https://mintcdn.com/lightdash/WLXBk-kxTAbWGYvv/images/explore/review-requests/similar-content.png?fit=max\&auto=format\&n=WLXBk-kxTAbWGYvv\&q=85\&s=63619f067af1da3f515765981d985c6d) ## Reviewing a request Reviewers find pending requests under **Browse** → **Review requests**, and get notified when a new request comes in — in Lightdash, by email, and in Slack if your organization has the [Slack integration](/integrations/slack) set up. Only the reviewers chosen in [Review settings](#set-up-review-requests) are notified, and the requester is never one of them. ![Review requests page listing pending and decided requests with their requester, target space, and status](https://mintcdn.com/lightdash/WLXBk-kxTAbWGYvv/images/explore/review-requests/review-queue.png?fit=max\&auto=format\&n=WLXBk-kxTAbWGYvv\&q=85\&s=bf2ab87f2c7b3b1f7a863f35be17b4f0) Reviewers get temporary access to the content while the request is pending, so they can open the chart, check the numbers and the name, and then decide: * **Approve and move** moves the content into the target space, where everyone with access to that space can find it. Tick **Verify on approve** to add the verified badge as part of the same step — it ranks the content first for Ask AI and search, exactly as if you'd verified it by hand. * **Reject** keeps the content in the requester's personal space. The requester sees your note and can ask again after making changes. Every request keeps its history — who asked, who decided, and when — so there's an audit trail for how content became shared or verified. ## Review requests and verified content ![An approved review request showing the audit trail, with the content moved to the shared space and marked Verified](https://mintcdn.com/lightdash/WLXBk-kxTAbWGYvv/images/explore/review-requests/approved-request.png?fit=max\&auto=format\&n=WLXBk-kxTAbWGYvv\&q=85\&s=ecc449febc8016f41c431c5c63cebdbf) **Verify on approve** is the bridge between review requests and [verified content](/explore/verified-content). Teams that use verification as their trust signal can make review the only road to it: users build freely in their personal spaces, and everything that reaches shared spaces has been looked at — and badged — by a reviewer. To keep verified content locked down after promotion, pair this with the **Edit or delete verified charts and dashboards** (`manage:VerifiedContent`) scope on [custom roles](/workspace-admin/custom-roles), so promoted-and-verified content can't be edited by the general editor population. # Search Source: https://docs.lightdash.com/explore/search Find charts, dashboards, spaces, tables, and fields anywhere in your project Search matches content from everywhere in your project: dashboards, charts, spaces, tables, and fields by name and description, plus settings pages. Click the search bar at the top of your screen, or press `Cmd + K` (Mac) or `Ctrl + K` (Windows, Linux), to open it. ![Opening the search bar and typing a query](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/search/search-bar-199ebd366ff2bc7d0d209a3f85327786.gif?s=60f25e2a85b677ddf1a8a42719a6b868) ## Search filters Filters in the search bar narrow results without leaving it. Specify a content type, or narrow by date — either a range ("from: January 10, 2024, to: January 20, 2024") or a single date ("from: January 10, 2024"). You can also filter by the creator of the content, which makes it easy to find items made by a specific teammate, or by verified status to see only [verified content](/explore/verified-content). Results are ranked so the trustworthy answer comes first: exact name matches and verified charts and dashboards appear at the top of the list. ![Applying content type and date filters in the search bar](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/search/search-filters-95f2b5220c54f6df58c24d0c44870426.gif?s=b89a51b5437cf7650d9f16896d832e2a) ## Search groups Results are organized into groups by content type, and items within each group are sorted by relevance to your query. This makes it quick to pick out the kind of thing you're after — a chart, a dashboard, or any other entity in the project. ![Search results grouped by content type](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/search/search-groups-97b3814af60e64fc7ebc19b97fdfe65c.gif?s=a74cdc99f80071aa8e0d055f92e85bde) Content shared directly with you is also discoverable through [Shared with me](/workspace-admin/direct-access#find-shared-content). ## Browsing instead of searching When you don't know what you're looking for yet, browse. Your home page lists recent and pinned content as soon as you land in Lightdash. ![The Lightdash project home page](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/search/home-page.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=49614597a737754430f84d94e073b5fb) Click the Lightdash icon in the top-left corner to get back to it from anywhere. ![The Lightdash icon in the top-left corner of the nav bar](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/search/return-to-homepage.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=da3f9963fcd5682e64c38dc7fb720a9c) `Browse` in the navbar lists every saved chart, dashboard, and [space](/explore/spaces) you and your teammates have made in the project. ![The Browse menu in the nav bar](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/search/browse.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=6d300806d8cf86f55f338bb19a4f7b1a) # Sharing charts Source: https://docs.lightdash.com/explore/share-charts Share a work-in-progress exploration or a saved chart, and download results and chart images There are three ways to get a chart in front of your team: share the URL of an exploration in progress, share a saved chart, or download the results or an image. ## Share a draft URL As you explore data, the URL holds a unique link to your work in progress. Copy it and anyone with access to your Lightdash project lands in the Explore view at exactly the point you're at. The link gets long when a chart carries a lot of configuration, so use the built-in link shortener to grab a short one. ![The link shortener button in the Explore view](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/share-charts/draft-query-link-button.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=de378304a11216c862bdc0614c2dd749) ## Share a saved chart Create a new saved chart, or update an existing one, with the **Save chart** button on the chart panel. You'll have the option to [save to a space or a dashboard](/explore/explore-view#save-your-chart). ![The Save chart button on the chart panel](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/share-charts/save-chart.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=23547a4ad7dd294f3d9067e256884d2a) Users with access to the containing space can find the chart under **Browse → All saved charts**, or you can send them its URL — a URL copied at any screen size opens the full chart for everyone. To share an individual saved chart without sharing its space, use [Direct access](/workspace-admin/direct-access). That guide also explains how sharing differs for dashboard-owned and reusable charts. ![Browsing all saved charts](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/share-charts/saved-charts-browse.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=c4921ec63615b7099b99b00a1b56a5e4) ## Download results or a chart image Click the export icon on a chart to download it as JPEG, PNG, SVG, PDF, or JSON, with an opaque or transparent background. You can download the file or copy it to your clipboard. JPEG, PNG, and PDF images are rendered at the chart's on-screen size in pixels, with no extra resolution, so they can look blurry when enlarged in a slide or report. For an image that stays sharp at any size, download SVG, a vector format. Image downloads aren't available for big number, table, map, and [custom](/visualizations/custom-charts) charts. ![The chart export menu](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/share-charts/export-chart.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=6e9d2647e075d9a9b0668e4986879c64) You can also download the results table as a CSV or an Excel spreadsheet, or export it to a Google Sheet if your organization has [that set up](/integrations/google-sheets). ![The results table export menu](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/share-charts/export-results.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=cece5611e52972abb8cebe2637364e57) ### Choosing how many rows an export contains The download dialog also asks how the values should be written — `Formatted` keeps the table's presentation, `Raw` uses the underlying values — and, for interactive viewers and above, the **result scope**: * `Table rows` exports exactly the rows currently loaded in the table. * `All results` runs the query for the full result set. * `Custom` exports the number of rows you enter. Viewers don't get the result scope choice; their downloads contain the visible table rows. Every export is bounded by your organization's [export limits](/workspace-admin/export-limits): a CSV or Excel file can hold at most the configured number of cells (rows × columns), so `All results` means as many rows as fit under that cap, and a custom row count above it is reduced to it. Excel files are additionally capped at 1,000,000 rows. Exporting to Google Sheets has no row choice. # Spaces Source: https://docs.lightdash.com/explore/spaces Organize saved charts and dashboards into spaces, and manage who can access each one Spaces are kind of like folders. All saved charts and dashboards exist in a Space and can only be in one Space at a time. ![The Browse drop-down open in the navigation bar, listing the project's spaces](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/spaces/view-spaces.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=cf9ac22e77eff22265e67d2ccf729f79) To access Spaces, you can either select a Space from the drop-down list in `Browse` or you can click on the Lightdash icon and select your Space from the homepage. To build subfolders, [nest Spaces](#nested-space-permissions) inside each other, for example a `Marketing` Space with `Campaigns` and `Paid social` Spaces inside it. **All saved charts**, **All dashboards** and **All data apps** in `Browse` list content from every Space you can access in one flat list, with a **Space** column showing where each item lives. Use them to find content, and Spaces to organize it. ![The All spaces view, with a row per space showing its name and access level](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/spaces/view-all-spaces.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=7bbd9c5cdfaee99ba5da0646aaea0704) Organization and project admins see a **Spaces** / **Admin Content View** toggle above this list. **Spaces** shows the spaces you have access to - the same view a regular member sees. **Admin Content View** lists every public and private space in the project, including other users' private and personal spaces you haven't been added to, so you can oversee and manage spaces you're not a member of. ## Creating a Space Editors and above can create Spaces. Click `Add` on the `All spaces` page, or pick `Space` from the `+ New` menu in the navigation bar, then give the Space a name. Root-level Spaces also ask you to pick an access mode as you create them: `Inherited access` (everyone in the project, the default) or `Restricted access` (only invited users and groups) — see [managing access](#managing-access-to-a-space) for what each means. To create a nested Space, open the parent Space and pick `Create space` from its `Add` menu. A nested Space always starts with the same access as its parent; you can change that after creating it. Either way, you become an admin of the Space you created, and it appears in `Browse` and on the `All spaces` page alongside the rest. This is a direct **Full Access** grant on the Space, so it stays if your project role changes later and when the Space switches between Inherited and Restricted Access. To change it, update that user's role in the Space's **Share** dialog. ## Moving items between Spaces To move a saved chart, dashboard or space between Spaces, you can click on the three dot menu (`...`) to the right of the item and pick the `Move` action. Or select items using checkboxes on the left and click `Move to Space`. ![The three-dot menu open beside a saved chart, with the Move action in the list](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/spaces/transfer-to-space.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=3c209e7ed7edf0401d95d8eaf2f7f446) ![Several items selected by their left-hand checkboxes, with a Move to Space button in the toolbar above](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/spaces/transfer-to-space-bulk.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=0785d7dd197563a2db2de855d726d3f8) ![The Move to Space dialog with a picker for the destination space and the selected items listed](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/spaces/transfer-to-space-bulk-2.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=d505db8adbfebcc9abec293bde922008) For admins, the Move dialog opens on **Spaces**, where spaces you haven't been added to are greyed out and can't be selected. Switch to **Admin Content View** to pick one of those as the destination, such as another user's private space or [personal space](/explore/default-user-spaces). Moving a dashboard doesn't move the saved charts on it. A saved chart can appear on several dashboards, so it stays in its own space. To see a tile, a user needs access to the chart as well as the dashboard, so when you move a dashboard to share it more widely, move its saved charts to a space those users can access too. Charts [created inside the dashboard](/explore/dashboards#create-a-new-chart) belong to it and move with it. You can also add items to a Space from within the Space. Just click on the `Add` button on the space page. ![The Add button on a space page, offering to add existing charts and dashboards to that space](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/spaces/add-to-space.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=640851e416e5c882d2121edec2cfd5f7) ## Updating and deleting Spaces You can rename or delete your Space from All Spaces view or on the homescreen by clicking on the three-dot menu (`...`) for the Space. ![The three-dot menu open beside a space in the All spaces view, with rename and delete options](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/spaces/edit-delete-space.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=acfdacda9c0c6e0f4432033c6188fc20) > [!WARNING] > > Deleting a Space will delete all of the content in that Space. ## Managing access to a Space By default, when you create a Space, it has Inherited Access—inheriting permissions from the project (for root-level spaces) or from the parent space (for nested spaces). You can change a space to Restricted Access to limit it to only invited users and admins. ![Clean Shot2026 02 26at12 23 08@2x](https://mintcdn.com/lightdash/SLNTWrKoyVE8TrRr/images/CleanShot2026-02-26at12.23.08@2x.png?fit=max\&auto=format\&n=SLNTWrKoyVE8TrRr\&q=85\&s=7b46cbd44d5912e2fe24152dda6e4c05) To edit access to a Space, navigate into the Space, then click the three-dot menu (`...`) and select `Share`. From there, you can choose between `Inherited Access` and `Restricted Access`. ![The Share dialog for a space, with Inherited Access and Restricted Access as the two options](https://mintcdn.com/lightdash/SLNTWrKoyVE8TrRr/images/CleanShot2026-02-26at15.48.52@2x.png?fit=max\&auto=format\&n=SLNTWrKoyVE8TrRr\&q=85\&s=d32655b90f6d90302454d043531e8fec) By default, in spaces with Inherited Access, a user's space permissions are inherited from their project permissions (for root-level spaces) or parent space (for nested spaces). For example, if I'm a project viewer, I will get `Can View` access to a Space. For what each space role can do, see [the space roles table](/workspace-admin/roles#space-roles). ### Restricted Access spaces **Only admins and members that are invited to a Space with Restricted Access have access to it.** For example, here I have a Space with Restricted Access. Only admins and the invited members have access to this Space. Katie, Filipe and Marshall have inherited `Full Access` because they are organization admins. Priyanka was invited to the space, so she has `Can View` access to the space. Individual items can also be shared through [Direct access](/workspace-admin/direct-access), which does not grant access to browse this Space. Only users with `Full Access` permissions to a Restricted Access Space can invite other users to that Space. #### Give all project members view access To let everyone in a project view a Space while allowing only selected people to edit it: 1. Set the Space to **Restricted Access**. 2. Review the Space's direct grants and remove or reduce any unwanted **Can Edit** or **Full Access** entries. 3. Add **All project members** with **Can View**. 4. Give selected users or groups **Can Edit** or **Full Access**. Restricted Access stops permissions from parent Spaces from continuing to flow into this Space. When you change an existing Space from Inherited Access to Restricted Access, Lightdash copies its current inherited permissions into direct grants so users do not suddenly lose access. Review those copied grants before relying on the Space as view-only. **Nested spaces inherit access from Restricted Access spaces by default.** When you create a space inside a Restricted Access space, the nested space automatically uses Inherited Access, meaning it inherits the same restricted permissions from its parent. This makes it easy to organize content within a restricted area while maintaining consistent access control. ### Inherited Access spaces **Everyone who has access to your project (or parent space) has access to a space with Inherited Access.** For example, here I have a Space with Inherited Access. Everyone who has access to my Project, "Lightdash analytics", will get access to the content in my space. ![The Share dialog for a space set to Inherited Access, noting that everyone with access to the Lightdash analytics project can reach it](https://mintcdn.com/lightdash/SLNTWrKoyVE8TrRr/images/CleanShot2026-02-26at15.53.06@2x.png?fit=max\&auto=format\&n=SLNTWrKoyVE8TrRr\&q=85\&s=c02b3912f36e712e737501ec5c339137) **By default, you inherit your space permissions in an Inherited Access space from your project permissions (for root-level spaces) or parent space permissions (for nested spaces).** So, if someone is an `editor` or `developer` in my project, they will have `Can Edit` permissions in my Space. If someone is a `viewer` or `interactive viewer` in my project, they will have `Can View` permissions in my Space. Project admins get `Full Access`. For more details about actions you can take in a Space based on your role, [check out this table](/workspace-admin/roles#space-roles). > [!WARNING] > > Adding **All project members** with **Can View** to an Inherited Access Space does not make the Space view-only. More permissive user or group grants from the Space or its ancestors still apply. Users with **Full Access** can change a user's Space permissions. Users cannot be removed from Inherited Access Spaces. To give a user **No access**, change the Space from Inherited Access to Restricted Access. ## Nested space permissions Spaces can be nested inside other spaces to create a hierarchy. Nested spaces have flexible permission options that allow you to either inherit permissions from their parent or define custom access. ### Permission inheritance options When creating or editing a space, you can choose between two access modes: * **Inherited Access**: The space inherits permissions from its parent. For nested spaces, this means inheriting from the parent space. For root-level spaces, this means inheriting from the project. This is the more open option—users with access to the parent automatically have the same access to the space. * **Restricted Access**: The space defines its own permissions, which its children inherit. Only users and groups explicitly invited to this space (plus admins) can access it. This is the more restricted option. ### How permission inheritance works When a nested space uses Inherited Access: 1. **Inheritance chain**: Permissions flow down through the space hierarchy. If Space A contains Space B, and Space B contains Space C, then Space C can inherit permissions all the way from Space A (if both B and C use Inherited Access). 2. **Breaking inheritance**: When you switch a space from Inherited Access to Restricted Access, the current inherited permissions are copied as direct access entries. This ensures users don't suddenly lose access when you restrict permissions. 3. **Effective access**: Lightdash collects direct user, group, and **All project members** grants from the Space and every active ancestor in its inheritance chain. The highest applicable Space role wins. A lower role on a child Space does not revoke a higher role inherited from an ancestor. If the chain contains no applicable Space grants, access is derived from the user's organization and project permissions. 4. **Access sources**: In the Share modal, **Shared with** shows the configured grants, while **Who has access** shows each user's effective access and where it comes from: * **Direct access**: Explicitly granted to this space * **Parent space**: Inherited from a parent space * **Project**: Inherited from project-level permissions * **Organization**: Inherited from organization-level permissions Check **Who has access** when verifying that a Space is view-only. > [!TIP] > > To check every space in a project at once instead of opening each one, call, as an admin, `GET /api/v1/projects/{projectUuid}/spaces`. Each space in the response has an `inheritParentPermissions` field: `true` means it's still on Inherited Access, `false` means Restricted Access. See the [API reference](/api-reference/v1/introduction). ### Managing nested space permissions To change a nested space's permission mode: 1. Navigate into the space 2. Click the three-dot menu (`...`) and select `Share` 3. Toggle between Inherited Access and Restricted Access 4. If switching to Restricted Access, you can then add or remove specific users and groups When you switch a space to Restricted Access, you automatically receive Full Access to prevent accidentally locking yourself out. ### Best practices for nested spaces * **Use groups over individual users**: When sharing spaces, prefer adding groups rather than individual users. This makes permission management easier as your team grows. * **Plan your hierarchy**: Consider how permissions should flow before creating deeply nested structures. * **Use Inherited Access when possible**: Inheriting permissions simplifies management and ensures consistent access across related content. # SQL runner Source: https://docs.lightdash.com/explore/sql-runner Build ad-hoc queries and charts with totally custom SQL A query built in the SQL runner can be: * used to power a single saved chart * turned into a virtual view so it becomes a reusable table * written back to dbt as a model Only users with [`developer or admin access`](/workspace-admin/roles) can use the SQL runner. ## Getting started with the SQL Runner The SQL Runner can be accessed from the `New` --> `Query using SQL Runner` option in your navigation bar. ![The New menu open in the navigation bar, with Query using SQL Runner in the list](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/sql-runner/access-sql-runner-e299a63e83e2ecb4b3b09c64f94211be.jpg?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=b692af8298cae9620e9de7d75a519645) Once you're in the SQL Runner, you'll see four key components: 1. A list of tables in your data warehouse that Lightdash has access to (based on your data warehouse connection in Lightdash). 2. The schema of a selected table. 3. The SQL query builder. 4. The results from your latest SQL query. ![The SQL Runner laid out in four parts: the warehouse table list, the selected table's schema, the SQL query builder, and the results below](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/sql-runner/sql-runner-components-60eb488682b46fb2ecedad92a2656adb.jpg?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=e50d5765669f80199620160dca1e4f30) The table list shows every table the project's warehouse credentials can read, or your own credentials when you use [personal warehouse credentials](/personal-settings/personal-warehouse-connections). Lightdash has no setting to hide schemas or tables from it: what the SQL runner can list and query is whatever those credentials can read in the warehouse. Clicking a table while the editor is empty starts a `SELECT *` query on it. On BigQuery, a partitioned table's query also gets a `WHERE` on its partition column, set to today's date for a date partition or `0` for an integer range partition, with a comment naming the partition type. To build a query in the SQL Runner, just write your query in the SQL query builder, then hit `Run query` to see the results. Charts built in [the Explore view](/explore/explore-view) show their generated SQL in a read-only **SQL** section. To edit that SQL, click **Open in SQL Runner** in that section. The SQL runner opens with the generated query, and saving it creates a separate SQL chart; the Explore chart doesn't change. You can access your **Query history** from your session by clicking on the `SQL Query history` button beside `Run query`. ![The SQL Query history panel listing the queries run in this session, opened from the button beside Run query](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/sql-runner/query-history-3c6295f2352f2d118474de3a51d83fd7.jpg?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=1f7fc1888a15375ea8f91c564a9f9db4) Once you've run your query, you can either: 1. [**Build and save a Chart**](#saved-charts-in-the-sql-runner) 2. [**Create a Virtual View so your query becomes a reusable table in Lightdash**](/semantic-layer/virtual-views) 3. [**Write-back to dbt so your query is saved as a governed model.**](/integrations/dbt/write-back) 4. Click the link icon in the top-right to share your query draft with a coworker (or save it yourself to return to later). ## Saved charts in the SQL Runner Once you've run your query, you can build a chart by clicking on the `chart` tab in the SQL Runner. The charts in the SQL Runner are built from the data that you generated in your query. The chart builder automatically aggregates the data from your query results using the aggregation type that you choose. Depending on the column type, the aggregation options are: * count (which is a distinct count and will ignore duplicates) * any (which will count and include duplicates) * sum * average * max * min ![The chart builder in the SQL Runner, with field pickers and an aggregation drop-down beside a chart of the query results](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/sql-runner/build-chart-sql-runner-72c3e95c8e37b83f48189599e25ddba1.jpg?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=2207b9006eb3b10342b4996695b3d1ab) Once you've configured your chart, you can save it, add it to a space, and add it to a dashboard by hitting `save chart`. SQL runner charts on a dashboard can be filtered in the UI. See the [dashboard filter documentation](/explore/dashboards/filter#filtering-charts-created-in-the-sql-runner) for more information. The SQL runner itself has no filter controls. ### Chart types The SQL runner supports the following chart types: * Table * Bar chart * Line chart * Pie chart * Big value Other chart types, such as area, scatter and funnel charts, are only available in the Explore view. To use one with your SQL, save the query as a virtual view and build the chart from it, as described in [Explore-only chart features](#explore-only-chart-features). ### Series draw order For bar, line, and mixed charts, open **Chart → Series** to choose which series appear in front of others. The list runs from **Back → Front**: a series lower in the list is drawn on top of a series above it. The last series has a **Front** badge. * **Drag** a series by its handle to change its position. * **Bring to front** moves a series to the end of the list. Hover over its heading to reveal the button. * **Reverse** flips the order in that list. For a mixed chart with a line hidden behind bars, bring the line series to the front. Its color, label, chart type, and axis assignment stay with it. ![SQL Runner Series settings with Sales bars followed by a Target line marked Front, and the line visible across the bars](https://mintcdn.com/lightdash/KsLmIq8Hloh0Q8wc/images/explore/sql-runner/series-draw-order-light.png?fit=max\&auto=format\&n=KsLmIq8Hloh0Q8wc\&q=85\&s=7c6338bdeb427c1139b339aea874f2d2) The Target line is at the front of the series list, so it remains visible over the Sales bars. When using **Group by**, reorder whole metric groups or expand a group to reorder its individual series. Charts keep their current order until you change it. **Save** the chart to retain your chosen order when reopening it or viewing it on a dashboard. ## Limitations ### Explore-only chart features Some chart features work only on charts built in [the Explore view](/explore/explore-view). SQL runner table charts don't support conditional formatting, and SQL runner charts on a dashboard don't respond to [date zoom](/explore/dashboards/date-zoom) or offer **Drill into**. To use them with your SQL, save the query as a [virtual view](/semantic-layer/virtual-views), then build the chart from that virtual view in the Explore view. **Create virtual view** is only in the save menu of a new, unsaved query. To turn a saved SQL chart into a virtual view, open a new SQL runner query, paste and run the SQL, and save it from there. ### ORDER BY not guaranteed Results from the SQL runner are not guaranteed to respect your `ORDER BY` clause. This is because Lightdash wraps your query in a subquery to support dashboard filtering, and SQL databases don't preserve ordering from subqueries. **Common symptoms:** Results appear in wrong order, sorting doesn't work, ORDER BY ignored, sort order not preserved. # Table calculations Source: https://docs.lightdash.com/explore/table-calculations Add calculations across your results table, like running totals and window aggregations You add table calculations in the Explore view and they appear as green columns in your results table (remember, [dimensions](/semantic-layer/dimensions) are blue, and [metrics](/semantic-layer/metrics) are orange). ![Table calculation column in the results table](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/table-calculations/table-calc-results-light.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=afbcd4c920abd56765b7a346e3168ac3) Table calculations can be built in two ways: * **[Formula](/explore/table-calculations/formulas)**: a spreadsheet-style syntax that reads like Google Sheets. The default mode for new table calculations. * **SQL**: raw SQL. Both modes are available on every warehouse Lightdash supports. With either mode you can build mathematical, True/False, text, and date-based calculations on top of your results. ## When to use table calculations The Lightdash semantic layer allows you to define metrics and dimensions that can be reused across your organization. This creates consistency and saves time by establishing standard definitions everyone can rely on. Sometimes the predefined metrics and dimensions aren't quite enough, and you might need to perform additional calculations for specific visualizations, create specialized metrics for particular analyses, or build custom logic to better communicate your insights. ### How Table Calculations Help Table calculations work as an additional computational layer that builds on top of: * Semantic layer metrics and dimensions (your standard definitions) * Custom metrics and dimensions (created at the BI layer) * Other table calculations (you can even stack them) Table calculations are useful for specialized, temporary needs, but if you find yourself repeatedly reusing a table calculation, it's a sign to add it to dbt so it's tracked in the semantic layer. This keeps your organization's metrics centralized and consistently defined. You can read more about [adding metrics to your dbt project here](/semantic-layer/metrics). ## Creating table calculations Before you create a table calculation, you need to add some dimensions and/or metrics to your results table. Table calculations work with whatever data you've already pulled into your results table - they can reference the dimensions and metrics you've selected, as well as other table calculations you've built from those same underlying fields. Think of it like building with blocks: you start with your base dimensions and metrics, then you can stack table calculations on top of those, and even build new calculations that reference the ones you've already created. ### Using quick calculations Quick calculations are shortcuts to the most common table calculations, these are only available to metrics in the contextual menu in the results table. ![Quick calculation menu on a metric column](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/table-calculations/quick-calculation-menu-light.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=2055f42a0c5d4585de7d15797082daa7) To learn more about what these calculations are doing, check out the docs [here](/explore/table-calculations/sql-templates). Once the table calculation is generated you can edit it to modify the SQL query or update the format. **Running total**, **Difference from previous**, **Percent change from previous**, and **Percent of previous value** take their row order from the results table's sort when you create them. The three previous-value calculations store each field in the reverse direction of the table's sort. Changing the table's sort afterwards doesn't change the calculation. To change its order, choose **Edit calculation** from the column's menu and edit the **Order by** list, where you can add, remove, and reorder fields and set each one to **Ascending** or **Descending**. A running total saved without an **Order by** follows the table's current sort. ### Using custom table calculations Once you've got some data in your results table, you can create a table calculation by clicking on the `+ Table calculation` in the `Results` tab of the Explore view: ![+ Table calculation button in the Results header](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/table-calculations/create-table-calc-button-light.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=9b37a3ff7eaa8fc1aaee109c3dff7030) ##### Write the SQL for your table calculation in the pop-up box Your table calculation is defined using raw SQL that you write up in this pop up box. If you're not sure what to write here, you can [check out some of our table calculation SQL templates](#table-calculation-functions-and-sql-templates). To reference the metrics and dimensions in your results table, you can either use the autocomplete, or you can manually write the full field name using the format `${table_name.field_name}`. ![Add table calculation modal with SQL editor and inline format options](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/table-calculations/table-calc-modal-light.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=3bc73544abb3176be75316af17aa09b5) ### Using table calculation functions In addition to writing raw SQL, you can use built-in functions that simplify common table calculation patterns. These functions compile to SQL window functions automatically, so you don't need to write `LAG`, `LEAD`, or `ROW_NUMBER` by hand. ##### Update the format of your table calculation (if needed) If needed, you can update the format of your table calculation — percent, currency, number with custom prefix/suffix — in the **Format** section of the modal, just below the SQL editor. ![Format options for a table calculation](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/table-calculations/table-calc-format-light.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=cf4c1edee7d29eb2c55004df04447606) See [Formatting table calculations](/explore/formatting-your-fields#formatting-table-calculations) for the full list of format types and their options. ##### Choose how totals are calculated (if needed) Use the **Totals** setting in the table calculation modal to control how Lightdash calculates grand totals, column totals, pivot row totals, and subtotals for the calculation. | Totals mode | How it works | When to use it | | :- | :- | :- | | **Formula** (default) | Re-applies the calculation to aggregated total values. | Ratios, percentages, and calculations that should be evaluated at the total grain. | | **Sum of rows** | Calculates the value for each row, then sums those row-level values at the requested total grain. | Additive row-level transformations such as `${metric} + 2`, window calculations, and template calculations. | | **None** | Leaves total cells blank for this table calculation. | Calculations where a total would not be meaningful. | You can choose a different mode for each table calculation in the same table. For example, use **Formula** for a profit-margin ratio and **Sum of rows** for an adjustment applied to every row. > [!NOTE] > > **Formula** mode can only produce a total when Lightdash can evaluate the calculation at the aggregated total grain. If a calculation references dimensions, other table calculations, or window logic, use **Sum of rows** to total its row-level results. ##### To edit or remove your table calculation, open the column dropdown Click the chevron next to the table calculation column header in the results table. From there you can **Edit calculation** to reopen the modal, or **Remove** to drop it. ![Edit / delete dropdown on a table calculation column header](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/table-calculations/table-calc-edit-delete-light.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=3722703e9231f2cb1f085676ef562973) If a table calculation's SQL makes the query fail, open the column dropdown and choose **Edit calculation** to fix it, or **Remove** to delete it. Saving the edit or confirming the removal reruns the query, even when **Auto-fetch results** is off. ## Table calculation execution and limitations The processing order: 1. **Raw data filtering happens first** - Dimension and metric filters are applied to your base data. 2. **All table calculations run** - Using this filtered dataset, all calculations are performed. 3. **Table calculation filters apply last** - Only then are rows hidden based on calculated values. The query's row limit comes after these steps. Table calculations run over every row before the limit, and the limit counts only the rows that table calculation filters keep. ### Key limitations Since all calculations are performed before filtering, table calculation filters only hide rows without affecting the underlying calculations. For example: You use table calculations to calculate the `percentage_of_shipping_method_amount`, then filter to hide rows below 30%. The filtered rows (shown in purple) will disappear but the `percentage_total` calculation still shows 100% even though the visible percentages in the `percentage_of_shipping_method_amount` column no longer add up to 100%. ![A results table where rows below 30% are highlighted in purple as the ones a table calculation filter hides, while the percentage total still reads 100%](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/table-calculations/table_calculation_filter_example.jpg?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=f8f75efe02c2450e1a1ee251d480aa7f) ## Show only the top N rows or groups Lightdash has no built-in top N filter, and no chart option to group the rest into "Other". To keep only the top N rows or groups by a metric, add a `RANK` or `ROW_NUMBER` [formula table calculation](/explore/table-calculations/formulas), ordered by that metric descending, then filter the table calculation to `N` or fewer. For example, to find the top 2 browsers by visits each month: ``` =RANK(PARTITION BY orders_order_month, ORDER BY orders_visits DESC) ``` Add a filter on the new table calculation column using the **is less than or equal to** operator with a value of `2`. * `PARTITION BY` ranks within each group, so the example above keeps the top 2 browsers for every month. Leave out `PARTITION BY` to rank over the whole results table instead, for a single top N across all rows. * The filter only hides rows below the cutoff (see [Key limitations](#key-limitations) above) — it doesn't change any other table calculation. A running total, percent-of-total, or another rank built from the same data still runs over every row, not just the ones the top N filter keeps. ## Table calculation functions and SQL templates If you prefer not to write raw SQL, check out the built-in [row functions](/explore/table-calculations/functions/row-functions), [pivot functions](/explore/table-calculations/functions/pivot-functions), and [aggregate functions](/explore/table-calculations/functions/aggregate-functions) — they handle common patterns like accessing previous rows, row numbering, working across pivot columns, and computing totals. For more advanced or custom SQL, we also have copy-paste SQL templates to help you get started with common table calculations. You can check out our table calculation SQL templates [here](/explore/table-calculations/sql-templates). # Formula table calculations Source: https://docs.lightdash.com/explore/table-calculations/formulas Build table calculations using a spreadsheet-style formula syntax instead of raw SQL Formula table calculations let you write table calculations in a spreadsheet-style syntax, the way you would in Google Sheets or Excel, instead of raw SQL. When you create a new [table calculation](/explore/table-calculations), **Formula** is the default input mode. You can switch to the SQL editor any time. ![Creating a formula table calculation](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/table-calculations/formulas/create-table-calculation-formula-light.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=4e40f2fad7209c0de550b262aa57c504) ## Why use formulas? * **Faster to write** for common calculations. No `OVER (…)` or `CASE WHEN` boilerplate to remember. * **Familiar** if you've used Google Sheets, Excel, or Airtable. * **Portable** across warehouses. The same formula compiles to the correct SQL for whichever warehouse your project is connected to. If you need something the formula syntax doesn't cover yet, the SQL editor is always one click away. ## Supported warehouses Formula table calculations work on every warehouse Lightdash supports: Athena, BigQuery, ClickHouse, Databricks, DuckDB, PostgreSQL, Redshift, Snowflake, and Trino. The same formula compiles to the correct SQL for whichever warehouse your project is connected to. ## Writing your first formula Every formula starts with `=`. Reference a field by its column name (the same name you see in the results table header): ``` =orders_total_order_amount * 1.2 ``` The result appears as a new green column in your results table: ![Formula table calculation in the results table](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/table-calculations/formulas/table-calculation-formula-in-table-light.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=4c545ac06793f14a6564a1fa68095a3a) You can use: * **Numbers**: `42`, `3.14`, `-1.5` * **Strings**: `"hello"` or `'hello'` * **Booleans**: `TRUE`, `FALSE` * **Column references**: any field present in your results table * **Arithmetic operators**: `+`, `-`, `*`, `/`, `%` (modulo) * **Comparison operators**: `=`, `<>`, `>`, `<`, `>=`, `<=` * **Boolean operators**: `AND`, `OR`, `NOT` Division with `/` is safe by default: dividing by zero returns an empty (null) value instead of an error, on every warehouse, so you don't need a `SAFE_DIVIDE` function. Dividing one whole number by another returns a decimal result, as in a spreadsheet. ## Function reference ### Math | Function | Description | | - | - | | `ABS(x)` | Absolute value | | `ROUND(x, [digits])` | Round to N decimal places | | `CEIL(x)` / `CEILING(x)` | Round up to nearest integer | | `FLOOR(x)` | Round down to nearest integer | | `MIN(x, [y])` | Minimum (scalar or aggregate) | | `MAX(x, [y])` | Maximum (scalar or aggregate) | ### Logical | Function | Description | | - | - | | `IF(condition, then, [else])` | Conditional expression | | `AND`, `OR`, `NOT` | Boolean operators | | `=`, `<>`, `>`, `<`, `>=`, `<=` | Comparison operators | ### String | Function | Description | | - | - | | `CONCAT(a, b, …)` | Concatenate strings | | `LEN(s)` / `LENGTH(s)` | String length | | `TRIM(s)` | Remove whitespace | | `LOWER(s)` | Convert to lowercase | | `UPPER(s)` | Convert to uppercase | | `LEFT(s, n)` | Leftmost `n` characters | | `RIGHT(s, n)` | Rightmost `n` characters | | `SUBSTRING(s, start, length)` | Extract `length` characters from 1-indexed `start` | | `REPLACE(s, old, new)` | Replace all occurrences of `old` with `new` | | `SPLIT_PART(s, delimiter, n)` | Split on `delimiter` and return the `n`-th part (1-indexed) | | `STRPOS(s, substring)` | 1-indexed position of `substring` in `s`, or `0` if not found | | `STARTS_WITH(s, prefix)` | True if `s` begins with `prefix` | ### Date | Function | Description | | - | - | | `TODAY()` | Current date | | `NOW()` | Current timestamp | | `YEAR(d)` | Extract year | | `MONTH(d)` | Extract month | | `DAY(d)` | Extract day | | `LAST_DAY(d)` | Last day of the month containing `d` | | `DATE_TRUNC(d, unit)` | Truncate `d` to the start of `unit` (`"day"`, `"week"`, `"month"`, `"quarter"`, `"year"`) | | `DATE_ADD(d, n, unit)` | Add `n` whole `unit`s to `d` (e.g. `DATE_ADD(orders_date, 3, "month")`) | | `DATE_SUB(d, n, unit)` | Subtract `n` whole `unit`s from `d` | | `DATE_DIFF(start, end, unit)` | Whole-`unit` calendar-boundary difference. Positive when `end > start`. | `unit` is always one of `"day"`, `"week"`, `"month"`, `"quarter"`, `"year"` — quoted as a string literal. ### Aggregation | Function | Description | | - | - | | `SUM(x)` | Sum values | | `AVG(x)` / `AVERAGE(x)` | Average values | | `COUNT([x])` | Count rows (or non-null x) | | `SUMIF(condition, x)` | Sum where condition is true | | `AVERAGEIF(condition, x)` | Avg where condition is true | | `COUNTIF(condition)` | Count where condition true | ### Window | Function | Description | | - | - | | `RUNNING_TOTAL(x)` | Running (cumulative) total | | `ROW_NUMBER()` | Sequential row number | | `RANK()` | Rank with gaps | | `DENSE_RANK()` | Rank without gaps | | `LAG(x, [offset], [default])` | Previous row's value | | `LEAD(x, [offset], [default])` | Next row's value | | `FIRST(x)` | First value in window | | `LAST(x)` | Last value in window | | `NTILE(n)` | Distribute rows into N buckets | | `MOVING_SUM(x, n)` | Sum of the last N rows | | `MOVING_AVG(x, n)` | Average of the last N rows | ### Null handling | Function | Description | | - | - | | `COALESCE(a, b, …)` | First non-null argument | | `ISNULL(x)` | `TRUE` if x is null | ## Window clauses: `PARTITION BY` and `ORDER BY` Window functions accept optional `PARTITION BY` and `ORDER BY` clauses, written inline as extra arguments. Use them when you want a running total, moving average, rank, or `LAG`/`LEAD` to reset for each group or follow a specific row order. * `PARTITION BY ` — restart the calculation for each value of the dimension (for example, run a separate running total per region). * `ORDER BY ` — define the row order the window uses (for example, by date). Defaults to the natural sort of your results table when omitted. **Running total per group** ``` =RUNNING_TOTAL(orders_revenue, PARTITION BY orders_region, ORDER BY orders_order_date) ``` **Moving average per group** ``` =MOVING_AVG(orders_revenue, 6, PARTITION BY orders_partner_name, ORDER BY orders_order_month) ``` **Percent change vs. previous row in the same group** ``` =(orders_revenue - LAG(orders_revenue, PARTITION BY orders_region, ORDER BY orders_order_date)) / LAG(orders_revenue, PARTITION BY orders_region, ORDER BY orders_order_date) ``` **Rank within each group** ``` =RANK(PARTITION BY orders_region, ORDER BY orders_revenue DESC) ``` You can also wrap any aggregate with an explicit `OVER (…)` clause for warehouse-style window aggregates: ``` =SUM(orders_revenue) OVER (PARTITION BY orders_region ORDER BY orders_order_date) ``` ## Examples **Gross margin as a percentage** ``` =ROUND((orders_revenue - orders_cost) / orders_revenue * 100, 2) ``` **Flag high-value orders** ``` =IF(orders_total_amount > 1000, "VIP", "Standard") ``` **Running total of revenue** ``` =RUNNING_TOTAL(orders_revenue) ``` **Period-over-period growth %** ``` =(orders_revenue - LAG(orders_revenue, 1, 0)) / LAG(orders_revenue, 1, 0) * 100 ``` **Bucket customers by spend** ``` =IF(customers_lifetime_value > 10000, "Platinum", IF(customers_lifetime_value > 5000, "Gold", IF(customers_lifetime_value > 1000, "Silver", "Bronze"))) ``` **Percent of total** ``` =orders_revenue / SUM(orders_revenue) * 100 ``` ## FAQ > [accordion] Can I switch between SQL and Formula on the same table calculation? > > No. The input mode is chosen when you create the table calculation > and can't be changed afterwards, because formulas and SQL aren't > always losslessly interconvertible. If you need to move a SQL calc to > a formula (or vice versa), delete the old one and create a new one in > the mode you want. > [accordion] I found a bug or want a function that isn't listed > > Post in the [Lightdash Community Slack](https://join.slack.com/t/lightdash-community/shared_invite/zt-3pbwqmq5e-vhTc7HHcS787w618ngoPHA) > or [open a GitHub issue](https://github.com/lightdash/lightdash/issues). > See [Contact Us](/support) for more options. ## Related * [Table calculations overview](/explore/table-calculations) * [Table calculation functions](/explore/table-calculations/functions/row-functions) * [SQL templates for table calculations](/explore/table-calculations/sql-templates) # Aggregate functions Source: https://docs.lightdash.com/explore/table-calculations/functions/aggregate-functions Built-in functions for referencing column and row totals in your table calculations Aggregate functions let you reference grand totals and row totals in your table calculations. Unlike [row functions](/explore/table-calculations/functions/row-functions) and [pivot functions](/explore/table-calculations/functions/pivot-functions) which compile to SQL window functions, aggregate functions generate separate CTEs that compute totals from the underlying data. This means `total()` correctly handles all metric types — including `count_distinct` and `average` — by re-running the metric's native aggregation rather than naively summing grouped values. > [!NOTE] > > Aggregate functions only accept **metric** field references — dimensions and other table calculations are not valid arguments. Passing a dimension (e.g. `total(${orders.customer_id})`) returns the error *"Tried to reference metric with unknown field id"*. ## total Returns the grand total of a metric across all rows, computed from the raw data using the metric's native aggregation. ``` total(${table.metric}) ``` | Parameter | Type | Description | | :- | :- | :- | | `metric` | metric reference | The metric to compute the grand total for | **Example** Calculate each row's share of total revenue: ``` ${orders.total_revenue} / total(${orders.total_revenue}) ``` With percent formatting applied, this gives you each row as a percentage of the overall total. ![Edit Table Calculation dialog with a percent\_of\_total formula using total()](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/table-calculations/functions/aggregate-functions/aggregate-functions-total-example.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=6d28cbc03df56729036ef22f89c7cdee) > [accordion] How it works > > Lightdash generates a `column_totals` CTE that re-aggregates the metric from the raw data with no `GROUP BY`, producing a single grand-total value. This value is then cross-joined into the main query. > > For a `sum` metric, the CTE computes `SUM(...)`. For `count_distinct`, it computes `COUNT(DISTINCT ...)`. For `average`, it computes `AVG(...)`. Each metric type uses its own native aggregation, so the total is always mathematically correct. *** ## row\_total Returns the sum of a metric's values across all pivot columns for the current row. ``` row_total(${table.metric}) ``` | Parameter | Type | Description | | :- | :- | :- | | `metric` | metric reference | The metric to sum across pivot columns | > [!NOTE] > > `row_total` is only available when your query includes a pivoted dimension. If no pivot is configured, `row_total(${table.metric})` falls back to the metric's value directly. **Example** In a pivot table with revenue broken out by region, calculate each region's share of the row total: ``` ${orders.total_revenue} / row_total(${orders.total_revenue}) ``` > [accordion] How it works > > Lightdash generates a `row_totals` CTE that reads from the already-grouped results and computes `SUM(metric)` grouped by the non-pivot dimensions. This gives one total per row, which is then joined back into the main query. > > Unlike `total()`, `row_total()` always uses `SUM` regardless of the metric type, since it's summing pre-aggregated values across the pivot columns within each row. # Pivot functions Source: https://docs.lightdash.com/explore/table-calculations/functions/pivot-functions Built-in functions for accessing values across pivot columns in your table calculations Pivot functions let you work with values across pivot columns in your results table. When you pivot a dimension in Lightdash, the values of that dimension become separate columns — pivot functions give you a way to reference and aggregate across those columns. > [!NOTE] > > Pivot functions are only available when your query includes a pivoted dimension. ## pivot\_column Returns the 0-based index of the current pivot column. ``` pivot_column() ``` **Parameters:** None **Example** Use the column index to apply different logic per pivot column: ``` CASE WHEN pivot_column() = 0 THEN 'First' ELSE 'Other' END ``` > [accordion] Compiled SQL > > ```sql theme={null} > "column_index" > ``` > > The pivot column index is a field in the underlying pivoted results, so no window function is needed. *** ## pivot\_offset Returns the value of an expression from a pivot column at a relative offset from the current column. ``` pivot_offset(expression, columnOffset) ``` | Parameter | Type | Description | | :- | :- | :- | | `expression` | column reference or SQL expression | The expression to evaluate | | `columnOffset` | integer | Number of columns to offset. Negative = previous columns, positive = next columns, 0 = current column | Returns `NULL` if the target column is not adjacent (e.g., if intermediate columns were filtered out). **Example** Compare the current pivot column's revenue against the previous pivot column: ``` ${orders.total_revenue} - pivot_offset(${orders.total_revenue}, -1) ``` > [accordion] Compiled SQL > > For negative offsets (previous columns): > > ```sql theme={null} > CASE WHEN LAG("column_index", 1) OVER ( > PARTITION BY "row_index" ORDER BY "column_index" > ) = "column_index" + (-1) > THEN LAG(${orders.total_revenue}, 1) OVER ( > PARTITION BY "row_index" ORDER BY "column_index" > ) > ELSE NULL > END > ``` > > For positive offsets (next columns), `LEAD` is used instead of `LAG`. > > For an offset of 0, the expression is returned directly with no window function. > > Each call includes an adjacency guard — a `CASE WHEN` check that verifies the target column is actually adjacent. This prevents incorrect values when pivot columns have been filtered out and are non-contiguous. *** ## pivot\_index Returns the value of an expression from a specific pivot column by its 0-based index. ``` pivot_index(expression, pivotIndex) ``` | Parameter | Type | Description | | :- | :- | :- | | `expression` | column reference or SQL expression | The expression to evaluate | | `pivotIndex` | integer (≥ 0) | The 0-based pivot column index | **Example** Compare every pivot column's revenue against the first pivot column's revenue: ``` ${orders.total_revenue} / pivot_index(${orders.total_revenue}, 0) ``` > [accordion] Compiled SQL > > ```sql theme={null} > MAX( > CASE WHEN "column_index" = 0 > THEN ${orders.total_revenue} > ELSE NULL > END > ) OVER (PARTITION BY "row_index") > ``` *** ## pivot\_where Finds the first pivot column where a condition is true and returns a value from that column. ``` pivot_where(selectExpression, valueExpression) ``` | Parameter | Type | Description | | :- | :- | :- | | `selectExpression` | SQL boolean expression | Condition to evaluate for each pivot column | | `valueExpression` | column reference or SQL expression | The expression to return from the matching column | If multiple columns match, the value from the column with the lowest index is returned. **Example** Find the revenue from the first pivot column where the count exceeds 100: ``` pivot_where(${orders.count} > 100, ${orders.total_revenue}) ``` > [accordion] Compiled SQL > > ```sql theme={null} > MAX( > CASE WHEN "column_index" = ( > SELECT MIN("column_index") > FROM ( > SELECT "column_index", > ${orders.count} > 100 AS condition > FROM DUAL > ) > WHERE condition = TRUE > ) > THEN ${orders.total_revenue} > ELSE NULL > END > ) OVER (PARTITION BY "row_index") > ``` *** ## pivot\_row Returns an array of all values across the pivot columns for the current row. ``` pivot_row(expression) ``` | Parameter | Type | Description | | :- | :- | :- | | `expression` | column reference or SQL expression | The expression to evaluate for each pivot column | **Example** Get all pivoted revenue values for the current row: ``` pivot_row(${orders.total_revenue}) ``` > [accordion] Compiled SQL > > ```sql theme={null} > ARRAY_AGG(${orders.total_revenue}) OVER ( > PARTITION BY "row_index" > ORDER BY "column_index" > ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING > ) > ``` *** ## pivot\_offset\_list Returns an array of values from consecutive pivot columns starting at a relative offset from the current column. ``` pivot_offset_list(expression, columnOffset, numValues) ``` | Parameter | Type | Description | | :- | :- | :- | | `expression` | column reference or SQL expression | The expression to evaluate | | `columnOffset` | integer | Starting column offset. Negative = previous columns, positive = next columns, 0 = current column | | `numValues` | integer | Number of consecutive pivot columns to include | Values are returned as `NULL` when the offset points to a non-adjacent pivot column (e.g., if columns were filtered out). **Example** Get the current and two previous pivot column values: ``` pivot_offset_list(${orders.total_revenue}, -2, 3) ``` > [accordion] Compiled SQL > > ```sql theme={null} > ARRAY[ > CASE WHEN LAG("column_index", 2) OVER ( > PARTITION BY "row_index" ORDER BY "column_index" > ) = "column_index" + (-2) > THEN LAG(${orders.total_revenue}, 2) OVER ( > PARTITION BY "row_index" ORDER BY "column_index" > ) > ELSE NULL > END, > CASE WHEN LAG("column_index", 1) OVER ( > PARTITION BY "row_index" ORDER BY "column_index" > ) = "column_index" + (-1) > THEN LAG(${orders.total_revenue}, 1) OVER ( > PARTITION BY "row_index" ORDER BY "column_index" > ) > ELSE NULL > END, > ${orders.total_revenue} > ] > ``` > > Each element includes an adjacency guard — a `CASE WHEN` check that verifies the target column is actually adjacent. This prevents incorrect values when pivot columns have been filtered out and are non-contiguous. # Row functions Source: https://docs.lightdash.com/explore/table-calculations/functions/row-functions Built-in functions for accessing values from other rows in your table calculations Row functions let you reference values from other rows without writing raw SQL window functions. They use the `${table.column}` syntax to reference fields in your results table. > [!NOTE] > > Row functions use your query's current sort order to determine row positions. Changing the sort order of your results will change the output of these functions. Row functions operate across your entire results table, with no equivalent to SQL's `PARTITION BY`. If a dimension in your rows splits the data into categories (for example a region or product column), `offset`, `index`, `offset_list`, `lookup`, and `row` don't reset at each category — an `offset(${orders.total_revenue}, -1)` can return a value from a different category's row. If you need an offset or lag that resets per group, either: * Use the [Formula table calculation](/explore/table-calculations/formulas)'s window functions (for example `LAG`), which accept an inline `PARTITION BY` clause, or * Pivot the dimension into columns and use [pivot functions](/explore/table-calculations/functions/pivot-functions) like `pivot_offset`, which partition by row automatically. ## row Returns the 1-based row number of the current row. ``` row() ``` **Parameters:** None **Example** Add a row number column to your results: ``` row() ``` > [accordion] Compiled SQL > > ```sql theme={null} > ROW_NUMBER() OVER (ORDER BY ...) > ``` > > The `ORDER BY` clause uses the sort order configured in your query. *** ## offset Returns the value of a column from a row at a relative offset from the current row. ``` offset(column, rowOffset) ``` | Parameter | Type | Description | | :- | :- | :- | | `column` | column reference | The column to get the value from | | `rowOffset` | integer | Number of rows to offset. Negative = previous rows, positive = next rows, 0 = current row | `offset` counts rows across your whole results table, in sort order — it doesn't restart at each value of a dimension. This makes it safe when your results have one row per step (for example a single time dimension), but unreliable once another dimension adds more than one row per step: with three categories alongside a weekly time dimension, `offset(x, -52)` moves back about 17 weeks, not 52, because it also steps across the other categories' rows. To offset within a group, use a [formula table calculation with `PARTITION BY`](/explore/table-calculations/formulas#window-clauses-partition-by-and-order-by), which restarts `LAG`/`LEAD` for each value of a dimension. For a prior-year or prior-period comparison on a chart with extra dimensions, use [period comparison](/explore/period-over-period), which compares each group against its own prior period. **Example** Get the previous row's revenue to calculate period-over-period changes: ``` ${orders.total_revenue} - offset(${orders.total_revenue}, -1) ``` > [accordion] Compiled SQL > > For negative offsets (previous rows): > > ```sql theme={null} > LAG(${orders.total_revenue}, 1) OVER (ORDER BY ...) > ``` > > For positive offsets (next rows): > > ```sql theme={null} > LEAD(${orders.total_revenue}, 1) OVER (ORDER BY ...) > ``` > > For an offset of 0, the column value is returned directly with no window function. None of these include a `PARTITION BY`, so the offset always spans the whole results table. *** ## index Returns the value of an expression from an absolute row position (1-based). ``` index(expression, rowIndex) ``` | Parameter | Type | Description | | :- | :- | :- | | `expression` | column reference or SQL expression | The expression to evaluate | | `rowIndex` | integer (≥ 1) | The 1-based row position to get the value from | **Example** Compare every row's revenue against the first row's revenue: ``` ${orders.total_revenue} / index(${orders.total_revenue}, 1) ``` > [accordion] Compiled SQL > > ```sql theme={null} > NTH_VALUE(${orders.total_revenue}, 1) OVER ( > ORDER BY ... > ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING > ) > ``` *** ## lookup Finds a value in one column and returns the corresponding value from another column. ``` lookup(value, lookupColumn, resultColumn) ``` | Parameter | Type | Description | | :- | :- | :- | | `value` | any | The value to search for | | `lookupColumn` | column reference | The column to search in | | `resultColumn` | column reference | The column to return the value from | If multiple rows match, the largest matching value from `resultColumn` is returned. **Example** Look up the revenue for a specific status: ``` lookup('completed', ${orders.status}, ${orders.total_revenue}) ``` > [accordion] Compiled SQL > > ```sql theme={null} > MAX( > CASE WHEN ${orders.status} = 'completed' > THEN ${orders.total_revenue} > ELSE NULL > END > ) OVER () > ``` *** ## offset\_list Returns an array of values from consecutive rows starting at a relative offset. ``` offset_list(column, rowOffset, numValues) ``` | Parameter | Type | Description | | :- | :- | :- | | `column` | column reference | The column to get values from | | `rowOffset` | integer | Starting row offset. Negative = previous rows, positive = next rows, 0 = current row | | `numValues` | integer | Number of consecutive values to include | **Example** Get the current and two previous revenue values (a 3-period window): ``` offset_list(${orders.total_revenue}, -2, 3) ``` > [accordion] Compiled SQL > > ```sql theme={null} > ARRAY[ > LAG(${orders.total_revenue}, 2) OVER (ORDER BY ...), > LAG(${orders.total_revenue}, 1) OVER (ORDER BY ...), > ${orders.total_revenue} > ] > ``` *** ## list Constructs an array from multiple values. Unlike the other row functions, `list` does not use any windowing. ``` list(value1, value2, ..., valueN) ``` | Parameter | Type | Description | | :- | :- | :- | | `value1...valueN` | any | Values or expressions to combine into an array | **Example** Create an array of specific column values: ``` list(${orders.total_revenue}, ${orders.total_cost}, ${orders.total_profit}) ``` > [accordion] Compiled SQL > > ```sql theme={null} > ARRAY[ > ${orders.total_revenue}, > ${orders.total_cost}, > ${orders.total_profit} > ] > ``` # SQL templates Source: https://docs.lightdash.com/explore/table-calculations/sql-templates Copy-paste SQL patterns for common table calculations like running totals and rankings Most of these patterns don't need hand-written SQL. [Formula table calculations](/explore/table-calculations/formulas) have window functions such as `LAG`, `RANK`, `RUNNING_TOTAL`, and `MOVING_AVG`, and the [row functions](/explore/table-calculations/functions/row-functions) and [pivot functions](/explore/table-calculations/functions/pivot-functions) cover previous rows and pivot columns. Each template is a window function over your results table. Swap the `${table.column_...}` placeholders for your own fields, using the `${table_name.field_name}` format or autocomplete. The `ORDER BY` columns in a template should match the dimensions and sort order of your results table. Add every dimension in the results table, in the same order, so each row compares against the row directly above it. Columns sort ascending by default; add `DESC` to sort descending. For the percent templates, set the table calculation's format to **Percent** in the **Format** tab so the result shows as a percentage instead of a ratio. ![The Format tab of the table calculation editor with the format set to percent](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/table-calculations/sql-templates/format-percent-6d905aa48e29631b298dd27a38a8b183.jpg?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=0cdf734f62493aa4ea12be2f80c71643) ## Percent change from previous Divides each value by the value in the row above it, using `LAG` ordered by your results table's dimensions, then subtracts 1. The first row has no previous value, so it returns `NULL`. ```sql theme={null} ( ${table.column_i_want_to_compare} / LAG(${table.column_i_want_to_compare}) OVER ( ORDER BY ${table.column_I_want_to_order_by}, ${table.optional_other_column_I_want_to_order_by} ) ) - 1 ``` On a pivot table, table calculations run on the results before they're pivoted, so the pivoted dimension must be in the query. To compare each pivot column with the one before it for the same row, partition by the row dimension and order by the pivoted dimension. This month-over-month version uses `orders.country` as the row dimension and `orders.order_date_month` as the pivot: ```sql theme={null} ${orders.total_revenue} / NULLIF( LAG(${orders.total_revenue}) OVER ( PARTITION BY ${orders.country} ORDER BY ${orders.order_date_month} ), 0 ) - 1 ``` For year over year on monthly data, use `LAG(${orders.total_revenue}, 12)`. `LAG` counts rows, not months, so a month with no row for that country shifts the comparison. ## Percent of previous value Divides each value by the value in the row above it, using `LAG` ordered by your results table's dimensions. The first row returns `NULL`. ```sql theme={null} ${table.column_i_want_to_compare} / LAG(${table.column_i_want_to_compare}) OVER ( ORDER BY ${table.column_I_want_to_order_by}, ${table.optional_other_column_I_want_to_order_by} ) ``` ## Percent of column total Divides each value by the sum of the whole column. The empty `OVER()` makes the window every row in the results table. ```sql theme={null} ${table.column_i_want_to_see_the_percent_of_total} / SUM(${table.column_i_want_to_see_the_percent_of_total}) OVER() ``` ## Percent of group total Divides each value by the sum of its group. `PARTITION BY` splits the rows into groups by `column_i_want_to_group_by`, such as a month or a pivot dimension, and the sum restarts for each group. ```sql theme={null} ${table.column_i_want_to_see_the_percent_of_total} / SUM(${table.column_i_want_to_see_the_percent_of_total}) OVER ( PARTITION BY ${table.column_i_want_to_group_by} ) ``` ## Rank in column Numbers the rows by the column you want to rank. `DESC` gives the largest value rank 1; `ASC` gives the smallest value rank 1. To rank within groups, add a `PARTITION BY` clause before `ORDER BY`. ```sql theme={null} ROW_NUMBER() OVER ( ORDER BY ${table.column_i_want_to_rank} DESC ) ``` ## Running total Sums each value with every value above it. The window runs from the first row (`UNBOUNDED PRECEDING`) to the current row, in the order of your results table's dimensions. ```sql theme={null} SUM(${table.column_I_want_to_sum}) OVER ( ORDER BY ${table.column_I_want_to_order_by}, ${table.optional_other_column_I_want_to_order_by} ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) ``` ## Rolling window Sums the current row and the `N` rows before it, so a four-week window uses `N = 3`. Dividing one rolling sum by a second rolling sum gives a rolling average or ratio; drop the second `SUM` for a plain rolling total. Replace `N` with a number before you run it. ```sql theme={null} SUM(${table.column_I_want_to_sum}) OVER ( ORDER BY ${table.column_I_want_to_order_by} ROWS BETWEEN N PRECEDING AND CURRENT ROW ) / SUM(${table.second_column_I_want_to_sum}) OVER ( ORDER BY ${table.column_I_want_to_order_by} ROWS BETWEEN N PRECEDING AND CURRENT ROW ) ``` # Verified charts and dashboards Source: https://docs.lightdash.com/explore/verified-content Mark charts and dashboards as verified so your team can spot trusted content at a glance ![Verified dashboard with green checkmark badge showing 'Verified by tori whaley'](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/verified-content/dashboard-badge.jpeg?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=54d5b6e39945486a6f4423ed9d9bb051) Verified charts and dashboards let organization and project admins sign off on specific content so the rest of your team knows at a glance which charts and dashboards are trusted and approved. Each verified item gets a green checkmark badge that shows who verified it and when. Verification always reflects the current state of the content. If a chart or dashboard is edited by someone other than the verifier after being verified, the badge is automatically removed and an admin will need to re-verify the updated version. Edits made by the original verifier preserve the verified badge, since they're effectively re-approving the content as they save it. [https://www.loom.com/embed/2d2b4d46f10d498389c2061715708e54](https://www.loom.com/embed/2d2b4d46f10d498389c2061715708e54) ## Who can verify content Organization and project admins and developers can verify or unverify charts and dashboards. Users on other built-in roles (editors, interactive viewers, viewers, members) can see which content is verified, but cannot change verification status themselves. If you use [custom roles](/workspace-admin/custom-roles), grant the **Manage content verification** (`manage:ContentVerification`) scope to any role that should be able to verify or unverify content. ## Verifying a chart or dashboard Admins and developers can verify content directly from the chart or dashboard, or from the verification panel in project settings. They also have a dedicated verification panel under **Project settings** that lists all verified content and provides a central place to manage verification across the project. ![Verified content panel in project settings showing a list of verified charts and dashboards with their space and verifier](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/verified-content/admin-panel.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=c229fcc4a7dff8f93c9af7374417a1ae) [Data apps](/data-apps) can be verified too. Open the app, then choose **Verify** from its three-dot menu. The badge appears in the app's header with the verifier's name, and **Remove verification** in the same menu takes it off. ## Verifying through review requests Verification doesn't have to start with an admin. When someone submits a chart or dashboard from their personal space through a [review request](/explore/review-requests), the reviewer can tick **Verify on approve** — the content lands in its shared space already wearing the badge. This gives teams a single flow where everything that reaches shared spaces has been reviewed, and optionally verified, on the way in. ## Where users see verified content Once a chart or dashboard is verified, the green checkmark badge appears wherever that content is surfaced, including: * The homepage, so users can quickly spot approved content to start from * Chart and dashboard listings * Inside the chart or dashboard itself, along with the verifier's name and verification timestamp * [Search](/explore/search), which can be filtered by verified status — and ranks verified content and exact name matches at the top of results This makes it easy for teams to distinguish between exploratory or work-in-progress content and content that's been reviewed and approved. ![Homepage with a 'Verified' tab listing all verified charts and dashboards for quick access](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/verified-content/homepage-tab.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=95c5afd6c4c3656896af9738e4fe808a) ## AI agents prefer verified content When an [AI agent](/agents) searches your project for existing charts and dashboards to reference, admin-verified content is ranked first. If a verified chart or dashboard matches the user's question, the agent surfaces it ahead of unverified results and tells the user it's verified, including who verified it and when. This applies to: * The agent's content search, used when a question can be answered by an existing chart or dashboard * The agent's dashboard chart previews, where verified charts inside a dashboard are shown first Verification stays atomic per item: a chart inside a verified dashboard is only treated as verified by the agent if that chart itself has been verified. Verifying a dashboard does not cascade to its charts. You don't need to configure anything for this — any chart or dashboard you've verified is automatically preferred by every AI agent in the project. To benefit, verify the canonical charts and dashboards you want your team (and your agents) to start from. ### External agents and MCP Verified content is also exposed to external agents through the [Lightdash MCP](/agents/lightdash-mcp) `list_verified_content` tool. This lets tools like Claude, Cursor, or your own agents discover the charts and dashboards your team trusts and build on them instead of guessing. The tool returns both admin-verified content and [verified answers](/agents/verified-answers) that have been saved as charts or dashboards, deduplicated into a single list. Each item includes enough signal for an agent to rank and drill into it — `description`, `views`, and `lastUpdatedAt`, plus `chartKind` and `exploreName` for charts. As with in-product retrieval, verification is an absolute trump: a verified item is preferred over a more relevant but unverified one, with relevance order preserved within each group. This works hand in hand with [verified answers](/agents/verified-answers), where users mark answers an AI agent produced as good examples. When one of those answers is saved as a chart or dashboard, verifying it also makes it verified content — see [Verified answers and verified content](#verified-answers-and-verified-content) below. ## Who can edit or delete verified content Editing or deleting a verified chart or dashboard requires the usual permission to edit or delete that content, plus **Edit or delete verified charts and dashboards** (`manage:VerifiedContent`). The original verifier can also change the content without that additional scope. Developers and admins receive the scope by default; a custom role can grant it to other users. Without that scope or the original-verifier exception, verified content is read-only. Permission to edit verified content is separate from permission to preserve or apply its verified badge when saving. ## What happens to verification when content is edited Verification is tied to the exact state of the content at the time it was verified, so editing a verified chart or dashboard puts its badge at risk. To make sure the badge never disappears silently, Lightdash shows a confirmation dialog whenever you save changes to verified content. What you can do in that dialog depends on whether you're allowed to preserve verification: * **If you can verify content** (you have verify permission, or you're the original verifier), you're offered the choice to keep the badge as part of saving. Choosing **Save & verify** re-approves the current version and keeps the badge (updating the verification timestamp to your save); choosing **Save** drops it. * **If you can't verify content** (for example, a custom role that allows editing verified content but not verifying it), saving removes the badge. You're warned first and can cancel, but you can't keep it — someone with verify permission then needs to review the updated version and re-verify it. This guarantees a verified badge always reflects content that someone with verify permission has explicitly approved in its current form. ### What you see when saving verified content The confirmation dialog comes in two variants: * **If you can keep the badge** (verify permission or original verifier), you get a **Keep this verified after saving?** prompt with two options: **Save** drops the badge, and **Save & verify** keeps it and updates the verification timestamp to your save. Note there's no automatic retention — even the original verifier keeps the badge only by choosing **Save & verify**. * **If you cannot keep the badge**, you get a warning: *"Saving your changes will remove its verified status until someone verifies it again."* You can **Cancel** to back out, or **Save anyway** to save and drop the badge. For example, if a user with permission to edit verified content but not to verify it edits the **Ecom sales overview** dashboard (verified by someone else), they'll see the warning and can decide whether to save and drop the badge or cancel and let the verifier make the change instead. ## Verified answers and verified content Lightdash has two places you can verify something, and they now feed into each other: * **Verified content** — a saved chart or dashboard that someone with verify permission has approved. It gets the green badge and everything described on this page: listings, search, content-as-code, MCP, and in-product AI retrieval. * **[Verified answers](/agents/verified-answers)** — an answer an AI agent produced that a user marks as a good example inside a conversation. It trains that agent (few-shot examples, suggested questions, Slack replies). **When you verify an AI answer that has been saved as a chart or dashboard, it also becomes verified content** — the same green badge appears everywhere, and it shows up in search, content-as-code, and the `list_verified_content` MCP tool alongside admin-verified content. Removing verification from the answer removes it from both places too. A few things worth knowing about how the two interact: * **Only saved answers bridge.** An answer that lives only inside an agent conversation stays an agent example — it won't get a badge or appear in MCP until it's saved as a chart or dashboard. Save it first, then verify it, to make it verified content. * **The link is one-way.** Verifying an AI answer promotes the saved chart or dashboard to verified content. Verifying a chart or dashboard directly does *not* reach back and mark the originating agent answer. ### Still on the way One piece of the unified experience isn't here yet: using verified content as templates when the AI agent generates brand-new charts and dashboards. (Once a saved answer is verified, it already flows through content-as-code, search, and MCP like any other verified content.) ## Verification in charts and dashboards as code Verification status is included in [charts and dashboards as code](/workflow/content-as-code). When you run `lightdash download`, verified content includes verification metadata in the YAML, and `lightdash upload` can apply or remove the verified badge based on what your YAML says. ### Two fields: `verification` and `verified` Verified content has two related fields in the YAML: * **`verification`** — read-only audit metadata showing who verified the content and when. Emitted on download for visibility in version control. Ignored on upload. * **`verified`** — a boolean that controls verification state on upload. This is the field you edit to change verification. Here's what a verified chart looks like after `lightdash download`: ```yaml theme={null} name: Total orders slug: total-orders description: Count of all orders # ... other chart fields ... verification: verifiedAt: "2026-04-22T17:48:43.394Z" verifiedBy: firstName: David lastName: Attenborough userUuid: b264d83a-9000-426a-85ec-3f9c20f368ce verified: true ``` ### How `verified` behaves on upload The `verified` field has three states: | Value | Behavior on upload | | - | - | | `verified: true` | Verifies the content. No-op if already verified. | | `verified: false` | Unverifies the content. No-op if already unverified. | | `verified` absent | Leaves verification state unchanged. | The "absent = leave alone" semantic means that downloading and re-uploading a YAML file you haven't touched will not unintentionally change verification state, even if you delete the `verified` line. ### Permissions Only users with permission to verify content (admins, developers, and any custom role granted `manage:ContentVerification`) can change verification state via the CLI. If you upload a YAML containing `verified: true` or `verified: false` but you don't have verify permissions, the upload still succeeds — the rest of your changes go through, but the verification field is silently skipped and a warning is logged on the server. This means CI pipelines run by deployers without verify permission (for example, a custom role that has `manage:ContentAsCode` but not `manage:ContentVerification`) won't fail just because a YAML file contains a `verified` field they can't act on. # Version history Source: https://docs.lightdash.com/explore/version-history Roll back to earlier versions of charts and dashboards in Lightdash ## Charts ### Exploring version history To access version history, click on the `Version History` option under the three dot menu when viewing or editing a chart. ![A chart's three-dot menu open, with Version History in the list](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/version-history/version-history.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=a8cacb1a06ea637e1fc4fa8a55f5ff77) This takes you to the version history of the chart where you can see the previous versions of the chart including information around who authored the previous versions as well as when they were udpated. You can preview any previous version by clicking on it. ![The version history view, listing each previous version with its author and update time beside a preview of the selected one](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/version-history/version-history-explorer-ba442ad1aba9dbbef26fd2b7eff21eef.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=46d4f78a3f9cbf6be39a03e65a6b6116) Once you're happy with the version you want, you can click on the three dot menu next to the version you want to restore the chart to. Lightdash saves all iterations of your chart, so reverting to a previous version does not delete any existing history. ![The three-dot menu open next to a version in the history list, with the option to restore the chart to it](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/explore/version-history/version-history-selection-9a266ef03efb84ab3567e1ac80eeedab.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=29413f47a837c5ad1dd1439d78740146) ## Dashboard + charts Rolling back a dashboard to a previous version rolls back every chart saved within that dashboard, not just the layout, filters, and tile positions. Pick any point in your dashboard's history and get the exact view your users saw back then: same chart configs, same fields, same formatting. > [!NOTE] > > Only charts saved **within** the dashboard are affected by a rollback. Charts saved in a space are not changed when you restore a dashboard version. To roll back a dashboard: 1. Open the dashboard you want to restore. 2. Click the three-dot menu and select **Version History**. 3. Browse previous versions and click one to preview it. 4. When you find the version you want, click the three-dot menu next to it and select **Restore**. > [!NOTE] > > Restoring a dashboard version also restores every chart saved within that version. Any changes made to those charts after the selected version will not appear once you roll back. ### Known limitations Dashboard version history only tracks changes to the dashboard itself (layout, filters, tile positions). Chart changes are not recorded as separate dashboard versions — when you roll back, chart versions are restored based on the **timestamp** of the dashboard version you select. This means you can't selectively revert a single change. For example, if you: 1. Create a dashboard. 2. Add a chart (bar chart). 3. Edit the chart to be a line chart. 4. Add a filter to the dashboard. Rolling back step 4 from the dashboard version history will also revert step 3, because both chart versions are tied to dashboard version timestamps and only steps 1 and 2 exist as dashboard versions. For more granular control over chart changes, use the chart's own version history instead. ## Recently deleted charts and dashboards When soft delete is enabled, charts and dashboards deleted within the retention window (30 days by default) can be restored or permanently deleted from the **Recently deleted** page in project settings. You need access to the project. Users with **Manage soft-deleted content** (`manage:DeletedContent`) can review and manage items deleted by other users. Without that permission, you can only see and manage items you deleted. To access it, go to **Project settings** → **Recently deleted**. For each item you'll see who deleted it and when, along with options to: * **Restore** the item back to its original space. * **Delete permanently** to remove it immediately. Confirm **Delete permanently** in the dialog; the item can no longer be restored. Items in **Recently deleted** are automatically purged after the configured retention window. > [!NOTE] > > [Self-hosted](/support/feature-badges#self-hosted) Soft delete is opt-in. Set `SOFT_DELETE_ENABLED=true` to route deletes through **Recently deleted** instead of removing items immediately, and optionally set `SOFT_DELETE_RETENTION_DAYS` (default `30`) to change the retention window. See [environment variables](/self-host/customize-deployment/environment-variables). ## How much history is kept? Lightdash shows every saved version of a chart or dashboard within your retention window. The retention window depends on the tier of Lightdash Cloud you're using: * Cloud Pro: 30 days * Cloud Enterprise: 60 days Speak to the team if you're interested in moving tier to get access to more history. # Getting started Source: https://docs.lightdash.com/get-started Set up your first Lightdash project and learn the fundamentals Start with the [Quickstart](/get-started/quickstart) to get your dbt project Lightdash-ready, connect your warehouse, and invite your team. From there, pick the track that matches what you're doing next. If you're analyzing data, **Explore your data** walks through querying Tables, building charts and dashboards, and sharing insights. If you're building the semantic layer, **Build your semantic layer** covers adding Tables and creating metrics and dimensions. To learn a feature by trying it, open [Learn](/explore/learn) from the top bar. Its guided walkthroughs run on a sample project, so nothing you do touches your real projects. # Agentic onboarding with Aurora Source: https://docs.lightdash.com/get-started/agentic-onboarding Sign up, connect a warehouse, and chat with Aurora before any dbt models exist [Beta](/support/feature-badges#beta) > [!NOTE] > > Agentic onboarding is gated by a feature flag. Contact Lightdash > support to enable it for your organization or instance. Agentic onboarding is a guided flow for brand-new organizations. You sign up with an email, set up your organization, connect a warehouse, and land on a provisioned **Getting started** homepage where **Aurora** — a default AI agent Lightdash creates for the new project — is ready to chat. Because Aurora runs in SQL mode from day zero, you can query your warehouse before you've built any dbt models, semantic layer, or explores. ## When to use it Use agentic onboarding when you want to: * Evaluate Lightdash against a warehouse without preparing a dbt project first. * Get a working AI agent that can answer questions using the warehouse catalog directly. * Hand off the semantic-layer buildout to a coding agent (Claude Code, Cursor, etc.) and keep an analyst-facing chat live in the meantime. If you already have a dbt project you want to connect, use the standard [Quickstart](/get-started/quickstart) instead. ## Prerequisites Agentic onboarding is gated by a single feature flag: * `new-onboarding` — turns on the whole journey as one unit: email-only signup (an anonymous, instance-wide flag on the register page), the full-page organization setup, and the dbt-less warehouse-connect flow. Off by default. For the day-0 chat and the provisioned homepage you also need: * The AI copilot feature flag on the organization — required for Aurora to be auto-provisioned and for the chat composer to create real threads. * The homepage-builder feature flag on the organization — required for Lightdash to provision the **Getting started** homepage when the first project is created. If AI copilot isn't enabled, the flow still completes but the day-0 chat composer is rendered disabled with an explainer callout. Enable copilot to unlock the live chat. ## The flow **1. Email-only signup** A new user registers with just an email address — no password, no dbt setup, no name. Ownership is proven via the existing email OTP verification. For example, `alex@ecom-store.com` can sign up in one step and set a password later from settings or a password reset. **2. Full-page organization setup** A full-page setup screen collects the organization name, appearance, and a short "tell us about yourself" section. When the signup email uses a company domain, Lightdash pulls the brand (logo, colors) from that domain via Brandfetch as a starting point. You can override anything before continuing. **3. Data-source picker (`/onboarding/data-source`)** Pick a warehouse from a two-tier picker: * **Most popular** — a hero row featuring **BigQuery** and **Snowflake** with SSO-oriented subtitles. * **All warehouses** — a compact grid with Postgres, Redshift, Databricks, Trino, ClickHouse, DuckDB, and Athena. Two warehouses have smart defaults tuned for the onboarding path: * **Snowflake** — **Connect via CLI (SSO)** is pre-selected as the authentication method, with an account-identifier placeholder to guide you (for example `xy12345.us-east-1`). * **BigQuery** — when the **Sign in with Google** (user-account SSO) auth method is selected, the project, location, dataset, and advanced fields stay hidden until you sign in. Once the SSO check resolves, the project and dataset become autocompletes backed by the resources your account can access, and picking a dataset auto-fills the location (still editable). Keyfile auth keeps the manual inputs. Not the person who owns the warehouse credentials? Use **Invite a teammate to connect the warehouse** — see [Handing warehouse connect to a teammate](#handing-warehouse-connect-to-a-teammate) below. **4. Warehouse-only project creation** The connect form is the standard warehouse settings form without the dbt project step and without the general settings section — you can rename the project later. Submitting **Test & save** creates a warehouse-only project in your organization. No dbt models are required. The per-warehouse schema or dataset field renders inside the warehouse card so BigQuery has a dataset input and Postgres has a schema input, even in this dbt-less flow. **Test & save** stays disabled until every required field for the selected warehouse and auth variant is filled in — for example Snowflake password vs. key-pair, Databricks PAT vs. OAuth, Athena access keys, or MotherDuck credentials. Editing an existing project keeps its previous behavior of accepting blank secrets as "keep existing". **5. Project ready checklist (`/onboarding/project-ready/:projectUuid`)** A staged checklist runs against the real warehouse catalog: * Connecting to warehouse * Reading schemas (with the schema count from the catalog) * Indexing tables & columns (with the table count from the catalog) When the checklist finishes, Lightdash fires a one-shot confetti burst and hands you off to the provisioned homepage. **6. Getting started homepage** You land on a custom homepage Lightdash provisioned when the project was created. It contains: * An **ask-AI hero** with a greeting and a chat composer bound to the Aurora agent. * A **recommended actions** checklist rendered inside the hero (see below). * A **quick actions** row with shortcuts to ask AI, run a query, browse dashboards, and browse spaces. The composer opens threads with **SQL mode enabled** whenever the project has no dbt connection and you can use the SQL runner, so Aurora can answer using warehouse discovery tools before any semantic layer exists. If you get to the app before a project exists (for example the homepage hasn't been provisioned yet), Lightdash lands you on `/get-started` — a day-0 page with the greeting, an inert ask composer, and the recommended-actions checklist. This replaces the old redirect to `/createProject`. ## Handing warehouse connect to a teammate If you're the founder or business owner setting up Lightdash but don't have your warehouse credentials, you can hand the warehouse-connect step to a teammate without leaving the flow. The onboarding footer opens an **Invite a teammate** modal that sends a task-framed **setup invite**: * The invite is a new type of invite link with `purpose: setup` and always carries the **admin** role, which is required to create a project. Setup invites can't be silently downgraded. * If you don't have a name on your profile yet (email-only signup), the modal asks for your first and last name so the invite email can attribute you personally; those values are saved back to your account. * The email is sent from the current template system and explains what Lightdash is, why the invitee is being asked, and that accepting leads straight to connecting the warehouse. When your teammate clicks the emailed link: * Under the `new-onboarding` flag they see a single **Continue as `teammate@ecom-store.com`** card — no password, name, or SSO form. Clicking it hits a passwordless activation endpoint that provisions the pending user, marks the email verified (opening the emailed single-use link proves mailbox ownership), consumes the invite, and logs the session in. * They land on the warehouse connect screen. If they haven't completed the "About you" interstitial, it carries a redirect param so they return to onboarding rather than the app root. * Activation is a click-triggered POST so mail scanners that prefetch the link can't consume the invite. Instances with password authentication disabled, and any environment with the flag off, keep the legacy invite-accept flow with the full form. ## Aurora auto-provisioning When the first non-preview project is created in a new organization, Lightdash provisions a default AI agent server-side: * The agent is named **Aurora** and is created with data access enabled and SQL mode available. * **User context is enabled by default** on Aurora so the agent can address the user by name and collect a missing name from an email-only signup (see [Name collection](#name-collection-from-email-only-signup) below). User context stays opt-in for every other agent — existing agents are unaffected. * Provisioning is gated on AI copilot being enabled for the organization. If copilot is disabled, provisioning is skipped and the day-0 chat is rendered disabled. * The operation is **idempotent** — repeated project-creation events on the same organization won't create duplicate Aurora agents. * Provisioning is **non-throwing**. If it fails for any reason, project creation still succeeds and you can create an agent manually from [Set up agents](/agents/set-up-agents). * The `ai_agent.created` analytics event carries an `autoProvisioned: true` flag so this path can be distinguished from a manually-created agent in analytics. Preview projects don't get an auto-provisioned agent — the flag only applies to real projects that would receive an agent anyway. ## Provisioned Getting started homepage When the first project is created, Lightdash also provisions a **Getting started** homepage published to everyone in the organization. The homepage config is fixed and contains: * An ask-AI hero with `showGreeting: true` and `showRecommendedActions: true`. * A quick-actions row (ask AI, run a query, browse dashboards, browse spaces). Homepage provisioning is idempotent and never fails project creation — if it fails, the project is still created and the standard homepage is shown. You can edit or replace this homepage later from the homepage builder. ### Recommended actions checklist The ask-AI hero renders a recommended actions checklist as a rotating carousel. The fixed action list is: * **Connect warehouse** — unskippable; hidden once complete. * **Add a semantic layer** — hidden until a project exists. * **Connect source control** — provider-neutral, detecting GitHub or GitLab installations. Hidden on instances without either integration configured. * **Connect Slack** — hidden on instances without a Slack integration configured. Behavior: * One incomplete card is shown at the top of a stack of "up next" cards. Users can move up and down through the incomplete cards. * Skippable actions have a **Skip** control; the connect-warehouse step is deliberately unskippable so users aren't stranded with an inert composer. * Skipped and completed state is persisted per project in local storage. * The stack **auto-rotates** every 10 seconds, pausing when the user hovers the stack. ### Ask input with schema-grounded suggestions The homepage ask composer creates real Aurora threads and enables SQL mode automatically when the project has no dbt connection and the user can use the SQL runner. Prompt-chip suggestions above the composer are also grounded in the warehouse: * On projects with explores or verified content, chips are drawn from those signals. * On a fresh, dbt-less project with zero explores, chips are grounded in the real, fully-qualified warehouse tables (`database.schema.table`) so Aurora can answer via `runSql` against tables that actually exist — instead of showing generic "set up your data" prompts. * In that zero-explores mode, chips are **SQL-only**. Aurora won't offer prompts that ask for charts, visualizations, dashboards, or dashboard tiles, because the visualization tools require semantic-layer explores that don't exist yet. Every chip is a plain data question answerable with a SQL result. ## SQL mode on day zero Threads Aurora opens from the homepage composer run in SQL mode whenever the project has no dbt connection and you have SQL runner access. This matters on a warehouse-only project: * Without any dbt models, the project has zero explores and zero semantic-layer content. * In SQL mode, Aurora uses the warehouse discovery tools (list schemas, list tables, describe columns, run SQL) instead of only searching explores. * The zero-explores system prompt is tuned so Aurora will offer warehouse-catalog answers rather than telling you there is no data. You can turn SQL mode off later once you've built explores; see [Data access](/agents/data-access) for how SQL mode interacts with agent permissions. If AI copilot is disabled for your organization, the homepage composer is rendered disabled with an explainer, and no agent thread is created. ## Name collection from email-only signup Email-only signup registers users without a first or last name, so Aurora doesn't know what to call you at day zero. Because Aurora is auto-provisioned with user context enabled, its requesting-user prompt detects the missing name and: * Answers your request first — Aurora never blocks on collecting a name. * Politely asks for your first and last name once, at a natural moment (typically at the end of the first reply). * Saves the name to your user profile via the `updateUserName` agent tool and greets you by first name from then on. * Doesn't ask again in the same conversation if you decline or ignore the request. The `updateUserName` tool is agent-only and only exposed when the prompt identity is trusted (user context is enabled on the agent and the sender is verified). It isn't exposed to MCP clients. If you later want to change the name yourself, you can either ask Aurora to correct it or update it from your account settings. ## Coding-agent handoff prompt From the connect flow, you can also copy a prompt to run in your coding agent (Claude Code, Cursor, or similar). The agent uses that prompt to finish setting up the semantic layer — building the dbt project, models, and metrics — on top of the warehouse you just connected. The agent models one focused use case, the smallest one that the warehouse and your repository give evidence for, rather than every table your credentials can reach. It extends your dbt project if the repository has one, or writes [Lightdash YAML](/semantic-layer/yaml) models if not, then builds a starter dashboard for that use case. Tables outside it don't appear in Explore until you model them, in dbt or Lightdash YAML, yourself or by asking your coding agent to extend the models. The copiable prompt includes the **configured database and schema** from the project's warehouse connection, alongside the warehouse type and prepared project UUID: ```markdown theme={null} # Complete Lightdash project setup ## Prepared setup - Warehouse type: snowflake - Prepared project UUID: 00000000-0000-0000-0000-000000000000 - Configured database: ANALYTICS - Configured schema: PUBLIC ## Next step Fetch and follow the remaining instructions from: https://app.lightdash.cloud/api/v1/prompts/project-onboarding Use the prepared setup values above whenever those instructions refer to a setup value. ``` Credentials from the warehouse connection are never included in the prompt. Only the non-sensitive `database` and `schema` fields are copied, so the coding agent knows where in the warehouse to focus. The database and schema fields are derived from the warehouse connection you saved, and are mapped consistently across warehouse types: | Warehouse | Database | Schema | | - | - | - | | Snowflake, Athena | `database` | `schema` | | Postgres, Redshift, Trino | `dbname` | `schema` | | BigQuery | `project` | `dataset` | | Databricks | `catalog` | `database` | | ClickHouse | — | `schema` | | DuckDB (Ducklake) | `catalogAlias` (defaults to `ducklake`) | `schema` | The onboarding instructions the coding agent follows also changed: * The agent is told to use the warehouse type, project UUID, and — when listed — the configured database and schema from the prompt. * When running the broad catalog query, the agent is instructed to **prioritize tables in the configured database and schema** (matching names case-insensitively) unless repository evidence points elsewhere. * If the catalog spans many databases or schemas and neither the configured connection nor repository evidence identifies where to look, the agent is told to **ask you which database and schema to use** before continuing. This keeps the coding agent focused on the warehouse location the project is already pointed at, instead of picking arbitrary tables from anywhere the credentials happen to reach. ## After onboarding Once you're chatting with Aurora, the project behaves like any other Lightdash project: * Add more agents or customize Aurora from [Set up agents](/agents/set-up-agents). * Build out the dbt project and semantic layer either by running the coding-agent prompt above, or by following the [Quickstart](/get-started/quickstart). * Invite the rest of your team — see [Invite your team](/workspace-admin/invite-new-users). # Build your semantic layer Source: https://docs.lightdash.com/get-started/build-your-semantic-layer Install the CLI, add Tables, and define the metrics and dimensions your whole team explores This track is for people who build in Lightdash. Everything you expose for BI is written as code in your dbt project, so the developer journey runs through the Lightdash CLI: you generate Tables from your models, then define the metrics and dimensions your team explores. Each step below gets you moving, then links to the page that covers it in full. ## 1. Install and authenticate the CLI The CLI is how your dbt project reaches Lightdash. Install it, then log in to link it to your instance. ```bash theme={null} brew tap lightdash/lightdash brew trust lightdash/lightdash brew install lightdash lightdash login https://your-instance.lightdash.cloud ``` See [installing the CLI](/workflow/cli/install) and [authenticating](/workflow/cli/authenticate). To build conversationally with an AI coding agent, also [install the Lightdash skills](/workflow/install-agent-skills). ## 2. Choose which models become Tables Tag the dbt models you want to expose, so staging and intermediate models stay out of Lightdash: ```yaml theme={null} models: - name: model_name config: tags: ['lightdash'] ``` Then point your project's Tables configuration at that tag. See [choosing which Tables appear](/semantic-layer/tables#choosing-which-tables-appear-in-lightdash). ## 3. Generate your YAML `lightdash generate` writes a starting YAML file for each model, with an entry for every column, so you're editing rather than authoring from scratch. ```bash theme={null} lightdash generate -s model_name ``` See [`lightdash generate`](/workflow/cli/generate). ## 4. Define dimensions Dimensions are the attributes your team groups and filters by. Each one is a column in your model, declared in its YAML. See [dimensions](/semantic-layer/dimensions) for the full set of configuration options, formatting, and additional dimensions. ## 5. Define metrics Metrics are the aggregations your team measures. Defining them once here is what keeps everyone's numbers consistent. See [metrics](/semantic-layer/metrics) for every metric type and configuration option. You can also start from the Explore view: build a custom metric or dimension there, then use [dbt write-back](/integrations/dbt/write-back) to open a pull request that adds it to your dbt project. For changes across several files, ask an agent with [AI writeback](/agents/ai-writeback). ## 6. Preview before you deploy `lightdash preview` spins up a temporary project from your local changes so you can check your work against real data without touching production. ```bash theme={null} lightdash preview ``` See [preview projects](/workflow/preview-projects). ## 7. Deploy to production Once the preview looks right, deploy the changes to your production project. ```bash theme={null} lightdash deploy ``` See [`lightdash deploy`](/workflow/cli/deploy), and [set up CI/CD](/workflow/set-up-ci-cd) to run this automatically on merge. ## Where to go next The rest of the [Workflow](/workflow) area covers the software lifecycle around your project: [preview environments](/workflow/preview-projects), [pull request checks](/workflow/pull-requests), [content as code](/workflow/content-as-code), and [validating your content](/workflow/validating-your-content). Prefer to watch first? This overview walks through the Lightdash developer workflow end to end. [https://www.loom.com/embed/09b65e2d8d984d15985002a49a832f57](https://www.loom.com/embed/09b65e2d8d984d15985002a49a832f57) # Explore your data Source: https://docs.lightdash.com/get-started/explore-your-data Query Tables, build charts and dashboards, and share insights with your team This track is for people who analyze data in Lightdash. It walks the explorer journey end to end: find your way around the content your team has already built, run your own explorations, and turn the results into charts and dashboards you can share. Each step below gets you moving, then links to the page that covers it in full. Prefer to learn by doing? [Learn](/explore/learn) has guided walkthroughs for many of these steps, on a sample project you can change freely. ## 1. Find what your team has already built Most questions are already answered by an existing chart or dashboard. Start from the homepage, which surfaces recently viewed and pinned content, and use the search bar to jump straight to a chart, dashboard, or field by name. See [search](/explore/search) for search filters and grouping, and [spaces](/explore/spaces) for how content is organized and shared. ## 2. Get to know metrics and dimensions Every query in Lightdash is built from two kinds of field. **Dimensions** are the attributes you group and filter by — a country, a date, a customer name. **Metrics** are the aggregations you measure — a count of orders, a sum of revenue. Your team defines both once so that everyone's numbers agree. For the full field reference, see [dimensions](/semantic-layer/dimensions) and [metrics](/semantic-layer/metrics). ## 3. Run your own query Open a Table and you're in the Explore view: pick the dimensions and metrics you want, sort the results, and Lightdash writes the SQL for you. From there you can chart the results and save them. See [the Explore view](/explore/explore-view) for selecting fields, sorting, building a chart, and saving it. ## 4. Narrow the results with filters Filters cut your query down to the rows you care about — one country, last quarter, orders above a threshold. See [filtering in the Explore view](/explore/explore-view/filter) for where to add them, and the [filters reference](/explore/filters-reference) for every filter type and operator. ## 5. Share what you find Send a colleague a link to exactly what you're looking at, save a chart into a space so the team can find it later, or download the results. See [sharing charts](/explore/share-charts). ## 6. Build a dashboard A dashboard collects charts onto one canvas so a question stays answered. Add saved charts or build new ones inline, arrange them into tabs, and share the result. See [dashboards](/explore/dashboards). ## 7. Use dashboards other people built Dashboards aren't read-only. Filter them to your slice, change the date granularity, click a point to filter the rest of the tiles, and drill into any number to see the rows behind it. See [interacting with dashboards](/explore/dashboards/interact). ## Video guides If you prefer watching over reading, check out the videos below. These use data available in [demo.lightdash.com](https://demo.lightdash.com), so you can follow along. The videos are split into chapters, so you can jump to the part you need using the progress bar. The first video covers the **fundamentals** of Lightdash: dashboards, charts, metrics, dimensions, and how to explore data on your own. [https://www.loom.com/embed/3baada5e1d9e479da0dbe12e8a54121e?sid=2527066a-c9df-416c-b4a6-68e920029519](https://www.loom.com/embed/3baada5e1d9e479da0dbe12e8a54121e?sid=2527066a-c9df-416c-b4a6-68e920029519) For **advanced functionality** — custom metrics, table calculations, advanced chart configuration, and more — check out the video below. [https://www.loom.com/embed/ffcb6754146a49b9acc6fb5e5e90e7a3?sid=91a43128-7b36-438d-94b3-e7a0425d0baf](https://www.loom.com/embed/ffcb6754146a49b9acc6fb5e5e90e7a3?sid=91a43128-7b36-438d-94b3-e7a0425d0baf) # The Lightdash Way Source: https://docs.lightdash.com/get-started/lightdash-way Giving everybody in your company the building blocks to answer their own questions Lightdash is where the data team (the builders) and the rest of the business (the people asking the questions) come together to make better data-driven decisions. We have some pretty strong opinions about how this relationship between the data team and the rest of the business should work. So, we thought it would be useful to explain the principles that make up The Lightdash Way. The Lightdash Way isn't just semantics - it's about the entire experience of enabling everybody in your company to answer their own data questions. But, we'll start off slow and just go through one of the principles for now: > How should you serve data to people who want to answer their own data questions? ** The Lightdash Way:** **Give end users meaningful building blocks to answer their own data questions.** Let me explain what we mean... ## We've come across three ways to let people answer their questions using data: *I hope it's obvious which one is our fave* 1. You give everyone access to the raw data. 2. If you have a data question, you ask the data builders, and they just give you complete answers. ** The Lightdash Way:** 3. The data builders give you meaningful building blocks to answer your own data questions. ### 1. You give everyone access to the raw data. If everybody in your organization knows SQL and everyone has the context they need to query the raw data (...and unicorns were real 🦄...), then giving everyone access to the raw data wouldn't be that bad. But, if a single person doesn't know SQL then they're totally dependent on someone helping them with a data question...no bueno. : very flexible, totally self-serve (as long as everyone knows SQL) : everybody has to know sql, everybody needs context of raw data, duplicated work, bound to be errors ### 2. If you have a data question, you ask the data builders, and they just give you complete answers. If nobody knows SQL or they aren't willing to explore data themselves, then dedicated team members (probably data analysts) will be completely responsible for exploring data. Everybody relies on the data team for answer questions. : only analysts have to have data skills, fewer errors (since only data experts are answering data questions) : doesn't scale, analysts become a bottleneck, this kind of work sort of sucks :( ### 3. The data builders give you meaningful building blocks to answer your own data questions. ** The Lightdash Way:** We give your data team the tools they need to build metrics + dimensions that everyone else can use in a user-friendly interface. With this approach, you leave the SQL to the experts: your data team. They become force-multipliers when they create these pre-defined metrics + dimensions in SQL because anybody in the business can combine, segment, and filter them to answer their own questions. The downside is that the data team need to spend some time defining and maintaining the library of metrics. But, a small set of metrics can power a huge amount of different analyses, enabling the rest of your team to answer their own data questions. : you only need a few SQL experts, anyone can ask questions using the data, fewer errors, scaleable : you need a data team, this system needs maintenance ## When we aggregate data, we add value. Giving people useful building blocks makes it easier for them to self-serve and answer their own questions. We believe that this way of sharing data insights is a core part of the experience of everyone being able to answer their own data questions. It's the foundation of a healthy, happy relationship between data builders and the people asking the questions 👯‍♀️. # Migrating from another BI tool Source: https://docs.lightdash.com/get-started/migrate-from-another-bi-tool Move reports, dashboards, and modeling logic out of an existing BI tool into Lightdash Use this guide when you're replacing an existing BI tool with Lightdash. It works for any source tool — Looker, Tableau, Power BI, Metabase, Mode, Sigma, or an in-house solution — because the process is the same: extract what you have, translate the modeling into Lightdash YAML or dbt, and rebuild the dashboards on top of your new semantic layer. The steps below are designed to be followed in order. You'll do most of the modeling work with an AI coding agent (Claude Code, Cursor, or Codex) using Lightdash skills, and finish by rebuilding the dashboards visually in Lightdash. Before you start, make sure you have: * A Lightdash project connected to your warehouse. See the [Quickstart](/get-started/quickstart). * Admin (or export-equivalent) access to the BI tool you're migrating from. * A dbt project (or an empty repo where one will live) connected to the same warehouse. ## 1. Install the Lightdash CLI and skills The AI-assisted path is by far the fastest way to migrate. Install the CLI and skills first so your coding agent knows how to write Lightdash YAML, metrics, and dashboards correctly. **1. Install the Lightdash CLI** Follow [Install the CLI](/workflow/cli/install) and [Authenticate](/workflow/cli/authenticate) against your Lightdash project. **2. Install Lightdash skills** Run this from your dbt or YAML project root: ```bash theme={null} lightdash install-skills ``` This installs skills into `.claude/skills/` (also read by GitHub Copilot). For Cursor or Codex, pass `--agent cursor` or `--agent codex`. To share across projects, add `--global`. See [Install agent skills](/workflow/install-agent-skills) for all options. **3. Confirm your agent picks up the skills** In Claude Code, prefix migration prompts with `/developing-in-lightdash` so the agent uses the Lightdash context. Cursor and Codex pick the skills up automatically. ## 2. Set up your migration workspace Before touching your source BI tool, get a clean workspace ready to receive the migrated content. **1. Create a migration branch in your dbt or YAML repo** Work on a branch (for example `migration/from-looker`) so you can iterate without affecting production models. **2. Create a Lightdash preview project** Use a [preview project](/workflow/preview-projects) or a separate development project so the migrated content is isolated until you're ready to promote it. This gives you a safe place to validate metrics against the source tool. **3. Create a working folder for source exports** In the repo, add a folder like `migration/source/` to hold everything you export from the source tool (LookML, `.twb` files, `.pbix` unpacks, question JSON, screenshots). Your agent will read from this folder. ## 3. Extract your source information Pull every piece of information out of the source BI tool that Lightdash will need to rebuild the reports. What you extract depends on the tool, but the goal is the same: capture the modeling logic, the queries, and the visual layout. Choose the option that matches your source tool. If more than one applies, do them all — the more source material your agent has, the better the translation. ### Modeling logic as code If the source tool stores modeling logic in files, export those files first. This is the highest-signal input for the migration. * **Looker** — clone the LookML project (`.lkml`, `.view.lkml`, `.model.lkml`, `.dashboard.lookml`). * **dbt-based tools** (Metabase Metrics Layer, Mode with dbt) — you already have the source; note which models are actually used by the reports. * **Sigma / Hex / Omni** — export workbook or dataset definitions as JSON or YAML where the tool supports it. Copy the files into `migration/source/` in your repo. ### Workbooks and reports as files If the source tool stores reports as binary or archive files, unpack them so the agent can read the SQL and field definitions. * **Tableau** — save workbooks as `.twbx` (packaged) then unzip to expose the underlying `.twb` XML. The XML contains data source definitions, calculated fields, filters, and worksheet layouts. * **Power BI** — export `.pbix` files and unpack them (for example with a `.pbix` viewer or `pbi-tools`) to extract the data model, DAX measures, and report layout as JSON/XML. * **Mode / Metabase / Redash** — export questions or reports as SQL. Group them by dashboard so you know which queries feed which report. Put the extracted files under `migration/source//`. ### API extraction For SaaS BI tools without a file export, pull the definitions through the API. This is usually the best route when there are hundreds of reports and manual export isn't practical. * **Looker** — [Looker API](https://cloud.google.com/looker/docs/reference/looker-api/latest) endpoints for `looks`, `dashboards`, and `queries`. * **Tableau** — [Metadata API](https://help.tableau.com/current/api/metadata_api/en-us/index.html) for workbooks, data sources, calculated fields, and lineage. * **Power BI** — [REST API](https://learn.microsoft.com/en-us/rest/api/power-bi/) for datasets, reports, and DAX definitions. * **Metabase** — `/api/card` and `/api/dashboard` for questions and dashboards. * **Mode** — `/api/{workspace}/reports` for reports and their queries. * **Amazon QuickSight** — the AWS CLI. Use [`describe-dashboard-definition`](https://docs.aws.amazon.com/cli/latest/reference/quicksight/describe-dashboard-definition.html) for one dashboard's JSON definition, or [`start-asset-bundle-export-job`](https://docs.aws.amazon.com/cli/latest/reference/quicksight/start-asset-bundle-export-job.html) with `--export-format QUICKSIGHT_JSON` and `--include-all-dependencies` to export dashboards together with their datasets. Write a small script to dump the responses to JSON in `migration/source/api/`. Include the raw SQL, field definitions, filters, and any joins. ### Direct SQL For everything else — bespoke reports, undocumented queries, ad-hoc dashboards — capture the executed SQL. Query your warehouse's query history (Snowflake `QUERY_HISTORY`, BigQuery `INFORMATION_SCHEMA.JOBS`, Redshift `STL_QUERY`) filtered to the BI tool's service user to see what actually runs in production. Save the top queries by frequency into `migration/source/sql/`. ## 4. Take screenshots of the source dashboards Screenshots are the reference for rebuilding the visual layer. Your coding agent can't see the source tool, so it needs the images to match layout, chart types, and filter positions. **1. Capture each dashboard end to end** Take a full-page screenshot of every dashboard you're migrating. Include the filters, tab structure, and any drilldowns. **2. Capture chart-level detail where it matters** For complex visualizations (custom colors, conditional formatting, mixed chart types), take a zoomed-in screenshot too. Also grab the underlying query where the source tool exposes it. **3. Store screenshots alongside the source files** Save them under `migration/source/screenshots/`, named by dashboard. Reference them in your prompts so the agent uses them when rebuilding layouts. ## 5. Translate the modeling into Lightdash With everything extracted, use your coding agent to translate the source modeling into Lightdash's semantic layer. Do this in passes — models first, then metrics, then joins — rather than all at once. **1. Prompt the agent to profile the warehouse and read the source** Point the agent at both the source files and your warehouse schema. For example: ``` /developing-in-lightdash Read the LookML files under migration/source/looker/ and profile the corresponding tables in our warehouse. For each Looker view that underlies a dashboard in migration/source/screenshots/, propose a Lightdash model with matching dimensions and metrics. Do not create files yet — list the models and metrics you plan to create. ``` Review the plan before letting it write files. **2. Generate models one source at a time** Ask the agent to write the Lightdash YAML (or dbt `meta` tags) for one source at a time. See [Lightdash YAML](/semantic-layer/yaml) for the format. After each file, run: ```bash theme={null} lightdash lint ``` Fix errors before moving on. **3. Translate metrics, calculated fields, and measures** Map source metric types to Lightdash [metric types](/semantic-layer/metrics). Common mappings: | Source | Lightdash | | - | - | | Looker `measure: sum` | `type: sum` metric | | Looker `measure: count_distinct` | `type: count_distinct` metric | | Tableau calculated field (agg) | Lightdash metric with `sql` | | Power BI DAX `SUMX` / `CALCULATE` | Lightdash metric, or a dbt column plus a `sum` metric | | Metabase custom expression | Lightdash metric with `sql`, or a [table calculation](/explore/table-calculations) if it's row-level | Ask the agent to add descriptions and categories so the migrated fields land in the [metrics catalog](/explore/metrics-catalog) cleanly. **4. Rebuild joins** Translate source joins to Lightdash [joins](/semantic-layer/joins). Specify the relationship (`one-to-many`, `many-to-one`, `one-to-one`) — this is what unlocks correct fan-out handling. **5. Deploy to your preview project** ```bash theme={null} lightdash deploy ``` Then run [`lightdash validate`](/workflow/cli/validate) to catch broken references. ## 6. Rebuild the dashboards With the semantic layer in place, rebuild the dashboards on top of it. **1. Rebuild charts against the migrated tables** Open each source dashboard screenshot side by side with Lightdash. For each chart, build the equivalent in Lightdash using the migrated metrics and dimensions. See [Configure charts](/explore/configure-charts) and the [chart types gallery](/visualizations). If you'd rather do this conversationally, ask your agent to build the dashboards for you — it can generate [content as code](/workflow/content-as-code) from the screenshots and the migrated models. Use your local coding agent for this: the in-app AI agent chat accepts text files only, so it can't read screenshots or PDF exports. **2. Rebuild dashboard-level filters and tabs** Recreate the source dashboard's filter set with [dashboard filters](/explore/filters-reference) and multi-tab layouts. Match the visual grouping from the screenshots. **3. Validate the numbers match the source** For every migrated dashboard, run the same query in the source tool and in Lightdash and compare the results. Any mismatch usually points to: * A missing or mismapped join * A different aggregation type * A silent filter in the source tool (default date range, hidden user filter) * A timezone difference — see [Set the project timezone](/workspace-admin/set-project-timezone) Do this before you cut anyone over. ## 7. Layer in best practices and the customer's own conventions Once the content works, take a pass to align it with Lightdash conventions and any modeling standards the team already follows. * **Follow Lightdash's modeling guidance.** Read [modeling strategies](/semantic-layer/modeling-strategies) and apply it: name fields consistently, keep grain explicit, use pre-aggregates where warranted. * **Apply the customer's own style guide.** If the team has a metric naming convention, category structure, or documentation standard, feed that into the agent as extra context so the migrated fields match. Skills read anything in the project — a `MODELING_GUIDE.md` at the repo root is often enough. * **Write good descriptions.** See [Writing descriptions](/semantic-layer/writing-descriptions). Migrations are the best time to fix the descriptions that never got written in the source tool. * **Verify canonical content.** Mark the migrated dashboards and charts as [verified content](/explore/verified-content) so users know which reports are the source of truth going forward. * **Set up promotion.** Once validated in preview, use [content promotion](/explore/promote-content) to move dashboards to production. * **Plan the cutover.** Announce a date, keep the source tool read-only for a defined grace period, and use [scheduled deliveries](/explore/create-scheduled-deliveries) to replace any recurring exports from the old tool. ## Common pitfalls * **Migrating everything.** Most BI tools carry hundreds of stale reports. Use warehouse query history to see what's actually used, and migrate that subset first. * **Trying to match the old tool 1:1.** Lightdash's metric definitions are reusable across charts. Consolidate duplicates instead of copying every one-off calculated field. * **Skipping joins.** LookML `explores` and Tableau data sources bake in joins that aren't obvious from the SQL. Read the model definitions, not just the queries. * **Forgetting user attributes and access.** Row-level filters and user attributes from the source tool need to be re-modeled with Lightdash [user attributes](/workspace-admin/user-attributes). ## Next steps * [Install agent skills](/workflow/install-agent-skills) * [Lightdash YAML](/semantic-layer/yaml) * [Modeling strategies](/semantic-layer/modeling-strategies) * [Content as code](/workflow/content-as-code) # Quickstart Source: https://docs.lightdash.com/get-started/quickstart Set up Lightdash with dbt or Lightdash YAML, from an empty project to your first insight Lightdash builds your BI layer from a semantic layer you define as code, either in a dbt project or in [Lightdash YAML](/semantic-layer/yaml) files that point at tables already in your warehouse. Every setup follows the same three steps. The details depend on how you model your data, where Lightdash runs, and how it reaches your warehouse. 1. **Define your semantic layer.** Install the Lightdash CLI and generate your first Tables so there's something to explore. Start from [your dbt project](/integrations/dbt#set-up-a-dbt-project) or [Lightdash YAML](/semantic-layer/yaml). 2. **[Connect your warehouse and project](/integrations/connect-project).** Add warehouse credentials and choose how Lightdash gets your project: deploy from the CLI or connect your git repository so Lightdash stays in sync. Warehouse-specific connection details for BigQuery, Snowflake, Postgres, and more live in this step. If your warehouse sits in a private network, you also need to [connect through an SSH tunnel](/integrations/connect-through-ssh-tunnel). 3. **[Invite your team](/workspace-admin/invite-new-users).** Bring in teammates with the right roles, or let people with your work email domain join automatically. When your project is live, pick the track that matches what you're doing next: [explore your data](/get-started/explore-your-data) to query, visualize, and share, or [build your semantic layer](/get-started/build-your-semantic-layer) to define metrics and dimensions as code. ## Find your setup path Answer a few questions to get the version of these steps that fits your setup, each linked to the page with the details. # Integrations Source: https://docs.lightdash.com/integrations Connect Lightdash to dbt, Slack, Google Sheets, SQL clients, and Snowflake Cortex Lightdash works with the tools your team already uses. Connect a [dbt project](/integrations/dbt) to build your semantic layer from it, send chart results to Slack and Google Sheets, deliver alerts and scheduled reports, query your semantic layer from any SQL client, and operate Lightdash agentically from Snowflake Cortex. One closely related integration is documented in its own product area: the [Lightdash MCP server](/agents/lightdash-mcp), which lets AI assistants explore your data and run queries directly. # Apache Ossie Source: https://docs.lightdash.com/integrations/apache-ossie Exchange semantic models with other tools using the Apache Ossie open specification [Experimental](/support/feature-badges#experimental) [Apache Ossie (Incubating)](https://ossie.apache.org) — formerly the Open Semantic Interchange (OSI) — is an open, vendor-neutral specification for exchanging semantic models between tools. It defines a machine-readable format for describing datasets, relationships, fields, and metrics, along with the business context around them, so that any tool in a data stack can produce or consume semantic definitions without losing meaning. The project is incubating at the Apache Software Foundation, developed in the open on GitHub, and backed by a coalition of data and analytics vendors. Its goal is to make a business concept like "Monthly Active Users" resolvable consistently across warehouses, BI tools, and AI agents, regardless of where it was originally defined. ## What Ossie covers Ossie standardizes the shape of a semantic layer as an interchange format: * **Semantic models** — the top-level unit exchanged between tools. * **Datasets** — the queryable tables in a model. * **Relationships** — how datasets connect to each other. * **Fields** — the dimensions on each dataset. * **Metrics** — the measures defined against fields. * **AI context** — the descriptions and business meaning consumers (including AI agents) rely on. * **Custom extensions** — a `custom_extensions` slot for tool-specific detail that would otherwise be lost in a round-trip. ## How Ossie maps to the Lightdash semantic layer The [Lightdash semantic layer](/semantic-layer) already models the same building blocks Ossie standardizes: | Ossie concept | Lightdash equivalent | | - | - | | Semantic model | A Lightdash project's models and their [YAML](/semantic-layer/yaml) / dbt definitions | | Dataset | A [table](/semantic-layer/tables) | | Relationship | [Joins](/semantic-layer/joins) between models | | Field (dimension) | [Dimensions](/semantic-layer/dimensions) | | Metric | [Metrics](/semantic-layer/metrics) | A Lightdash project doesn't read or write Ossie files itself. Define your semantic layer in [Lightdash YAML](/semantic-layer/yaml) or dbt, where its tables, joins, dimensions, and metrics map to Ossie as shown above. ## Where to learn more * Apache Ossie project site: [ossie.apache.org](https://ossie.apache.org) * Source and spec: [github.com/apache/ossie](https://github.com/apache/ossie) * Lightdash semantic layer: [Lightdash semantic layer](/semantic-layer) # Connect Athena with web identity Source: https://docs.lightdash.com/integrations/connect-athena-with-web-identity Connect to Amazon Athena without storing AWS keys, using an IAM role that trusts Lightdash [Beta](/support/feature-badges#beta) [Cloud-only](/support/feature-badges#cloud-only) > [!NOTE] > > Web identity uses Lightdash Cloud's Google Cloud workload identity and is gated by a feature flag — contact Lightdash support to enable it for your organization. Self-hosted instances can connect without keys using [IAM role authentication](/self-host/customize-deployment/environment-variables#athena). Web identity lets Lightdash query Athena without any AWS access keys. You create an IAM role in your AWS account that trusts Lightdash's identity. When Lightdash runs a query, it signs in with that identity and exchanges it for short-lived credentials on your role through `sts:AssumeRoleWithWebIdentity`. Lightdash stores no AWS secrets, and you can revoke access at any time by editing or deleting the role. The role's trust policy pins two values that Lightdash shows in the connection form: * **Subject**: your Lightdash instance's identity. It is the same for every connection on the instance. * **Audience**: a value Lightdash generates for your connection and ties to your organization. No other organization can use it, so a role that requires it can only be used by your connection. ## Before you start You need: * Permission to create IAM roles and policies in the AWS account that runs Athena. * The Athena settings for the connection: region, catalog, database, and the S3 staging directory for query results. See [Athena connection settings](/integrations/connect-project#athena). ## Connect Athena **1. Choose web identity in Lightdash** In your project's connection settings, choose **Athena** as the warehouse type, then choose **Web Identity (No Keys)** as the **Authentication Type**. Lightdash generates an **Audience** and shows the **Subject**. Select **Show trust policy** to see the trust policy filled in with both values, and copy it. **2. Create the IAM role** In the AWS IAM console, create a role with a **Custom trust policy** and paste the trust policy from Lightdash. It has this shape: ```json theme={null} { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Federated": "accounts.google.com" }, "Action": "sts:AssumeRoleWithWebIdentity", "Condition": { "StringEquals": { "accounts.google.com:sub": "", "accounts.google.com:aud": "", "accounts.google.com:oaud": "" } } } ] } ``` > [!WARNING] > > Use the **Custom trust policy** JSON editor, not the **Web identity** option in the role wizard. The wizard puts the audience in `accounts.google.com:aud`, which doesn't match the token Lightdash sends. Keep all three conditions: without `sub` and `oaud`, other identities or other Lightdash organizations could use the role. **3. Give the role access to Athena** Attach a permissions policy that lets the role run queries, read the Glue catalog and your data, and write query results. Replace the bucket names, region, and account ID with your own: ```json theme={null} { "Version": "2012-10-17", "Statement": [ { "Sid": "Athena", "Effect": "Allow", "Action": [ "athena:StartQueryExecution", "athena:GetQueryExecution", "athena:GetQueryResults", "athena:GetWorkGroup", "athena:ListDatabases", "athena:ListTableMetadata", "athena:GetTableMetadata" ], "Resource": [ "arn:aws:athena:::workgroup/*", "arn:aws:athena:::datacatalog/*" ] }, { "Sid": "GlueCatalog", "Effect": "Allow", "Action": [ "glue:GetDatabase", "glue:GetDatabases", "glue:GetTable", "glue:GetTables", "glue:GetPartition", "glue:GetPartitions" ], "Resource": "*" }, { "Sid": "ReadData", "Effect": "Allow", "Action": ["s3:GetObject", "s3:ListBucket", "s3:GetBucketLocation"], "Resource": [ "arn:aws:s3:::", "arn:aws:s3:::/*" ] }, { "Sid": "QueryResults", "Effect": "Allow", "Action": [ "s3:GetObject", "s3:PutObject", "s3:ListBucket", "s3:GetBucketLocation", "s3:AbortMultipartUpload" ], "Resource": [ "arn:aws:s3:::", "arn:aws:s3:::/*" ] } ] } ``` If your tables are encrypted with a customer-managed KMS key, also allow `kms:Decrypt` on that key. Narrow the Glue resources to your catalog, databases, and tables if your security policy requires it. **4. Finish the connection** Back in Lightdash, paste the role's ARN into **IAM Role ARN**, fill in the rest of the [Athena settings](/integrations/connect-project#athena), and save. Lightdash tests the connection before saving. The test also checks that the role refuses an audience Lightdash never issued. If the role accepts one, the trust policy doesn't require your audience and the test fails until you add the `accounts.google.com:oaud` condition. ## Create the role with Terraform Copy the subject and audience from the connection form: ```hcl theme={null} variable "lightdash_subject" { description = "Subject shown in the Lightdash Athena connection form" type = string } variable "lightdash_audience" { description = "Audience shown in the Lightdash Athena connection form" type = string } data "aws_iam_policy_document" "lightdash_trust" { statement { actions = ["sts:AssumeRoleWithWebIdentity"] principals { type = "Federated" identifiers = ["accounts.google.com"] } condition { test = "StringEquals" variable = "accounts.google.com:sub" values = [var.lightdash_subject] } condition { test = "StringEquals" variable = "accounts.google.com:aud" values = [var.lightdash_subject] } condition { test = "StringEquals" variable = "accounts.google.com:oaud" values = [var.lightdash_audience] } } } resource "aws_iam_role" "lightdash_athena" { name = "lightdash-athena" assume_role_policy = data.aws_iam_policy_document.lightdash_trust.json } ``` Attach the permissions policy from the previous section to `aws_iam_role.lightdash_athena`. ## Generate a new audience Select **Generate new audience** to replace the connection's audience, for example if it was shared more widely than intended. After you save, the connection stops working until the role's trust policy uses the new audience, so update the trust policy at the same time. ## Personal credentials If the project requires user credentials, each user connects with their own AWS access keys. Their queries run as their own IAM user, not through the project's role. ## Troubleshooting | Message | What to check | | - | - | | AWS didn't allow Lightdash to use the role | The role's trust policy has the subject and audience shown in the connection form, under `accounts.google.com:sub`, `accounts.google.com:aud`, and `accounts.google.com:oaud`. | | The trust policy doesn't require `accounts.google.com:oaud` | Add the `oaud` condition with your connection's audience, then test again. | | This connection's audience isn't valid for your organization | Generate a new audience, then update the role's trust policy. | | Web identity isn't turned on for this Lightdash instance | Web identity isn't enabled for your organization. Contact Lightdash support, or choose another authentication type. | | Access denied on a query, after the connection succeeds | The role's permissions policy is missing an Athena, Glue, or S3 action, or a bucket. Check AWS CloudTrail for the denied action. | # Connect your warehouse and project Source: https://docs.lightdash.com/integrations/connect-project Connect your warehouse and choose a dbt or native Lightdash YAML project To setup your Lightdash connection you'll need to: 1. [Connect to your data warehouse](/integrations/connect-project#1-connect-to-a-warehouse) 2. Connect a [dbt project](#2-import-a-dbt-project) or [native Lightdash YAML project](/semantic-layer/yaml#connect-through-github) You can see a list of every time your project is compiled by visiting the [project compilation history](/workspace-admin/project-compilation-history) page. ## Open up your Lightdash instance to get started. **To update an existing connection**, go to **Project settings** by clicking on the gear icon in the top-right navigation. ![Lightdash project settings, opened from the gear icon, with Connection settings selected and the warehouse connection form on the right](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/connect-project/project-connection-settings.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=70883baf18b31318e85f089c330c8adb) Changing the warehouse connection doesn't change the tables in Explore. They still come from the project's dbt or [Lightdash YAML](/semantic-layer/yaml) models, so if you point a project at a different warehouse, deploy models for that warehouse's tables. Otherwise queries fail because the old tables don't exist there. This includes the **Playground (sample data)** project: its sample tables stay after you change its connection, so create a new project for your own warehouse instead. **To create a new project**, go to **Organization settings**, then **All projects** and click **Create new**. ![The Project management settings page under Organization settings, with the Create new button at the top right](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/connect-project/project-create-new.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=15b74229186d385e42fdeb1d8b81ab0e) ## 1. Connect to a warehouse We currently support [BigQuery](#bigquery), [Postgres](#postgres), [Supabase](#supabase), [Redshift](#redshift), [Snowflake](#snowflake), [Databricks](#databricks), [Trino](#trino), [ClickHouse](#clickhouse), [DuckDB](#duckdb), and [Athena](#athena). If your warehouse isn't listed, you may still be able to connect to it through [Trino](#trino). We always recommend giving read-only permissions to Lightdash, that way you ensure than no data can be manipulated. See each section below for warehouse specific details. A Postgres, Athena or Snowflake project can also query more than one warehouse. See [multiple warehouse connections](/workspace-admin/multiple-warehouse-connections). > [accordion] Connect to your warehouse without a dbt project (warehouse-first onboarding) > > When the `new-onboarding` feature flag is enabled, the **Create new project** screen shows a **Connect to your warehouse** option alongside the standard "Connect via CLI" and "Connect manually" flows. > > Choosing it takes you directly to the warehouse connection form and creates the project with dbt type `NONE` — no dbt project is imported and no dbt compilation runs. You can create the same kind of project without the feature flag: choose **Connect manually** and set the dbt connection **Type** to **CLI**. > > The project starts with no tables in Explore. You can query the warehouse from the [SQL Runner](/explore/sql-runner) straight away, and tables appear in Explore once you deploy dbt models or [Lightdash YAML](/semantic-layer/yaml) models for them. You can add or switch to a dbt project later from **Project settings**. > > Combine this with **Connect via Lightdash CLI (SSO)** on Snowflake or **Sign in with Google** on BigQuery (see below) to create a project without ever pasting a credential — the same feature flag also enables smart defaults (recommended project, largest dataset/database, recommended warehouse) after you authenticate. > [accordion] Adding Lightdash's static IP addresses to your allow-list > > Since we host your Lightdash for you, you may need to add our static IP addresses to the allow-list for your security group or firewall rules so they don’t block calls from your Lightdash Cloud to your connected databases. > > If you login at: > > * **app.lightdash.cloud** use **35.245.81.252** > * **eu1.lightdash.cloud** use **34.38.17.228** > > If you login at a different domain, look for the IP in the project settings page (see image below). > > ![The warehouse connection panel of project settings, showing the static IP address to add to your allow-list](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/connect-project/screenshot-ip-address-20ea3b322ef6d3efc2fca2637ad5fe72.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=c81aa2ccefae736ec0009b65fe9e6cd7) ### Choose how to connect your warehouse Choose your authentication method before you connect. You can connect Lightdash to your warehouse with your user account or with a service account: * **Your user account.** Depending on the warehouse, you sign in with SSO (for example **Sign in with Google**, **Sign in with Snowflake**, or **Connect via Lightdash CLI (SSO)**) or with your personal username and password. This is quick for testing, but Lightdash runs every query as you. * **A service account.** Lightdash connects with a dedicated identity, for example using a JSON key file, private key, password, or PAT. This is the recommended option for production. The available options depend on the warehouse. You pick one in the **Authentication type** dropdown of the warehouse connection form, and each warehouse section below lists what it supports. > [!WARNING] > > **If you connect with your user account, Lightdash uses your personal credentials for everyone.** Lightdash runs all project operations with your credentials: other users' queries, scheduled deliveries, and everything else. Every query appears under your name in warehouse logs, and every user can query anything you can. If your token expires, your access is revoked, or you leave the company, the project stops working. For production, create a dedicated service account with read-only permissions. To have each user query with their own identity instead, require [personal warehouse credentials](/personal-settings/personal-warehouse-connections). ### Bigquery ##### Project This is project ID from Google Cloud Platform for the data that you want to connect Lightdash to. To find your project ID, head to the [BigQuery Cloud console](https://console.cloud.google.com/). Once you're in there, click on the project name in the top bar. ![The Google Cloud Platform header bar with the project name dropdown beside the logo called out](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/connect-project/get-to-projects-bd5a9153523381e91b00033480cb862c.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=3650fffec71332a927e84cb3d060c6d5) Then, you should see all of the projects and their project IDs in your organization (that you have access to). ![The Google Cloud project picker listing project names beside their IDs, such as lightdash-analytics](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/connect-project/project-id-list-840be6a159a39476ecf24eb7fea43a08.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=a5ad2b53f0bc4e8858cf9fcaa1de3945) For the project you want to connect Lightdash to, just copy its `id` and pop it into the `project` field in the Warehouse Connection form in Lightdash. ##### Authentication type You can choose to connect to BigQuery with a user account (using "Sign in with Google") or with a service account using a JSON key file. You can change the authentication type later in the project's warehouse connection settings. On a self-hosted instance, you can also connect without a key file: set [`AUTH_ENABLE_GCLOUD_ADC=true`](/self-host/customize-deployment/environment-variables#google-cloud-platform) and pick **Application Default Credentials**. Lightdash then uses the Google credentials available in the environment it runs in. Every connection that uses **Application Default Credentials** runs as that same environment identity, across all projects on the instance. You can't give one connection a different identity this way. To give connections different BigQuery access, use a separate service account key file for each, or run separate Lightdash deployments with different runtime service accounts. To let AI agents run as a separate service account, see [BigQuery: the shared agent account](/agents/agent-identity#bigquery-the-shared-agent-account). ##### User Account (Sign in with Google) When you use "Sign in with Google" - Lightdash will execute queries against bigquery with your personal google user account. This is the simplest way to get connected quickly using your existing account. When the `new-onboarding` feature flag is enabled, new BigQuery projects default to **Sign in with Google** and the setup wizard suggests smart defaults after you authenticate: a recommended **Project ID** based on your Google account's BigQuery activity, and the largest available **Dataset** (marked with a *Recommended · largest* badge in the picker). You can override either at any time. > [accordion] BigQuery tokens expiring > > If your Google Workspace uses [Google Cloud session control](https://support.google.com/a/answer/9368756), users are asked to reconnect their Google account every session (16 hours by default). When the session ends, queries fail with this error: > > ```text theme={null} > Google rejected the BigQuery refresh token (invalid_grant: …; invalid_rapt). Reconnect your BigQuery account in personal settings. > ``` > > An admin can change this for Lightdash in one of two ways. > > **Set a session length for Lightdash only (recommended)** > > A Google Cloud admin can set a per-app session length with [Access Context Manager](https://docs.cloud.google.com/access-context-manager/docs/session-controls-for-reauthentication). This doesn't trust Lightdash or affect other apps. It applies to members of a Google Group, so add your Lightdash users to one first. > > Create a binding file that targets the Lightdash OAuth client. Set `sessionLength` to between `3600s` and `86400s`, or to `0s` with `sessionLengthEnabled: false` to exempt Lightdash from session control: > > ```yaml theme={null} > scopedAccessSettings: > - scope: > clientScope: > restrictedClientApplication: > clientId: 550976420660-kr9mochv2btveg9sr7rpeqe08mo2hvk5.apps.googleusercontent.com # Lightdash Cloud only > activeSettings: > sessionSettings: > sessionLength: 86400s > sessionReauthMethod: LOGIN > sessionLengthEnabled: true > ``` > > The client ID above is for Lightdash Cloud. On a self-hosted instance, use the value of `AUTH_GOOGLE_OAUTH2_CLIENT_ID`. > > Then bind it to the group: > > ```bash theme={null} > gcloud access-context-manager cloud-bindings create \ > --organization=ORG_ID \ > --group-key=GROUP_ID \ > --binding-file=lightdash-session.yaml > ``` > > `GROUP_ID` is the group's ID, not its email address. `gcloud identity groups describe GROUP_EMAIL --format="value(name)"` returns it as `groups/GROUP_ID`. > > This binding overrides the Admin console session setting for members of the group and isn't shown in the Admin console. If your organization already has Access Context Manager bindings for the same group, only the most recently created one applies, so add the Lightdash scope to that binding instead. > > **Trust Lightdash (simpler)** > > A Google Workspace admin can mark the Lightdash OAuth app as **Trusted** under **Security → API controls → Manage Third-Party App Access**, then select **Exempt trusted apps** under **Google Cloud session control** (this applies to all trusted apps, not just Lightdash). Marking an app as **Trusted** also allows it any Google scope it requests without admin approval. [See more](https://knowledge.workspace.google.com/admin/apps/control-which-apps-access-google-workspace-data). ##### Service account (JSON Key File) To have Lightdash connect to BigQuery with a service account, you need to create the account and JSON key. You can read more about [creating and managing service accounts with Google BigQuery in their docs](https://cloud.google.com/iam/docs/creating-managing-service-accounts). You will need permissions to create service accounts and keys in your Google Project. If you don't have the permissions, use your user account instead. If you're creating a new service account, make sure that you save your JSON key file somewhere safe! You'll need it for connecting to Lightdash. The service account you use with Lightdash will need to have the following roles in your GCP project: * `roles/bigquery.dataViewer` (to see data in your project) * `roles/bigquery.jobUser` (to run queries in your project) If you need to provide access to data across multiple BigQuery projects, the service account will need to be granted `roles/bigquery.dataViewer` on each additional BigQuery project. Once you have a service account all ready to go, you'll need to add its JSON key file to Lightdash in the `key file` section of the Warehouse Connection page. The file must be a service account key: other Google credential files, such as workload identity federation configurations, aren't accepted. If Google stops accepting the key, for example because it was deleted or disabled in Google Cloud, queries fail with this error: ```text theme={null} Google rejected the BigQuery credentials (invalid_grant: …). ``` Create a new JSON key for the service account and upload it in the project's Warehouse Connection settings. An error that says Google rejected the BigQuery *refresh token* comes from a **Sign in with Google** connection instead; see **BigQuery tokens expiring** above. ##### Data set This is the name of your dbt dataset: the BigQuery dataset where the output of your dbt models is written to. It's required, and it must match the `dataset` value in your dbt `profiles.yml` file. When you pick a data set from the list, Lightdash fills in its **Location** for you. ##### Location The data location of the dataset in BigQuery where the output of your dbt models is written to. `location` may be either a multi-regional location (e.g. `EU`, `US`), or a regional location (e.g. `us-west2` ). Check out the [BigQuery documentation](https://cloud.google.com/bigquery/docs/locations) for more information on dataset locations. You can find the location of the dataset you're using for your dbt project [in your dbt profiles.yml file](https://docs.getdbt.com/reference/warehouse-profiles/bigquery-profile#dataset-locations), or in your BigQuery console. Every query from this connection runs in this location. If you connect [multiple dbt sources](/integrations/dbt/projects#connecting-multiple-dbt-sources), their datasets need to be in the same location for joins between them to work. ![A BigQuery Data set info panel with the Data location row reading US](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/connect-project/data-location-55e6d6d1001e53864486bf81014ff921.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=3e36e44410ba3ab688b24c9646810e65) ##### Timeout in seconds BigQuery supports query timeouts. By default, the timeout is set to 300 seconds. If a query run by Lightdash takes longer than this timeout to complete, then BigQuery may cancel the query and issue the following error: ```bash theme={null} Operation did not complete within the designated timeout. ``` To change this timeout, use the `Timeout in seconds` configuration. ##### Priority The priority for the BigQuery jobs that Lightdash executes can be configured with the `priority` configuration in your Warehouse Connection settings. The `priority` field can be set to one of `batch` or `interactive`. For more information on query priority, [check out the BigQuery documentation.](https://cloud.google.com/bigquery/docs/running-queries) ##### Retries The `retries` configuration specifies the number of times Lightdash should retry queries that result in unhandled server errors. For example, setting `retries` to 5 means that Lightdash will retry BigQuery queries 5 times with a delay. If the query does not succeed after the fifth attempt, then Lightdash will raise an error. By default, the number of retries is set to 3. ##### Maximum bytes billed If a value for the `Maximum bytes billed` is set, then queries executed by Lightdash will fail if they exceed the configured maximum bytes threshhold. This configuration should be supplied as an integer number of bytes. For example, setting this to `1000000000` means if a query would bill more than a gigabyte of data (e.g. 2Gb), then BigQuery will reject the query and you'd get an error like this: ```bash theme={null} Query exceeded limit for bytes billed: 1000000000. 2000000000 or higher required. ``` Leaving this field empty or setting it to `0` means no limit. ###### Maximum bytes billed by role A limit that suits people who view dashboards can be too tight for people who write SQL. Under **Maximum bytes billed by role**, you can set a different limit for each project role: **Viewer**, **Interactive Viewer**, **Editor**, **Developer** and **Admin**. You'll find these fields in the advanced options of the BigQuery connection, after **Maximum bytes billed**. Lightdash uses the person's highest project role. That role can come from their organization role, their project access or a group they belong to. For example, a person who is an organization **Viewer** but a **Developer** on the project through a group gets the **Developer** limit. * Leave a role empty to use the connection's **Maximum bytes billed** for that role. * Set a role to `0` to remove the limit for that role. * People whose access comes only from a [custom role](/workspace-admin/custom-roles) get the connection's **Maximum bytes billed**. ###### AI agent maximum bytes billed **AI agent maximum bytes billed** sets a separate limit for queries that AI agents run. This includes agents in Lightdash and Slack, MCP clients and the [shared agent account](/agents/agent-identity#bigquery-the-shared-agent-account). Leave it empty to use the role limit of the person the agent is working for, or the connection's limit if their role has none. Set it to `0` to remove the limit for agent queries. ###### Which limit applies Lightdash picks one limit for each query and sends it with that query to BigQuery: 1. For an agent query, the **AI agent maximum bytes billed**, if it's set. 2. Otherwise, the limit for the person's highest project role, if it's set. 3. Otherwise, the connection's **Maximum bytes billed**. The role and agent limits replace the connection's limit. They don't add to it, so a role limit can be higher or lower than the connection's limit. They apply to queries from charts, dashboards, the SQL runner, scheduled deliveries and agents. dbt runs and compiling the project use the connection's **Maximum bytes billed**. ###### When a query hits the limit BigQuery rejects the query before it runs, so nothing is billed. The chart, dashboard tile or SQL runner shows an error with the limit and the number of bytes the query needs: ```bash theme={null} Bigquery warehouse error: bytesBilledLimitExceeded - Query exceeded limit for bytes billed: 1000000000. 2000000000 or higher required. ``` To get the query under the limit, add filters, choose fewer fields or use a shorter date range. To raise the limit, ask a project admin to change it for your role. When an agent's query hits the limit, the agent gets the same error. It may try a narrower query. If its queries keep failing, it stops querying and answers with what it has, telling you that the query failed. ##### Query cost estimates Lightdash can estimate how much data a query will process before it runs, using a free [BigQuery dry run](https://cloud.google.com/bigquery/docs/running-queries#dry-run). All three settings are in the advanced options of the BigQuery connection and are off until you set them. `Maximum bytes billed`, and the role and AI agent limits above, are enforced by BigQuery itself, so they stay the hard limit for every query, including AI agent queries. Keep them set when you use query cost estimates: estimates can be lower than the bytes a query is billed for. | Setting | What it does | | - | - | | `Show query cost estimates` | Shows the estimated bytes processed next to **Run query** in the Explore view and next to **Run** in the SQL Runner. | | `Confirm queries estimated above (bytes)` | Asks users to confirm before running a query whose estimate is above this number of bytes. Requires `Show query cost estimates`. Leave it empty to never ask. | | `AI agent query limit (estimated bytes)` | Refuses AI agent queries whose estimate is above this number of bytes. Leave it empty for no limit. | **Estimate and confirm for users.** With estimates on, the estimate updates as you change the query, before you run it. If you run a query estimated above the confirmation threshold, a dialog shows the estimate and the threshold, and the query only runs once you confirm. If an estimate can't be calculated, the query runs as normal. **Enforced limit for AI agents.** Every query an AI agent runs, in Lightdash or through [MCP](/agents/lightdash-mcp), is dry-run before it executes. If the estimate is above the agent limit, the query is not run and the agent receives an error with the estimate and the limit, so it can narrow the query (filter on a partition column, shorten the date range, or select fewer columns) and try again. Lightdash checks the limit on every agent query; it does not depend on the agent's instructions. This limit is separate from **AI agent maximum bytes billed**: the estimate limit stops the query before it reaches BigQuery, and the bytes-billed limit is enforced by BigQuery on the query itself. > [!WARNING] > > Dry-run estimates can be lower than what a query is billed for: tables with row-level security report 0 bytes, and external tables can report less than they scan. Keep `Maximum bytes billed` (or the role and AI agent limits) set as the hard limit. The confirmation threshold and the agent limit are integer numbers of bytes, for example `10000000000` for 10 GB. Estimates are bytes processed. On-demand pricing bills bytes processed but rounds each referenced table up to at least 10 MB, so a very small query can be billed more than its estimate. With capacity (slot-based) pricing, estimates show scan size, not cost. ##### Start of week This controls what day is the start of the week in Lightdash. `Auto` sets it to whatever the default is for your data warehouse. Or, you can customize it and select the day of the week from the drop-down menu. This will be taken into account when using 'WEEK' time interval in Lightdash. ##### Execution project Here you can specify an execution project to bill for query execution, instead of using the project where your dbt resources are materialized. If you leave this blank, all costs get applied to the project from the top of the connection details. *** ### Postgres You can see more details in [dbt documentation](https://docs.getdbt.com/reference/warehouse-profiles/postgres-profile). > [!TIP] > > **Using Supabase?** Supabase runs on Postgres, so pick **Postgres** as your warehouse and use your Supabase connection details. See the [Supabase setup guide below](#supabase) for step-by-step instructions, including a quickstart repo that wires up the CLI and AI-generated models for you. ##### Host This is the host where the database is running. ##### User This is the database user name. ##### Password This is the database user password. ##### DB name This is the database name. ##### Schema This is the default schema used by dbt to compile and run your dbt project. You can find this in the dbt cloud IDE or your local `profiles.yml` file. If you're a dbt cloud user you can find this under your profile in the dbt cloud IDE: ![dbt Cloud development credentials for a project, with the Dataset row circled](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/connect-project/dbt-cloud-credentials-351bb1a9bdda693be0ed82eb17705410.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=b9fa8a5e0f54bed6a6a8313fd668b146) If you work with dbt locally, then check your `profiles.yml` file at `~/.dbt/profiles.yml` and look for a field named `schema`: ```yaml theme={null} company-name: target: dev outputs: dev: type: postgres host: [hostname] user: [username] password: [password] port: [port] dbname: [database name] schema: [dbt schema] # look for this one! ``` ##### Port This is the port where the database is running. ##### Keep alive idle (seconds) This specifies the amount of seconds with no network activity after which the operating system should send a TCP keepalive message to the client. You can see more details in [postgresqlco documentation](https://postgresqlco.nf/doc/en/param/tcp%5Fkeepalives%5Fidle/). ##### Search path This controls the Postgres "search path". You can see more details in [dbt documentation](https://docs.getdbt.com/reference/warehouse-profiles/postgres-profile#search%5Fpath). ##### SSL mode This controls how dbt connects to Postgres databases using SSL. You can see more details in [dbt documentation](https://docs.getdbt.com/reference/warehouse-profiles/postgres-profile#sslmode). The default is `prefer`. When Lightdash runs queries, every mode except `disable` and `no-verify` checks the server's certificate. The certificate must match the host name and be signed by a public certificate authority, the AWS RDS certificate authority, or the certificate you upload in **SSL root certificate**. That field appears when you pick `verify-ca` or `verify-full`. `no-verify` keeps the connection encrypted but skips the certificate check. ##### SSL certificate The client certificate used to authenticate your connection to the database. This is only required if you're using SSL mode `verify-full`. ##### SSL private key The private key used to authenticate your connection to the database. This is only required if you're using SSL mode `verify-full`. ##### SSL root certificate The trusted certificate authority (CA) certificate used to verify the database server’s identity. This is only required if you're using SSL mode `verify-ca` or `verify-full`. ##### Start of week This controls what day is the start of the week in Lightdash. `Auto` sets it to whatever the default is for your data warehouse. Or, you can customize it and select the day of the week from the drop-down menu. This will be taken into account when using 'WEEK' time interval in Lightdash. ##### Use SSH tunnel Enable to input your **SSH Remote Host**, **SSH Remote Port**, **SSH Username**, and to generate a public SSH key. Use this when your Postgres database is in a private VPC and cannot be reached directly from Lightdash. See [Connect through an SSH tunnel](/integrations/connect-through-ssh-tunnel) for the full setup. *** ### Supabase [Supabase](https://supabase.com) is a managed Postgres database, so Lightdash connects to it using the **Postgres** warehouse type — there's no separate Supabase connector to pick. The fields below are the same Postgres fields documented above; this section just maps them to the values Supabase exposes. > [!TIP] > > Prefer a hands-on walkthrough? The [`lightdash/lightdash-supabase-quickstart`](https://github.com/lightdash/lightdash-supabase-quickstart) repo gets you from zero to charts on your Supabase data in about 15 minutes, with no dbt project required. It includes setup scripts for macOS/Linux and Windows, a preconfigured [Supabase MCP](https://supabase.com/docs/guides/getting-started/mcp) so your AI agent (Cursor or Claude Code) can generate Lightdash models from your schema, and a `set-warehouse` script that wires up your warehouse credentials via the API. #### Get your Supabase connection details In the Supabase dashboard, open your project and go to **Connect → Session Pooler → View parameters**. Use the **Session pooler** (not the direct connection or transaction pooler) — it accepts long-running queries and is the right fit for Lightdash. Map the Supabase parameters to the Lightdash Postgres connection form: | Lightdash field | Supabase value | | :- | :- | | **Host** | Pooler host (e.g. `aws-0-.pooler.supabase.com`) | | **Port** | `5432` (session pooler) | | **User** | `postgres.` | | **Password** | Your database password (set when you created the project; you can reset it under **Database → Settings**) | | **DB name** | `postgres` | | **Schema** | The schema your models live in — typically `public` | | **SSL mode** | `require` | Lightdash Cloud connects from a [static IP](#adding-lightdashs-static-ip-addresses-to-your-allow-list). Supabase accepts traffic from anywhere by default; if you've enabled **Network Restrictions** under **Project Settings → Database**, add the Lightdash IP for your region to the allow-list. #### Setup options > [tab] Quickstart repo (recommended) > > The [Supabase quickstart repo](https://github.com/lightdash/lightdash-supabase-quickstart) automates everything below — clone it and follow the README. > > 1. **Clone the repo and install the Lightdash CLI:** > > ```bash theme={null} > git clone git@github.com:lightdash/lightdash-supabase-quickstart.git > cd lightdash-supabase-quickstart > brew tap lightdash/lightdash && brew trust lightdash/lightdash && brew install lightdash > lightdash login https://app.lightdash.cloud --token > ``` > > 2. **Install Lightdash skills for your AI agent** — this loads the Lightdash YAML schema into your editor session so the agent can generate and validate models correctly: > > ```bash theme={null} > # Claude Code (default) > lightdash install-skills > > # Cursor > lightdash install-skills --agent cursor > > # Codex > lightdash install-skills --agent codex > ``` > > 3. **Connect the Supabase MCP** — the repo ships with `.cursor/mcp.json` and `.claude/mcp.json` already configured. Open the project in Cursor or Claude Code, authenticate via the browser popup, and verify the `supabase` MCP shows a green status in your editor's MCP settings. > > 4. **Connect your database** — run the setup script and paste in your Supabase pooler credentials when prompted: > > ```bash theme={null} > # macOS / Linux > bash setup.sh > > # Windows (PowerShell) > powershell -ExecutionPolicy Bypass -File ./setup.ps1 > ``` > > 5. **Generate models from your schema** — in Cursor or Claude Code, ask the agent: > > > Look at my Supabase tables and generate Lightdash models > > The agent reads your schema through the Supabase MCP and writes YAML files into `lightdash/models/` with sensible metrics and dimensions wired up. > > 6. **Deploy your project and attach the warehouse:** > > ```bash theme={null} > lightdash lint > lightdash deploy --create --no-warehouse-credentials > # Then push your warehouse credentials via the API: > bash set-warehouse.sh > # Windows: powershell -ExecutionPolicy Bypass -File ./set-warehouse.ps1 > ``` > > After any model changes, run `lightdash lint && lightdash deploy --no-warehouse-credentials`. After chart or dashboard changes, run `lightdash upload --include-charts`. > [tab] Manual setup in the UI > > 1. In Lightdash, go to **Organization settings → All projects → Create new** (or **Project settings** for an existing project). > 2. Pick **Postgres** as the warehouse type. > 3. Fill in the connection form using the [Supabase parameters mapped above](#get-your-supabase-connection-details). > 4. Set **SSL mode** to `require`. > 5. Click **Test & save**. > 6. Continue to [step 2: import a dbt project](#2-import-a-dbt-project), or use the CLI to deploy a project without dbt — see the [quickstart repo](https://github.com/lightdash/lightdash-supabase-quickstart) for an AI-assisted workflow. #### Troubleshooting | Problem | Fix | | :- | :- | | `password authentication failed for user "postgres"` | Make sure the user is `postgres.` (with the project ref suffix) when using the session pooler, not just `postgres`, and that **Password** holds your database password. | | Connection times out | Confirm you're using the **session pooler** host and port `5432`, not the direct database host. If you've enabled Network Restrictions in Supabase, add the [Lightdash static IP](#adding-lightdashs-static-ip-addresses-to-your-allow-list) for your region. | | `SSL connection required` | Set **SSL mode** to `require`. | | `self-signed certificate in certificate chain` | Supabase signs its certificate with its own certificate authority, which Lightdash doesn't trust by default. Download the CA certificate from **Database → SSL Configuration** in Supabase, set **SSL mode** to `verify-full`, and upload the certificate in **SSL root certificate**, not **SSL certificate**. To unblock the connection in the meantime, set **SSL mode** to `no-verify`, which keeps the connection encrypted but skips the certificate check. | | MCP keeps disconnecting (quickstart repo) | Restart your editor. On Windows, also check that your firewall isn't blocking outbound HTTPS. | *** ### Redshift You can see more details in [dbt documentation](https://docs.getdbt.com/reference/warehouse-profiles/redshift-profile). ##### Host This is the host where the database is running. ##### User This is the database user name. ##### Password This is the database user password. ##### DB name This is the database name. ##### Schema This is the default schema used by dbt to compile and run your dbt project. You can find this in the dbt cloud IDE or your local `profiles.yml` file. If you're a dbt cloud user you can find this under your profile in the dbt cloud IDE: ![dbt Cloud development credentials for a project, with the Dataset row circled](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/connect-project/dbt-cloud-credentials-351bb1a9bdda693be0ed82eb17705410.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=b9fa8a5e0f54bed6a6a8313fd668b146) If you work with dbt locally, then check your `profiles.yml` file at `~/.dbt/profiles.yml` and look for a field named `schema`: ```yaml theme={null} company-name: target: dev outputs: dev: type: redshift host: hostname.region.redshift.amazonaws.com user: username password: password1 port: 5439 dbname: analytics schema: analytics # look for this one! ``` ##### Port This is the port where the database is running. ##### Keep alive idle (seconds) This specifies the amount of seconds with no network activity after which the operating system should send a TCP keepalive message to the client. If the database closes its connection while Lightdash is waiting for data, you may see the error `SSL SYSCALL error: EOF detected`. Lowering the [keepalives\_idle value](https://www.postgresql.org/docs/9.3/libpq-connect.html) may prevent this, because the server will send a ping to keep the connection active more frequently. By default, this value is set to 240 seconds, but can be configured lower (perhaps 120 or 60), at the cost of a chattier network connection. ##### SSL mode This controls how dbt connects to Postgres databases using SSL. ##### RA3 Node Allow dbt to use cross-database-resources ##### Start of week This controls what day is the start of the week in Lightdash. `Auto` sets it to whatever the default is for your data warehouse. Or, you can customize it and select the day of the week from the drop-down menu. This will be taken into account when using 'WEEK' time interval in Lightdash. ##### Use SSH tunnel Enable to input your **SSH Remote Host**, **SSH Remote Port**, **SSH Username**, and to generate a public SSH key. Use this when your Redshift cluster is in a private VPC and cannot be reached directly from Lightdash. See [Connect through an SSH tunnel](/integrations/connect-through-ssh-tunnel) for the full setup. ##### Authentication type By default Lightdash connects to Redshift with a database **username and password**. You can instead authenticate with **AWS IAM**: Lightdash mints short-lived Redshift database credentials from AWS at connection time, then connects over the standard Postgres protocol. No long-lived database password is stored. This is useful when your security policy disallows static or hashed passwords, or when your cluster fronts Lake Formation. Lightdash supports three Redshift authentication methods: * **Username & password**: store a shared Redshift database user and password on the project connection. * **AWS IAM (CLI credentials)**: users paste temporary AWS credentials, or admins configure an IAM role/access-key identity, and Lightdash uses those AWS credentials to mint temporary Redshift database credentials. * **User Account (Sign in with AWS)**: users sign in through AWS IAM Identity Center in the browser. The project stores the AWS access portal and a fixed account ID and role; each user signs in with AWS and Lightdash stores short-lived credentials for that role as their personal warehouse credentials. > [!NOTE] > > If you don't see the AWS IAM authentication options, they aren't enabled for your organization yet — contact Lightdash support. When **Authentication type** is set to **AWS IAM (CLI credentials)** or **User Account (Sign in with AWS)**, the following fields replace the password. Your **Host**, **DB name**, **Schema**, SSL, and SSH tunnel settings still apply. ##### AWS region The AWS region where your Redshift cluster or serverless workgroup is located, for example `us-east-1`. ##### Redshift Serverless Enable if you're connecting to a Redshift Serverless workgroup rather than a provisioned cluster. ##### Cluster identifier (Provisioned clusters) The identifier of your Redshift cluster. ##### Workgroup name (Serverless) The name of your Redshift Serverless workgroup. ##### Database user (Provisioned clusters) The Redshift database user to request temporary credentials for. Serverless derives the user automatically. When using **User Account (Sign in with AWS)**, users can optionally set their own database user when they sign in. If they leave it blank, Redshift derives the user from their IAM Identity Center role. ##### Assume role ARN Optional. An IAM role to assume — within your own AWS account — before minting credentials, instead of using the access-key identity directly. Self-hosted instances running on AWS can leave this and the access keys blank to use the host's IAM role. ##### Assume role external ID The external ID required by the role's trust policy, if you configured one. ##### Advanced: AWS access key ID & secret access key The access key for the IAM user Lightdash uses to mint temporary Redshift credentials. On Lightdash Cloud, this is how you provide the AWS identity. ##### Advanced: Auto-create database user (Provisioned clusters) Create the database user automatically if it does not already exist. ##### AWS access portal URL Required for **User Account (Sign in with AWS)**. The IAM Identity Center access portal URL users open to sign in, for example `https://d-xxxxxxxxxx.awsapps.com/start`. ##### IAM Identity Center region Required for **User Account (Sign in with AWS)**. The AWS region where IAM Identity Center is enabled. ##### AWS account ID Required for **User Account (Sign in with AWS)**. The AWS account users should access through IAM Identity Center. ##### AWS role name Required for **User Account (Sign in with AWS)**. The IAM Identity Center permission set role name every user is given when they sign in — it's fixed on the project connection, not a choice users make in the access portal. Every user who signs in to this project needs to be assigned that permission set. This is usually the permission set name shown in the AWS access portal, for example `LightdashRedshiftReadOnly`. > [accordion] Setting up AWS IAM CLI credentials for Redshift > > > [!NOTE] > > > > IAM changes how Lightdash **authenticates**, not how it **reaches** your warehouse. Lightdash still opens a network connection to your cluster, so its [static IP addresses](#adding-lightdashs-static-ip-addresses-to-your-allow-list) must be allow-listed in your Redshift security group or VPC firewall (or use an SSH tunnel), exactly as with password authentication. Minting credentials happens over public AWS API endpoints and needs no extra allow-listing. > > **1. Create an IAM policy** that allows minting credentials. Use the variant for your warehouse type. > > Provisioned cluster: > > ```json theme={null} > { > "Version": "2012-10-17", > "Statement": [{ > "Sid": "LightdashRedshiftCredentials", > "Effect": "Allow", > "Action": "redshift:GetClusterCredentials", > "Resource": [ > "arn:aws:redshift:::dbuser:/", > "arn:aws:redshift:::dbname:/" > ] > }] > } > ``` > > If you enable **Auto-create database user**, also allow `redshift:CreateClusterUser` on the `dbuser:` resource. If you use database groups, add `redshift:JoinGroup` on the relevant `dbgroup:` resources. > > Serverless workgroup: > > ```json theme={null} > { > "Version": "2012-10-17", > "Statement": [{ > "Sid": "LightdashRedshiftServerlessCredentials", > "Effect": "Allow", > "Action": "redshift-serverless:GetCredentials", > "Resource": "arn:aws:redshift-serverless:::workgroup/" > }] > } > ``` > > **2. Create an identity to call that API.** > > * **Access keys (Lightdash Cloud).** Create an IAM user, attach the policy above, generate an access key and secret, and enter them under **Advanced** on the connection form. Lightdash Cloud has no AWS identity of its own, so this is how you grant access. Keep the policy minimal and rotate the key periodically. > > * **Assume role (optional).** If you'd rather not grant the IAM user the Redshift permissions directly, attach the policy to a separate IAM role and let the user assume it: add a trust policy on the role allowing that user to assume it, then enter the role ARN (and external ID, if set) on the form. The role is assumed **within your own AWS account**. > > * **Host role (self-hosted on AWS only).** If you run Lightdash yourself on AWS, attach the policy to the instance or task role (EC2 instance profile, ECS task role, or IRSA) and leave the access-key and role fields blank. > > **3. Configure the connection in Lightdash.** Open your project's connection settings — [**Project settings** via the gear icon in the top-right navigation](#open-up-your-lightdash-instance-to-get-started) for an existing project, or **Organization settings → All projects → Create new** for a new one. In the Redshift form, switch **Authentication type** to **AWS IAM (CLI credentials)** (this reveals the AWS fields), then fill in the **AWS region**, **cluster identifier** (or serverless **workgroup name**), **database user**, and your access keys under **Advanced**, and click **Test & save**. > [accordion] Setting up AWS IAM Identity Center for Redshift > > Use **User Account (Sign in with AWS)** when every user who queries this project should sign in with AWS in the browser rather than share a database password. The AWS account ID and role name are fixed on the project connection, not chosen at sign-in: every user who signs in gets credentials for that one IAM Identity Center permission set, and each must be assigned to it. This method can't give different users different Redshift access within the same project — if some users need their own permission set, they need personal credentials that don't use Identity Center sign-in, such as a database username and password or their own AWS IAM keys. > > > [!NOTE] > > > > Do not configure this with Lightdash environment variables. IAM Identity Center settings are project-specific: different Redshift projects can use different AWS accounts, access portals, regions, and permission sets. > > **Requirements** > > * An AWS Organizations-backed IAM Identity Center instance. Account instances of IAM Identity Center do not support permission sets or AWS account access. > * A user or group assigned to the AWS account through an IAM Identity Center permission set. > * A permission set or IAM policy that can mint Redshift database credentials: > * Provisioned Redshift: `redshift:GetClusterCredentials` and, if needed, `redshift:CreateClusterUser` / `redshift:JoinGroup`. > * Redshift Serverless: `redshift-serverless:GetCredentials`. > * The Redshift database user created by IAM must have database permissions such as `USAGE` on the schema and `SELECT` on the tables Lightdash queries. > * Network access from Lightdash to Redshift, exactly as with password authentication. > > **1. Enable IAM Identity Center.** In AWS, enable IAM Identity Center as an organization instance and choose the region users will sign in through. > > **2. Create a permission set.** Attach a policy that can mint Redshift credentials for your cluster or serverless workgroup. For production, keep this policy scoped to the cluster/workgroup and database your Lightdash project uses. > > **3. Assign users or groups to the AWS account.** Assign the permission set to the AWS account your Redshift warehouse lives in. Every Lightdash user who will sign in to this project needs this permission set assigned to them — they all authenticate as the same role. > > **4. Grant Redshift database permissions.** IAM authentication creates or uses a Redshift database user derived from the AWS role. Grant that database user access to the schemas and tables Lightdash should query. > > Example for a Redshift Serverless IAM role-derived user: > > ```sql theme={null} > GRANT USAGE ON SCHEMA analytics TO "IAMR:AWSReservedSSO_LightdashRedshiftReadOnly_xxxxxxxxxxxxxxxx"; > GRANT SELECT ON ALL TABLES IN SCHEMA analytics TO "IAMR:AWSReservedSSO_LightdashRedshiftReadOnly_xxxxxxxxxxxxxxxx"; > ALTER DEFAULT PRIVILEGES IN SCHEMA analytics > GRANT SELECT ON TABLES TO "IAMR:AWSReservedSSO_LightdashRedshiftReadOnly_xxxxxxxxxxxxxxxx"; > ``` > > **5. Configure the connection in Lightdash.** In the Redshift form, switch **Authentication type** to **User Account (Sign in with AWS)**, then fill in: > > * **AWS region**: Redshift cluster/workgroup region. > * **Cluster identifier** or **Workgroup name**. > * **AWS access portal URL**: the IAM Identity Center start URL. > * **IAM Identity Center region**. > * **AWS account ID**. > * **AWS role name**: the permission set/role every user who signs in is given. It's the same for everyone on this connection, not something users choose. > > After saving, users who open the project will see **Sign in with AWS**. They complete the AWS browser login and Lightdash stores their personal short-lived AWS credentials for queries. *** ### Snowflake You can see more details in [dbt documentation](https://docs.getdbt.com/reference/warehouse-profiles/snowflake-profile). To let Snowflake apply its own policies to agent queries, see [Snowflake agent sign-in](/agents/agent-identity#snowflake-agent-sign-in-for-each-person). ##### Account This is your Snowflake [account identifer](https://docs.snowflake.com/en/user-guide/admin-account-identifier.html#format-1-preferred-account-name-in-your-organization). The easiest way to find this is to login to Snowflake in your browser. Your account identifier is found in the URL in the format `-`. For example, if your Snowflake URL looks like `https://app.snowflake.com/ehcrzll/aaa99827/#/homepage`, your account identifier would be `ehcrzll-aaa99827` (combining both IDs with a hyphen). ![A Snowflake browser URL with the organization and account IDs in the path highlighted](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/connect-project/snowflake-account-url-09f2817563f91f1b6b85eec3f0f6224b.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=65138bfef5277795db8903fb087ed3e1) **Important:** The account identifier requires both the organization ID and account ID separated by a hyphen, not just the account name alone. You can also find your account identifier by using the format `-` where `organization_name` and `account_name` can be found by following any of the methods listed in [Managing accounts in your organization](https://docs.snowflake.com/en/user-guide/organizations-manage-accounts.html#label-viewing-organization-name). ##### User This is the login name for your Snowflake user. This is usually the same username you use to login to Snowflake. Alternatively, you can [create a new user through the snowflake console](https://docs.snowflake.com/en/user-guide/admin-user-management.html)with a username and password specifically for Lightdash to use. If you're a snowflake admin you can list all users available in the snowflake console: ![The Users tab of the Snowflake console Account page, listing each user's login name and status](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/connect-project/snowflake-users-list-bbffde04712b812206714e329bdcf37d.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=ad97806e42f5143689a4ebfda589e13c) ##### Authentication type Choose to authenticate using either a user account (using "Sign in with Snowflake" or "Connect via Lightdash CLI (SSO)") or with a service account using a JSON key file or password. ##### Connect via Lightdash CLI (SSO) > [!NOTE] > > This method is available behind the `new-onboarding` feature flag and only applies during **project creation**. Contact Lightdash support to enable it for your workspace. Use this when your Snowflake account requires SSO (or MFA) and you don't want to paste a password, private key, or PAT to create the project. The Lightdash CLI signs you in to Snowflake in your browser and provisions a durable credential that is deposited straight into the project connection form — you never handle the secret yourself. **How it works:** 1. In the Snowflake connection form, choose **Connect via Lightdash CLI (SSO)**. Lightdash generates a single-use connect code (valid for 15 minutes) and shows the CLI command to run. 2. Run the command shown in the setup wizard from a machine that has the [Lightdash CLI](/workflow/cli/reference) installed: ```bash theme={null} lightdash connect-snowflake \ --url https://app.lightdash.cloud \ --code \ --account ecomstore-xy12345 ``` 3. The CLI opens your Snowflake SSO login in a browser. Once you sign in, the CLI mints a durable Snowflake credential and deposits it into the setup wizard tab. 4. The wizard shows **Connected as `` ✓** and pre-fills smart defaults from your Snowflake session inventory: the largest database is picked as the default, the recommended compute warehouse is auto-selected, and the first available schema in the chosen database is filled in. Adjust any of these from the dropdowns, then submit the form to create the project. **Credential type the CLI provisions:** The CLI never deposits your raw SSO token. It tries, in order: 1. **Key-pair authentication (preferred)** — generates a local RSA-2048 key-pair and registers the public key in the first free slot on your Snowflake user with `ALTER USER … SET RSA_PUBLIC_KEY`. The key is verified with a diagnostic connection before deposit. 2. **Programmatic Access Token (PAT)** — if key-pair provisioning fails (for example, because both `RSA_PUBLIC_KEY` slots are already in use), the CLI falls back to a Snowflake [Programmatic Access Token](https://docs.snowflake.com/en/user-guide/programmatic-access-tokens) valid for 365 days. If both fail, the CLI prints admin remediation SQL and exits without depositing a credential. **Optional flags:** You can preset any of `--user`, `--database`, `--warehouse`, `--role`, or `--schema`. Anything not provided is filled from your Snowflake session defaults, or picked in the browser tab from the discovered options. **Security notes:** * The connect code is single-use and expires after 15 minutes; only a SHA-256 hash of it is stored server-side. * Generating a new connect code invalidates any previous codes for your user. * A code can only be claimed once, by the user who created it. * Deposited credentials are encrypted at rest and cleared from the deposit store as soon as the browser tab claims them. ##### Sign in with Snowflake This method requires you to configure an Oauth2 flow from your Snowflake warehouse. > [accordion] Adding security integration on Snowflake warehouse > > To do this, first open an SQL console on your Snowflake warehouse, and create a `security integration` like this: > > ``` > CREATE SECURITY INTEGRATION lightdash_oauth > TYPE = OAUTH > ENABLED = TRUE > OAUTH_CLIENT = 'CUSTOM' > OAUTH_CLIENT_TYPE = 'CONFIDENTIAL' > OAUTH_REDIRECT_URI = 'https://.lightdash.cloud/api/v1/oauth/redirect/snowflake' > OAUTH_ISSUE_REFRESH_TOKENS = TRUE > ``` > > Now you can get the integration details using > > ``` > DESCRIBE SECURITY INTEGRATION lightdash_oauth; > > ``` > > Copy the `OAUTH_AUTHORIZATION_ENDPOINT` and `OAUTH_TOKEN_ENDPOINT` > > Then run > > ``` > SELECT SYSTEM$SHOW_OAUTH_CLIENT_SECRETS('LIGHTDASH_OAUTH'); > ``` > > And copy the `OAUTH_CLIENT_SECRET`, `OAUTH_CLIENT_SECRET_2` and `OAUTH_CLIENT_ID` > > Finally, contact the Lightdash Team [support@lightdash.com](mailto:support@lightdash.com) to setup Sign in with Snowflake for your instance. You can read more about this on [Snowflake official docs](https://docs.snowflake.com/en/user-guide/oauth-snowflake-overview) Lightdash doesn't request a Snowflake role when a person signs in, and the **Role** field on the connection doesn't apply to this method. Each person's queries run with the role Snowflake assigns to their sign-in, which is their default role. If your security integration sets `OAUTH_ENABLE_ROLE_SELECTION = TRUE`, Snowflake asks each person to choose their roles while they sign in, and their queries run with those roles. Signing in again adds roles and never removes one. To limit the roles people can choose, set `ALLOWED_ROLES_LIST` or `BLOCKED_ROLES_LIST` on the integration. See [Snowflake OAuth for custom clients](https://docs.snowflake.com/en/user-guide/oauth-custom) for these settings. ##### Private Key You can generate a Private Key for a Snowflake user following the guide [here](https://docs.snowflake.com/en/user-guide/key-pair-auth#generate-the-private-key) Once generated, copy across the Private Key File that is generated into Lightdash. If you chose to encrypt your private key you will also need to supply the Private Key Passphrase. ##### Password This is the password your Snowflake user. This is usually the same password you use to login to Snowflake. Note that due to changes in Snowflake Authentication, users that require passwords may also need to enable MFA, which is not compatible with a Lightdash project connection. ##### Role This is the security role that you would like to use when running queries as the specified user. The role must have access to any warehouses, databases, schemas, and tables you want to use. If you're a Snowflake admin you can list all roles available in the snowflake console: ![The Roles tab of the Snowflake console Account page, listing roles such as ACCOUNTADMIN with their descriptions](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/connect-project/snowflake-roles-list-e75fbf628b9fc8694fd459edeabc846e.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=6cae12e93af89e6f87be21f22a661180) You can configure your role to allow read access to all warehouses, databases, schemas, and tables by following the guide for[Creating custom read-only roles](https://docs.snowflake.com/en/user-guide/security-access-control-configure.html#creating-custom-read-only-roles). ##### Database This is the name of your database. The specified user must be granted access to this database. You can see a list of databases available in the snowflake console: ![The Databases page of the Snowflake console listing the available databases and their owners](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/connect-project/snowflake-database-list-1a59a45edb75cf1ff62bfa22c4609f89.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=4d3b9405bf5aba715c339453545c67f0) ##### Warehouse This is the name of the warehouse you would like to use for running queries. The specified user must be grantend access to use this warehouse. You can see al list of warehouses available in the snowflake console: ![The Warehouses page of the Snowflake console listing each warehouse with its status and size](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/connect-project/snowflake-warehouse-list-061564f3ec10b3e2d0416fc79f6d2385.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=8fd8473a5821124ff8563122c8b79e18) If “Always use this warehouse” is set to yes, this warehouse will be used for all queries, even if the dbt configuration specifies a different warehouse using snowflake\_warehouse. With it off, queries built from an Explore, such as charts and dashboards, run on the warehouse set in the base model's `snowflake_warehouse` config, if it has one. Queries written in SQL, such as the SQL runner and SQL charts, always run on this warehouse. ##### Schema This is the default schema used by dbt to compile and run your dbt project. You can find this in the dbt cloud IDE or your local `profiles.yml` file. If you're a dbt cloud user you can find this under your profile in the dbt cloud IDE: ![dbt Cloud development credentials for a project, with the Dataset row circled](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/connect-project/dbt-cloud-credentials-351bb1a9bdda693be0ed82eb17705410.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=b9fa8a5e0f54bed6a6a8313fd668b146) If you work with dbt locally, then check your `profiles.yml` file at `~/.dbt/profiles.yml` and look for a field named `schema`: ```yaml theme={null} my-snowflake-db: target: dev outputs: dev: type: snowflake account: [account id] user: [username] password: [password] role: [user role] database: [database name] warehouse: [warehouse name] schema: [dbt schema] # Look for this one! ``` ##### Keep client session alive This is intended to keep Snowflake sessions alive beyond the typical 4 hour timeout limit. You can see more details in [dbt documentation](https://docs.getdbt.com/reference/warehouse-profiles/snowflake-profile#client%5Fsession%5Fkeep%5Falive). ##### Query tag A value with which to tag all queries, for later searching in [QUERY\_HISTORY view](https://docs.snowflake.com/en/sql-reference/account-usage/query%5Fhistory.html)) ##### Start of week This controls what day is the start of the week in Lightdash. `Auto` sets it to whatever the default is for your data warehouse. Or, you can customize it and select the day of the week from the drop-down menu. This will be taken into account when using 'WEEK' time interval in Lightdash. *** ### Databricks The credentials needed to connect to your cluster can be found in the ODBC options in your databricks account: 1. Go to the `Compute` tab in the sidebar. 2. Click the configuration tab for the cluster that you're connecting to Lightdash. 3. Expand the `Advanced options` tab 4. Open the `JDBC/ODBC` tab ![A Databricks cluster Configuration tab with Advanced options expanded and the JDBC/ODBC tab open, showing server hostname, port, and HTTP path](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/connect-project/databricks-connect-screenshot-6b167bd07fe88540d9ba4de5fa2bc0ca.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=8d065aedb38a2c3800f3124eaec3c109) ##### Server hostname Follow the instructions above to find your ODBC connection instructions. ##### HTTP Path Follow the instructions above to find your ODBC connection instructions. ##### Port Follow the instructions above to find your ODBC connection instructions. ##### Authentication type Choose to authenticate using either a user account (using "Sign in with Databricks") or with a Personal Access Token. ##### Sign in with Databricks This method requires you to configure an OAuth application in your Databricks workspace. > [accordion] Adding OAuth application on Databricks workspace > > To do this, first go to your Databricks workspace settings: > > 1. Access Account Console > * Log into your Databricks account console > * Click the Settings icon in the sidebar > 2. Navigate to App Connections > * Go to the App connections tab > * Click Add connection > 3. Configure the application with the following settings: > * **Application Name**: `Lightdash` (or any name you prefer) > * **Redirect URL**: `https://.lightdash.cloud/api/v1/oauth/redirect/databricks` > * **Access scopes**: all-apis and offline\_access > * **Client Secret**: optional > 4. Click **Create** > 5. Copy the **Client ID** and **Client Secret** > > Finally, contact the Lightdash Team at [support@lightdash.com](mailto:support@lightdash.com) to set up Sign in with Databricks for your instance. Configure the following ENV variables to enable Databricks OAuth: * DATABRICKS\_OAUTH\_CLIENT\_ID: see above * DATABRICKS\_OAUTH\_CLIENT\_SECRET (optional): see above * DATABRICKS\_OAUTH\_AUTHORIZATION\_ENDPOINT: [https://your-url.cloud.databricks.com/oidc/v1/authorize](https://your-url.cloud.databricks.com/oidc/v1/authorize) * DATABRICKS\_OAUTH\_TOKEN\_ENDPOINT: [https://your-url.cloud.databricks.com/oidc/v1/token](https://your-url.cloud.databricks.com/oidc/v1/token) You can read more about this on [Databricks official docs](https://docs.databricks.com/aws/en/dev-tools/auth/oauth-m2m). ##### Personal Access Token Your personal access token can be found in your user settings in databricks: 1. Open `Settings` by clicking the cog ⚙️ in the sidebar and select `User settings` 2. Click `Generate token`. You'll be asked to enter a name and expiry. 3. Copy the token ![The Access Tokens tab of Databricks User Settings, with the Generate New Token button above the list of existing tokens](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/connect-project/databricks-access-screenshot-44dfec5587315b2ced0b1724155c1eac.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=aaec8ad90f0e0a078fa8748d8110ad08) ##### Database The default database name used by dbt for this connection. ##### Start of week This controls what day is the start of the week in Lightdash. `Auto` sets it to whatever the default is for your data warehouse. Or, you can customize it and select the day of the week from the drop-down menu. This will be taken into account when using 'WEEK' time interval in Lightdash. *** ### Trino Lightdash connects to your Trino cluster and queries the catalogs it exposes — it doesn't connect to the underlying data sources directly. This means that if Lightdash doesn't have a native connection for your warehouse but your Trino cluster can reach it through a [Trino connector](https://trino.io/docs/current/connector.html), you can still explore that warehouse in Lightdash by connecting through Trino. We only support [LDAP authentication with Trino](https://trino.io/docs/current/security/ldap.html). You can see more details in [dbt's documentation](https://docs.getdbt.com/reference/warehouse-setups/trino-setup#configuration). ##### Host The hostname of your cluster. E.g. `mycluster.mydomain.com` Don't include the http\:// or https\:// prefix. ##### User The username (of the account) to log in to your cluster. When connecting to Starburst Galaxy clusters, you must include the role of the user as a suffix to the username. Format for Starburst Enterprise or Trino: `user.name` or `user.name@mydomain.com` Format for Starburst Galaxy:`user.name@mydomain.com/role` ##### Password This is the password for authentication. ##### DB name Specify the name of the database that your dbt models are built into. This is the name of a catalog in your cluster. e.g. `my_postgres_catalog` ##### Port The port to connect to your cluster. By default, it's 443 for TLS enabled clusters. e.g. `443` ##### SSL mode This controls how dbt connects to Trino database using SSL. ##### Start of week This controls what day is the start of the week in Lightdash. `Auto` sets it to whatever the default is for your data warehouse. Or, you can customize it and select the day of the week from the drop-down menu. This will be taken into account when using 'WEEK' time interval in Lightdash. *** ### ClickHouse You can see more details in [dbt documentation](https://docs.getdbt.com/reference/warehouse-profiles/clickhouse-profile). ##### Host This is the host where your ClickHouse database is running. ##### User This is the ClickHouse database user name. ##### Password This is the ClickHouse database user password. ##### DB name This is the ClickHouse database name. ##### Schema This is the default schema used by dbt to compile and run your dbt project. You can find this in your local `profiles.yml` file. If you work with dbt locally, then check your `profiles.yml` file at `~/.dbt/profiles.yml` and look for a field named `schema`: ```yaml theme={null} my-clickhouse-db: target: dev outputs: dev: type: clickhouse host: [hostname] user: [username] password: [password] port: [port] schema: [dbt schema] # Look for this one! ``` ##### Port This is the port where the ClickHouse database is running. The default port for ClickHouse HTTP interface is 8123. ##### Secure Enable this option to use HTTPS/SSL for secure connections to your ClickHouse database. For ClickHouse Cloud, use the HTTPS port, usually `8443`, and turn on **Secure**. ClickHouse connections can't use an SSH tunnel, so if your ClickHouse service restricts access by IP, add Lightdash's [static IP addresses](#adding-lightdashs-static-ip-addresses-to-your-allow-list) to its IP access list. ##### Retries The number of times Lightdash should retry ClickHouse queries that result in unhandled server errors. By default, this is set to 3. ##### Start of week This controls what day is the start of the week in Lightdash. `Auto` sets it to whatever the default is for your data warehouse. Or, you can customize it and select the day of the week from the drop-down menu. This will be taken into account when using 'WEEK' time interval in Lightdash. #### Known issues ##### Boolean expression columns must be typed as boolean ClickHouse represents the result of boolean expressions, like `status = 'active'`, as `UInt8`. If the column is not typed as boolean in your dbt schema, Lightdash may treat it as a string dimension and generate a filter like `IN ('true')`. ClickHouse rejects this with an error like `Cannot convert string 'true' to type UInt8`. To avoid this, explicitly type boolean expression columns as `boolean` in your dbt schema: ```yaml theme={null} models: - name: orders columns: - name: is_active data_type: boolean ``` Or set the Lightdash dimension type: ```yaml dbt v1.10+ theme={null} models: - name: orders columns: - name: is_active config: meta: dimension: type: boolean ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: orders columns: - name: is_active meta: dimension: type: boolean ``` *** ### DuckDB Lightdash supports DuckDB project connections in two modes: * **MotherDuck** — managed cloud DuckDB * **DuckLake** — a [DuckLake](https://ducklake.select/) catalog backed by your own metadata store (Postgres, SQLite, or a DuckDB file) and your own data store (S3-compatible, GCS, Azure Blob, or local filesystem) Pick the mode from the **MotherDuck / DuckLake** toggle at the top of the connection form. Both modes use the same `dbt-duckdb` adapter — see the [dbt-duckdb documentation](https://docs.getdbt.com/reference/resource-configs/duckdb-configs) for adapter-level details. DuckDB connections in Lightdash require dbt `v1.8` or later. #### MotherDuck Lightdash supports DuckDB project connections through [MotherDuck](https://motherduck.com/). ##### Database This is your MotherDuck database name. For example, if your dbt profile uses `path: "md:analytics"`, the database value in Lightdash is `analytics`. ##### Schema This is the schema in your MotherDuck database that Lightdash should use. ##### Access token This is your MotherDuck access token. You can create one from your MotherDuck account settings. We recommend using a dedicated token for Lightdash with access only to the database(s) you want to query. ##### Threads The number of threads dbt should use for this connection. If you're not sure what to use, start with `1`. ##### Start of week This controls what day is the start of the week in Lightdash. `Auto` sets it to whatever the default is for your data warehouse. Or, you can customize it and select the day of the week from the drop-down menu. This will be taken into account when using 'WEEK' time interval in Lightdash. If you work with dbt locally, your `profiles.yml` should look similar to this: ```yaml theme={null} my-motherduck-db: target: prod outputs: prod: type: duckdb path: "md:analytics" schema: main threads: 4 extensions: - motherduck settings: motherduck_token: "{{ env_var('MOTHERDUCK_TOKEN') }}" ``` #### DuckLake [DuckLake](https://ducklake.select/) separates **catalog metadata** (where DuckLake records tables, schemas, and snapshots) from **data files** (the Parquet files themselves). Lightdash attaches the catalog read-only on a warm in-memory DuckDB instance and reads data files from your chosen object store. You configure two backends independently: a catalog backend and a data path backend. ##### Schema The default DuckLake schema your queries will use (for example, `main`). ##### Catalog alias The alias under which Lightdash attaches the DuckLake catalog. Defaults to `ducklake`. This is the name Lightdash exposes as the database in dbt and in queries. ##### Catalog backend Where DuckLake stores its metadata. Choose one of: * **PostgreSQL** — recommended for multi-pod deployments. Lightdash will need `host`, `port`, `database`, `user`, and `password`. * **SQLite** — a SQLite file on the Lightdash server. Provide the absolute path to the catalog file. * **DuckDB** — a DuckDB file on the Lightdash server. Provide the absolute path to the catalog file. > [!WARNING] > > SQLite and DuckDB catalogs live on the Lightdash server's local filesystem and are only viable for single-pod deployments. Use a PostgreSQL catalog if you run more than one Lightdash pod. ##### Data path backend Where DuckLake reads Parquet data files from. Choose one of: * **S3-compatible** — `url` (e.g. `s3://my-bucket/path/`), optional `endpoint` and `region`, optional `accessKeyId` + `secretAccessKey`, and an optional path-style URL toggle. Leave the keys blank to use the SDK credential chain (IAM role, web identity, etc.). * **Google Cloud Storage** — `url` (e.g. `gs://my-bucket/path/`) and optional HMAC `keyId` + `secret`. Leave the HMAC fields blank to use the SDK credential chain. * **Azure Blob Storage** — `url` (e.g. `azure://container/path/` or `abfss://container@account.dfs.core.windows.net/path/`). Authenticate with either a `connectionString` (takes precedence) or `accountName` + `accountKey`. * **Local filesystem** — a directory on the Lightdash server. Only viable for single-pod deployments. ##### Threads The number of threads dbt should use for this connection. If you're not sure what to use, start with `1`. ##### Start of week This controls what day is the start of the week in Lightdash. `Auto` sets it to whatever the default is for your data warehouse. ##### dbt profile examples If you work with dbt locally, your `profiles.yml` should look similar to one of these. PostgreSQL catalog + S3 data path: ```yaml theme={null} my-ducklake-db: target: prod outputs: prod: type: duckdb path: ":memory:" database: ducklake schema: main threads: 4 extensions: [ducklake, postgres, httpfs] settings: autoinstall_known_extensions: true autoload_known_extensions: true attach: - alias: ducklake path: "ducklake:ld_ducklake" secrets: - name: ld_ducklake_catalog type: postgres host: pg.example.com port: 5432 database: catalog user: "{{ env_var('DUCKLAKE_CATALOG_USER') }}" password: "{{ env_var('DUCKLAKE_CATALOG_PASSWORD') }}" - name: ld_ducklake_data type: s3 scope: "s3://my-bucket/path/" region: us-east-1 key_id: "{{ env_var('AWS_ACCESS_KEY_ID') }}" secret: "{{ env_var('AWS_SECRET_ACCESS_KEY') }}" - name: ld_ducklake type: ducklake data_path: "s3://my-bucket/path/" metadata_parameters: TYPE: postgres SECRET: ld_ducklake_catalog ``` SQLite catalog + local data path: ```yaml theme={null} my-ducklake-db: target: prod outputs: prod: type: duckdb path: ":memory:" database: ducklake schema: main threads: 4 extensions: [ducklake, sqlite] settings: autoinstall_known_extensions: true autoload_known_extensions: true attach: - alias: ducklake path: "ducklake:sqlite:/var/lib/ducklake/catalog.sqlite" options: data_path: "/var/lib/ducklake/data" ``` *** ### Athena You can see more details in [dbt documentation](https://docs.getdbt.com/docs/core/connect-data-platform/athena-setup). ##### AWS Region The AWS region where your Athena workgroup is located (e.g. `us-east-1`, `eu-west-1`). ##### Catalog This is the Athena data catalog name. For most setups, this is `AwsDataCatalog`. ##### Database This is the Athena database name (also known as schema in other warehouses). This is where your dbt models are materialized. ##### S3 Staging Directory The S3 location where Athena stores query results. This is required for all Athena queries. e.g. `s3://your-bucket/athena-results/` ##### S3 Data Directory (optional) The S3 location for storing table data when materializing models. This is optional and only needed if you're using dbt to create tables. e.g. `s3://your-bucket/data/` ##### AWS Access Key ID Your AWS access key ID for authentication. This should belong to an IAM user with permissions to run Athena queries and access the S3 buckets specified above. ##### AWS Secret Access Key Your AWS secret access key for authentication. Create a dedicated IAM user or role for Lightdash with minimal permissions: * `AmazonAthenaFullAccess`, or a more restrictive custom policy * S3 read/write access to your staging and data directories On Lightdash Cloud, you can connect without storing access keys by choosing **Web Identity (No Keys)** as the authentication type. See [Connect Athena with web identity](/integrations/connect-athena-with-web-identity). Self-hosted instances can use IAM role authentication instead of access keys — see the [`ATHENA_WAREHOUSE_IAM_ROLE_AUTH`](/self-host/customize-deployment/environment-variables#athena) environment variable. ##### Assume Role ARN (optional) An IAM role ARN for Lightdash to assume after authenticating, so Athena access stays on a separate role from the Access Keys or IAM Role credentials above. Works with Access Keys and IAM Role authentication, not Web Identity. ##### Assume Role External ID (optional) An external ID to send when assuming the role above, if its trust policy requires one. ##### Workgroup (optional) The Athena workgroup to use for queries. If not specified, the default workgroup (`primary`) is used. ##### Threads (optional) The number of threads dbt should use. Default is 1. ##### Number of Retries (optional) The number of times to retry failed queries. Default is 5. ##### Start of week This controls what day is the start of the week in Lightdash. `Auto` sets it to whatever the default is for your data warehouse. Or, you can customize it and select the day of the week from the drop-down menu. This will be taken into account when using 'WEEK' time interval in Lightdash. *** ## 2. Import a dbt project You don't have to connect a git repository to sync your dbt project to Lightdash. There are two approaches: * **CLI deploy:** you compile the dbt project locally or in CI with `lightdash deploy`, and Lightdash doesn't need a remote git connection. * **Git connection:** Lightdash pulls a connected branch from GitHub, GitLab, Azure DevOps, or Bitbucket and compiles it server-side. A [dbt Cloud](#dbt-cloud) connection reads the project from dbt Cloud instead of compiling it. To compare them and choose a method, see [Syncing your dbt project to Lightdash](/integrations/dbt/projects#syncing-your-dbt-project-to-lightdash). To set your dbt connection type in Lightdash, follow the steps below. > [accordion] I'm using dbt Cloud, should I connect using my git repository or through dbt Cloud? > > Generally, **we recommend connecting via git repository for most users**, unless you specifically need to use features that are only available when connecting via dbt Cloud. > > For example, if you are using [cross project references](https://docs.getdbt.com/docs/mesh/govern/project-dependencies#how-to-write-cross-project-ref) in dbt Cloud, you'll *need* to use that connection type, or Lightdash won't be able to compile your projects. > > If you connect via git repository, you need to make sure that your environment version in dbt Cloud is set to ['Compatible'](https://docs.getdbt.com/docs/dbt-versions/cloud-release-tracks). > > You can switch connection type later in the dbt project section of **Project settings**. The project keeps its charts, dashboards and spaces, and Lightdash rebuilds its tables from the new connection, so check that your tables still load in Explore afterwards. To choose how Lightdash syncs your dbt project, head to your project connection settings in Lightdash: ![Lightdash project settings, opened from the gear icon, with Connection settings selected and the warehouse connection form on the right](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/connect-project/project-connection-settings.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=70883baf18b31318e85f089c330c8adb) Then scroll down to the dbt project section: ![The dbt connection section of Lightdash project settings, with type GitHub, OAuth authorization, and repository, dbt version, and branch fields](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/connect-project/project-connection-dbt.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=046b66116175e85cb0294040201a3e21) The **dbt version** field sets the dbt Core 1.x version Lightdash uses when it compiles your project. Lightdash supports dbt Core 1.4 to 1.12. The default, **latest**, uses the newest version Lightdash supports, currently 1.12. If a refresh fails with a dbt compile error and the project is pinned to an older version, choose a newer version, or **latest**, and refresh again. `lightdash deploy` and `lightdash preview` compile with the dbt you have installed, so for those, upgrade dbt locally. The list has no dbt Core v2 (Fusion) option: for a Fusion project, keep **latest** and keep the project compatible with dbt Core 1.10 or later, as described in [Moving to dbt Core v2 (Fusion)](/integrations/dbt/upgrading#moving-to-dbt-core-v2-fusion). Pick your connection type and follow the guide below: [GitHub](#github), [GitLab](#gitlab), [Azure DevOps](#azure-devops), [Bitbucket](#bitbucket), [dbt Cloud](#dbt-cloud), or the [CLI](#cli). **dbt Cloud managed repositories** Support for connecting Lightdash to [dbt Cloud managed repositories](https://docs.getdbt.com/docs/dbt-cloud/cloud-configuring-dbt-cloud/cloud-using-a-managed-repository) is [Beta](/support/feature-badges#beta). If you're using dbt Cloud and you'd like to use Lightdash, please reach out to us. ### GitHub ##### Semantic layer format Choose **dbt** for a dbt project or **Native Lightdash YAML** for standalone Lightdash models. See [Connect through GitHub](/semantic-layer/yaml#connect-through-github) for native setup and supported features. The dbt-specific settings below apply when **dbt** is selected. ###### OAuth (recommended authorization method) We recommend you connect to Github using OAuth. This gives Lightdash a direct connection to the repo, so it won't lose access when individuals leave the company, and it can create pull requests, which is required for [dbt write-back features](/integrations/dbt/write-back). This connection lives at the organization level, so you can map different dbt project repos to each Lightdash project without needing a new access token. ###### Personal access token (classic authorization method) This is used to access your repo. See the [instructions for creating a personal access token here](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token). Select `repo` scope when you're creating the token. ![The GitHub token scope picker with the repo scope ticked and its sub-scopes selected](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/connect-project/oauth-scope-7b15ec5e0dadade4c485e24df69a878b.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=55569d6884e172f6f6e79642a4375ac5) ###### Fine-grained access token Fine-grained access tokens let you limit access to specific repositories on your GitHub account. You can read more about them in the [GitHub docs](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token#creating-a-fine-grained-personal-access-token). 1. Go to [Settings > Developer access > Personal access tokens > Fine-grained token](https://github.com/settings/personal-access-tokens/new) 2. Add the name, expiration, description and owner (we'll need their username later) 3. Add the repositories you want Lightdash to access. You might want to give access only to the repository where your `dbt` project is located. ![The GitHub Repository access options with "Only select repositories" chosen and one dbt repository selected](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/connect-project/fine-grained-repo-5e1f06ae0ef950bf0d798d3bb88dd9ae.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=94fe69aadf1c7f4bfcf428a44f61504c) 4. On `Repository` permissions, select `Contents` --> `Read and Write` and `Pull Requests` --> `Read and Write`. ![GitHub repository permissions with Contents and Pull requests both set to Access: Read and write](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/connect-project/fine-grained-permissions.jpg?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=fd1ba5f0889f5dc23320bc4bcb2d88d6) 5. Click `Generate token` and copy the token. You could also replace your old tokens with new fine-grained tokens on project settings. ##### Repository This should be in the format `my-org/my-repo`. e.g. `lightdash/lightdash-analytics` ##### Branch This is the branch in your GitHub repo that Lightdash should sync to. e.g. `main`, `master` or `dev` By default, we've set this to `main` but you can change it to whatever you'd like. ##### Project directory path For **dbt**, this is the path from the root of your repository to the folder containing `dbt_project.yml`. For **Native Lightdash YAML**, use the [native project directory](/semantic-layer/yaml#project-layout). Write the path with a leading slash and without your repository name: * Put `/` if `dbt_project.yml` is in the root of your repo. * Otherwise, write the path to the folder that contains it. For example, if `dbt_project.yml` is at `/dbt/emcnl/dbt_project.yml`, write `/dbt/emcnl`. ##### Host domain If your repository is on GitHub Enterprise with its own domain, enter that domain here, for example `github.acme.com`. By default, this is `github.com` A custom host domain works with a personal access token or fine-grained token. OAuth connects to `github.com` only. [dbt write-back](/integrations/dbt/write-back) opens pull requests through the `github.com` API, so it doesn't work with a custom host domain. If you selected **dbt**, fill out the [dbt project details](/integrations/dbt/projects#dbt-project-settings). For **Native Lightdash YAML**, save the connection to compile your models. ##### Fix a GitHub App "Not Found" error If a refresh, **Test & deploy**, or an agent's **Connect GitHub** fails with an error that starts with `Not Found` and links to GitHub's docs on creating an installation access token, the GitHub App installation Lightdash has stored for your organization no longer works. An organization admin can replace it in **Organization settings** → **Integrations** → **GitHub**: * If the card shows **Install**, click it and complete the GitHub flow until it returns you to Lightdash. Lightdash then stores the new installation. * If the card shows **Reinstall**, click it. Lightdash deletes the stored installation, uninstalls the app on GitHub, and opens the install flow. **Delete** does the same without opening the install flow, so follow it with **Install**. * **Pending approval** means an admin of your GitHub organization still needs to approve the installation request in GitHub. This fixes an installation that is missing or pending approval. If the installation works but is set to **Only select repositories** and doesn't include a repository you've connected, such as an [additional dbt source](/integrations/dbt/projects#adding-and-managing-sources), the refresh doesn't show this `Not Found` message; it fails to load that repository instead. Add the repository in the app installation's **Repository access** settings on GitHub, or click **Reinstall** and select it, then retry. *** ### GitLab ##### Access token This is used to access your repo. Lightdash accepts either a personal access token or a project access token in the same token field — pick whichever fits how you want to manage access. ###### Personal access token See the [instructions for creating a personal access token here](https://docs.gitlab.com/ee/user/profile/personal%5Faccess%5Ftokens.html). Select `read_repository` scope when you're creating the token, and make sure the user has permission to download the code — normally the `Reporter` role. A personal access token is tied to the user who created it, so the connection breaks if that person leaves. If you'd rather not tie it to an individual, create the token for a dedicated service-account GitLab user instead, or use a project access token. ###### Project access token A [project access token](https://docs.gitlab.com/ee/user/project/settings/project%5Faccess%5Ftokens.html) belongs to the GitLab project rather than a person, so it keeps working after its creator leaves. 1. In your GitLab project, go to **Settings** → **Access tokens**. 2. Create a new token with `read_repository` scope and the `Reporter` role. 3. Paste the token into the same token field Lightdash uses for personal access tokens. ##### Repository You can find this in the GitLab URL when you're in your repo. This should be in the format `my-org/my-repo`. e.g. if my browser had [`https://gitlab.com/lightdash/lightdash-analytics.gitlab.io`](https://gitlab.com/lightdash/lightdash-analytics.gitlab.io), I'd put in: `lightdash/lightdash-analytics` as my repository in Lightdash. ##### Branch This is the branch in your GitLab repo that Lightdash should sync to. e.g. `main`, `master` or `dev` By default, we've set this to `main` but you can change it to whatever you'd like. ##### Project directory path This is the folder where your `dbt_project.yml` file is found in the GitLab repository you entered above. If your `dbt_project.yml` file is in the main folder of your repo (e.g. `lightdash/lightdash-analytics/dbt_project.yml`), then you don't need to change anything in here. You can just leave the default value we've put in. If your dbt project is in a sub-folder in your repo (e.g. `lightdash/lightdash-analytics/dbt/dbt_project.yml`), then you'll need to include the path to the sub-folder where your dbt project is (e.g. `/dbt`). ##### Host domain If you've [customized the domain for your GitLab pages](https://docs.gitlab.com/ee/user/project/pages/getting%5Fstarted%5Fpart%5Fone.html), you can add the custom domain for your project in here. By default, this is `gitlab.io`. After adding your Gitlab information, fill out the [dbt project details](/integrations/dbt/projects#dbt-project-settings) and you're all set! *** ### Azure DevOps ##### Personal access token This is your secret token used to access Azure Devops. See the [instructions to create a personal access token](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops\&tabs=Windows)You must specify at least the Repo:Read scope. ##### Organization This is the name of the organization that owns your repository ##### Project This is the name of the project that owns your repository ##### Repository This is the name of the repository. For many projects, this is the same as your project name above. ##### Branch This is the branch in your repository that Lightdash should sync to. e.g. `main`, `master` or `dev` By default, we've set this to `main` but you can change it to whatever you'd like. ##### Project directory path This is the folder where your `dbt_project.yml` file is found in the repository you entered above. If your `dbt_project.yml` file is in the main folder of your repo (e.g. `lightdash/lightdash-analytics/dbt_project.yml`), then you don't need to change anything in here. You can just leave the default value we've put in. If your dbt project is in a sub-folder in your repo (e.g. `lightdash/lightdash-analytics/dbt/dbt_project.yml`), then you'll need to include the path to the sub-folder where your dbt project is (e.g. `/dbt`). After adding the Azure DevOps details, fill out the [dbt project details](/integrations/dbt/projects#dbt-project-settings) and you're all set! *** ### Bitbucket Connect a dbt or native Lightdash YAML repository on Bitbucket Cloud using the project's **API Token** field. Choose **Bitbucket** in your project's connection settings. #### Bitbucket Cloud API token For repositories on `bitbucket.org`, use a personal API token with scopes. Follow [Atlassian's token creation instructions](https://support.atlassian.com/bitbucket-cloud/docs/create-an-api-token/): 1. Open your Atlassian account's **Security** settings, then **Create and manage API tokens**. 2. Select **Create API token with scopes**, name the token, and choose its expiry date. 3. Select **Bitbucket** as the app, then choose the permissions below. 4. Create the token and copy it into Lightdash's **API Token** field. Atlassian displays the token only once. | Permission | Scope | When needed | | - | - | - | | Repositories: Read | `read:repository:bitbucket` | Connecting and syncing the dbt project | | Repositories: Write | `write:repository:bitbucket` | Writeback | | Pull requests: Read | `read:pullrequest:bitbucket` | Writeback | | Pull requests: Write | `write:pullrequest:bitbucket` | Writeback | Select all four permissions for writeback. Write scopes do not include read scopes; see [Atlassian's API token permissions](https://support.atlassian.com/bitbucket-cloud/docs/api-token-permissions/). A connection used only to read and sync the repository needs only Repositories: Read. The token's owner must have access to the repository and permission to push branches and create pull requests. Bitbucket writeback uses that person's identity. Lightdash users still need [source-code write permissions](/workspace-admin/roles) on the project to use the stored token. No Bitbucket OAuth connection or Lightdash GitHub App installation is required. #### Connection fields * **Semantic layer format:** choose **dbt** or **Native Lightdash YAML**. For native setup and repository layout, see [Connect through GitHub or Bitbucket Cloud](/semantic-layer/yaml#connect-through-github). * **Username:** your Bitbucket username, with the exact capitalization shown in your Bitbucket personal settings. Use the username, not your email address. * **API Token:** the token created above. * **Repository:** the workspace and repository slug, such as `my-workspace/analytics`. Do not enter the full URL. * **Branch:** the branch Lightdash syncs from, such as `main`. Writeback opens a separate change branch and targets this configured branch. * **Project directory path:** the directory containing `dbt_project.yml` for dbt, or `lightdash.config.yml` and your model directory for native YAML. Use `/` for the repository root. * **Host domain:** for dbt, leave blank for Bitbucket Cloud or use `bitbucket.org`. Native YAML uses `bitbucket.org` automatically and hides this field. ![Bitbucket connection fields showing the username, required API token permissions, and repository slug](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/connect-project/bitbucket-connection.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=685c0982223c8bdd6d5d1fe76160de35) Save the connection. For dbt, complete the [dbt project settings](/integrations/dbt/projects#dbt-project-settings). For the available writeback actions, see [dbt write-back](/integrations/dbt/write-back) and [AI writeback](/agents/ai-writeback). #### Updating credentials If the token expires or is revoked, create a replacement with the required permissions and update **API Token** in the project's connection settings. A token that can sync but cannot write back may be missing writeback scopes or repository permissions. When changing the repository, host, or username, provide credentials for the new destination. Lightdash does not carry the stored token over to a different credential destination. #### Bitbucket Server and Data Center For a company-hosted Bitbucket instance, use an [HTTP access token](https://confluence.atlassian.com/bitbucketserver/http-access-tokens-939515499.html) with **Project read** and **Repository read**, and enter your instance's **Host domain**. These connections support dbt projects only: native Lightdash YAML projects and Bitbucket writeback require Bitbucket Cloud. Here, “Cloud” means the Git host is `bitbucket.org`, not that Lightdash must be hosted on Lightdash Cloud. *** ### dbt Cloud The dbt Cloud connection type bypasses any git connection, instead directly accessing metadata from your dbt Cloud project using the dbt Cloud API. Lightdash doesn't compile your project with this connection. It reads the models, columns, and compiled SQL that dbt Cloud recorded for the environment in its last run. Changes you push to your repository, or make in the warehouse, show up in Lightdash only after a dbt Cloud job has run them in that environment. A git connection compiles the connected branch directly, so it reflects the repository as soon as you refresh. This means a number of features are **not** available, including: * [dbt write-back features](/integrations/dbt/write-back) * [Preview environments](/workflow/preview-projects#lightdash-app) created in the UI from git branches * Automatic refreshes on new commits to your git repo - you'll need to manually trigger refreshes in Lightdash when you make changes to your dbt project. * [`lightdash.config.yml`](/semantic-layer/lightdash-config-yml) and other files in your repository, because Lightdash reads only the metadata dbt Cloud records, not your repository. **MetricFlow metrics are translated automatically.** If your dbt project defines [MetricFlow](https://docs.getdbt.com/docs/build/about-metricflow) semantic models and metrics, Lightdash pulls them from the dbt Cloud Discovery API on each refresh and translates the supported ones into Lightdash metrics — no dbt Semantic Layer configuration needed. See [dbt MetricFlow metrics](/integrations/dbt/metricflow#using-the-dbt-cloud-connection) for what translates and for dbt Cloud–specific limitations. ##### Service Token To connect Lightdash to your dbt Cloud project, you'll need to create a [dbt Cloud service token](https://docs.getdbt.com/docs/dbt-cloud-apis/service-tokens) with the 'Metadata Only' and 'Job Viewer' permissions. ##### Environment ID This is the identifier for your dbt Cloud environment. You can find this in the URL when you're in your dbt Cloud environment. Lightdash will use this to identify which environment it should be built from, so commonly you'll point to your production environment here. ##### Webhook for dbt This webhook is an optional extra for those using the dbt Cloud CI steps. If you set up a webhook in dbt Cloud that triggers when a job completes, paste the webhook address into dbt Cloud and Lightdash will automatically spin up a preview for the given CI environment. Follow the [dbt Cloud webhooks guide](https://docs.getdbt.com/docs/deploy/webhooks) to create a webhook that fires on job completion, and set the endpoint URL to the value shown in this field. ##### Webhook secret Optional, but recommended if you configure the webhook above. When you create the webhook in dbt Cloud, dbt Cloud generates a signing secret — paste that secret here so Lightdash can verify the HMAC signature on each incoming webhook and confirm the request genuinely came from dbt Cloud. * The secret is stored encrypted and is stripped from API responses, so it never appears in project payloads returned by the Lightdash API. * Leaving this field blank preserves the previous behaviour: webhook requests are accepted without signature verification (backwards compatible). * If you edit the project without re-entering the secret, the existing value is preserved. ##### Discovery API Endpoint The dbt Cloud metadata API host for your region. Must use `https://`. Match it to your dbt Cloud access URL: * US multi-tenant: `https://metadata.cloud.getdbt.com` * EU multi-tenant: `https://metadata.eu1.dbt.com` * Cell-based (URL like `abc123.us1.dbt.com`): `https://.metadata.us1.dbt.com` ##### Tags Only models that carry **all** the tags you list here are synced. Lightdash passes the tags as a filter to the dbt Cloud Discovery API, together with `lastRunStatus: success`, so a model is synced only if it has every listed tag in the connected environment's last successful run. The [dbt selector](/integrations/dbt/projects#dbt-selector) setting doesn't apply to dbt Cloud connections. Limiting the synced models also reduces the number of warehouse tables Lightdash looks up on each refresh. > [!WARNING] > > If no model in the last successful run carries all the listed tags, the sync fails with "No models found". After you add a tag to a model in dbt, a job must run in that environment before you refresh Lightdash — Lightdash only sees tags from the environment's last successful run. *** ### CLI The `CLI` connection type is the default type for projects that were created using the CLI via the `lightdash deploy --create` command. Usually, we recommend swapping to a direct connection to your git repo after initial project creation, but if you want to continue managing deployments in the CLI, [read this guide on how to use Lightdash deploy and set up continuous deployment](/workflow/cli/deploy). *** ### Local dbt project > [!WARNING] > > Unsuitable for production and only available for Lightdash instances installed on your local machine To start Lightdash with the option to connect to a local dbt project, you must specify the directory of the dbt project when you start docker compose: ```yaml theme={null} # Specify the absolute path to your dbt project # e.g. export DBT_PROJECT_DIR=/Users/jake/mydbtproject export DBT_PROJECT_DIR= # Enter your path here! docker compose start ``` # Connect through an SSH tunnel Source: https://docs.lightdash.com/integrations/connect-through-ssh-tunnel Reach a Postgres or Redshift database in a private VPC by tunnelling through a bastion host Use an SSH tunnel when your database is in a private VPC and cannot be reached directly from Lightdash. Lightdash opens an SSH connection to a bastion (jump) host that you run in a public subnet of your VPC, and forwards database traffic through it. The path is **Lightdash Cloud → your bastion host → private database**. SSH tunnelling is available for the **Postgres** and **Redshift** warehouse types, under the **Use SSH tunnel** option on the connection form. ## Setup **1. Run a bastion/jump host** Provision a small server (for example an EC2 instance) in a public subnet of the VPC that contains your database. The bastion needs: * A public IP or hostname reachable from the internet. * A user account for Lightdash to log in as (for example `ec2-user` or `ubuntu`). * Network access to the database on its port (Postgres is typically `5432`, Redshift `5439`) — usually a VPC security group rule that lets the bastion's security group reach the database's security group on that port. **2. Configure the SSH tunnel in Lightdash** In your project's connection settings, enable **Use SSH tunnel** and fill in: * **SSH Remote Host**: the bastion's public hostname or IP. * **SSH Remote Port**: the bastion's SSH port, usually `22`. * **SSH Username**: the Linux user Lightdash logs in as. Lightdash generates a public SSH key for the connection. Copy it. **3. Authorize the key on the bastion** Append the public key to `~/.ssh/authorized_keys` for the SSH user you configured above. Authentication is SSH public-key auth — no separate certificate is needed. **4. Point the database at its private hostname** Keep the **Host** field on the connection set to the private database endpoint (the one that resolves inside the VPC). Lightdash resolves and connects to it from the bastion, not from the public internet. **5. Allow Lightdash to reach the bastion** Add Lightdash's [static IP addresses](/integrations/connect-project#adding-lightdashs-static-ip-addresses-to-your-allow-list) to the bastion's security group on the SSH port you configured. ## Concurrent queries and SSH sessions Lightdash doesn't share one tunnel across queries. Every query that goes through the tunnel opens its own SSH connection to the bastion, so concurrent queries — a dashboard loading several tiles at once, data apps, or several users working at the same time — open the same number of simultaneous SSH sessions. Make sure the bastion's SSH connection limits allow for your peak query concurrency. ## Encryption between the bastion and the database The SSH tunnel already encrypts traffic between Lightdash and the bastion. You can additionally enable SSL on the database connection to encrypt the bastion-to-database hop; SSH tunnels work with or without it. # dbt Source: https://docs.lightdash.com/integrations/dbt Connect a dbt project to Lightdash, keep it in sync, and use metrics defined in dbt [dbt](https://docs.getdbt.com/docs/introduction?version=2) is the industry-standard tool for transforming data in your warehouse. You write modular transformations as plain SQL `select` statements, and dbt handles the dependencies between them, builds the resulting tables and views, and tests them. Lightdash reads a connected dbt project and builds your [semantic layer](/semantic-layer) from it. Your dbt models define *what the tables are*; the Lightdash metadata in their YAML defines *what they mean* — which columns are dimensions, which aggregations are metrics, how models join. Lightdash doesn't read dbt tests. Test definitions such as `unique`, `not_null`, or `accepted_values` and the results of `dbt test` don't change what Lightdash shows. Define [primary keys](/semantic-layer/tables#defining-primary-keys) with `primary_key` in the model metadata, and fixed filter values with [`filter_autocomplete`](/semantic-layer/dimensions#filter-autocomplete). Lightdash doesn't read Snowflake semantic views either. A dbt model materialized as `semantic_view` is treated like any other model, but the dimensions, metrics, and relationships defined in the semantic view don't carry over. Define dimensions and metrics in the Lightdash metadata of the base models the semantic view is built on. dbt is not required. If you don't use it, define the same semantic layer in [Lightdash YAML](/semantic-layer/yaml) instead. This area covers the dbt integration itself: connecting a project, keeping it in sync, moving definitions between Lightdash and your repository, and what changes when you upgrade dbt. For how to shape models so they explore well, see [modeling strategies](/semantic-layer/modeling-strategies). ## Set up a dbt project Before you start, you need a dbt project on your machine and a Lightdash account. If you haven't used dbt before, [follow dbt's getting started guide](https://docs.getdbt.com/tutorial/setting-up) first. ![Three steps in sequence: install the CLI tool, prepare your Tables, create a project](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/dbt/overview-intro.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=32a50bf65d4c5b6ee16b3073180749b6) ### Install and log in to the CLI Install the Lightdash CLI with [Homebrew](https://brew.sh) on macOS, Linux, or Windows through WSL: ```bash theme={null} brew tap lightdash/lightdash brew trust lightdash/lightdash brew install lightdash lightdash --version ``` For other install methods, such as a direct binary download or npm, see [Install the Lightdash CLI](/workflow/cli/install). Lightdash generates a personal access token for you during onboarding and shows the login command to copy into your terminal: ```bash theme={null} lightdash login https://{{ lightdash_domain }} --token my-super-secret-token ``` `{{ lightdash_domain }}` is `app.lightdash.cloud` on Lightdash Cloud, or your own domain if you self-host. For other login methods, see [Authenticate the CLI](/workflow/cli/authenticate). ### Generate your first Tables If you use dbt Cloud, [clone your repository to your local machine](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) first. From the folder that contains your `dbt_project.yml` file, run: ```bash theme={null} lightdash dbt run ``` The command documents every column in your models as a dimension and generates a Table for each model. For example, a `leads.yml` file becomes a Table called `Leads` with the dimensions `Lead id`, `User id`, and `Sdr`. ![A leads model with lead\_id, user\_id, and sdr columns becoming a Leads table in Lightdash with Lead id, Sdr, and User id dimensions](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/dbt/example-table.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=a4a582395ed3e8f000b82cac13dd8121) If you see `Error: Not a dbt project (or any of the parent directories). Missing dbt_project.yml file`, change into your dbt project folder and run the command again. To generate Tables for only some models, pass [dbt's model selection syntax](https://docs.getdbt.com/reference/node-selection/syntax). The examples under **Choose which models become Tables** below show common patterns. ### Create your project Create the Lightdash project and follow the link the CLI prints to start exploring: ```bash theme={null} lightdash deploy --create ``` If you started from the **Waiting for data** screen in Lightdash, it moves on when a new project appears in your organization or when the project you have open gets a git or dbt Cloud connection. A `lightdash deploy` without `--create` to a project that already exists leaves the screen waiting even when the deploy worked, so check the project's **Query from tables** page instead. Lightdash creates the project with the connection details from your local `profiles.yml`. Next, [update your connection settings](/integrations/connect-project) to switch to a service account and connect your version-controlled dbt project, so Lightdash stays in sync with your repository. To compare CLI deploys with a git connection, see [Syncing dbt projects](/integrations/dbt/projects#which-method-should-i-use). ![Project connection settings with the warehouse authentication type set to a service account and the dbt connection set to GitHub](https://mintcdn.com/lightdash/rkgexk0ec2sbSneH/images/integrations/dbt/update-your-project-connection-settings.png?fit=max\&auto=format\&n=rkgexk0ec2sbSneH\&q=85\&s=8a38276f2baebf4a06a6398e94f8ca32) ## What are Tables? Tables are the starting point for any data exploration in Lightdash — they're the data you can query. Lightdash stays in sync with your dbt project, so Tables come from the dbt models defined in your project's YAML files. If a dbt model has a YAML definition, it shows up in Lightdash as a Table. Not sure what a YAML file is? [Check out dbt's docs on model properties](https://docs.getdbt.com/reference/model-properties) to learn about adding YAML files for your dbt models. ### Choose which models become Tables `lightdash dbt run` documents every column in your models as a dimension and generates a Table for each one. It supports [dbt's model selection syntax](https://docs.getdbt.com/reference/node-selection/syntax), so you can generate Tables for your whole project at once or narrow to a subset — for example, everything tagged `lightdash`: ```bash theme={null} lightdash dbt run # every model with a YAML definition lightdash dbt run -s tag:lightdash # all models with the lightdash tag lightdash dbt run -s payments # just payments lightdash dbt run -s payments+ # payments and all children lightdash dbt run -s +payments # payments and all parents lightdash dbt run -s payments+ +customers tag:lightdash # mix and match ``` # dbt MetricFlow metrics Source: https://docs.lightdash.com/integrations/dbt/metricflow Connect Lightdash to your dbt MetricFlow semantic layer metrics If your dbt project defines metrics using [MetricFlow](https://docs.getdbt.com/docs/build/about-metricflow) (dbt's semantic layer), Lightdash can translate them into Lightdash metrics automatically. You keep a single source of truth for metric definitions in MetricFlow format, and Lightdash reads them directly from your dbt project — you don't need to duplicate the definitions. This works with every way of connecting a dbt project: * **Lightdash CLI** (`lightdash deploy` / `compile` / `preview`) — reads your compiled `manifest.json`. No dbt Cloud subscription or dbt Semantic Layer API needed. * **Git connections** (GitHub, GitLab, Azure DevOps, Bitbucket) — the same translation runs when Lightdash compiles your project server-side. * **[dbt Cloud connection](/integrations/connect-project#dbt-cloud)** — Lightdash pulls your semantic models and metrics from the dbt Cloud Discovery API when you refresh the project. See [Using the dbt Cloud connection](#using-the-dbt-cloud-connection) for details and limitations. ## How it works When you run `lightdash deploy` (or `lightdash compile` / `lightdash preview`), the CLI reads your project's compiled `manifest.json`, which contains everything MetricFlow knows about your project: the `semantic_models` (entities, dimensions, measures) and the `metrics` defined on top of them. Projects connected via git are compiled the same way server-side when you refresh dbt in Lightdash. These metrics can then be used everywhere Lightdash metrics work (charts, dashboards, the API, AI agents). ```bash theme={null} dbt parse # or dbt compile — writes target/manifest.json lightdash deploy # translates MetricFlow metrics as part of the deploy ``` If you define a metric with the same name in both MetricFlow and your model's `meta.metrics`, the `meta.metrics` (Lightdash YAML) definition will take precedence — so you can always override a translated metric by hand. ### Requirements * **dbt Core 1.6 or later** (manifest schema `v10`, the first version to include MetricFlow's semantic layer). The legacy metrics format used by pre-1.6 dbt (`calculation_method` / `expression` / `time_grains`) is no longer read. ### Use the latest MetricFlow spec Lightdash supports the latest and legacy spec, though it's recommended to use the latest spec. * **Legacy spec** (dbt Core 1.6+): top-level `semantic_models:` and `metrics:` blocks with `type_params`. * [**Latest spec**](https://docs.getdbt.com/docs/build/latest-metrics-spec) (dbt Fusion engine, dbt platform, dbt Core 1.12+): `semantic_model:` enabled inline on the model, with entities/dimensions on columns and metrics using top-level `agg` / `expr` keys. ## Supported features `simple` metrics, and measures flagged `create_metric: true`, translate into Lightdash: | MetricFlow | Lightdash metric type | | - | - | | `agg: sum` | `sum` | | `agg: count` | `count` | | `agg: count_distinct` | `count_distinct` | | `agg: average` | `average` | | `agg: median` | `median` | | `agg: min` / `agg: max` | `min` / `max` | | `agg: percentile` | `percentile` | | `agg: sum_boolean` | `sum` over `CASE WHEN bool THEN 1 ELSE 0 END` | Also carried over: * **Measure** `expr`: bare column references become the metric's SQL, qualified with `${TABLE}` (for example, `expr: amount` becomes `sql: ${TABLE}.amount`). Full SQL expressions are used verbatim. * **Labels and descriptions**: from the metric, falling back to the measure's. * **Percentile value**: MetricFlow's legacy spec authors percentile as a `0–1` fraction (`percentile: 0.95`) and the latest spec authors it as `0–100` (`percentile: 95`). Both are normalized to Lightdash's `0–100` scale automatically. * **`config.meta.hidden` and `config.meta.group_label`**: read from the metric first, falling back to the measure. Use them to hide translated helper metrics from the explore sidebar or [group them](/semantic-layer/metrics#groups) alongside your other Lightdash metrics. Unknown keys under `config.meta` are ignored. ### Filters Metric-level and measure-level `filter:` templates translate when every reference is a `{{ Dimension('entity__dimension') }}` that resolves on the metric's own semantic model. The filter is compiled into the metric SQL: ```yaml theme={null} - name: completed_revenue type: simple type_params: measure: total_revenue filter: | {{ Dimension('order__status') }} = 'completed' ``` becomes a Lightdash `sum` metric with SQL `CASE WHEN ("orders".status = 'completed') THEN ("orders".amount) END`. The dimension's `expr` is used when it isn't a plain column. Filters referencing dimensions on **other** semantic models, or using other template functions (`TimeDimension()`, `Entity()`, `Metric()`), are skipped with a warning. ### Ratio metrics `ratio` metrics translate to a non-aggregate Lightdash `number` metric dividing the two input metrics, when the numerator and denominator both live on the **same model**: ```yaml theme={null} - name: revenue_per_order type: ratio type_params: numerator: total_revenue denominator: order_count ``` becomes `(${total_revenue} * 1.0) / NULLIF(${order_count}, 0)` — the `* 1.0` avoids integer division on warehouses that truncate, and `NULLIF` avoids division-by-zero errors. Filtered inputs work too: a numerator with its own `filter:` (e.g. completion rate = completed orders ÷ all orders) compiles the filter into a hidden helper metric that the visible ratio references. A ratio-level `filter:` applies to both inputs. ### Derived metrics `derived` metrics translate to a `number` metric with the expression rewritten over the input metrics (aliases supported), again when all inputs live on the same model: ```yaml theme={null} - name: revenue_per_customer type: derived type_params: expr: total_revenue / unique_customers metrics: - name: total_revenue - name: unique_customers ``` becomes `${total_revenue} / ${unique_customers}`. Inputs using `offset_window` or `offset_to_grain` (time-shifted metrics) are skipped with a warning. **Why same-model only?** MetricFlow computes each input metric in its own aggregation subquery — even across unrelated tables — and joins the already-aggregated results. Lightdash compiles one query per explore, so ratio/derived metrics translate faithfully only when all inputs resolve to metrics on the same dbt model. Cross-model inputs are skipped with a warning naming the models involved. ## Using the dbt Cloud connection Projects connected through the [dbt Cloud connection type](/integrations/connect-project#dbt-cloud) don't have a local `manifest.json` — instead, Lightdash fetches your semantic models and metrics from the [dbt Cloud Discovery API](https://docs.getdbt.com/docs/dbt-apis/discovery-querying) alongside your models when you refresh the project. Translation then works exactly as described above, with no extra setup: * Your service token's existing **'Metadata Only'** permission covers the semantic layer queries — no dbt Semantic Layer configuration is required. * Definitions come from the environment's latest successful run, like the rest of your dbt Cloud metadata: run a job that parses your project (any `dbt build` / `dbt run` job) and refresh dbt in Lightdash. The Discovery API doesn't expose every field that's in the manifest, so a few things behave differently compared to the CLI or git connections: * **Percentile measures are skipped** (with a warning) — the API doesn't return `agg_params.percentile`, and translating without the percentile value would silently compute a median. * **Measure-level `label` and `config.meta`** (e.g. `hidden` or `group_label` set on a measure) aren't available. Set these on the metric instead of the measure — metric-level values come through fine. * **Dimension `expr` isn't available**, so metric `filter:` references resolve against the dimension *name*. If a filtered dimension's name doesn't match a real column on your model, define the filter on the metric in Lightdash YAML instead. ## What's not supported yet These are skipped with a warning on deploy (details under `--verbose`): | MetricFlow feature | Notes | | - | - | | `cumulative` metrics | require time-spine semantics | | `conversion` metrics | require entity-journey semantics | | Cross-model `ratio` / `derived` inputs | inputs must resolve to metrics on the same model (see above) | | `offset_window` / `offset_to_grain` inputs | time-shifted inputs have no Lightdash metric equivalent | | Cross-model or non-`Dimension()` `filter:` templates | only same-model `{{ Dimension('entity__dim') }}` references translate | | `agg: percentile` without a numeric `percentile` value | skipped rather than defaulted — set `type_params.measure.agg_params.percentile` (legacy) or `agg_params.percentile` (latest) | | `percentile_type: discrete` | Lightdash percentiles always compile to `PERCENTILE_CONT` | | `join_to_timespine`, `fill_nulls_with`, `non_additive_dimension` | no equivalents | And these parts of the semantic model are currently skipped: * **Entities / joins.** MetricFlow joins semantic models implicitly at query time through shared entity keys. Lightdash joins are explicit and authored per-explore ([joining tables](/semantic-layer/joins)). * **Dimensions and `agg_time_dimension`.** Lightdash generates dimensions from your model's real columns, so all of your columns are already available as dimensions, and metrics can be grouped by any of them — the MetricFlow dimension definitions aren't needed. (Dimension `expr` is honored when resolving filter references.) Lightdash reads only semantic models and metrics. It doesn't read saved queries or their exports, so they have no effect in Lightdash. ## Example A complete working example (both specs, with a reproducible test) lives in the Lightdash repo under [`examples/metricflow-demo`](https://github.com/lightdash/lightdash/tree/main/examples/metricflow-demo) — it exercises every supported shape, including filtered, ratio, derived, and `sum_boolean` metrics. The short version, in the legacy spec: ```yaml theme={null} semantic_models: - name: orders model: ref('orders') defaults: agg_time_dimension: ordered_at entities: - name: order type: primary expr: order_id dimensions: - name: ordered_at type: time type_params: time_granularity: day - name: status type: categorical measures: - name: total_revenue agg: sum expr: amount - name: order_count agg: count expr: order_id # create_metric: true auto-creates a metric — also translated - name: unique_customers agg: count_distinct expr: customer_id create_metric: true metrics: - name: total_revenue label: Total revenue type: simple type_params: measure: total_revenue # config.meta carries over to the translated Lightdash metric config: meta: group_label: Order metrics # Same-model filter → CASE WHEN in the metric SQL - name: completed_revenue label: Completed revenue type: simple type_params: measure: total_revenue filter: | {{ Dimension('order__status') }} = 'completed' # Same-model ratio → Lightdash `number` metric - name: revenue_per_order label: Revenue per order type: ratio type_params: numerator: total_revenue denominator: order_count ``` Deploying this project produces four metrics on the `orders` explore: `total_revenue` (`sum` on `${TABLE}.amount`, grouped under "Order metrics"), `unique_customers` (`count_distinct` on `${TABLE}.customer_id`, from the `create_metric: true` measure), `completed_revenue` (a `sum` over `CASE WHEN ${TABLE}.status = 'completed' THEN ${TABLE}.amount END`), and `revenue_per_order` (a `number` metric of `(${total_revenue} * 1.0) / NULLIF(${order_count}, 0)`) — all with no Lightdash-specific YAML. # Syncing dbt projects Source: https://docs.lightdash.com/integrations/dbt/projects Sync your dbt project to Lightdash by deploying with the CLI or refreshing from a Git connection > [!NOTE] > > Lightdash supports dbt v1.4.0 and above. If you are using an older version of dbt, you will need to upgrade to sync your project to Lightdash. ## Syncing your dbt project to Lightdash There are two approaches to syncing dbt into Lightdash. Each one has several methods, covered in [CLI deploy methods](#cli-deploy-methods) and [Git connection methods](#git-connection-methods). | | CLI deploy | Git connection | | - | - | - | | How it works | You compile the dbt project with `lightdash deploy` and push the resulting manifest to Lightdash | Lightdash pulls the connected branch, compiles it server-side, and refreshes the project | | dbt code source | Local working copy or CI checkout | Connected branch in GitHub, GitLab, Azure DevOps, or Bitbucket, or the last run of a dbt Cloud environment | | Uncommitted changes | Included when you deploy from a laptop | Not included | | Connection settings used | Local or CI `profiles.yml` | UI Connection Settings | | Remote git connection required? | No | Yes | | Multiple dbt sources | Not supported | Supported | | Methods | From a laptop, from CI | **Refresh dbt** button, `lightdash refresh` from CI, refresh API, `lightdash deploy` from a laptop or CI | > [!TIP] > > **New to Lightdash?** Start with CLI deploy to see your project quickly, then switch to a Git connection for production, or connect Git from the start if your repository is ready. The [setup path picker](/get-started/quickstart#find-your-setup-path) lists the steps for your setup. ### Which method should I use? | If you need... | Use | | - | - | | Quick local testing / debugging | CLI (`lightdash deploy`) | | Production deployment | Git connection + UI/API refresh | | Multiple dbt sources | Git connection (required) | | CI/CD without duplicating credentials | Git connection + `lightdash refresh` | | Include uncommitted changes | CLI only | For a property-by-property comparison of every method, see [Detailed comparison](#detailed-comparison). ### Common workflows #### Just getting started Use [`lightdash deploy` from your laptop](#cli-deploy-methods) for the fastest first look, or connect Git from the start if your repository is ready. Move a CLI-deployed project to one of the automated workflows below as soon as it's stable. #### Production team (git-connected) For projects with Lightdash connected to GitHub, GitLab, Azure DevOps, Bitbucket, or dbt Cloud: * **PR workflow** → `lightdash start-preview` + `lightdash validate` in CI * **Post-merge to `main`** → `lightdash refresh` from CI, or the refresh API * **Manual refresh** → the **Refresh dbt** button, for ad-hoc syncs #### No git connection For projects loaded through the CLI only, without a remote git connection: * **Production sync** → `lightdash deploy` from CI * **Previews** → `lightdash start-preview` in CI Not sure whether to use `lightdash deploy` or `lightdash refresh`? Read about the [differences between the two commands](/workflow/cli/reference#lightdash-deploy-vs-lightdash-refresh) in the CLI reference. When you create a project, **Connect via CLI** sets it up for CLI deploy, and **Connect manually** lets you pick a dbt connection type such as GitHub or GitLab for a Git connection. You can change the dbt connection type later in **Project settings**. For ready-to-use workflow templates, see the [`lightdash/cli-actions`](https://github.com/lightdash/cli-actions) repo. ## CLI deploy methods `lightdash deploy` compiles the dbt project wherever the CLI runs and replaces the project's Explores with the result. It ignores the project's UI Connection Settings, including the [dbt selector](#dbt-selector), and uses the local or CI `profiles.yml` instead. For command details, see [`lightdash deploy`](/workflow/cli/deploy). > [accordion] lightdash deploy from a developer's laptop > > Compiles the dbt project locally and pushes the resulting `manifest.json` to Lightdash. > > | Property | Value | > | - | - | > | dbt code source | Local working copy (uncommitted changes included) | > | Compile location | Laptop | > | `profiles.yml` source | Local (`~/.dbt/profiles.yml` by default, or `--profiles-dir`) | > | Target | Default in that `profiles.yml`, overridden by `--target` | > | UI Connection Settings respected? | No | > | Auth | `lightdash login` session or `LIGHTDASH_API_KEY` env var | > | Prerequisites | Lightdash CLI installed; dbt installed; warehouse creds reachable locally | > | Remote git connection required? | No | > > **Use cases:** initial project setup, debugging, one-off manual deploys. > > **Trade-offs:** bypasses PR review; relies on per-developer `profiles.yml`; high footgun risk if a developer's prod target accidentally points at a non-prod warehouse. > > > [!WARNING] > > > > Don't use `lightdash deploy` from your local environment as the primary way you update Lightdash. Small mistakes can lead to production issues. > [accordion] lightdash deploy from CI > > Same as deploying from a laptop, but runs inside a CI workflow (GitHub Actions, GitLab CI, Azure Pipelines, Bitbucket Pipelines, etc.) with credentials stored as CI secrets. > > | Property | Value | > | - | - | > | dbt code source | CI runner's checkout of the repo | > | Compile location | CI runner | > | `profiles.yml` source | Provided by the workflow — either committed as an `env_var()` template, or written to disk from a CI secret at runtime | > | Target | Default in the CI `profiles.yml`, overridden by `--target` | > | UI Connection Settings respected? | No | > | Auth | `LIGHTDASH_API_KEY` from CI secrets | > | Prerequisites | Lightdash CLI + dbt installed in the workflow; warehouse creds available to CI; valid `profiles.yml` produced at runtime | > | Remote git connection required? | No | > | Workflow template | [`deploy.yml`](https://github.com/lightdash/cli-actions) in `lightdash/cli-actions` (GitHub Actions example) | > > **Use cases:** automated production deploys gated by PR merge; PR preview workflows (`lightdash start-preview` + `lightdash validate`). > > **Trade-offs:** requires duplicating warehouse credentials into CI on top of what's already in Lightdash; needs dbt available in the runner. > > > [!WARNING] > > > > Never commit a `profiles.yml` with plaintext credentials. Either use an `env_var()` template committed to the repo, or write the file to disk at runtime from a CI secret. > > To set this up, see [continuous deployment example workflows](/workflow/set-up-ci-cd#deploy-changes-to-lightdash). ## Git connection methods The project is connected to a remote git source (GitHub, GitLab, Azure DevOps, or Bitbucket) or to dbt Cloud in Project Settings. Every method triggers the same server-side refresh: Lightdash pulls the connected branch, compiles it using the UI Connection Settings, and updates the project. A [dbt Cloud connection](/integrations/connect-project#dbt-cloud) doesn't compile: the refresh reads what dbt Cloud recorded in the environment's last run. The methods differ only in how you trigger that refresh. The server-side compile doesn't use dbt, a `profiles.yml` or warehouse credentials on your own machine, so a local `dbt debug` or warehouse permission error doesn't stop Lightdash from refreshing the project. You can also run [`lightdash deploy`](#cli-deploy-methods) against a git-connected project. It compiles locally or in CI instead of pulling the connected branch, and its result stays in place until the next refresh. Don't use it on projects with [multiple dbt sources](#connecting-multiple-dbt-sources). Push and merge your changes to the branch your Lightdash project is connected to before you trigger a refresh. > [accordion] "Refresh dbt" button in the Lightdash UI > > Lightdash fetches the dbt code from the configured remote, compiles it server-side, and updates the project. > > | Property | Value | > | - | - | > | dbt code source | Lightdash pulls from the remote git source configured in Project Settings (GitHub, GitLab, Azure DevOps, Bitbucket), or reads the last run of the connected dbt Cloud environment | > | Compile location | Lightdash servers | > | `profiles.yml` source | Lightdash synthesises one from Project Settings → Connection Settings | > | Target | UI Project Settings → Connection Settings → Target name | > | UI Connection Settings respected? | Yes | > | Auth | Logged-in user in the UI | > | Prerequisites | Project must have a remote git source connected | > | Remote git connection required? | Yes | > > **Use cases:** ad-hoc refresh after a merge; quick UI-driven sync without leaving the browser. > > **Trade-offs:** manual; relies on a human remembering to click it. > > The button is on the **Query from tables** page. Only people with the project **Developer** or **Admin** role see it, because it needs the `manage:CompileProject` and `manage:Job` scopes. To take it away from someone on a git-connected project, give them a role without `manage:CompileProject`, such as **Editor** or a [custom role](/workspace-admin/custom-roles), which also removes their ability to compile the project. On a project with dbt connection type **None**, you can hide it for everyone with **Hide refresh button in the app** in the dbt connection settings. > > ![The Refresh dbt button on the Query from tables page](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/integrations/dbt/projects/dbt-refresh.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=96b55d8f8b093f04791938bdc842f7c0) > > If you've changed the underlying data (for example, adding a new column in your `model.sql` file or changing the SQL logic of a dimension), run `dbt run -m yourmodel` before you click **Refresh dbt**. > [accordion] lightdash refresh from CI > > Calls the same endpoint as the "Refresh dbt" button, but programmatically from CI (GitHub Actions, GitLab CI, Azure Pipelines, Bitbucket Pipelines, etc.). Lightdash does the work server-side using the project's UI Connection Settings. > > | Property | Value | > | - | - | > | dbt code source | Lightdash pulls from the remote git source (configured in Project Settings) | > | Compile location | Lightdash servers | > | `profiles.yml` source | Synthesised by Lightdash from UI Connection Settings | > | Target | UI Project Settings → Connection Settings → Target name | > | UI Connection Settings respected? | Yes | > | Auth | `LIGHTDASH_API_KEY` from CI secrets | > | Prerequisites | Project must have a remote git source connected; Lightdash CLI installed in the workflow | > | Remote git connection required? | Yes | > | Workflow template | [`refresh.yml`](https://github.com/lightdash/cli-actions) in `lightdash/cli-actions` (GitHub Actions example) | > > **Use cases:** automated post-merge sync to production when the project is already git-connected. > > **Trade-offs:** can't push uncommitted changes (only what's in the connected branch); won't catch issues pre-merge — pair with a separate `lightdash validate` PR workflow if you want that. > [accordion] Refresh API from CI > > Same as `lightdash refresh` from CI, but bypasses the Lightdash CLI entirely — just a `curl` to the API. Works from any CI system (GitHub Actions, GitLab CI, Azure Pipelines, Bitbucket Pipelines, etc.). > > | Property | Value | > | - | - | > | dbt code source | Lightdash pulls from the remote git source (configured in Project Settings) | > | Compile location | Lightdash servers | > | `profiles.yml` source | Synthesised by Lightdash from UI Connection Settings | > | Target | UI Project Settings → Connection Settings → Target name | > | UI Connection Settings respected? | Yes | > | Auth | `LIGHTDASH_API_KEY` from CI secrets | > | Prerequisites | Project must have a remote git source connected | > | Remote git connection required? | Yes | > | Lightdash CLI required? | No | > | Endpoint | `POST /api/v1/projects/{projectUuid}/refresh` | > > **Use cases:** the simplest possible automated refresh — no dependencies to install. Useful for teams who don't want a Node toolchain in CI. > > **Trade-offs:** same as `lightdash refresh` from CI. The refresh is async (returns a `jobUuid`); for stronger guarantees, poll `GET /api/v1/jobs/{jobUuid}` to confirm completion before exiting the workflow. ## Detailed comparison > [accordion] Compare every sync method > > | | `lightdash deploy` — laptop | `lightdash deploy` — CI | "Refresh dbt" — UI button | `lightdash refresh` — CI | `POST /refresh` API — CI | > | - | - | - | - | - | - | > | Approach | CLI deploy | CLI deploy | Git connection | Git connection | Git connection | > | Automated? | No | Yes | No | Yes | Yes | > | Pushes uncommitted local changes? | Yes | No | No | No | No | > | Needs dbt + warehouse creds in CI? | N/A | Yes | No | No | No | > | Needs Lightdash CLI installed? | Yes | Yes | No | Yes | No | > | Respects UI Target name? | No | No | Yes | Yes | Yes | > | Works without a remote git connection? | Yes | Yes | No | No | No | > | Catches breaking changes pre-merge? | With `--select` + `validate` | If used in a PR workflow | No | No | No | > | Best for | Initial setup, debugging | PR previews; CI deploys with no remote git connection | Ad-hoc UI refresh | Post-merge sync (recommended) | Post-merge sync, minimal-CI shops | ## Things to know `lightdash deploy` does not use the UI **Target name** setting. It uses the local `profiles.yml` default, or whatever `--target` overrides it with. Only the Git connection methods respect the UI Target name. `lightdash deploy` runs the `dbt` installed where you run the CLI, so dbt plugins installed there, such as dbt-loom, take part in the compile. Git connection methods compile with Lightdash's own dbt installation, which has dbt-core and the warehouse adapters only, so third-party dbt plugins don't run on a server-side refresh. `lightdash refresh` requires a remote git connection. It fails with a `ParameterError` if the project's `dbtConnection.type` is `NONE`. Refresh is async. `lightdash refresh` and the refresh API both return a `jobUuid` and the work continues server-side. If your CI needs to know the refresh succeeded, poll `GET /api/v1/jobs/{jobUuid}` before exiting the workflow. > [!WARNING] > > **Never commit `profiles.yml` with credentials.** For `lightdash deploy` from CI, use either a secret-written-to-file approach or an `env_var()` template. Never check in plaintext credentials. `lightdash refresh` and the refresh API are underused. Most CI examples lead with `lightdash deploy`, which is the heaviest option in CI because it duplicates dbt and warehouse credentials into the runner. The refresh-based methods are simpler and often a better fit when the project is git-connected. > [!WARNING] > > **Projects with [multiple dbt sources](#connecting-multiple-dbt-sources) must not use `lightdash deploy`.** CLI deploy methods replace the project's Explores with only the local repo's models. Use a Git connection method instead. ## Connecting multiple dbt sources > [!NOTE] > > **Availability.** On Lightdash Cloud, multiple dbt sources is enabled by default, so the **dbt sources** panel is already visible in Project Settings. On self-hosted deployments, add `multi-dbt-sources` to your `LIGHTDASH_ENABLE_FEATURE_FLAGS` environment variable (comma-separated, so append it to any flags you already have set) on Lightdash v0.3275.0 or later. A single Lightdash project can connect to more than one dbt project. Each connected dbt project is called a **dbt source**: * The dbt connection you set up when you first created the Lightdash project is the **primary source**. * Any dbt projects you add on top of it are **additional sources**. All sources are compiled together into one set of Explores, so tables from different dbt repos appear side-by-side in the same Lightdash project and can be joined to each other. For a model to `ref()` a model in another source, see [Cross-project refs between sources](#cross-project-refs-between-sources). ### When to use this * A monorepo you've split into multiple dbt projects and want to expose as one analytics surface. * Multiple teams that each own their own dbt project, but share the same warehouse and want a single place to explore the data. * Shared/common dbt packages you want to pull into a project alongside team-specific models. All sources share the Lightdash project's warehouse connection. On a project with [multiple warehouse connections](/workspace-admin/multiple-warehouse-connections), you can run an additional source on another connection. For BigQuery joins across sources, check the [dataset location requirements](/integrations/connect-project#bigquery) in the connection settings. ### Adding and managing sources Go to **Project settings → dbt connection**. When the feature is enabled for your org, you'll see a **dbt sources** panel that lists the primary source plus any additional ones. Each row shows the source's display name and its git identity (`repository · branch · subfolder`), or the connection type for non-git sources. From the panel you can: * **Add an additional source**: connect a GitHub repository, give the source a display name, and fill in its repo/branch/subfolder/credentials and any environment variables. Environment variables are validated when the source is saved. Other connection types aren't supported for additional sources. * **Edit an additional source**: change its display name, connection details, or environment variables. * **Remove an additional source**: additional sources can be removed at any time. * **Edit the primary source**: the primary source is edited via the normal dbt connection form. It cannot be removed. > [!NOTE] > > An additional source that connects through the Lightdash GitHub App only compiles if the app's installation can access its repository. If the installation is set to **Only select repositories** and the repository isn't on the list, Lightdash skips the source with the warning `could not parse, list models, or validate the manifest`, not the `Not Found` error covered under [GitHub](/integrations/connect-project#github) on the connection page. Check the repository list on the GitHub card in **Organization settings** → **Integrations**. If the repository is missing, add it in the app installation's **Repository access** settings on GitHub, or click **Reinstall** and select it, then retry the refresh. If a source's saved credentials can't be loaded, its row in the sources panel shows a warning icon. Other sources keep working normally. Only operations that need that specific source's connection will fail. Each additional source has: * A **display name**: how it appears in the sources panel and in collision errors. * Its own **dbt connection**: GitHub only. The primary source can use any of Lightdash's supported connection types (GitHub, GitLab, Azure DevOps, Bitbucket, dbt Cloud), but additional sources are limited to GitHub, each with its own repo, branch, subfolder, credentials, and environment variables. * **Where this source's models live**: the database and schema the source's models are read from in the project's warehouse. Leave them blank to use the warehouse connection's values, or set them when that dbt project's profile targets a different database or schema. * A **precedence**: the order in which sources are merged. Collisions fail the deploy rather than being resolved by precedence (see below). Precedence determines which source is reported as holding the existing definition and which as the duplicate. ### How compilation and merging works On refresh, Lightdash compiles every source and merges the resulting manifests into a single set of Explores. **Precedence.** Sources are ordered by precedence. The primary source is always `0` (highest priority). Additional sources are appended after it in the order they were added. Precedence orders the merge and lookup resolution. For refs between sources, see [Cross-project refs between sources](#cross-project-refs-between-sources). **Name collisions.** If the same model name exists in more than one source, **compilation fails** with an error that names each collision and which sources define it (in the form `
"" is defined in both "" and ""`, listing up to 10 entries and ending with "Rename or remove the duplicate(s) before deploying."). Rename or remove the duplicates in one of the sources before deploying. Only identical dbt built-in macros and docs are merged silently. A dbt package installed in more than one source causes the same failure, because each of those manifests contains the package's models under the same IDs. The [dbt selector](#dbt-selector) doesn't prevent it: Lightdash checks every model in each source's manifest for collisions, not only the selected ones. Keep the package's models enabled in one source and disable them in the others with dbt's [`enabled`](https://docs.getdbt.com/reference/resource-configs/enabled) config. The error says the sources `use the same dbt project name` and suggests changing `name:` in `dbt_project.yml`, but a package's name is fixed, so disable its models instead. **The CLI's `--combine-manifest` flag is a different mechanism.** It merges an external manifest into the manifest the CLI just generated, and unlike the additional-sources merge it does not fail on collisions — see [`lightdash deploy`](/workflow/cli/reference#lightdash-deploy) in the CLI reference. **What's merged vs. deduplicated.** * **Models**: must be uniquely named across sources — a name collision fails the deploy. Once unique, models can be joined across sources and can reference each other with [cross-project refs](#cross-project-refs-between-sources). * **Metrics, docs, dbt sources, macros**: unioned across all repos. * **Identical dbt built-in macros and docs**: merged silently across repos and never reported as collisions. **Environment variables** are scoped to their source's connection and validated when that source is saved. ### Cross-project refs between sources [Experimental](/support/feature-badges#experimental) A model in one source can reference a model in another connected source. Use dbt's two-argument `ref`, the same syntax as dbt Mesh and dbt-loom: ```sql theme={null} select * from {{ ref('upstream_project', 'model_name') }} ``` The first argument is the `name` from the upstream project's `dbt_project.yml`. You don't need dbt-loom or any other package installed in Lightdash. To set up cross-project refs: 1. Enable the `cross-source-dbt-refs` feature flag, which is off by default, next to `multi-dbt-sources`. On Lightdash Cloud, `multi-dbt-sources` is already on; contact [Lightdash support](mailto:support@lightdash.com) to enable `cross-source-dbt-refs` for your organization. On self-hosted deployments, add both flags to `LIGHTDASH_ENABLE_FEATURE_FLAGS`. 2. Connect every upstream repository as a dbt source of the same Lightdash project, as described in [Adding and managing sources](#adding-and-managing-sources). 3. Use the [dbt selector](#dbt-selector) of each source to choose which of its models become Explores. A source whose selector matches none of its models still resolves refs from other sources, but you cannot join to its models. 4. Refresh the project. #### How Lightdash compiles the sources Lightdash prepares each source once. Before it compiles, it reads each source's project `name` from `dbt_project.yml`, its two-argument refs written as plain strings, and any `projects:` list in its `dependencies.yml`. It then compiles the sources in dependency order, so a ref to a model in another connected source resolves on the first compile of that source. The sources then merge as described in [How compilation and merging works](#how-compilation-and-merging-works). Chains of refs across several sources work, and so do diamond-shaped dependencies. Some refs are not visible before compile, for example a ref whose project name comes from a macro, a `{% set %}` variable, or `var()`. These refs still resolve. Lightdash compiles that source again after its upstream source has compiled, so the refresh takes longer. Deeper chains also take longer to refresh. #### Declaring upstream projects You can list the projects that a source depends on under `projects:` in its `dependencies.yml`. This is optional. It is the dbt Mesh convention, and dbt Core ignores the key. ```yaml theme={null} projects: - name: upstream_project ``` Lightdash checks declared upstream projects before it compiles any source. If the declarations form a cycle, the refresh fails immediately with an error that names the projects, for example: ```text theme={null} Declared dbt upstreams form a cycle: "a" -> "b" -> "a". Fix dependencies.yml in one of the repositories. ``` If a source declares a project that no connected source provides, the refresh fails immediately with an error that names the source, for example: ```text theme={null} dbt source "a" declares upstream project "p" in dependencies.yml, but no connected dbt source provides project "p". ``` #### Requirements The two dbt projects must have different `name` values in their `dbt_project.yml` files. dbt's [model access](https://docs.getdbt.com/docs/mesh/govern/model-access) settings decide which models you can reference: * You cannot reference a `private` model from another project. * You can reference a `protected` model. `restrict-access: true` in the consuming project has no effect on cross-project refs. * You can always reference a `public` model. Versioned models work. Pin a version with `v`, for example `{{ ref('upstream_project', 'model_name', v=2) }}`, or leave it out to get the latest version. #### Limits * The project's dbt version must be 1.6 or newer. * The two sources must use the same warehouse connection. On a project with [multiple warehouse connections](/workspace-admin/multiple-warehouse-connections), sources on different connections cannot reference each other. * Lightdash reads upstream projects only from connected dbt sources. It does not read an upstream project from anywhere else, for example a manifest published to S3 or to dbt Cloud, so a model that references such a project cannot compile. * If you run one Lightdash project per repository, connect the upstream repository as an additional source of each Lightdash project that references it. * A CLI preview includes the models of other sources only when the parent project has a merged manifest. A project with multiple warehouse connections has no merged manifest. See [Preview projects](#preview-projects). #### Joins to a model in another source The downstream model can declare a [join](/semantic-layer/joins) to the upstream model by its model name. The upstream model appears as an Explore, and as a table you can join, only when its source's [dbt selector](#dbt-selector) includes it. #### Local development and the CLI dbt-loom keeps working locally with your `dbt_loom.config.yml`. `lightdash compile`, `lightdash preview`, and `lightdash deploy` work from one repository, with no extra setup. The CLI compiles only the local repository's models. `lightdash deploy` uploads only those models, as described in [How refreshes work](#how-refreshes-work). `lightdash preview` adds the other sources' models from the parent project's merged manifest, as described in [Preview projects](#preview-projects). When the models of another source are not available, the CLI skips a join to a model from that source and prints a warning. #### Warnings A model can use the single-argument form, `ref('model_name')`. If that name exists only in another connected source, the ref resolves to the model in that source. The refresh then records a warning in the project's [compilation history](/workspace-admin/project-compilation-history), with the two-argument form to use, for example: ```text theme={null} Model "orders" in dbt source "b" uses ref('orders'), which resolved to external model model.a.orders from another dbt source. Use ref('a', 'orders') to make the cross-source reference explicit. ``` Use the two-argument form for all cross-project refs. #### Errors If a ref names a dbt project that no connected source provides, the refresh fails with: ```text theme={null} Cannot resolve dbt source "": ref "." was not found. No connected dbt source provides project "". ``` This error also appears when the upstream source is on a different warehouse connection. If the upstream project is connected but has no model with that name, for example after a typo in the ref, the refresh fails with: ```text theme={null} Cannot resolve cross-source dbt refs: Source "": .: source "" provides project "" but has no model "" ``` If two sources use the same dbt project name and a cross-project ref needs that name, the refresh fails with: ```text theme={null} dbt sources "" and "" both use the dbt project name "". A model cannot reference another dbt project that has its own name. Change the name: value in one repository's dbt_project.yml. ``` If two sources reference each other, directly or through other sources, or a source depends on an upstream source that failed, the refresh fails with: ```text theme={null} Cannot resolve cross-source dbt refs: the pending sources depend on each other or on an upstream source that failed. Source "": .; Source "": . ``` If the project's dbt version is 1.4 or 1.5, the refresh fails with: ```text theme={null} Cross-source dbt refs require dbt 1.6 or newer. ``` When the feature flag is off, a cross-project ref fails with dbt's usual error, followed by this hint: ```text theme={null} This model references a model in another dbt project. Connect that project as a dbt source and enable cross-source dbt refs for your organization. ``` ### How refreshes work Every refresh — [Git connection methods](#git-connection-methods), plus **Test & deploy** in Project Settings — re-fetches and compiles all sources and merges them into one Explore set. The whole refresh fails with an error naming the source when the **primary source** fails, when compilation hits a dependency cycle, an ambiguous ref, or a timeout or abort, or when sources collide on a model name (collisions are only caught after every source's manifest is merged, so Lightdash can't isolate them to one source). A failure in an **additional source** doesn't fail the refresh. If an additional source's stored credentials can't be decrypted, or the source can't be cloned, parsed, listed, or validated, Lightdash skips it and the refresh finishes. The job records a warning naming the source and the reason, for example: ```text theme={null} Source "finance" failed: could not parse, list models, or validate the manifest; no explores from a previous successful refresh are available; nothing was carried. ``` If that source compiled successfully on an earlier refresh, its Explores from that refresh are kept, and the warning ends with `kept its N explores from the last successful refresh` instead of `nothing was carried`. Those Explores stay as they were at that last successful compile until the source compiles again. To find out why a source failed, read the warning on the compiling step in the job's details during a refresh, or under `connectionWarnings` in the entry's log in [compilation history](/workspace-admin/project-compilation-history) afterwards. If the refresh failed outright, use **Download captured logs** on the job for the full saved errors and captured dbt log lines. > [!WARNING] > > **Do not use `lightdash deploy` against a multi-source project.** The CLI compiles the local repo and writes those Explores directly, without merging in the other sources — a CLI deploy will replace the project's Explores with only the local repo's models until the next server-side refresh. Teams using multiple dbt sources should sync via a [Git connection method](#git-connection-methods) and must not run `lightdash deploy` in CI against a multi-source project. ### Preview projects A preview of a multi-source project contains models from every source, not just the repo you are working in. How that happens depends on where the preview is created. **From the Lightdash UI.** The preview inherits the parent's additional sources, then compiles all of them server-side and stores the merged result. Branch and manifest overrides you set when creating the preview apply to the primary source only; additional sources are always compiled from the branch saved on their own connection. **From the CLI** (`lightdash preview` and `lightdash start-preview`). The CLI compiles your local repo, then fetches the parent project's merged manifest from Lightdash and combines the two before uploading. Your locally compiled models win on conflicts, so you get your working changes on top of everything else in the project. This is automatic — you don't need to pass `--combine-manifest`. > [!WARNING] > > If the CLI cannot fetch the parent's merged manifest, it continues with your local models alone, producing a preview that is missing the other sources' models. Read the CLI output if a preview looks short of models. The most common causes are: * The parent project has not completed a server-side refresh since additional sources were added, so it has no merged manifest yet. Run **Test & deploy** on the parent first. * Your local repo isn't recognised as one of the parent's sources, in which case the CLI says `the local dbt project is not a source of this Lightdash project`. * You passed `--no-combine`, which skips the fetch. Passing `--combine-manifest ` explicitly overrides the automatic fetch, and is still the right option when you want a specific manifest rather than the parent's. It takes a single file, so in a project with more than two sources that file must already contain the full merged set. [Cross-project refs](#cross-project-refs-between-sources) work in a preview the same way as in its parent. A preview created from the UI resolves them on the server. A CLI preview gets the upstream models from the parent's merged manifest. If the CLI skips that combine, it also skips joins to models from other sources and prints a warning. ### Write-back behavior Lightdash has two write-back paths, and they behave differently in a multi-source project. #### AI agent write-back Fully supported across all git-backed sources. AI agents that open PRs with dbt changes work in a multi-source project. Before making changes, the agent resolves which source to target, in this order: 1. A source you explicitly specified. 2. The source a resumed thread is already bound to. 3. The only source, if the project has just one. 4. A source named in your prompt. If it can't decide, it doesn't guess. It asks you to pick from the candidate sources. The chosen source is remembered for the whole thread, so follow-up messages keep editing the same repo and updating the same PR. Only git-backed sources (GitHub, GitLab, and other git connection types) can be targeted by agent write-back. If the primary source is not git-backed, the agent will skip it in favor of git-backed additional sources. #### Explore write-back Not available on a project with an additional git-backed source, even for models in the primary source. Lightdash can't tell which source owns the model, so writing custom metrics and dimensions back as a PR from the Explore view fails with an error that starts `Explore write-back cannot determine which dbt source owns this model on a project with multiple git-backed dbt sources`. To edit models in additional sources, use AI agent write-back or edit the source's dbt project directly. The next refresh picks up the change. ## dbt project settings For more information about dbt connection types (Github, Gitlab, Bitbucket, etc.) and the fields required for each type, [read the dbt project section in our connection guide](/integrations/connect-project#2-import-a-dbt-project). Below are details about the universal fields for all connected dbt projects. ### dbt selector This setting is found under Advanced configuration options You can filter out models in your dbt project that you don't want to see in Lightdash. This is useful if you have a large dbt project and you want to speed up the sync process. Unlike [Tables configuration](/semantic-layer/tables#choosing-which-tables-appear-in-lightdash), this selector is applied to the dbt models, so it will skip the entire compilation process for the models that you don't want to see in Lightdash. For a side-by-side comparison of the two settings, see [Tables configuration vs. dbt selector](/semantic-layer/tables#tables-configuration-vs-dbt-selector). To do this, you can add a **dbt selector** to your project settings. This is a JSON object that contains the models you want to include in Lightdash. For example, if you only want to include the `my_model` and all models with the `lightdash` tag in Lightdash, you can add the following to your dbt project settings: ```console theme={null} my_model tag:lightdash ``` To combine conditions, separate them with a comma. For example, `package:analytics,tag:lightdash` includes only models in the `analytics` package that also have the `lightdash` tag. We support all dbt selectors. [Read more about selectors in the dbt docs](https://docs.getdbt.com/reference/node-selection/syntax#combining-state-and-result-selectors). > [!WARNING] > > The dbt selector only applies when Lightdash compiles your dbt project itself, which happens with a Git-based connection on **Refresh dbt**, **Test & deploy** and [`lightdash refresh`](/workflow/cli/reference#lightdash-refresh). > > [`lightdash deploy`](/workflow/cli/reference#lightdash-deploy) compiles the project wherever the CLI runs and uploads the result, so it does not read this setting. Without a selection flag it uploads every model in the project. To scope a CLI deploy, pass [`--select`, `--exclude` or `--selector`](/workflow/cli/reference#dbt-node-selection) on the command, for example `lightdash deploy --selector lightdash_models`. If you deploy to several Lightdash projects from one repository, pass the matching selector on each deploy. In a project with [multiple dbt sources](#connecting-multiple-dbt-sources), each source has its own selector. Other sources can still use [cross-project refs](#cross-project-refs-between-sources) to a model outside its source's selector, but that model produces no Explore and you cannot join to it. This lets you connect a repository only so that other sources can reference its models: give it a selector that matches none of its models, such as `tag:reference_only`. The selector doesn't filter seeds: Lightdash always includes every seed in the project. To see which models a selector matches, run `dbt ls --select ""` locally; it doesn't list seeds. Tags set with `+tags` on a folder in `dbt_project.yml` apply to every model in that folder, so they count towards the selector too. When you add or rename a model, it has no Explore until it matches the selector. Charts and dashboards that use it show `Explore "" does not exist.`, and refreshing again doesn't help. Give the model the tag or other property the selector matches, merge the change, then refresh. Lightdash reads warehouse metadata only for the tables of the models and seeds it compiles. On BigQuery and Athena, if the warehouse credentials can't read one of those tables, the model still compiles without column types from the warehouse, and querying it fails until the credentials can read it. ## dbt targets ### What is a dbt target? A **dbt target** is an environment configuration in your dbt project that defines where and how dbt should run. In dbt Core, targets are defined in your `profiles.yml` file and typically include settings like: * Database connection details * Schema/dataset names * Warehouse specifications * Other environment-specific configurations Most teams have multiple targets for different environments: * `dev` - for development work * `prod` - for production deployments * `staging` - for testing before production Each target can have different connection settings which are stored in your profiles.yml file. The example `profiles.yml` file below shows different connection settings for the dev and prod targets. Note that on line 3 `target: dev` indicates that the dev target is the default target for this project. ```yaml theme={null} # example profiles.yml file jaffle_shop: target: dev outputs: dev: type: postgres host: localhost user: alice password: port: 5432 dbname: jaffle_shop schema: dbt_alice threads: 4 prod: # additional prod target type: postgres host: prod.db.example.com user: alice password: port: 5432 dbname: jaffle_shop schema: analytics threads: 8 ``` ### Configuring your target in Lightdash **Target** contains information about your dbt connection to your warehouse. By default, we set this to be the same value as you have as the default in your `profiles.yml` file when you run `lightdash deploy` (if that's how you created or recently deployed your project). If you want to update this, you can enter the target of your choice in the project settings (for example `prod` or `analytics`). [Read more about dbt targets in the dbt docs.](https://docs.getdbt.com/reference/dbt-jinja-functions/target) ### How targets work with dbt macros When Lightdash connects to your dbt project, it compiles a `profiles.yml` file based on the connection settings you configure in the Lightdash UI or the connection settings from your profiles.yml if you deployed your project from the CLI using `lightdash deploy`. This means that any dbt macros in your project that use target settings will be executed by Lightdash and resolved according to those settings. #### Why use targets in macros? You might want dbt to behave differently depending on the target/environment you're running in. Common use cases include: * Using different schema naming conventions in dev vs. production * Configuring different warehouse sizes (small for dev, large for prod) * Adjusting query performance settings per environment * Loading different amounts of data (sample data in dev, full data in prod) * Applying different data retention policies Let's look at a common example: customizing schema names based on your target. #### Example: Schema naming based on target By default, dbt appends your custom schema names to your target schema. For example, if your target schema is `analytics` and you configure a model with `schema='staging'`, dbt creates it in `analytics_staging`. This default behavior is useful in development because it prevents developers from overwriting each other's work - each developer can have their own target schema like `dbt_jane` or `dbt_john`, resulting in separated schemas like `dbt_jane_staging` and `dbt_john_staging`. However, in production, you typically want cleaner schema names. Instead of `analytics_staging`, you just want `staging`. This is where customizing the `generate_schema_name` macro based on the target becomes helpful. **Default behavior:** ```sql theme={null} {% macro generate_schema_name(custom_schema_name, node) -%} {%- set default_schema = target.schema -%} {%- if custom_schema_name is none -%} {{ default_schema }} {%- else -%} {{ default_schema }}_{{ custom_schema_name | trim }} {%- endif -%} {%- endmacro %} ``` **Modified behavior for production:** ```sql theme={null} {% macro generate_schema_name(custom_schema_name, node) -%} {%- set default_schema = target.schema -%} {%- if custom_schema_name is none -%} {{ default_schema }} {%- elif target.name == 'prod' -%} {{ custom_schema_name | trim }} {%- else -%} {{ default_schema }}_{{ custom_schema_name | trim }} {%- endif -%} {%- endmacro %} ``` This macro says: "If we're in production (`target.name == 'prod'`), use just the custom schema name. Otherwise, use the default behavior of prefixing it." **How this works in Lightdash:** If your Lightdash connection settings specify: * **Target name:** `prod` * **Dataset/Schema:** `analytics` And you have a model configured with: ```sql theme={null} {{ config(schema='staging') }} ``` Then Lightdash will create/query this model in the `staging` schema - not `analytics_staging` - because `target.name == 'prod'`. This gives you clean, professional schema names in production (`staging`, `marts`, `reporting`) while maintaining developer isolation in development environments (`dbt_jane_staging`, `dbt_john_staging`). The `generate_schema_name` macro is a default dbt macro and its behavior can be overridden by adding a macro to dbt with the same name. If this macro is not showing up in your dbt project, it means that your project is using the default macro. It is a good idea to check your project for custom macros which can alter your project's configurations. **Example: Warehouse configuration** Similarly, if you have a macro that dynamically configures settings: ```sql theme={null} {% macro get_warehouse() %} {% if target.name == 'prod' %} {{ return('LARGE_WAREHOUSE') }} {% elif target.name == 'dev' %} {{ return('SMALL_WAREHOUSE') }} {% endif %} {% endmacro %} ``` And use it in your models: ```sql theme={null} {{ config(snowflake_warehouse=get_warehouse()) }} ``` Lightdash will use the configuration that corresponds to the target name you've configured in your Lightdash connection settings. ### Differences between dbt Core and dbt Cloud In dbt Core, teams commonly use targets to manage different environments. In dbt Cloud, targets are replaced by environments, and custom logic such as `if target.name = dev then...` is commonly swapped out using env vars to become 'if env\_var = development then...' or similar. ## dbt environment variables ### What are environment variables? Environment variables allow you to set dynamic values that your dbt macros can reference. This is particularly useful if your dbt project uses environment variables to control behavior (common in dbt Cloud setups). ### Configuring environment variables in Lightdash This setting is found under Advanced configuration options If your dbt project uses [environment variables in your dbt `profiles.yml` file](https://docs.getdbt.com/reference/dbt-jinja-functions/env%5Fvar), you can add these to Lightdash in your project settings. For each environment variable, you'll need to add the `key` + `value` pair for the item. You'll normally find these values in a file called `.env` in your dbt project directory. For example, you might have something like: ```yaml theme={null} profile: target: prod outputs: prod: type: postgres host: 127.0.0.1 user: "{{ env_var('DBT_USER') }}" .... ``` Then a `.env` file like: ```yaml theme={null} export DBT_USER="myspecialuser" ``` So, in Lightdash, you'd add a new environment variable and put `key` as `DBT_USER` and `value` as `myspecialuser`. ### Reserved and blocked variable names When you create or update a project, Lightdash validates each environment variable key and rejects values that could change how dbt or its child processes execute. Names must contain only letters, numbers, and underscores, and cannot start with a number. The following keys are blocked: * `GIT_ASKPASS`, `GIT_SSH`, `GIT_SSH_COMMAND`, and any name starting with `GIT_CONFIG_` * `LD_AUDIT`, `LD_LIBRARY_PATH`, `LD_PRELOAD`, and any name starting with `DYLD_` * `NODE_OPTIONS`, `NODE_PATH` * `PATH`, `SHELL` * `PERL5OPT`, `PYTHONHOME`, `PYTHONPATH`, `RUBYOPT` * `SSH_ASKPASS` * Any name starting with `LIGHTDASH_DBT_PROFILE_VAR_` (reserved for internal use) If you have an existing project that already uses one of these keys, project compilation will continue to work — the check only runs when you save changes to your connection settings. Rename the variable in your dbt project and save the updated settings to clear the validation error. ### How environment variables work with dbt macros When Lightdash compiles your dbt project, any environment variables you configure will be available to your dbt macros through the `env_var()` function. For example, if you have a macro that checks an environment variable: ```sql theme={null} {% macro get_schema() %} {% if env_var('DBT_ENV') == 'production' %} {{ return('prod_analytics') }} {% else %} {{ return('dev_analytics') }} {% endif %} {% endmacro %} ``` You would set `DBT_ENV=production` as an environment variable in your Lightdash connection settings to ensure the macro resolves to `prod_analytics`. **Key points about environment variables:** * They're available to all macros in your dbt project via the `env_var()` function * They're particularly important if your dbt project was built for dbt Cloud, which relies heavily on environment variables * Make sure to set any environment variables your macros depend on in Lightdash to match your production dbt environment ## Key takeaways * Lightdash compiles your dbt project using the target name and other settings you configure in the connection settings * Any macros that use `target.name`, environment variables, or other profile settings will resolve according to your Lightdash configuration * Make sure your Lightdash target name matches the target you use for your production dbt runs to ensure Lightdash behaves consistently with your dbt project * If you have custom macros that depend on target settings or environment variables, ensure those settings are configured correctly in your Lightdash connection settings > [!TIP] > > If you're experiencing unexpected behavior with how Lightdash compiles your dbt project, check that your target name in Lightdash matches what your dbt macros expect, and verify any environment variables your macros depend on are properly set. ## dbt packages Running `dbt deps` installs the packages listed in `packages.yml` and writes `package-lock.yml`, which records the exact version of every installed package plus a `sha1_hash` fingerprint of the whole dependency tree. On later runs, dbt installs the versions pinned in the lock file instead of re-resolving the ranges in `packages.yml`, so every environment gets the same versions. `packages.yml` can specify version ranges: ```yaml theme={null} packages: - package: dbt-labs/dbt_utils version: [">=1.0.0", "<2.0.0"] - package: calogica/dbt_expectations version: ">=0.8.0" ``` `package-lock.yml` pins what those ranges resolved to: ```yaml theme={null} packages: - package: dbt-labs/dbt_utils version: 1.1.1 name: dbt_utils - package: calogica/dbt_expectations version: 0.10.1 name: dbt_expectations sha1_hash: b980d166c84935d6d661192cf31db5144295c1af ``` Commit `package-lock.yml` to version control. Lightdash runs `dbt deps` when it compiles your project server-side (the "Refresh dbt" button, `lightdash refresh`, and the refresh API), so a committed lock file makes Lightdash install the same package versions as your local and CI runs — the same reason it keeps your team, CI, and production consistent. To update packages, edit the version ranges in `packages.yml` (or delete `package-lock.yml` to force a fresh resolution), run `dbt deps`, test the change, and commit both files together. ### Private packages Lightdash runs `dbt deps` on its own servers, so a package hosted in a private repository only installs if the credentials to read that repository are available where dbt runs. **Over the GitHub connector, this works with no extra configuration.** Lightdash passes the same credentials it used to clone your project — the GitHub App installation token or the personal access token on the connection — to `dbt deps`. Package URLs written in SSH form are rewritten to HTTPS and authenticated with those credentials, so both of these install: ```yaml theme={null} packages: - git: "git@github.com:my-org/my-private-package.git" revision: v1.0.0 - git: "https://github.com/my-org/my-other-package.git" revision: v2.1.0 ``` The credentials must be able to read the package repository as well as the project repository: * **GitHub App**: install the app on the package repository too. If it is missing, `dbt deps` fails and the error tells you to add the dependency to the same installation. * **Personal access token**: the token needs read access to the package repository. This also applies to GitHub Enterprise, using the host domain set on the connection. > [!WARNING] > > **SSH keys are never used.** The image that runs dbt has no SSH client, so git cannot fall back to SSH. Over the GitHub connector the SSH-form URL above is rewritten to HTTPS before dbt runs, so it still works. On every other connection type an SSH package URL fails with `error: cannot run ssh: No such file or directory`. **On other connection types** — GitLab, Azure DevOps, Bitbucket, and dbt Cloud — the connection's credentials are not available to `dbt deps`. Declare the package over HTTPS with a token supplied as a dbt environment variable: ```yaml theme={null} packages: - git: "https://{{ env_var('DBT_ENV_SECRET_PKG_TOKEN') }}@github.com/my-org/my-private-package.git" revision: v1.0.0 ``` Set `DBT_ENV_SECRET_PKG_TOKEN` under **Advanced configuration options → Environment variables** on the dbt connection, and use a read-only token scoped to the package repository. The `DBT_ENV_SECRET_` prefix tells dbt to mask the value in its logs. > [!NOTE] > > In a project with [multiple dbt sources](#connecting-multiple-dbt-sources), every source resolves its own packages with its own connection's credentials, and environment variables are scoped to a single source. A token needed by two sources must be set on both. For more on dbt package management, see the [dbt packages documentation](https://docs.getdbt.com/docs/build/packages). # Upgrading dbt Source: https://docs.lightdash.com/integrations/dbt/upgrading What changes in your Lightdash setup when you move between dbt versions Lightdash reads your dbt project, so a dbt upgrade can change how your semantic layer is declared. Two changes matter: where `meta` and `tags` live as of 1.10, and the Fusion engine that ships as dbt Core v2. ## Moving to dbt 1.10 When you upgrade to dbt 1.10, you'll likely encounter deprecation warnings that look like this: ``` Warning: while parsing model config: Ignore unexpected key "meta" Warning: while parsing model config: Ignore unexpected key "tags" ``` These warnings indicate that dbt is changing how `meta` and `tags` should be structured in your YAML files. Instead of manually updating potentially hundreds of files, you can use MetaMove - a CLI tool specifically designed to automate this migration. ### What changed Starting in dbt 1.10, you will receive deprecation warnings for dbt code that will become invalid in the future, including custom inputs like unrecognized resource properties and configurations. Some properties are moving to configs, including `meta` and `tags`. The key change affects how you define `meta` and `tags` properties across your dbt project: **Before (dbt \< 1.10):** ```yaml theme={null} models: - name: my_model meta: owner: "Data Team" priority: "high" tags: ["core", "customer"] columns: - name: id meta: is_primary_key: true tags: ["identifier"] ``` **After (dbt 1.10+):** ```yaml theme={null} models: - name: my_model config: meta: owner: "Data Team" priority: "high" tags: ["core", "customer"] columns: - name: id config: meta: is_primary_key: true tags: ["identifier"] ``` ### Why it matters Previously, dbt allowed you to configure inputs largely unconstrained. Without a set of strictly defined inputs, it becomes challenging to validate your project's configuration, creating unintended issues such as silently ignoring misspelled properties and configurations. This change provides several benefits: * **Better Validation**: dbt can now catch misspelled properties and configurations * **Consistent Structure**: All custom attributes must be nested under the `meta` config * **Future-Proofing**: Prevents conflicts when dbt introduces new reserved properties ### Automated migration with MetaMove Rather than manually updating your YAML files, use MetaMove - a CLI tool built specifically for this migration. MetaMove automatically transforms your files while preserving comments and formatting. #### Installation Install MetaMove using pipx (recommended): ```bash theme={null} pip install pipx # if you don't have it pipx install metamove ``` #### Basic usage Transform a single YAML file: ```bash theme={null} metamove models/my_model.yml ``` Transform multiple files: ```bash theme={null} metamove models/* seeds/* snapshots/* ``` Transform all YAML files in your dbt project: ```bash theme={null} metamove models/**/* seeds/**/* snapshots/**/* ``` #### Safe migration process MetaMove follows a safe-by-default approach: 1. **Test First**: By default, transformed files are saved to a `transformed` directory: ```bash theme={null} metamove models/* # saves to ./transformed/ ``` 2. **Review Changes**: Compare the original and transformed files to ensure accuracy. 3. **Apply In-Place**: Once confident, transform files in place: ```bash theme={null} metamove models/* -i ``` #### Advanced options Specify a custom output directory: ```bash theme={null} metamove models/* -o my_transformed_models ``` The tool automatically processes only `.yml` and `.yaml` files, so wildcards work safely: ```bash theme={null} # Transform specific model directories metamove models/marts/* models/staging/* # Transform all nested directories metamove models/**/* ``` ### What MetaMove handles MetaMove intelligently processes: * **Nested Structures**: `meta` and `tags` at any nesting level, including inside `columns` * **Existing Config Blocks**: Merges new values into existing `config` sections * **All YAML Types**: Dictionaries, lists, and scalar values * **Formatting Preservation**: Maintains your comments and whitespace * **Complex Cases**: Handles edge cases following dbt precedence rules ### Migrating by hand If you prefer to migrate manually or need to understand the changes, here are the key transformations: #### Model-level changes **Before:** ```yaml theme={null} models: - name: customer_metrics description: "Customer analytics model" meta: owner: "analytics_team" sla: "daily" tags: ["core", "customer", "metrics"] ``` **After:** ```yaml theme={null} models: - name: customer_metrics description: "Customer analytics model" config: meta: owner: "analytics_team" sla: "daily" tags: ["core", "customer", "metrics"] ``` #### Column-level changes **Before:** ```yaml theme={null} models: - name: customers columns: - name: customer_id description: "Unique customer identifier" meta: is_primary_key: true data_type: "uuid" tags: ["pii", "identifier"] ``` **After:** ```yaml theme={null} models: - name: customers columns: - name: customer_id description: "Unique customer identifier" config: meta: is_primary_key: true data_type: "uuid" tags: ["pii", "identifier"] ``` #### Source-level changes **Before:** ```yaml theme={null} sources: - name: raw_data schema: staging meta: loader: "fivetran" freshness_sla: "1 hour" tags: ["external", "raw"] tables: - name: users meta: row_count: 50000 tags: ["pii"] ``` **After:** ```yaml theme={null} sources: - name: raw_data schema: staging config: meta: loader: "fivetran" freshness_sla: "1 hour" tags: ["external", "raw"] tables: - name: users config: meta: row_count: 50000 tags: ["pii"] ``` ### Other 1.10 changes to consider While migrating `meta` and `tags`, be aware of other properties moving to configs: * `freshness` (for sources) * `docs` * `group` * `access` These properties should now be set under the `config` block following the same pattern as `meta` and `tags`. ### Handling warnings If you're using `--warn-error` flags that promote warnings to errors, you may need to adjust your configuration during migration: ```yaml theme={null} # In dbt_project.yml flags: warn_error_options: warn: ["Deprecations"] # Keep deprecation warnings as warnings error: ["other_warning_types"] # Promote other warnings to errors ``` This allows you to continue working while addressing deprecation warnings gradually. ### Testing the migration After migrating your files: 1. **Run dbt parse**: Ensure your project parses without errors: ```bash theme={null} dbt parse ``` 2. **Check for Warnings**: Run a simple command to verify warnings are resolved: ```bash theme={null} dbt compile --select my_model ``` 3. **Run Tests**: Execute your test suite to ensure functionality is preserved: ```bash theme={null} dbt test ``` ### Migrating safely * **Backup First**: Always backup your project before running any migration tool * **Test in Development**: Run the migration in a development branch first * **Review Changes**: Use git diff to review all changes before committing * **Migrate Incrementally**: For large projects, consider migrating one directory at a time * **Update CI/CD**: Ensure your deployment processes work with the new structure ### Troubleshooting #### "Config block already exists" errors If you have existing `config` blocks, MetaMove will merge the new properties. However, if you encounter conflicts: 1. Review the specific file causing issues 2. Manually resolve conflicts between existing and new config properties 3. Re-run MetaMove on the corrected file #### Unexpected YAML structure If your YAML files have unusual structures that MetaMove doesn't handle: 1. Note the problematic files in the tool output 2. Manually migrate these files using the patterns shown above 3. Use MetaMove for the remaining standard files #### Performance on large projects For projects with hundreds of YAML files: 1. Run MetaMove on subdirectories rather than the entire project at once 2. Use the `-o` flag to organize transformed files by directory 3. Process files in batches to make review manageable ## Moving to dbt Core v2 (Fusion) The Fusion engine is a rewrite of dbt in Rust, with faster builds, native SQL understanding, and real-time validation. It is not a separate product: **Fusion ships as dbt Core v2**, and it is open source like the Core releases before it. The proprietary parts of dbt live in dbt Cloud, which you reach by logging in from the CLI — the engine itself is not gated. Your SQL and YAML syntax is unchanged. What differs is enforcement: Fusion validates more strictly than earlier Core releases, so a project carrying unresolved deprecation warnings will fail on it. ### Before you upgrade 1. Move to dbt 1.10 and resolve the `meta` and `tags` warnings, using [MetaMove](#automated-migration-with-metamove) above. 2. Run your project and clear any remaining deprecation warnings. [dbt-autofix](https://github.com/dbt-labs/dbt-autofix) resolves many of them automatically. 3. Upgrade, and run your project once to surface anything left. Check the [dbt Fusion documentation](https://docs.getdbt.com/docs/fusion/about-fusion) for engine-specific behavior and any features still landing. > [!NOTE] > > The Lightdash CLI works with Fusion: `lightdash deploy` and `lightdash preview` compile your project with the dbt you have installed, including Fusion. When Lightdash compiles your project itself, on a [Git connection refresh](/integrations/dbt/projects#git-connection-methods), it uses dbt Core 1.x at the dbt version set in your [project connection settings](/integrations/connect-project#2-import-a-dbt-project). Keep your project compatible with dbt Core 1.10 or later so both paths compile it. # dbt write-back Source: https://docs.lightdash.com/integrations/dbt/write-back Develop models and metrics in Lightdash and open a pull request against your dbt project > [!NOTE] > > * dbt write-back supports dbt projects hosted in GitHub, GitLab, and Bitbucket Cloud. > * You need to be at least a [`project Developer`](/workspace-admin/roles) to use dbt Write-Back. > * Writing back custom metrics and dimensions isn't available on a project with [multiple dbt sources](/integrations/dbt/projects#explore-write-back). For a project using standalone YAML, see [Lightdash YAML write-back](/semantic-layer/yaml#write-back-from-lightdash). ## Control who can write back The write-back workflows on this page are controlled by two scopes, both included in the Developer role and above: * `manage:CustomFields` lets a user write back custom metrics and custom dimensions. It also lets them create and edit custom dimensions. * `manage:SourceCode` (**Create pull requests to update source code**) lets a user write back models from the SQL runner. It also controls whether [AI agents](/agents/ai-writeback) can open write-back pull requests for them. To give someone Developer access without write-back, [duplicate the Developer role](/workspace-admin/custom-roles#duplicate-an-existing-role) as a custom role and remove both scopes. Removing only one leaves the other write-back path open. Access to the repository in GitHub doesn't decide who can write back. When a user's [linked GitHub account](/workflow/pull-requests#pull-request-author) can't access the repository, Lightdash opens the pull request with its GitHub App instead. ## Bitbucket Cloud setup Connect your project using the [Bitbucket token setup instructions](/integrations/connect-project#bitbucket-cloud-api-token). All three workflows below use that stored project token and the configured repository, branch, and dbt directory. Bitbucket support covers dbt projects on `bitbucket.org`. These UI workflows do not support standalone Lightdash YAML on Bitbucket or Bitbucket Server/Data Center. For native YAML on Bitbucket Cloud, use [AI writeback](/agents/ai-writeback#bitbucket-cloud-behavior). Review and merge the pull request in Bitbucket, then sync the project in Lightdash. Writeback does not run your dbt models, display Bitbucket Pipelines status, or create an automatic preview project. ## Write back Metrics from Custom Metrics You can build Custom Metrics in Lightdash and write these back to your dbt project so they are promoted to permanent Metrics in your YAML. We recommend using dbt write-back for custom metrics that you're creating frequently so they become Metrics that are reusable, governed and available for everyone else to build from. **What's the difference between a Metric and a Custom Metric?** [Metrics](/semantic-layer/metrics) written to your dbt project (or YAML Metrics) are reusable by everyone in your project and will show up in the list of available metrics for a Table. [Custom Metrics](/explore/create-custom-fields#custom-metrics) are only saved in the chart they're used in and will not be available if you or others open the same Table to build a new chart. To get started, create a [Custom Metric](/explore/create-custom-fields#custom-metrics) in the Explorer. Hover over the Custom Metric in the sidebar and click on the three-dot menu, then **Write back to project**. ![Three stages of metric write-back: the custom metric menu with Write back to dbt, the confirmation modal, and the opened GitHub pull request](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/integrations/dbt/write-back/write-back-metrics.jpg?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=4c10a5e3128bdb3dcd09613e02e8524f) **Write-back requires a base dimension column.** **Write back to project** is only available for custom metrics that were built from a dimension (the YAML write-back attaches the metric to that dimension in the dbt model). Custom metrics that were [cloned from an existing metric](/explore/create-custom-fields#creating-a-custom-metric-from-an-existing-metric) do not have a base dimension, so the option is hidden from both the individual metric menu and the bulk write-back action in the sidebar's Custom metrics section. Once the pull request with your new Metric is merged, you can click `Refresh dbt` in Lightdash (or, if you're [using GitHub Actions](/workflow/set-up-ci-cd#deploy-changes-to-lightdash), your project will automatically refresh once your changes are merged) and your Custom Metric will be replaced by your new YAML Metric automatically. ![Writing a custom metric back to dbt, clicking Refresh dbt, and the metric appearing under Metrics in the sidebar](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/integrations/dbt/write-back/refresh-after-write-back.jpg?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=c6caeca09a79986b8f4b50e11311ae2b) **Any Custom Metric that matches the definition of your new YAML Metric will automatically be replaced by your YAML Metric.** This means if someone created the same Custom Metric, with the same formatting, filtering, etc. in another Saved Chart, it will also be replaced automatically with your new YAML Metric. ## Write back Dimensions from Custom Dimensions You can build Custom Dimensions in Lightdash and write these back to your dbt project. We recommend using dbt write-back for Custom Dimensions that you're creating frequently so they become Dimensions that are reusable, governed and available for everyone else to build from. **What's the difference between a dimension and a custom dimension?** [Dimensions](/semantic-layer/dimensions) written to your dbt project (or YAML Dimensions) are reusable by everyone in your project and will show up in the list of available Dimensions for a Table. [Custom Dimensions](/explore/create-custom-fields#custom-dimensions) are only saved in the chart they're used in and will not be available if you or others open the same Table to build a new chart. To get started, create a [Custom Dimension](/explore/create-custom-fields#custom-dimensions) in the Explorer. Hover over the Custom Dimension in the sidebar and click on the three-dot menu, then **Write back to project**. 1. Click **Write back to project** ![The three-dot menu on a custom dimension, with Write back to dbt among the options](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/integrations/dbt/write-back/write-back-custom-dimension-1.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=fb764d906bc3470980d1bb00d8e32e22) 2. Preview the Dimension YAML and open a pull request. ![The Write back to dbt modal previewing the dimension YAML, with an Open Pull Request button](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/integrations/dbt/write-back/write-back-custom-dimension-2.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=e132da0c9e6a0b00a5330125da75ae4e) 3. Approve and merge the pull request in your dbt project. ![The GitHub pull request diff adding the dimension under meta.additional\_dimensions in schema.yml](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/integrations/dbt/write-back/write-back-custom-dimension-3.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=21abdb7ee1c60a9347b90f52fdb874aa) Once the pull request with your new Dimension is merged, you can click `Refresh dbt` in Lightdash (or, if you're [using GitHub Actions](/workflow/set-up-ci-cd#deploy-changes-to-lightdash), your project will automatically refresh once your changes are merged). ### Known limitations ##### Bin Dimensions You can write back fixed-width, custom-range, and custom-group bins. Fixed-number bins can't be written back, because their boundaries depend on the query results; switch them to one of the other bin types first. Writing back a bin doesn't carry its sort order. Saved charts keep using the custom bin, so their ordering doesn't change. If bin order matters, add a separate numeric ordering dimension to your model and use it with the new YAML dimension. #### Write-back Dimensions automatically replacing Custom Dimensions At the moment, if you write back a Custom Dimension to your dbt project's YAML, the Custom Dimension will not be automatically replaced with the new YAML Dimension. Once your new Dimension is created in dbt, you'll need to manually update your charts and replace the Custom Dimensions with the new Dimension. ## Write back dbt Models from the SQL Runner You can use Lightdash to build models in dbt from queries that you've built in the SQL runner. We recommend writing back models from the SQL runner if you're planning to use the query regularly so it can be easily used, governed and managed like other dbt models in your Lightdash project. To get started, build and run a query in the SQL runner, then select the `Write back to dbt` option from the `Save` drop-down. ![The SQL runner Save dropdown open, with Write back to dbt below Save chart and Create virtual view](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/integrations/dbt/write-back/dbt-write-back-3774e219cdb58ad09a5e290b28e8b427.jpg?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=dffaf98e6d8467a77617021a83273645) You'll be asked to enter a name that will be used as the model name and file names in your dbt project. Clicking `Open pull request` will open a pull request created by Lightdash against your dbt project in GitHub, GitLab, or Bitbucket Cloud. ![A GitHub pull request opened by Lightdash adding a SQL file and matching .yml config for a new model](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/integrations/dbt/write-back/write-back-pull-request-5c36c33617a258728a644d1e76896725.jpg?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=e72a14559bbc32e394d9e94fe46e4d5f) For Bitbucket Cloud, the dialog previews the repository and both filenames before opening the pull request: ![SQL Runner writeback dialog naming an order summary model and previewing its SQL and YAML files in the Bitbucket repository](https://mintcdn.com/lightdash/_a3JUAaavrAywP0X/images/integrations/dbt/write-back/bitbucket-sql-model.png?fit=max\&auto=format\&n=_a3JUAaavrAywP0X\&q=85\&s=8d4f32669b59e9e50d74b8f10caea725) Bitbucket writeback creates the SQL and YAML files together in one commit. If either filename already exists, choose a different model name; writeback does not overwrite the existing model. The new model will be written to your dbt project in a `models/lightdash/` directory. The model will have the tag `created-by-lightdash` included in the model config. ### Getting your model to appear as a `Table` in Lightdash You might need to adjust [Tables configuration](/semantic-layer/tables#choosing-which-tables-appear-in-lightdash) in your project settings to have your new models appear as Tables in Lightdash. If you've selected: * `Show entire project` then you don't need to do anything. The models should appear automatically if you refresh your dbt project connection. * `Show models with any of these tags`, you'll need to add `created-by-lightdash` to the list of accepted tags. By default, models that you write back to dbt will have the tag `created-by-lightdash` included in the model config. * `Show models in this list`, you'll need to manually add the new models to the list of accepted models here. ![Project settings Tables configuration, with created-by-lightdash added to the list of included tags](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/integrations/dbt/write-back/tables-configuration-write-back-c4be0ae3c4c13aab3c93a81e4956cd4d.jpg?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=4db2bea9d1936fe77b99eed3629707f1) ### Running your models in dbt If you get an `Error: not found your_table_name`, it's likely because you haven't built the table generated by your new model in your data warehouse yet. There are a couple of ways to handle this: #### Manual approach Once your model is merged to your dbt project, you can run `dbt run -s your_model_name_here` to create the table in your data warehouse. You might need to add `--target prod` if your default profile is set to `dev`! #### Automated approach using dbt Cloud If you're using dbt Cloud to manage your dbt project, you can create a job that will automatically run any new models with the tag `created-by-lightdash`. To create a job that does this, you'll want to: 1. open dbt Cloud, head to `Deploy` --> `Jobs` and click `create new job` 2. toggle on `triggered by pull requests` in the `Git Trigger` section 3. add the command `dbt run --select tag:created-by-lightdash` 4. set `compare changes against environment` to `prod`. This will make sure that this job only runs when a model is changed from your pull request ![A dbt Cloud job triggered by pull requests, running dbt run --select tag:created-by-lightdash against the Prod environment](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/integrations/dbt/write-back/dbt-cloud-run-automatically-561d3a59b2dc47a003adaf926fbe5a3b.jpg?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=df134a009297a2e04924d29de38312d3) # Google Sheets Source: https://docs.lightdash.com/integrations/google-sheets Sync chart results to a Google Sheet on a schedule, or query Lightdash from the sidebar add-on ## Syncs You can set up as many syncs as you like, and if you make any changes to the content, Lightdash will update the syncs the next time they’re sent. You can also sync a [data app](/data-apps) to a Google Sheet. Setup is the same, but an app writes one tab per query it runs rather than a single tab — see [Scheduled deliveries and syncs for data apps](/data-apps/deliveries-and-syncs#syncing-an-app-to-google-sheets). ## Creating a Sync All users with editor access or above can create Syncs. To do this, open your chart in view or edit mode, click the three-dot menu in the top-right corner, then click on `Google Sheets Sync`. ![A saved chart's three-dot menu open, with Google Sheets Sync under the Integrations heading](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/integrations/new-sync.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=c44c6c302c31747778c07413f15e8ccc) The pop-up shows you a list of any existing Syncs for the saved chart, you also have the option to `Create new Sync`. Clicking `Create new Sync` takes you to the configuration screen to setup a new Google Sheets Sync. ![The Create a new Sync modal, with fields for the sync name, frequency, target sheet, and a Save in a new tab toggle](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/integrations/new-sync-setup.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=19fcfbc40497958381769a548a248f4e) When you create a Sync, Lightdash also creates a special tab in your Google Sheet called metadata which includes information on when the sheet was last updated and the frequency interval. This allows users to easily understand how often data is refreshed inside their Google Sheet. > [!WARNING] > > By default, data will be synced to the first tab in your Google Sheet and it will overwrite all the content. If you want to select a specific tab, use the **Save in new tab option**. ## Sync options * **Name**: this is the name of your Sync in Lightdash * **Frequency**: this is how often your Google Sheet will be synced. You can make this hourly, daily, weekly, monthly, or custom - each frequency has its own options. For example, with a monthly schedule, you set the day of the month and the time that you want your Sync to be happen. The custom frequency lets you write out your own custom Cron expression if you need something more specific than our standard options. All times for the scheduler are in UTC. * **Select Google Sheet**: Use the file picker to select the Google Sheet that you'd like to sync your chart results to. Note: You need to sync to an existing Google Sheet, so ensure you have created it before you can select it here. * **Save in new tab**: when enabled, it lets you set a tab name that will be used to store your sync data. The tab will be created if it doesn't exist yet in the sheet. This will avoid overwriting the first tab of the sheet. * **Show filters applied**: when enabled, adds a three-row summary of the chart's filters above the synced data. Not available for SQL charts. The Sync form has no filter or parameter overrides. A Sync runs the chart with the filters and parameters saved on it, so every run of a given Sync writes the same slice of data. To send different filtered versions of the same chart to different sheets (or different tabs of the same sheet), duplicate the chart once per filter combination and set up a separate Sync on each copy. Google Sheets isn't a destination in the scheduled delivery modal. A weekly overwrite of a Google Sheet is a Sync, not a [scheduled delivery](/explore/create-scheduled-deliveries) — create it from the chart's three-dot menu as described above. > [!NOTE] > > A Sync runs the chart's saved query as-is, so it's bounded by the organization's effective **Maximum query rows** limit, not by the CSV/Excel cell limit. If the chart's own row limit is above that ceiling, the Sync fails instead of truncating. See [Export limits](/workspace-admin/export-limits#how-limits-are-enforced) for how the two limits differ. The first time you click **Select Google Sheet**, Lightdash asks you to sign in to Google and grant access to your Google Drive. If you approve the sign-in without the Drive permission, Lightdash shows `Missing authorization to access Google Drive`. Click **Select Google Sheet** again to reopen Google's consent screen, and check that Google Drive access is selected before you continue. Once you've set up all of your Sync options, you can click `Sync`. In the list of Syncs for a chart, each Sync has a toggle to pause it and a `Sync now` button to run it immediately. Pausing a Sync stops manual runs too: `Sync now` stays available while a Sync is paused, but the sync itself is skipped until you re-enable it. ## Overview of your Syncs Users who have an admin role in your project can access an overview of your Syncs in the Project Settings. In the `Syncs & Scheduled deliveries` overview page, you can see a list of all of your Syncs (along with your Scheduled Deliveries), their most recent delivery status, and a history of all of the previous deliveries in your project. To access the overview page, just head to your Project Settings, then to the `Syncs & Scheduled deliveries` tab. ![The Syncs and Scheduled deliveries settings page, listing each schedule with its destination, frequency, and last delivery](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/integrations/google-sheets/sync-with-google-sheets-dashboard-overview-82473c0bc5b7a62b20b25443fbcbc9a9.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=803cfdd9a42445336b96c75281a25d4f) Here, you can also click on the three-dot-menu beside each Sync to edit or delete it. ![A sync's three-dot menu open, offering Edit schedule, Go to chart, and Delete schedule](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/integrations/google-sheets/sync-with-google-sheets-dashboard-overview-three-dot-menu-4fb3bae81cb7b62347ca8d1c608d9d7b.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=facad9a853df351271837a6157b6e755) Editing a Sync from the overview page will bring you to the same configuration screen as when you create a new Sync. Deleting a Sync from the overview page will remove it from your chart. ## Export a dashboard to Google Sheets Syncs keep a single chart up to date on a schedule. If you instead want a one-off copy of a whole dashboard — for example a data backup to share alongside a report — you can export the dashboard straight to a new Google Sheet. Open the dashboard, click the three-dot menu in the top-right corner, choose `Export dashboard`, then pick **Google Sheets** as the export format. ![The Export dashboard modal with Google Sheets selected as the export format](https://mintcdn.com/lightdash/PptB0out6mCmbYM1/images/integrations/google-sheets/export-dashboard-to-google-sheets.png?fit=max\&auto=format\&n=PptB0out6mCmbYM1\&q=85\&s=aa09d76b26795040ea946621c06cc28e) Every export creates a **new** Google Sheet in your Google Drive. This is not a sync — running the export again never overwrites a sheet you already have, so each export stays a separate snapshot. ### What you get The new sheet contains: * **`Export summary`** as the first tab: the dashboard name and a link back to it, the time the export ran, and a row for every output listing its tab, the chart it came from, its status, its row count, and a link straight to that tab. * **One tab per output**, in dashboard order, for each chart and SQL chart tile. Outputs that could not be exported still get a tab, containing the reason instead of data, and are marked `Failed` in the summary. This means a chart that breaks doesn't silently disappear from the sheet — the rest of the dashboard still exports. ### Before you start * You need **editor access or above** on the project, the same as for Syncs. * Your Google account must be connected to Lightdash. If it isn't, Lightdash will ask you to connect it the first time you export. * The export uses your dashboard's current filters, parameters, and tab selection. > [!NOTE] > > Large dashboards are bounded so a single export can't exceed Google's per-spreadsheet cell limit. Any tab trimmed to fit is marked `Truncated` in the summary tab with the number of rows that were written. See [Export limits](/workspace-admin/export-limits) for the details. ## Google Sheets add-on The Lightdash Google Sheets add-on runs inside Google Sheets as a sidebar so you can build queries or import saved Lightdash charts without leaving the spreadsheet. Install it from the [Google Workspace Marketplace](https://workspace.google.com/marketplace/app/lightdash/598569222430), and see [Google Sheets add-on](/integrations/google-sheets/add-on) for its capabilities. ## Google API Services User Data Policy Lightdash's use and transfer of information received from Google APIs adhere to [Google API Services User Data Policy](https://developers.google.com/terms/api-services-user-data-policy), including the Limited Use requirements. # Lightdash for Google Sheets Source: https://docs.lightdash.com/integrations/google-sheets/add-on Import saved charts or build refreshable Google Sheets reports with sorting, totals, and row groups Lightdash for Google Sheets is an add-on that runs inside Google Sheets™ as a sidebar so you can build queries or import saved Lightdash charts without leaving the spreadsheet. Each query you run becomes a **range** in the sheet that you can refresh in place, edit, or remove later. The add-on connects to your instance with OAuth and uses your existing Lightdash permissions, user attributes, and caching. Install the add-on from the [Google Workspace Marketplace](https://workspace.google.com/marketplace/app/lightdash/598569222430), then open it from **Extensions → Lightdash → Open sidebar**. Start by [building a query](#build-a-query) or [importing a saved chart](#import-a-saved-chart), then configure [sorting](#sorting-and-row-limits), [totals](#totals), or [collapsible row groups](#row-groups). ![A Lightdash range in Google Sheets with the sidebar showing its query, refresh, edit, and remove actions](https://mintcdn.com/lightdash/3TEHYq4yq7xFUIqM/images/integrations/google-sheets/add-on-range.png?fit=max\&auto=format\&n=3TEHYq4yq7xFUIqM\&q=85\&s=1f03e3a20289ae5652f19477e50d4e52) ## Ranges A range is the block of cells a query wrote to, plus the query behind it. The sidebar opens on the list of ranges, grouped by worksheet in tab order. Each worksheet heading shows its name and range count. Ranges whose cells can no longer be found appear under **Missing ranges**, where you can remove them. * **Refresh in place**: re-running a range writes fresh results over the same cells. If the result grew, the range expands into empty cells below or to the right, or shifts content within its own columns and rows, provided that would not push another Lightdash range. Reports with [row groups](#row-groups) have additional space requirements. If the result shrank, the leftover cells are cleared. * **Several per sheet**: put ranges side by side or on different tabs and refresh them individually, or use **Refresh all** from the sidebar or the **Lightdash** menu. For reports with row groups, follow the [placement requirements](#row-groups). * **Accidental-edit warnings**: each range has warning-only protection. Editing a protected cell shows a "Heads up" prompt, and you can choose to continue. For reports with row groups, only the headers are protected so the collapse controls work without warnings. * **Usable in formulas**: the named range (for example `Lightdash_orders`) works anywhere you'd reference cells, such as `=SUM(Lightdash_orders)`. * **Survives edits around it**: inserting or deleting rows and columns elsewhere in the sheet keeps the range attached to its cells. * **Shared with collaborators**: ranges are stored in the spreadsheet, so anyone who opens it sees the same list. Refreshing needs a Lightdash login, so each person connects their own account. Ranges are not carried over by **File → Make a copy**. ## Build a query 1. Select the cell where the results should start and choose **New query**. 2. Pick a project, then an Explore, and add dimensions and metrics. Drag a dimension into **Columns** to pivot. The project and Explore pickers are searchable. 3. Adjust [filters](#filters) and [sorting and the row limit](#sorting-and-row-limits). Enable [totals](#totals) or [row groups](#row-groups) if needed. 4. Choose **Insert**. The sidebar shows where the results will go and follows your selection while you build. If the selected cell is inside an existing range, pick a cell outside it first. Results are written with a bold header row and light banding, starting at the selected cell. If those cells already hold data, the sidebar asks before overwriting them. The field picker follows your model's nested groups and custom group labels. Collapse groups to reduce the list, or search by field, table, or group name. Searching expands matching groups; clearing the search restores the groups you collapsed. ### Filters Filters defined in your dbt models are respected: `required_filters` are prefilled and can't be removed (values are still editable), while `default_filters` are prefilled but can be adjusted or removed. Add your own dimension and metric filters with **+ Add filter**, then search the field picker to choose a field. For **is** and **is not** filters on text, numeric, or boolean dimensions, search the suggested values and select one or more. Selections appear as removable chips. Use **Select all** or **Select all matches** to select the available results, and **Clear all** to remove the selection. Model-defined suggestions and labels are respected. The picker shows up to 100 suggestions. When more values are available, narrow your search to enable bulk selection. You can also type a value and press **Enter** to add it, including when suggestions cannot load. ## Import a saved chart Use an existing saved Explore chart as the starting point for a report: 1. Choose **Import saved chart** from the Ranges page. 2. Paste the chart URL from your connected Lightdash instance and choose **Load chart**. 3. Review or adjust the query in the builder, select a destination cell, and choose **Insert**. The range takes the chart's name and preserves its supported fields, column order, filters, sorting, timezone, row limit, and pivot layout. Loading a chart or cancelling the import does not write cells or create a range. After insertion, refreshing uses the query saved with the range. Later edits to the original Lightdash chart are not synced, and chart styling is not imported. Reordering fields in the builder replaces the imported column order with the builder's layout order. Only saved Explore charts that the builder can represent are supported. Import rejects merged results, parameters, custom metrics or dimensions, table calculations, custom formatting overrides, OR filters, advanced filter options, unavailable or hidden fields, unsupported sorts, and a pivot layout that doesn't match the chart's dimensions. The chart must also fit the [row limit](#sorting-and-row-limits). The error identifies what needs changing before you can import it. For a chart with a rejected pivot layout, [build the query](#build-a-query) directly in the add-on instead: pick the same Explore, add the same dimensions and metrics, and drag a dimension into **Columns** to reproduce the pivot. Use a saved chart URL without filter overrides, other query parameters, or a fragment. The `fromDashboard` navigation parameter is accepted. Nested AND filters are supported. ## Sorting and row limits Under **Sort**, choose a selected field and ascending or descending order. Use **+ Add sort** for additional rules and the arrows to change their priority. Sorting is saved with the range and reused when editing, refreshing, or refreshing all ranges. Removing a field also removes its sort rule. Flat reports can sort by selected dimensions and metrics. Pivots can sort by row dimensions; without explicit rules, pivot rows sort ascending. When [row grouping](#row-groups) is enabled, the order of fields in **Rows** sets the sort priority, and you can choose a direction for each level. Select **Row limit** below the insert or update button. The control shows the current value with a chevron. While you edit the value, it shows **Maximum allowed**. You can set the limit from 1 row up to your organization's [maximum query rows](/workspace-admin/export-limits); the default is 500. Drafts from the add-on's AI assistant use the same ceiling. Sorting applies before the limit, so sorting a metric descending with a limit of 100 returns the top 100 results. The add-on fetches all result pages up to the configured limit before writing to the sheet. When a saved range's limit is above the organization's maximum, the add-on stops before writing cells. Group labels and totals rows are additional to the detail-row limit and displayed row count. ## Totals Use the checkboxes under **Totals** to include totals in the report: | Option | Result | Requires | | - | - | - | | **Column totals** | A bold totals row at the bottom | A metric in **Values** and a dimension in **Rows** | | **Row totals** | A total column per metric on the right | A metric in **Values** and a dimension in **Columns** | | Both | Row and column totals, including grand totals | Both requirements above | Lightdash calculates totals in the warehouse using the metric definitions, including averages, ratios, and distinct counts. Totals cover all matching data after filters, regardless of the displayed row limit or pivot-column cap. A total can therefore include data that is not visible in the sheet. Totals are off until enabled and are saved with the range. Empty results do not add a totals row. If your Lightdash instance cannot calculate a requested total, or returns incomplete totals, the report fails before writing cells. Retry or turn off totals. ## Row groups Enable **Group rows** with 2–9 dimensions in **Rows** to expand and collapse detail using the native Sheets **+ / −** controls. The order of row fields defines the hierarchy, and each group has a bold label. Both flat reports and pivots support grouping. Metrics are optional. When selected, Lightdash calculates subtotals for the group rows using the metric definitions and filters. Subtotals can include matching detail beyond the row limit. If your Lightdash instance cannot calculate the required subtotals, the update stops before cells or groups change. New groups start expanded. Refresh preserves the collapsed state of groups with the same fields and values. Grand totals stay outside the collapsible groups. Turning grouping off or removing the range removes its groups and reveals their detail rows. Groups hide entire worksheet rows. Use separate rows or worksheets for independent reports: the add-on refuses grouping beside other content or managed ranges, and refuses to overwrite unrelated row groups. Grouped reports need empty space to grow; they do not shift surrounding content. If row groups are manually restructured, ungroup the affected rows before refreshing. A range supports up to 200 groups. If a report exceeds that limit, add filters or reduce its row limit. ## Manage a range Select a range in the sidebar list to open it. From there you can: * **Refresh** to re-run the query. * **Edit query** to reopen the builder with the saved query loaded. **Update range** rewrites the same cells with the new result. * **Rename** by selecting the range's name. * **Remove** to delete the saved query and its protection, keeping or clearing the cells. Selecting a range in the list also moves the sheet selection to it. ## Sign in with your Lightdash account Authentication uses OAuth against your Lightdash instance, so results reflect what the signed-in user is allowed to see. The account and a **Disconnect** link are shown at the bottom of the sidebar. The sign-in request and every query the add-on runs are sent from Google's Apps Script server infrastructure, not from the signed-in user's browser. Your Lightdash instance must be reachable from Google's infrastructure, not only from users' browsers or your internal network. A self-hosted instance with no inbound path from outside your network — for example, one only reachable through a private or internal-only DNS zone — can't be reached by the add-on, even though users can reach it directly. ## How the add-on uses your Google data The add-on reads and writes only the spreadsheet it is opened in, so that it can insert and refresh the query results you ask for. It does not access your other files or your Google account data. Lightdash's use of information received from Google APIs follows the [Google API Services User Data Policy](/integrations/google-sheets#google-api-services-user-data-policy). See the Lightdash [privacy policy](https://www.lightdash.com/privacy-policy) and [terms of service](https://www.lightdash.com/terms-of-service). Google Sheets™ is a trademark of Google LLC. # Live data sources Source: https://docs.lightdash.com/integrations/live-data-sources Connect your tools and analyze their live data directly [Beta](/support/feature-badges#beta) > [!NOTE] > > [Contact Lightdash support](mailto:support@lightdash.com) to enable live data sources for your organization. > > On a self-hosted Enterprise instance, [enable them with a feature flag](/self-host/enterprise-features#live-data-sources). Live data sources let you analyze the live data in your tools, with or without a warehouse. Sign in to a tool and you get a ready-made set of dimensions and metrics to explore, chart and ask AI agents about. Each query goes to the tool's API when it runs, so results are as current as the tool and its data isn't loaded into your warehouse. Speed, history and rate limits depend on each tool. A project can use live data sources on their own, with no warehouse connected. ## Connect your tools Project admins [add a source](/integrations/live-data-sources/set-up-and-manage#connect-a-live-data-source) by signing in to the tool or entering an API key. There's no sync to schedule or dbt model to write. Each integration page lists its dimensions, metrics, supported features and limits. > [card] [PostHog](/integrations/live-data-sources/posthog) > > Product events, persons and sessions through HogQL > [card] [Google Analytics 4](/integrations/live-data-sources/google-analytics) > > Users, sessions, events and revenue for a property > [card] [Google Search Console](/integrations/live-data-sources/google-search-console) > > Search clicks, impressions, click-through rate and position > [card] [Meta Ads](/integrations/live-data-sources/meta-ads) > > Facebook and Instagram ad performance for an ad account > [card] [Google Ads](/integrations/live-data-sources/google-ads) > > Campaign and ad group cost, clicks and conversions > [card] [YouTube Analytics](/integrations/live-data-sources/youtube-analytics) > > Channel views, watch time and subscribers > [card] [LinkedIn Ads](/integrations/live-data-sources/linkedin-ads) > > Campaign spend, clicks, leads and conversions To ask for another tool, click **Request** next to it in the **Add a live data source** dialog. If it isn't listed, contact [Lightdash support](mailto:support@lightdash.com). ## Integration levels An integration's level describes how much its API can do when Lightdash queries it live. The higher the level, the more questions work. Each integration page states its level and the features it supports. | Level | What the API does | What you can ask | | - | - | - | | 5 | Runs SQL | The widest range of metrics and breakdowns | | 4 | Runs its own query language, including totals | Totals and breakdowns that query language supports | | 3 | Runs reports from a fixed menu of dimensions and metrics | Any combination the menu allows | | 2 | Filters records, without totals | Small, filtered sets of records | | 1 | Lists records, without filtering | Very little works live | ## Access and security A source uses one shared connection, so everyone who can query it sees the same data. | Topic | How it works | | - | - | | Who can manage sources | Project admins add, edit, sign in again and delete sources | | Who can query | People with the Interactive viewer role or above. Viewers can open saved charts and dashboards | | Whose access queries use | The account that signed in, or the API key, within the dimensions and metrics in use | | Access requested | Read-only. Each integration page lists what it needs | | Credentials | Sign-in tokens and API keys are stored encrypted and never shown again | | What AI agents see | Source names, the dimensions and metrics in use with their labels, descriptions and AI hints, and the rows their queries return | | Usage | Each source shows data read, API calls and median latency | [User attributes](/workspace-admin/user-attributes) don't apply to live data sources, so you can't limit rows or columns per person. To limit who can query a source, connect it in a separate project that only those people can access. To keep sensitive data, such as properties that hold email addresses, away from people and agents, [turn off **In use**](/integrations/live-data-sources/set-up-and-manage#dimensions-and-metrics) for that dimension or metric. ## Limits ### Rate limits Each source caps queries at once, calls per minute and calls per hour, and everyone who queries it shares those caps. Each person's first open of a chart makes its own call, so a popular dashboard can reach them. Scheduled deliveries send results to people without each of them querying the source. A query waits up to 15 seconds for a free slot. Over a cap, it fails with a message saying when to retry. Calls also count toward your API quota with the tool. ### Date ranges and rows A query with no filter on the source's date dimension reads a default range, such as the last 28 days. Each integration also caps the rows a query returns and how long it waits for an answer. ### Unavailable features These aren't available on any live data source: * View underlying data * SQL runner and compiled SQL * Embedded dashboards and charts * Funnels, retention and user paths * Pivot tables and charts grouped by a dimension * Data apps Other features, such as table calculations and custom metrics, vary by integration. A query that uses an unsupported feature fails with a message saying what to remove, even when the control for it still appears. ## Caching [Results caching](/semantic-layer/caching) doesn't apply to live data sources, so its project setting, duration and sharing between people have no effect. Integrations have their own processing delays, listed on each integration page. * **Repeat queries.** If you run the same query again within 60 seconds, you get your earlier result. It doesn't call the integration or count toward its rate limits. This reuse is per person, so the same query from someone else calls the integration. * **Scheduled deliveries.** Deliveries fetch new results unless **Use cached results when available** is on. * **Clearing the cache.** Clearing cached results for a project, chart, dashboard or explore, on demand or on a schedule, also clears live data source results. ## Choose a data source | Use | When you want to | | - | - | | [A live data source](/integrations/live-data-sources/set-up-and-manage#connect-a-live-data-source) | Answer questions about one tool's own data, without building a pipeline | | [Your warehouse](/get-started/build-your-semantic-layer) | Join a tool's data with other data, model it, or keep history the tool doesn't | | [External sources](/explore/external-sources) | Upload a CSV or connect a Google Sheet and query it next to your warehouse data | You can't join a live data source to other tables in Explore. # Google Ads Source: https://docs.lightdash.com/integrations/live-data-sources/google-ads Query cost, clicks and conversions for a Google Ads account live from Explore and AI agents The Google Ads [live data source](/integrations/live-data-sources) reads one Google Ads account, by day and by campaign or ad group. Each query is one report request, and Lightdash shows the results as they come back from Google. It's a [level 3](/integrations/live-data-sources#integration-levels) integration: its API returns reports. ## Before you start * **Live data sources enabled** for your organization. See [Live data sources](/integrations/live-data-sources). * **Admin role** in the Lightdash project. * **A Google account that can read the Google Ads account.** Read-only access is enough. ## Connect Google Ads 1. On the nav bar, click **Browse** → **Semantic Layer**. 2. In the sidebar, select **Live data sources**, then click **Add**. 3. Select **Google Ads**. 4. Enter a **Name**, such as `Google Ads`. 5. Click **Continue to Google**. 6. Sign in with your Google account and allow access. 7. Back in Lightdash, pick the account the source reads. The list shows client accounts, including those under a manager account. Google only reports metrics for client accounts, so you can't pick a manager account itself. Lightdash adds an **Ad performance** table to Explore. Queries run with the Google account that signed in. To change it, choose **Sign in again** from the source's menu. Google's consent screen asks for access to manage your Google Ads account, because Google has only one permission for its Ads API. Lightdash limits the source to the read-only report endpoint of the account you picked. ## Dimensions | Dimension | Notes | | - | - | | Date, Date week, Date month, Date quarter, Date year | In the account's time zone. Weeks start on Monday | | Day of week, Device, Network | | | Account ID, Account name, Account currency | | | Campaign ID, Campaign name, Campaign status, Campaign type, Campaign bidding strategy type | A removed campaign can share its name with a live one. Add **Campaign ID** to tell them apart | | Ad group ID, Ad group name, Ad group status, Ad group type | An ad group name is unique only within its campaign | Ads, keywords, search terms and conversion actions aren't available. ## Metrics | Metric | Notes | | - | - | | Cost, Average CPC, Average CPM | In the account's currency | | Clicks, Impressions, Click-through rate | | | Interactions, Interaction rate, Engagements | | | Conversions, Conversion value, Conversion rate, Cost per conversion, Value per conversion | Counted by the account's bidding goals. Attribution can make them fractional | | All conversions, All conversions value, View-through conversions | Include conversions not used for bidding | | Search impression share, Search top impression share, Search absolute top impression share, Search lost impression share (budget), Search lost impression share (rank) | | ## Combination rules Google Ads returns one row per campaign or ad group and doesn't group across them, so a query has to identify the rows it returns: * Any campaign dimension needs **Campaign name** or **Campaign ID** in the query. * Any ad group dimension needs **Ad group ID**, or **Ad group name** with **Campaign name** or **Campaign ID**. * To filter by **Day of week**, **Device** or **Network**, also add that dimension to the query. * To filter by a campaign or ad group, include a dimension at that level or a finer one. For example, add **Campaign name** before you filter by it. Lightdash checks these rules before calling Google and tells you which dimension to add. Google also rejects some combinations of metrics and dimensions. When it does, Lightdash shows Google's error. ## Supported features | Feature | Available | | - | - | | Filters on text dimensions: is, is not, includes, doesn't include, starts with, ends with | Yes | | Filters on IDs, statuses and types: is, is not | Yes | | Filters on metrics: greater than, less than, between | Yes | | OR filters and nested filter groups | No | | Table calculations, custom metrics and custom dimensions | No | | Period-over-period comparisons, pivots and date zoom | No | ## Limits | Limit | Value | | - | - | | Default date range | Last 30 days ending yesterday, when the query has no filter on Date | | Most rows per query | 9,999 | | Timeout | 60 seconds | | Queries at once | 5 per source | | Calls per minute | 60 per source | | Calls per hour | 1,000 per source | When a query has more than 9,999 rows, Lightdash shows an error rather than a partial result. Narrow the date range, add a filter or remove a dimension. Google Ads also applies its own daily quota to the Google Cloud project behind the sign-in, shared by every source that uses it. ## Example questions * *"Cost and conversions by campaign over the last 30 days."* * *"Top 10 ad groups by clicks last month, with their campaign."* * *"Weekly cost per conversion by device since the start of the quarter."* ## Troubleshooting **Numbers don't match the Google Ads interface.** Check the date range first. Relative dates such as *last 7 days* use the project's time zone to decide what today is, so they can be a day off from the account's. Google can also keep updating conversions for several days. **Your query needs a dimension you didn't pick.** See [Combination rules](#combination-rules). The error names the dimension to add. # Google Analytics 4 Source: https://docs.lightdash.com/integrations/live-data-sources/google-analytics Query users, sessions, events and revenue for a GA4 property live from Explore and AI agents The Google Analytics 4 [live data source](/integrations/live-data-sources) reads one GA4 property through the Google Analytics Data API. Each query is one report request, and Lightdash shows the results as they come back from Google. It's a [level 3](/integrations/live-data-sources#integration-levels) integration: its API runs reports from a fixed menu of dimensions and metrics. ## Before you start * **Live data sources enabled** for your organization. See [Live data sources](/integrations/live-data-sources). * **Admin role** in the Lightdash project. * **A Google account that can read the property**, with at least the Viewer role in Google Analytics. ## Connect Google Analytics 4 1. On the nav bar, click **Browse** → **Semantic Layer**. 2. In the sidebar, select **Live data sources**, then click **Add**. 3. Select **Google Analytics 4**. 4. Enter a **Name**, such as `Google Analytics`. 5. Click **Continue to Google**. 6. Sign in with your Google account and allow read-only access to Google Analytics. 7. Back in Lightdash, pick the property the source reads. Lightdash reads the property's key events and custom metrics, and adds a **Report** table to Explore. Queries run with the Google account that signed in. To change it, choose **Sign in again** from the source's menu. ## Dimensions | Dimension | Notes | | - | - | | Date, Date week, Date month, Date year | In the property's time zone | | Year and month | `YYYYMM`, such as `202610` | | Country, City | From the user's IP address; rare cities can be grouped into `(other)` | | Device category, Platform | `desktop`, `mobile`, `tablet`; web, Android or iOS | | Session source, Session medium, Session campaign, Session default channel group | Where the session came from | | First user source | Where the user first came from | | Landing page, Page path | Page path is event-scoped | | Event name | Such as `page_view`, `purchase` or a custom event | | New or returning | `new` for a first visit, `returning` otherwise | | Item name | Item-scoped; only works with item metrics | ## Metrics | Metric | Notes | | - | - | | Active users, Total users, New users | Daily values don't add up to a weekly total | | Sessions, Engaged sessions, Engagement rate, Average session duration (s) | | | Views, Event count, Key events | Your key events are also added as separate metrics | | Total revenue, Ecommerce purchases | | | Item revenue, Items purchased, Items viewed | Item metrics | Custom metrics defined in the property are added too. Click **Refresh fields** after you add a key event or custom metric in Google Analytics. See [Dimensions and metrics](/integrations/live-data-sources/set-up-and-manage#dimensions-and-metrics). ## Combination rules Google Analytics only answers some combinations of dimensions and metrics: * A query can use at most **9 dimensions** and **10 metrics**. * **Item name** only works with item metrics: Item revenue, Items purchased and Items viewed. * **Date month** and **Year and month** read the same Google Analytics dimension, so a query can only use one of them. * **Page path** is event-scoped. Splitting sessions or users by page counts a session once for each page it visited. Lightdash checks these rules before calling Google and tells you which dimension or metric to remove. ## Supported features | Feature | Available | | - | - | | Table calculations | No | | Custom metrics and custom dimensions | No | | Period-over-period comparisons | No | | OR filters and nested filter groups | Yes | | Filters on metrics | Yes | | Pivots and date zoom | No | ## Limits | Limit | Value | | - | - | | Default date range | Last 28 days, when the query has no filter on Date | | Most rows per query | 24,999 | | Timeout | 30 seconds | | Queries at once | 5 per source | | Calls per minute | 60 per source | | Calls per hour | 1,000 per source | Google Analytics also applies its own quotas per property. ## Example questions * *"Which channels brought the most sessions in the last 28 days?"* * *"Weekly active users by device category since the start of the quarter."* * *"Top landing pages by engaged sessions last month."* # Google Search Console Source: https://docs.lightdash.com/integrations/live-data-sources/google-search-console Query Google Search clicks, impressions, CTR and position for a site live from Explore and AI agents The Google Search Console [live data source](/integrations/live-data-sources) reads Google Search performance for one Search Console site. Each query is one request to the Search Console API. It's a [level 3](/integrations/live-data-sources#integration-levels) integration: its API runs reports from a fixed menu of dimensions and metrics. ## Before you start * **Live data sources enabled** for your organization. See [Live data sources](/integrations/live-data-sources). * **Admin role** in the Lightdash project. * **A Google account with access to the site** in Search Console, as an owner or user. ## Connect Google Search Console 1. On the nav bar, click **Browse** → **Semantic Layer**. 2. In the sidebar, select **Live data sources**, then click **Add**. 3. Select **Google Search Console**. 4. Enter a **Name**, such as `Search Console`. 5. Click **Continue to Google**. 6. Sign in with your Google account and allow read-only access to Search Console. 7. Back in Lightdash, pick the site the source reads. Lightdash adds a **Search performance** table to Explore. Queries run with the Google account that signed in. To change it, choose **Sign in again** from the source's menu. ## Dimensions | Dimension | Notes | | - | - | | Date | In Pacific Time | | Query | What people searched for. Google hides rare queries, so totals split by query are lower than site totals | | Page | Splitting or filtering by page counts impressions per page, so a result showing two of your pages counts twice | | Country | Three-letter country code | | Device | `DESKTOP`, `MOBILE` or `TABLET` | | Search appearance | Rich result type | ## Metrics | Metric | Notes | | - | - | | Clicks | Clicks from Google Search | | Impressions | Times a link to the site appeared in results | | Click-through rate | Clicks divided by impressions | | Average position | Average top position in results, weighted by impressions | See [Dimensions and metrics](/integrations/live-data-sources/set-up-and-manage#dimensions-and-metrics) to rename dimensions and metrics, add AI hints or hide them. ## Data freshness Search Console dates are in Pacific Time, and the last two or three days are incomplete in Search Console itself. Leave them out of comparisons, or expect them to change. ## Supported features | Feature | Available | | - | - | | Table calculations | No | | Custom metrics and custom dimensions | No | | Period-over-period comparisons | No | | OR filters and nested filter groups | No | | Filters on metrics | No | | Date filter operators | **in the last**, **is between** and **is** only | | Pivots and date zoom | No | ## Limits | Limit | Value | | - | - | | Default date range | Last 28 days, when the query has no filter on Date | | Most rows per query | 24,999 | | Timeout | 30 seconds | | Queries at once | 5 per source | | Calls per minute | 600 per source | | Calls per hour | 20,000 per source | ## Example questions * *"Top 20 search queries by clicks last month, with click-through rate."* * *"Daily clicks and impressions over the last 4 weeks."* * *"Average position and clicks by device for the blog pages this month."* # LinkedIn Ads Source: https://docs.lightdash.com/integrations/live-data-sources/linkedin-ads Query spend, clicks, leads and conversions for a LinkedIn ad account live from Explore and AI agents The LinkedIn Ads [live data source](/integrations/live-data-sources) reads one Campaign Manager ad account. Each query is one report request, and Lightdash shows the results as they come back from LinkedIn. It covers paid ads only, not organic Company Page analytics. It's a [level 3](/integrations/live-data-sources#integration-levels) integration: its API returns reports. ## Before you start * **Live data sources enabled** for your organization. See [Live data sources](/integrations/live-data-sources). * **Admin role** in the Lightdash project. * **A LinkedIn member with a role on the ad account.** * **Your ad account ID:** the number at the top of the account in Campaign Manager. If LinkedIn Ads shows a **Request** button instead of connecting, your instance doesn't have a LinkedIn client. On a self-hosted instance, [configure one](/self-host/enterprise-features#live-data-sources). ## Connect LinkedIn Ads 1. On the nav bar, click **Browse** → **Semantic Layer**. 2. In the sidebar, select **Live data sources**, then click **Add**. 3. Select **LinkedIn Ads**. 4. Enter a **Name**, such as `LinkedIn Ads`, and the **Ad account ID**. 5. Click **Continue to LinkedIn**. 6. Sign in with your LinkedIn account and allow access. Lightdash asks for read-only access to your ad accounts and their reporting. Lightdash checks that the member can read the ad account and adds a **Performance** table to Explore. To change the member, choose **Sign in again** from the source's menu. ## Dimensions | Dimension | Notes | | - | - | | Date, Date month, Date year | In UTC | | Campaign group ID, Campaign group name | | | Campaign ID, Campaign name | | | Campaign status, Campaign type, Campaign objective | Current values, not values at the time of the activity | Names show their current value too. Creatives, demographics and conversion actions aren't available. ## Metrics | Metric | Notes | | - | - | | Cost, Conversion value | In the ad account's currency | | Impressions | | | Reach | Deduplicated by LinkedIn for each row, so don't add rows together | | Clicks, Landing page clicks, Total engagements | **Clicks** counts LinkedIn's chargeable clicks | | Likes, Comments, Shares | Sponsored Content only | | Follows | Sponsored Content and Follower ads only | | Video views, Video completions | | | Leads, Lead form opens | From LinkedIn lead gen forms | | Conversions, Post-click conversions, Post-view conversions | Website conversions | ## Combination rules * A query can use at most **18 metrics** and one of **Date**, **Date month** or **Date year**. * To filter by **Campaign ID**, include a campaign dimension in the query. * To filter by **Campaign group ID**, include a campaign group or campaign dimension in the query. * **Reach** covers at most 92 days. Shorten the date range or remove it. * LinkedIn rounds totals older than six months to whole months. Without a date dimension, a range that reaches back that far has to start on the first of a month and end on the last of a month. Lightdash checks these rules before calling LinkedIn and tells you what to change. ## Supported features | Feature | Available | | - | - | | Filters on Campaign ID and Campaign group ID | Yes, exact match | | Filters on other dimensions | No | | Filters on metrics | No | | OR filters and nested filter groups | No | | Table calculations, custom metrics and custom dimensions | No | | Period-over-period comparisons, pivots and date zoom | No | ## Limits | Limit | Value | | - | - | | Default date range | Last 28 days, when the query has no filter on Date | | Most rows per query | 14,999 | | Timeout | 60 seconds per request | | Queries at once | 5 per source | | Calls per minute | 60 per source | | Calls per hour | 1,000 per source | A query can make several calls, because Lightdash also reads campaign and campaign group names from LinkedIn. When a query has more than 14,999 rows, Lightdash shows an error rather than a partial result. Narrow the date range, add a filter or remove a dimension. ## Example questions * *"Spend and leads by campaign over the last 28 days."* * *"Monthly impressions and clicks this year."* * *"Top 10 campaigns by conversions last month."* ## Troubleshooting **This LinkedIn member can't read the ad account.** Check the ID in Campaign Manager and that the member has a role on the account, then sign in again. **Numbers don't match Campaign Manager.** Dates here are in UTC, so compare a range in UTC first. Totals older than six months are rounded by LinkedIn to whole months. # Meta Ads Source: https://docs.lightdash.com/integrations/live-data-sources/meta-ads Query Facebook and Instagram ad performance for a Meta ad account live from Explore and AI agents The Meta Ads [live data source](/integrations/live-data-sources) reads one Meta ad account. Lightdash turns each query into a Marketing API Insights request and shows the results Meta returns. Ad data stays in Meta. It's a [level 3](/integrations/live-data-sources#integration-levels) integration: its API returns reports. ## Before you start * **Live data sources enabled** for your organization. See [Live data sources](/integrations/live-data-sources). * **Admin role** in the Lightdash project. * **Your ad account ID:** the number after `act=` in your Ads Manager URL. * **A system user access token** with only the `ads_read` permission. To create one: 1. In [Meta Business settings](https://business.facebook.com/settings/system-users), add a system user and assign it your ad account with **View performance** access. 2. In [Meta for Developers](https://developers.facebook.com/apps/creation/), create a Business app in the same business portfolio and add the **Marketing API** product. 3. On the system user, click **Generate new token**, choose the app, select `ads_read`, and set the token to never expire. ## Connect Meta Ads 1. On the nav bar, click **Browse** → **Semantic Layer**. 2. In the sidebar, select **Live data sources**, then click **Add**. 3. Select **Meta Ads**. 4. Enter a **Name**, such as `Meta Ads`. People see this name in Explore and agents use it to refer to the source. 5. Enter the **Ad account ID** and **Access token**, then click **Test connection**. 6. Click **Add source**. Lightdash adds an **Insights** table to Explore. ## Dimensions | Dimension | Notes | | - | - | | Date, Date month | In the ad account's time zone | | Campaign ID, Campaign name, Campaign objective | | | Ad set ID, Ad set name | | | Ad ID, Ad name | | | Age, Gender | Can be used together | | Country, Region | One at a time | | Platform, Placement | Add **Platform** whenever you add **Placement** | Age and gender, location, and placement can't be combined in one query. Meta doesn't report those breakdowns together. ## Metrics | Metric | Notes | | - | - | | Spend | In the ad account's currency | | Impressions, Clicks (all), Link clicks | | | Reach, Frequency | Deduplicated by Meta for each row, so don't add rows together | | Click-through rate (all), Cost per click (all), Cost per 1,000 impressions | | | Purchases, Purchase value, Purchase ROAS | | | Leads, Landing page views, Adds to cart, Checkouts initiated, Registrations completed | | Conversion metrics use Meta's default attribution: 7-day click and 1-day view. This can differ from an ad set's own attribution setting, so numbers can differ from Ads Manager. A blank value means Meta reported nothing for that row. ## Supported features | Feature | Available | | - | - | | Filters on campaign, ad set and ad names and IDs | Yes | | Filters on age, gender, location, platform or placement | No | | Filters on metrics | No | | OR filters and nested filter groups | No | | Table calculations, custom metrics and custom dimensions | No | | Period-over-period comparisons, pivots and date zoom | No | To filter by a campaign, ad set or ad, include that field or a finer one in the query. For example, add **Campaign name** before you filter by it. ## Limits | Limit | Value | | - | - | | Default date range | Last 30 days, when the query has no filter on Date | | History | 37 months. Reach and frequency with a breakdown: 13 months | | Most rows per query | 5,000 | | Timeout | 60 seconds per request | | Queries at once | 3 per source | | Calls per minute | 60 per source | | Calls per hour | 1,000 per source | When a query has more than 5,000 rows, Lightdash shows an error rather than a partial result. Narrow the date range, add a filter or remove a dimension. ## Example questions * *"Spend and purchases by campaign over the last 30 days."* * *"Top 10 ads by spend this month."* * *"Impressions and link clicks by age and gender last week."* ## Troubleshooting **Meta rejected the access token.** Generate a new system user token with `ads_read` and update the source. **Meta denied access to the ad account.** Check that the system user is assigned to this ad account and that the token includes `ads_read`. **Numbers don't match Ads Manager.** Check the date range and time zone first. For conversions, compare against the 7-day click and 1-day view attribution setting in Ads Manager. # PostHog Source: https://docs.lightdash.com/integrations/live-data-sources/posthog Query events and persons in a PostHog project live from Explore and AI agents The PostHog [live data source](/integrations/live-data-sources) reads one PostHog project. Lightdash turns each query into a HogQL query, sends it to PostHog, and shows the aggregated results. Event data stays in PostHog. It's a [level 5](/integrations/live-data-sources#integration-levels) integration: its API runs SQL. ## Before you start * **Live data sources enabled** for your organization. See [Live data sources](/integrations/live-data-sources). * **Admin role** in the Lightdash project. * **Your PostHog region**, US Cloud or EU Cloud. Check the address you use for PostHog: `us.posthog.com` or `eu.posthog.com`. * **One of these PostHog credentials:** * An account on the PostHog project, to use **Sign in with PostHog**. This option appears only when your Lightdash instance has a PostHog sign-in app configured. * A [personal API key](https://posthog.com/docs/api#private-endpoint-authentication) with the **Query Read** scope, and the project ID: the number after `/project/` in your PostHog URL. ## Connect PostHog 1. On the nav bar, click **Browse** → **Semantic Layer**. 2. In the sidebar, select **Live data sources**, then click **Add**. 3. Select **PostHog**. 4. Enter a **Name**, such as `PostHog`. People see this name in Explore and agents use it to refer to the source. 5. Choose your **Region**. 6. Connect with one of: * **Sign in with PostHog**: sign in, then pick the project. Lightdash asks for query access only. * **Personal API key**: enter the **Project ID** and **Personal API key**, then click **Test connection**. 7. Click **Add source**. ![The Add PostHog source dialog with Name, Region set to US Cloud, Project ID and Personal API key fields, and Test connection and Add source buttons](https://mintcdn.com/lightdash/bfRhm6Fu1UC-QFZJ/images/integrations/live-data-sources/add-posthog-source.png?fit=max\&auto=format\&n=bfRhm6Fu1UC-QFZJ\&q=85\&s=3c04e2964625a25d73f78e65d713c151) Lightdash reads the project's event and person properties, and adds an **Events** table to Explore. ## Dimensions | Dimension | Notes | | - | - | | Event date, Event week, Event month | Weeks start on Monday | | Event time | The exact time of the event | | Event name | Such as `$pageview` or a custom event | | Distinct ID | The ID the event was captured with | | Person ID | The person after identify and merges | | Current URL, Pathname, Referring domain, UTM source, Browser, OS, Device type, Country | Common event properties | ## Metrics | Metric | Notes | | - | - | | Events | Events captured | | Unique users | Distinct people, after identify and merges | | Unique sessions | Distinct sessions | Lightdash also adds the event properties and person properties defined in your project as dimensions, up to 2,000. Internal PostHog properties are left out. Use **Refresh fields** on the source's page after you add properties in PostHog, and turn **In use** off for anything people or agents shouldn't query. See [Dimensions and metrics](/integrations/live-data-sources/set-up-and-manage#dimensions-and-metrics). ## Supported features | Feature | Available | | - | - | | Table calculations | Yes | | Custom metrics and custom dimensions | Yes | | Period-over-period comparisons | Yes | | OR filters and nested filter groups | Yes | | Filters on metrics | Yes | | Pivots and date zoom | No | ## Limits | Limit | Value | | - | - | | Default date range | Last 30 days, when the query has no filter on Event date | | Most rows per query | 49,999 | | Timeout | 10 seconds | | Queries at once | 3 per source | | Calls per minute | 240 per source | | Calls per hour | 2,400 per source | Funnels, retention and user paths aren't available from the PostHog source. Ask for events or unique users by event, date or property instead. ## Example questions * *"Daily unique users who triggered `signed_up` over the last two weeks."* * *"Top 10 pathnames by pageviews this month."* * *"Unique sessions by country and device type last week."* ## Troubleshooting **PostHog rejected the API key.** Check that the region matches your PostHog project: a key from an EU project is rejected by US Cloud, and a key from a US project is rejected by EU Cloud. Then check that the key has the **Query Read** scope and access to the project ID you entered. **A property is missing.** Click **Refresh fields** on the source's page, then check that the property's dimension is **In use**. Property names must start with a letter, `_` or `$`, and contain only letters, numbers, `_` and `$`. # Set up and manage live data sources Source: https://docs.lightdash.com/integrations/live-data-sources/set-up-and-manage Connect, query and manage a live data source Live data sources must be [enabled for your organization](/integrations/live-data-sources). These steps are the same for every integration; each integration's page has its own sign-in details, dimensions, metrics and limits. ## Connect a live data source Project admins can add live data sources. You also need access to the tool itself; each integration page lists what it needs. 1. On the nav bar, click **Browse** → **Semantic Layer**. 2. In the sidebar, select **Live data sources**, then click **Add**. 3. In the **Add a live data source** dialog, select an integration, then follow the steps on its integration page. ![The Add a live data source dialog listing the integrations you can connect, and others with a Request button](https://mintcdn.com/lightdash/bfRhm6Fu1UC-QFZJ/images/integrations/live-data-sources/add-live-data-source.png?fit=max\&auto=format\&n=bfRhm6Fu1UC-QFZJ\&q=85\&s=aef04ee3fed15f4b5d7ec7470f06af67) When the source is added, Lightdash reads its dimensions and metrics, and the source appears under **Live data sources** and as a table in Explore with a **Live** badge. ![The Semantic Layer page with Live data sources selected, listing connected sources with their data read, API calls and median latency](https://mintcdn.com/lightdash/bfRhm6Fu1UC-QFZJ/images/integrations/live-data-sources/live-data-sources-list.png?fit=max\&auto=format\&n=bfRhm6Fu1UC-QFZJ\&q=85\&s=facbee618a36127d180c2c1b886d0ce3) You can connect several sources from the same integration, such as one for each account. Give each a clear name, because people and agents use the name to choose a source. ## Dimensions and metrics Each source starts with the dimensions and metrics its integration offers, plus the ones Lightdash reads from your account, such as custom properties or events. Each integration page lists them. Select a source under **Live data sources** to see them. Only dimensions and metrics marked **In use** appear in Explore and to AI agents. ![A live data source's page with its integration, access, usage and a searchable list of dimensions with their descriptions](https://mintcdn.com/lightdash/bfRhm6Fu1UC-QFZJ/images/integrations/live-data-sources/live-source-fields.png?fit=max\&auto=format\&n=bfRhm6Fu1UC-QFZJ\&q=85\&s=6366b71c78c68da0af3061a16afc7aef) Click a dimension or metric to change its **Label**, **Description**, **AI hint** and **Group**, or turn **In use** off. Click **Save** to apply. Click **Refresh fields** to read them from the integration again after you add properties or events in the tool. You can't add dimensions or metrics of your own, or manage them as code. ![The Country dimension dialog with Label, Description, AI hint, Group and an In use toggle, and its type, source name, charts that use it and last change below](https://mintcdn.com/lightdash/bfRhm6Fu1UC-QFZJ/images/integrations/live-data-sources/live-source-field-details.png?fit=max\&auto=format\&n=bfRhm6Fu1UC-QFZJ\&q=85\&s=6c210d055e585aadadcb5493b925a254) ## Explore a live data source In Explore, open the source's table, which has a **Live** badge. Pick metrics and dimensions, and run the query. Each run is one call to the integration. ![Explore on a live data source with a Live badge, showing a bar chart and results of a metric split by a dimension](https://mintcdn.com/lightdash/bfRhm6Fu1UC-QFZJ/images/integrations/live-data-sources/live-source-explore.png?fit=max\&auto=format\&n=bfRhm6Fu1UC-QFZJ\&q=85\&s=d0056b2b3c5357783188a0085ea08706) Save the result as a chart to add it to a dashboard or a scheduled delivery. ## Ask an AI agent about a live data source Every agent in the project can query live data sources, whatever tags it's limited to. Ask in plain language; the agent picks the dimensions and metrics, adds a date filter for the period you mention and builds a chart. Name the tool in your question when the project has more than one source that could answer it. ![An AI agent thread answering a question from a live data source with a summary, a results table and a bar chart](https://mintcdn.com/lightdash/bfRhm6Fu1UC-QFZJ/images/integrations/live-data-sources/live-source-agent-answer.png?fit=max\&auto=format\&n=bfRhm6Fu1UC-QFZJ\&q=85\&s=1d1ff9c3495e914221cb2f99cc56a76c) If a question needs something a source can't do, such as a funnel, the agent says so instead of approximating it. ## Manage a live data source Open a source's menu from the **Live data sources** list or its page. **Edit** renames it, **Refresh fields** reads its dimensions and metrics again, **Sign in again** reconnects it with your account, and **Delete** removes it and its table. ![The Live data sources list with the actions menu open on a source, showing Edit, Refresh fields, Sign in again and Delete](https://mintcdn.com/lightdash/bfRhm6Fu1UC-QFZJ/images/integrations/live-data-sources/live-source-actions.png?fit=max\&auto=format\&n=bfRhm6Fu1UC-QFZJ\&q=85\&s=4a3786c952c9fed6eb3ef43c250a8325) # YouTube Analytics Source: https://docs.lightdash.com/integrations/live-data-sources/youtube-analytics Query views, watch time and subscribers for a YouTube channel live from Explore and AI agents The YouTube Analytics [live data source](/integrations/live-data-sources) reads one YouTube channel. Each query is one report request, and Lightdash shows the results as they come back from YouTube. It's a [level 3](/integrations/live-data-sources#integration-levels) integration: its API returns reports. ## Before you start * **Live data sources enabled** for your organization. See [Live data sources](/integrations/live-data-sources). * **Admin role** in the Lightdash project. * **A Google account that can read the channel's analytics.** ## Connect YouTube Analytics 1. On the nav bar, click **Browse** → **Semantic Layer**. 2. In the sidebar, select **Live data sources**, then click **Add**. 3. Select **YouTube Analytics**. 4. Enter a **Name**, such as `YouTube Analytics`. 5. Click **Continue to Google**. 6. Sign in with your Google account and allow read-only access to YouTube. 7. Back in Lightdash, pick the channel the source reads. Lightdash adds a **Channel activity** table to Explore. Queries run with the Google account that signed in. To change it, choose **Sign in again** from the source's menu. ## Dimensions | Dimension | Notes | | - | - | | Date | Per day | | Date month | First day of the month | | Video ID | Video titles aren't available | | Country | Two-letter code, such as `US`. `ZZ` means unidentified | | Device type | Such as `DESKTOP`, `MOBILE` or `TV` | | Traffic source type | Such as `YT_SEARCH`, `RELATED_VIDEO` or `SUBSCRIBER` | | Content type | `LIVE_STREAM`, `SHORTS`, `STORY`, `VIDEO_ON_DEMAND` or `UNSPECIFIED` | Revenue, demographics, playlists and audience retention aren't available. ## Metrics | Metric | Notes | | - | - | | Views, Engaged views | YouTube counts a view differently per report | | Estimated minutes watched | | | Average view duration | In seconds, per playback. Don't add rows together | | Average view percentage | From 0 to 100, per playback. Don't add rows together | | Likes, Dislikes, Comments, Shares | | | Subscribers gained, Subscribers lost | | ## Combination rules YouTube answers a fixed set of reports. A query can break down by one of these: * **Date** or **Date month** * **Country** * **Video ID** * **Device type**, optionally with **Date** * **Traffic source type**, optionally with **Date** You can add **Content type** to any of them, but it can't be used alone. A query with no dimensions returns channel totals. Some reports have further rules: * **Device type** and **Traffic source type** only work with Views, Engaged views and Estimated minutes watched. * **Video ID** returns at most 200 videos, ranked from highest to lowest. Sort by one of Views, Estimated minutes watched, Subscribers gained or Subscribers lost. * **Date month** only reads whole months. Filter Date to start on the first of a month and end on the last of a month or today. Lightdash checks these rules before calling YouTube and tells you what to change. ## Supported features | Feature | Available | | - | - | | Filters on Video ID, up to 500 values | Yes, exact match | | Filters on Country, one value | Yes, exact match | | Filters on other dimensions | No | | Filters on metrics | No | | OR filters and nested filter groups | No | | Table calculations, custom metrics and custom dimensions | No | | Period-over-period comparisons, pivots and date zoom | No | A query can't filter by a dimension and break down by it at the same time. ## Limits | Limit | Value | | - | - | | Default date range | Last 28 days, when the query has no filter on Date. Last 12 full months for **Date month** | | Most rows per query | 9,999. 200 for **Video ID** | | Timeout | 30 seconds | | Queries at once | 5 per source | | Calls per minute | 60 per source | | Calls per hour | 1,000 per source | YouTube leaves out the most recent days until all their metrics are ready, so the latest dates can be missing. YouTube also applies its own quotas. ## Example questions * *"Views and watch time by day over the last 28 days."* * *"Top 20 videos by estimated minutes watched this month."* * *"Views by traffic source type last week."* ## Troubleshooting **The latest days are missing.** YouTube publishes a day's data once all its metrics are ready. Check again later, or end the date range earlier. **YouTube has no report for your combination.** See [Combination rules](#combination-rules) and remove a dimension. # Metrics SQL API Source: https://docs.lightdash.com/integrations/metrics-sql-api Query your Lightdash semantic layer over the Postgres wire protocol from any SQL client or BI tool [Beta](/support/feature-badges#beta) [Enterprise](/support/feature-badges#enterprise) > [!NOTE] > > The Metrics SQL API is disabled by default and must be enabled for your organization by an admin. For more information on our plans, visit our [pricing page](https://www.lightdash.com/pricing). The Metrics SQL API is a Postgres wire protocol compatible interface for querying your Lightdash semantic layer. Any tool that can connect to a PostgreSQL database — `psql`, BI tools, notebooks, database drivers — can connect to Lightdash and query your metrics and dimensions with SQL. Your explores are exposed as tables, and their dimensions and metrics as columns. When you run a query, Lightdash compiles it through the semantic layer, so metric calculations, joins, and access controls are handled for you — you get the same numbers as in the Lightdash UI. ## Enable it for your organization Once the endpoint is available on your instance, an organization admin turns it on from **Project settings → Semantic Layer API** by toggling **Semantic layer Postgres connection**. The same page then shows the connection details, an inline **Generate token** button for creating a scoped service account token, and ready-to-copy client snippets. Non-admins see the tab but not the connection details. ## Connect You can find copy-paste connection details in your project settings under **Semantic Layer API**. Connect with any Postgres-compatible client using: | Field | Value | | - | - | | Host | `pg..lightdash.cloud` | | Port | `5432` | | Database | Your project UUID. The slugified project name also works, but changes if the project is renamed — the UUID is stable. You can find it in the Lightdash URL when viewing a project (`/projects//...`) | | User | Your Lightdash account email. This value is informational — authentication is via the token | | Password | A service account token (`ldsvc_...`, recommended) or a [personal access token](/personal-settings/create-personal-tokens) (`ldpat_...`) | As a connection URI: ```bash theme={null} psql "postgresql://:@pg..lightdash.cloud:5432/?sslmode=require" ``` Queries run with the permissions of the token, so you can only query explores and fields that the token's account has access to. ## How queries work * **Tables are explores.** Each explore in your project appears as a table, and `FROM` takes a single explore. Fields from tables joined in the explore are included as columns — joins are defined in the semantic layer, not in your SQL. * **Columns are field IDs.** Dimensions and metrics use their Lightdash field IDs, e.g. `orders_status`, `orders_total_order_amount`. * **Metrics are pre-aggregated.** Select a metric like any other column and Lightdash computes the aggregation for you. `GROUP BY` is optional — results are implicitly grouped by the dimensions you select. If you do write one, it's validated against your `SELECT` list. * **Results are limited to 500 rows** by default. Add a `LIMIT` to override it. Supported SQL includes `WHERE` (`=`, `!=`, `<`, `<=`, `>`, `>=`, `IN`, `LIKE`/`ILIKE`, `BETWEEN`, `IS NULL`, `AND`/`OR`), `HAVING`, `ORDER BY`, `LIMIT`, date parts of date columns (`EXTRACT`, `DATE_PART`, `DATE_TRUNC`), and calculated expressions in the `SELECT` list (arithmetic, functions, `CASE`, and window functions). ## Examples ### Discover explores and fields The catalog is exposed through `information_schema`. The `field_type` column on `information_schema.columns` tells you whether a field is a dimension or a metric: ```sql theme={null} SELECT table_name FROM information_schema.tables; SELECT column_name, data_type, field_type FROM information_schema.columns WHERE table_name = 'orders'; ``` ### Query a metric by a dimension Select the dimensions and metrics you want — no `GROUP BY` or aggregate functions needed: ```sql theme={null} SELECT orders_status, orders_total_order_amount FROM orders ORDER BY orders_total_order_amount DESC; ``` ### Filter and limit ```sql theme={null} SELECT orders_order_date_month, orders_total_order_amount, payments_unique_payment_count FROM orders WHERE orders_order_date >= '2026-01-01' AND orders_status IN ('completed', 'shipped') ORDER BY 1 LIMIT 12; ``` ### Date parts `EXTRACT`, `DATE_PART` and `DATE_TRUNC` over a date or timestamp dimension compile to that dimension's Lightdash time frame, so the warehouse groups by the date part directly. The explore's own interval column (e.g. `orders_order_date_year`) is used when it exists; otherwise the part is computed the same way Lightdash builds interval dimensions. `ORDER BY` and `GROUP BY` can repeat the same expression — this is the shape BI tools like Looker Studio generate for derived year, quarter and month fields: ```sql theme={null} SELECT orders_order_date_day, CAST(EXTRACT(YEAR FROM orders_order_date::TIMESTAMP) AS INT) AS "Year", orders_total_order_amount FROM orders ORDER BY CAST(EXTRACT(YEAR FROM orders_order_date::TIMESTAMP) AS INT) DESC; ``` Supported parts are `YEAR`, `QUARTER`, `MONTH`, `WEEK`, `DAY`, `DOY`, `HOUR` and `MINUTE` for `EXTRACT`/`DATE_PART`, and `year` through `milliseconds` for `DATE_TRUNC`. `EXTRACT(DOW)` is rejected because Postgres and Lightdash number weekdays differently — select the dimension's day-of-week interval column instead. Parts the model already exposes as interval columns work for every role. Parts the model doesn't list are computed as custom SQL dimensions, which — like calculated expressions — need the developer role's custom fields permission. ### Calculated expressions Combine metrics and dimensions with expressions in the `SELECT` list, like table calculations in the Lightdash UI: ```sql theme={null} SELECT orders_status, orders_total_order_amount, orders_total_order_amount / payments_unique_payment_count AS amount_per_payment FROM orders; ``` ### Query from Python Because the interface speaks the Postgres wire protocol, existing Postgres drivers work: ```python theme={null} import psycopg2 import pandas as pd conn = psycopg2.connect( host="pg..lightdash.cloud", port=5432, dbname="", user="", password="", sslmode="require", ) df = pd.read_sql( "SELECT orders_status, orders_total_order_amount FROM orders", conn, ) ``` If a query isn't valid, error messages include hints — an unknown column error lists the available fields, and using an aggregate function suggests the matching metric instead. ## Errors Errors are returned as standard Postgres `ErrorResponse` messages, so your client's error handling behaves normally. | SQLSTATE | Meaning | | - | - | | `28P01` | Authentication failed — the password is not a valid `ldsvc_` or `ldpat_` token, or the token belongs to a SCIM-only service account. | | `3D000` | The database name is unknown or ambiguous. Use a project UUID, or one of the slugs listed in the error message. | | `0A000` | The client tried to use an unsupported feature — for example, the extended query protocol, `pg_catalog`, or an operator that isn't allowed on `information_schema`. | ## Self-hosting If you self-host Lightdash, the Metrics SQL API server is disabled until you set the `PGWIRE_PORT` [environment variable](/self-host/customize-deployment/environment-variables#metrics-sql-api). TLS is required by default, so you also need to provide a certificate and key (PEM format) for the hostname clients connect to: ```bash theme={null} PGWIRE_PORT=5432 PGWIRE_HOST=pg.analytics.example.com # optional: hostname shown to admins in project settings PGWIRE_SSL_CERT_PATH=/path/to/tls.crt # server certificate (leaf first, then chain) PGWIRE_SSL_KEY_PATH=/path/to/tls.key # private key ``` If `PGWIRE_PORT` is set without certificate paths and without `PGWIRE_SSL_MODE=disabled`, Lightdash fails fast at boot with a config error — this is intentional, so a misconfigured deployment can't accidentally accept Lightdash tokens in plaintext. `PGWIRE_HOST` is optional. If unset, the project settings page shows an empty host and admins will need to fill it in themselves. * If your certificate is from a public CA (e.g. Let's Encrypt), clients can use `sslmode=require` or `verify-full`. * If you use a private CA or a self-signed certificate, clients either pass the CA with `sslrootcert=/path/to/ca.pem` for verification, or use `sslmode=require` (encrypted, but the server identity isn't verified). The certificate and key files are watched by modification time and reloaded on change, so `cert-manager` renewals apply without a restart. A failed reload keeps the previously loaded certificate in place and logs an error. The server starts a separate TCP listener on that port, so you'll also need to expose it through your load balancer or network configuration alongside the main Lightdash port. It requires a valid `LIGHTDASH_LICENSE_KEY` — see [enterprise features](/self-host/enterprise-features). > [!WARNING] > > The Postgres wire protocol handshake is StartTLS-style — the client sends a plaintext `SSLRequest` before upgrading — so **a generic TLS-terminating load balancer (e.g. an L7 HTTPS proxy) cannot front this endpoint.** Terminate TLS at Lightdash by giving the backend the cert and key. If you must front it, use a Postgres-aware proxy (e.g. PgBouncer, HAProxy in `mode tcp`) and set `PGWIRE_SSL_MODE=disabled` on the Lightdash side so it accepts plaintext from the proxy on a trusted network. ### Rejecting plaintext clients With TLS required (the default), a client that connects with `sslmode=disable` is rejected before authentication — no password is ever prompted for, so Lightdash tokens cannot be leaked over cleartext: ```text theme={null} psql: error: connection to server ... failed: ERROR: connection requires TLS SQLSTATE: 28000 ``` Update client connection strings to `sslmode=require` (or stronger) to fix this. ## Limitations * **No explicit joins, subqueries, or CTEs.** Queries select from a single explore; joins are defined in the semantic layer. * **No DML.** The API is read-only — `SELECT` queries only. * **No custom metrics or period-over-period comparisons.** * **Text and common binary types only.** Both the simple and the extended query protocol (prepared statements, bind parameters) are supported. Bound parameters and result columns can use text format for any type, and binary format for booleans, integers, floats, dates, timestamps and text — which covers what JDBC and psycopg drivers request by default. Other types in binary format return `0A000`. * **No `pg_catalog` emulation.** Schema browsers in GUI clients (e.g. DBeaver) won't populate their sidebar — query `information_schema.tables` and `information_schema.columns` instead. > [accordion] Using sslmode=verify-full > > `sslmode=require` encrypts the connection; `verify-full` additionally verifies the server's certificate and hostname, protecting against impersonation. On Lightdash Cloud the certificate is publicly trusted (Let's Encrypt), but some Postgres clients don't check the system trust store by default: > > * **psql / psycopg (libpq 16+)**: add `sslrootcert=system` to use the OS trust store. On older libpq, point `sslrootcert` at your system CA bundle (e.g. `/etc/ssl/certs/ca-certificates.crt`). > * **JDBC (DBeaver, DataGrip)**: add `sslfactory=org.postgresql.ssl.DefaultJavaSSLFactory` to use Java's built-in trust store. > * **node-postgres, Go, Rust, .NET**: use the runtime's trust store natively — no extra configuration. > > Validate via the CA chain as above — don't pin the certificate itself, as it's rotated automatically every \~60 days. > [!TIP] > > If you're working in Python, the [Lightdash Python SDK](/sdk/python-sdk) offers a typed, dataframe-native way to query the semantic layer without writing SQL. # Slack integration Source: https://docs.lightdash.com/integrations/slack Unfurl chart links, deliver scheduled reports and alerts, and chat with your AI agents in Slack The Lightdash Slack app connects your project to Slack so your team can preview content, receive scheduled deliveries and alerts, and talk to AI agents without leaving their workspace. ## Install the Slack integration > [!NOTE] > > Only your Lightdash organization admins can add or configure the Slack integration. Go to **Organization settings**, then **Integrations**, and click **Add to Slack**. This opens a confirmation page granting the Lightdash Slack app access to your Lightdash and Slack organizations. If you're not a Slack admin, you might need to request approval to add the app. Once it's approved, you're all set. Self-hosting Lightdash? Creating and configuring the underlying Slack app is a platform setup step — see [Configure a Slack app for Lightdash](/self-host/customize-deployment/configure-a-slack-app-for-lightdash). This two-minute video shows the full install and configuration flow: [https://www.loom.com/embed/9df1e9e24ead48cd8e46a73558d31764?sid=1daa03c8-c783-4f46-ad6e-8dabbd7d5223](https://www.loom.com/embed/9df1e9e24ead48cd8e46a73558d31764?sid=1daa03c8-c783-4f46-ad6e-8dabbd7d5223) ## Required permissions The Lightdash Slack app requests these scopes: * **`links:read` for lightdash.cloud** — lets Lightdash fetch information from the charts and dashboards you link so it can render previews in Slack. * **`links:write`** — lets Lightdash unfurl those links. No other content is shared from your workspace. ## Settings After installing the app, you'll see these settings: ![The Slack integration settings, with the notification channel, bot avatar, thread access consent, OAuth requirement, and multi-agent channel fields](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/integrations/slack/slack-settings.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=f9086e8b3435dd05240eae94f6d602b5) ### Select a notification channel Choose a Slack channel where Lightdash sends alerts when any scheduled delivery in your organization fails. Add the Lightdash app to that channel for notifications to work. ### Slack bot avatar Customize the app's avatar by adding an image URL in the **Profile photo URL** field. Slack recommends a square image at least 512x512 pixels and no larger than 1024x1024 pixels. ### AI agents configuration > [!NOTE] > > The AI agent settings, including the **Multi-agent channel** field, appear only when your organization has the AI agents entitlement or an AI trial. Control how AI agents interact with your Slack workspace — whether they can read thread messages when mentioned, and whether OAuth authentication is required to use them. For channel limitations and multi-agent support, see [Slack channels: single-agent vs. multi-agent](/agents/set-up-slack-agents#slack-channels-single-agent-vs-multi-agent). **AI Agents in Slack** is on by default. Turn it off to stop people talking to AI agents from Slack: agents no longer respond to mentions, while scheduled deliveries, alerts, and link previews keep working. The other AI agent settings below can't be changed while it's off. #### User attribution and OAuth By default, every AI agent conversation in Slack is attributed to the user who installed the Slack app (or created the agent): all questions appear as if they came from that single user, and every query runs with that user's permissions. Enable the **AI Agents OAuth requirement** toggle to identify each Slack user individually. When enabled: * Each Slack user authenticates with Lightdash before using the AI agent. * Conversations are attributed to the individual asking the question. * Queries respect each user's own [user attributes and permissions](/agents/data-access#user-attributes-and-permissions). Enable OAuth if your organization uses row- or column-level security through user attributes, or if you need an audit trail of which users ask which questions. #### Links only, no data in Slack Turn on **Links only, no data in Slack** to keep query results out of Slack. Agents still answer in Slack, but people open the results in Lightdash. With it off, an agent can post a result table inline in its answer when the agent has [data access](/agents/data-access#data-access-modes) enabled. Agents answer with a summary by default and add a table only when it's requested or the rows help the answer, so ask for a table if you want one. The **AI Agents OAuth requirement** doesn't affect whether tables appear. Answers that the agent gets by running raw SQL in [SQL mode](/agents/use-ai-agents#sql-mode) show a card that links to the results, never an inline table. #### Automatic channel linking When someone `@mentions` the Lightdash app in a channel that has no agent configured, Lightdash offers to link an agent to that channel from Slack — either auto-linking the user's one manageable agent, or posting an in-thread picker if the user manages several. See [Linking an agent from Slack](/agents/set-up-slack-agents#linking-an-agent-from-slack) for the full flow. The **Enable automatic channel linking** toggle controls this: * **On (default)** — Slack mentions in unconfigured channels can add the channel to an agent's list, so first-time setup is seamless. * **Off** — Slack mentions in unconfigured channels post an ephemeral message pointing to the AI agents page, and never modify an agent's channel list. Channels can only be managed from the agent settings UI. Turn this off if you need the configured channel list to be a strict allowlist — for example, to prevent a sensitive agent from being extended into new channels by an admin's Slack activity. Turning it off does not affect channels that are already linked. ## Using the Slack integration Once installed, the Slack integration surfaces Lightdash content and delivers it where your team already works. This video walks through the main ways to use it: [https://www.loom.com/embed/5ba2d4b3ad8445b18e1ad233a4c0f930?sid=488d516a-adcc-4915-9ad7-0c186b10eecc](https://www.loom.com/embed/5ba2d4b3ad8445b18e1ad233a4c0f930?sid=488d516a-adcc-4915-9ad7-0c186b10eecc) ### Unfurl Lightdash links The app automatically unfurls links you share from your Lightdash project. Invite the app to a channel first, and it will unfurl links there — both links copied from the URL bar and "share" links copied with the link icon. Chart and dashboard links are supported. > [!WARNING] > > Link previews are generated with the credentials of the user who installed the Slack app, so previews reflect that user's data access — not the permissions of whoever shares the link. If the installer's warehouse session expires, previews fail until they re-authenticate. Here's an unfurled chart: ![A shared chart link unfurled in Slack, showing the chart title, description, a bar chart image, and an Open in Lightdash button](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/integrations/slack/slack-chart-unfurl-45875cd3a4a3afc83b636571085be4c0.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=d88d4e450ef9ce399c73ce8d30257eaa) And an unfurled dashboard: ![A shared dashboard link unfurled in Slack, showing the dashboard title, description, and a preview image of its tiles](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/integrations/slack/slack-dashboard-unfurl-424589974afbb6574dff67199a9cdcda.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=7b724dcf65b569ae74249663e69fa8fc) ### Scheduled deliveries Use Slack as a destination for [scheduled deliveries](/explore/create-scheduled-deliveries). Schedule refreshes for charts or dashboards and push the results into a Slack channel or DM. Add the Lightdash app to each channel before you send deliveries there, public or private, with `/invite @Lightdash` as described in [Use Lightdash in private channels](#use-lightdash-in-private-channels). The app doesn't request permission to join channels itself, so if it isn't in a channel, saving the delivery fails with `Unable to join channel(s): missing channels:join scope. Add the app to the channel(s) manually.` Charts look like this when you attach an image: ![A scheduled delivery in Slack with the chart name, description, and an image of the scatter plot, noting files expire after 3 days](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/integrations/slack/slack-scheduled-chart-d2604af845afc166f4c13b2265a83b71.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=589c66a40469ac2580bb8219ff3b577c) And dashboards look like this when you choose *not* to include an image: ![A scheduled dashboard delivery in Slack listing each chart with its own Download results button instead of an image](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/integrations/slack/slack-scheduled-dashboard-a2e37864f7d080ea04d3cc28e367040e.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=ee2152a2ab229c4c886a874d6ab23398) ### Saved chart alerts in Slack Beyond scheduled deliveries, you can set up [alerts on saved charts](/explore/create-alerts) that only send to Slack when your criteria are met. Alerts need the same channel membership as scheduled deliveries: add the Lightdash app to the channel first, as described [above](#scheduled-deliveries). ![A Slack alert naming the chart, the threshold that was crossed, and an image of the chart results](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/integrations/slack/slack-alert-f80ad5e8c309f46972bb8e8a12238efc.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=d3f177b0222df01bf3a28a0430721c67) ### Use Lightdash in private channels Slack doesn't expose private channels to apps by default, so add the Lightdash app to a private channel manually. Either: * **Invite the app** — type `/invite @Lightdash` in the channel. ![The Slack message box with /invite @lightdash typed, and the Lightdash app shown as Not in channel above it](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/integrations/slack/slack-invite-command.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=9d4e7c705d4e4b88bdaaa85a5e80b63b) * **Use channel settings** — click the channel name, go to **Integrations → Add an app**, then search for and add Lightdash. ![A private Slack channel's Integrations tab, with the Add an App button under the Apps section](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/integrations/slack/slack-add-app-settings.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=d2bafab09f10a14b935e08050361c178) Once the app is added, find the channel in Lightdash by either: * **Refreshing the channel list** in the Lightdash UI, or * **Looking up the channel by ID** — in Slack, right-click the channel name, select **View channel details**, and copy the Channel ID from the bottom of the modal. ![A Slack channel details modal, with the Channel ID at the bottom and its copy button highlighted](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/integrations/slack/slack-channel-id.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=1efdbcac658d1c058bf6a6d1e636863c) Paste the channel ID into the Channels input field and select **Look up channel ID** to find your private channel. ![The Lightdash Channels field with a channel ID pasted in and a Look up channel ID suggestion below it](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/integrations/slack/slack-lookup-id.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=85381cc87b587b0dd4e51e4abdd0b386) ### AI analyst agents AI analyst agents use the Slack integration to chat with your data and build charts in Slack. Once you have access to AI analysts, give them access to Slack threads in your integration settings. Trigger a response by mentioning the Lightdash app in your message. There's a single Lightdash app to mention — you don't specify a particular agent. Lightdash routes your question to the most appropriate agent, and prompts you to choose if it's unclear. > [!NOTE] > > When you mention the agent, it only reads the text of that Slack message, plus the thread's history when [**AI Agents thread access consent**](#ai-agents-configuration) is on. It doesn't see images, screenshots, or files attached to the message, and it doesn't fetch the content of links to other Slack threads. To give the agent a document, CSV, or table, [attach it in the Lightdash composer](/agents/use-ai-agents#attach-a-file) instead, or paste the figures as text in your Slack message. What appears under a reply depends on what the agent did in that turn, not on a setting. When it ran a query, built a chart or dashboard, or edited your dbt project, the reply ends with **Good** and **Bad** feedback buttons and an **Open agent thread** link. Replies that only answer in text have neither. A dashboard card with a **View dashboard** button, and a **View Dashboard in Lightdash** link, appear only on a turn where the agent builds a [dashboard preview](/agents/enable-content-tools). > [!WARNING] > > By default, all Slack AI agent conversations are attributed to the user who installed the Slack app. To attribute conversations to individual Slack users and respect their data permissions, enable the **AI Agents OAuth requirement** in your [Slack integration settings](#ai-agents-configuration). ## Remove the Slack integration To disconnect Slack from Lightdash, go to **Organization settings**, then **Integrations**, and click the delete icon in the Slack settings. This removes Lightdash's stored Slack installation and unlinks your AI agents from their Slack channels. Deleting a Lightdash organization also deletes its Slack installation. An installation can't move to another organization or Lightdash instance: an organization admin there installs it again with **Add to Slack**, and your Slack admin may need to approve the app again. Deleting the integration in Lightdash doesn't uninstall the Lightdash app from your Slack workspace. To remove the app, a Slack workspace owner or admin removes it from the workspace's app management settings in Slack. # Snowflake Cortex Source: https://docs.lightdash.com/integrations/snowflake-cortex Operate your BI layer agentically by pairing Lightdash with Snowflake's Cortex Code agent [Cortex Code](https://www.snowflake.com/) is Snowflake's coding agent, with Snowflake-native tools and RBAC governance built in. Pair it with Lightdash and you can operate your BI layer agentically. For broader guidance on using AI coding agents with Lightdash, see [Editing dashboards with agents](/workflow/edit-dashboards-with-agents). ## Integration options There are three ways to integrate Cortex with Lightdash: | Method | Best for | Auth required | Where it works | | - | - | - | - | | [Skills](#skills) | Operating Lightdash as an expert: building your semantic layer, developing charts and dashboards, shipping [dashboards as code](/workflow/content-as-code), and vibe coding dashboards | None | Locally (via the Lightdash CLI) | | [Lightdash MCP](#lightdash-mcp) | Searching your semantic layer and executing queries | Lightdash login | Locally and in Snowsight Cortex | | [Docs MCP](#docs-mcp) | Looking up anything in the Lightdash docs | None (public) | Anywhere | You can use any combination of these together. ## Skills Skills are the best way to get Cortex operating Lightdash as an expert. They teach the agent how to: * Build your [semantic layer](/workflow/content-as-code) * Develop charts and dashboards * Ship [dashboards as code](/workflow/content-as-code) * Vibe code dashboards Skills are powered by the [Lightdash CLI](/workflow/cli/install). Install skills for Cortex in your project: ```bash theme={null} lightdash install-skills --agent cortex ``` Or install them globally so they're available across all your projects: ```bash theme={null} lightdash install-skills --agent cortex --global ``` For more details, see the [Agent skills guide](/workflow/install-agent-skills). ## Lightdash MCP The [Lightdash MCP](/agents/lightdash-mcp) searches your semantic layer and executes queries, and it works in Snowsight Cortex as well as locally. Add it to Cortex with your instance's MCP URL, replacing `` with your Lightdash instance name (commonly `app` or `eu1`, see [Find your instance name](/agents/lightdash-mcp#find-your-instance-name)): ```bash theme={null} cortex mcp add lightdash https://.lightdash.cloud/api/v1/mcp ``` ## Docs MCP The [Docs MCP](/agents/lightdash-docs-mcp) is public and needs no login — it lets Cortex look up anything in the Lightdash documentation: ```bash theme={null} cortex mcp add lightdash-docs https://docs.lightdash.com/mcp ``` # Welcome to Lightdash Source: https://docs.lightdash.com/introduction Enterprise-ready agentic analytics that turns questions into insights, dashboards, and data apps At its core, Lightdash builds a shared understanding of your data and your business — a single source of truth for what everything means. The more your team uses Lightdash, the richer and smarter that foundation becomes. Lightdash then allows your team to use conversational analytics, build dashboards, and custom data apps all with an AI-powered experience that means they don't need to write any SQL. Everything is built from a single source of truth, so you have lineage for every data asset and can trace any query to its official definition. Everything you create in Lightdash can be shared instantly with your team with control over roles, permissions, and row-level security to make sure people see all the data they need and nothing more. Copy Prompt **Talk to the docs with your agent** over MCP, no authentication required. Get [step-by-step instructions here](/agents/lightdash-docs-mcp). [YouTube video player](https://www.youtube.com/embed/LPsHglF_b-E) [Join our Slack Community](https://join.slack.com/t/lightdash-community/shared_invite/zt-3pbwqmq5e-vhTc7HHcS787w618ngoPHA) to share ideas with other Lightdash users and [the team](https://www.lightdash.com/about). To stay on top of new features, events, and analytics engineering deep dives, follow the [Lightdash blog](https://www.lightdash.com/blog). # Personal settings Source: https://docs.lightdash.com/personal-settings Manage your own tokens, warehouse connections, and display preferences in Lightdash These are settings scoped to you rather than your project or organization: personal access tokens for authenticating with the CLI and API, and personal warehouse connections for when you want to query with your own credentials instead of the project's shared connection. You can also set your timezone display preference here, which controls how dates and times are shown to you across Lightdash. # Personal access tokens Source: https://docs.lightdash.com/personal-settings/create-personal-tokens Create a personal access token to authenticate with the Lightdash CLI and API You can create a personal access token (PAT) to authenticate in the [CLI](/workflow/cli/authenticate) or with the API. ## Creating a personal access token To create a personal access token, head to the project settings, then to `personal access tokens`, then click `generate token`. ![The personal access tokens settings page with an empty token list and a generate token button](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/personal-settings/create-personal-tokens/create-pat-6ec282a4422b1a7c55c6b60c95937cf8.jpg?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=1abe9c6c5e471ce3fe79ec5de2bbc99e) ## Token ownership A personal access token uses its creator's permissions and stops working if that user is removed from the organization. You can only create tokens for yourself: the API creates them for the signed-in user (`POST /api/v1/user/me/personal-access-tokens`), and no endpoint creates a token for another user. For CI/CD, use a dedicated identity; see [Set up secrets and credentials](/workflow/set-up-ci-cd#set-up-secrets-and-credentials). ## Token policies Self-hosted admins can disable personal access tokens, limit which organization roles can use them, and cap their lifetime with the [personal access token environment variables](/self-host/customize-deployment/environment-variables#personal-access-tokens). For token lifetime on Cloud, the lack of an organization-wide token list, and tracing token queries in your warehouse, see [Access governance](/workspace-admin/instance-health#access-governance). # Personal warehouse connections Source: https://docs.lightdash.com/personal-settings/personal-warehouse-connections When and how your personal warehouse credentials are used in Lightdash projects Personal warehouse credentials allow you to connect to your data warehouse using your own individual credentials instead of shared project credentials. This provides better security and audit trails for data access. ## When are personal warehouse credentials used? Your personal warehouse credentials are used for every query you run in a project, including charts, dashboards, Explore, the SQL runner, and AI agents (Ask AI), when: * The project is configured to require user credentials for data access, or * The project uses a shared connection that accepts personal credentials. Databricks and Trino projects always do. BigQuery projects do when **Use personal credentials when available** is turned on under **Advanced configuration options** in the project's BigQuery connection settings. Service accounts have no personal warehouse credentials, so a project that requires user credentials refuses their queries. See [service accounts](/workspace-admin/service-accounts#warehouse-credentials) for how to set up warehouse access a service account can use. On a shared connection that accepts personal credentials, adding them is optional. Lightdash doesn't ask you to add any, and people who haven't added them keep using the shared project connection. If your personal credentials can't read a table that the shared connection can, you get the warehouse's permission error for that table even though others don't. Remove your credentials under **Settings → My warehouse connections** to go back to the shared connection. When you have credentials for the project's warehouse type, the **Warehouse credentials** button in the navigation bar lets you pick which ones to use. On a shared connection that accepts personal credentials, the button only appears once you've added them, so if it's missing, your queries use the shared connection. Every other project uses the shared project connection. On a project with [multiple warehouse connections](/workspace-admin/multiple-warehouse-connections#personal-warehouse-credentials), you choose credentials for each connection in the credentials switcher in the navigation bar. When a project is created with [organization credentials](/workspace-admin/organization-credentials) but also requires user credentials, your personal credentials override the organization credential for your own queries. > [!NOTE] > > If your personal sign-in has expired or fails, Ask AI doesn't show the reconnect prompt that charts, dashboards and Explore show. It replies with text only, for example that the warehouse connection has expired, and that wording can tell you to ask your data team instead of pointing you at your own settings. Reconnect under **Settings → My warehouse connections**, then ask your question again. ## Setting up personal warehouse credentials To configure your personal warehouse credentials: 1. Navigate to your user settings by clicking on your profile in the top right corner 2. Go to **My warehouse connections** and click **Add credentials** 3. Set **Warehouse** to your project's warehouse type. It starts on PostgreSQL, so for BigQuery change it to BigQuery to get **Sign in with Google** 4. Enter your individual warehouse connection details 5. Save your credentials ![Personal warehouse credentials settings page](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/personal-settings/personal-warehouse-connections/personal_warehouse_credentials.gif?s=50fe3f8f55f87fb91aa92a866f194d01) ## Supported authentication methods Depending on your warehouse type, you can authenticate using different methods: ### Snowflake * **Sign in with Snowflake (OAuth)**: Use your Snowflake account to authenticate via OAuth. This requires your organization to have configured a Snowflake security integration. See [Snowflake connection setup](/integrations/connect-project#sign-in-with-snowflake) for details. * **Private Key**: Authenticate using a private key file. * **Password**: Use your Snowflake username and password. ### Databricks * **Sign in with Databricks (OAuth)**: Use your Databricks account to authenticate via OAuth. This requires your organization to have configured a Databricks OAuth application. See [Databricks connection setup](/integrations/connect-project#sign-in-with-databricks) for details. * **Personal Access Token**: Use a Databricks personal access token. ### BigQuery * **Sign in with Google (OAuth)**: Use your Google account to authenticate via OAuth. * **Service Account**: Use a service account JSON key file. ### Redshift * **Sign in with AWS**: Use your AWS IAM Identity Center account to authenticate in the browser. The project fixes the AWS account and permission set role, so you get credentials for that role whenever you sign in — you can't pick a different one. If you need different Redshift access than that role gives, use **AWS IAM (CLI credentials)** or **Password** below instead. This requires the project connection to be configured with AWS IAM Identity Center settings. See [Redshift connection setup](/integrations/connect-project#redshift) for details. * **AWS IAM (CLI credentials)**: Paste temporary AWS credentials from your CLI or SSO profile when the project requires personal warehouse credentials. * **Password**: Use your Redshift username and password. ### Athena * **Access keys**: Use your own AWS access key ID and secret access key. This is the only sign-in method for personal Athena credentials. ### Other warehouses For other warehouse types (Postgres, Trino, ClickHouse), authentication is typically done using username and password credentials. ## With agent identity on When the [agent identity](/agents/agent-identity) feature flag is on, a personal warehouse credential can set sign-in fields only. The host, port, database, compute, TLS, SSH tunnel and policy settings always come from the project connection. Lightdash refuses to save a personal credential that sets any other field, and the error names the fields. | Warehouse | Sign-in fields a personal credential can set | | - | - | | Snowflake | User, password, private key, private key passphrase, refresh token, authentication type | | BigQuery | Sign in with Google only: the Google sign-in keyfile (type, client ID, client secret and refresh token) and the authentication type | | Databricks | Personal access token or refresh token, authentication type, OAuth client ID. The workspace host is checked against the connection, never used. | | Redshift | User, password, authentication type, AWS access key ID and secret access key, session token, and a role ARN and external ID with your own AWS keys | | Postgres, Trino, ClickHouse | User, password | | Athena | AWS access key ID and secret access key | | DuckDB | MotherDuck token | Lightdash refuses to save a BigQuery service account key file, and a Redshift IAM credential with a role but no AWS access key of your own. Some saved credentials stop working when the flag turns on. Queries with them fail with: "Your saved warehouse credentials can no longer be used with this connection. Reconnect your credentials and try again." Lightdash never falls back to the shared project credentials. Reconnect your credentials under **Settings → My warehouse connections**. This affects: * A Databricks sign-in saved without a workspace host, or for a different workspace host than the connection. * A Databricks credential that uses a service principal (machine-to-machine) sign-in. * A Redshift IAM credential that has a role but no AWS access key of your own. * An Athena credential that has a session token. * A credential for a different warehouse type than the project connection. * A MotherDuck token used with a DuckDB connection that is not MotherDuck. Other saved credentials keep working. Lightdash ignores any extra fields on them, such as a host, database, warehouse or role, and uses the connection's values instead. # Timezones Source: https://docs.lightdash.com/personal-settings/timezone How timezones resolve across charts, dashboards, filters, and scheduled deliveries Timezone setup — warehouse column types, the connection's data timezone, and the project timezone — lives in [Set up timezones](/workspace-admin/set-project-timezone). This page covers what happens once that's configured: how a chart resolves its timezone, and how filters, dashboards, and scheduled deliveries behave day to day. ## The chart timezone badge Every chart in Explore and on dashboards shows a small badge with its resolved timezone, for example `(UTC +01:00) Europe/London`. It's the zone the chart's filters, buckets, and values use, resolved by the rules in [Report timezone resolution](#report-timezone-resolution). ![Resolved timezone badge in the Explore view](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/personal-settings/timezone/resolved-timezone-badge-light.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=d8c2a52c5d2bc332191098c5f80d3120) If it's not the zone you expect, change it with the [timezone picker](#choosing-a-chart-timezone). ## Report timezone resolution A chart's own timezone setting decides what zone it uses, unless an embed overrides it. The zone it ends up using is its **resolved timezone**, the term used throughout this guide. From highest priority: 1. **A direct embed's** `timezone `**URL parameter** (on iframe embeds only, see [Embedded dashboards](#embedded-dashboards)). This outranks everything. 2. Otherwise, the chart's timezone setting applies: * **Project timezone** (the default): the [project's timezone](/workspace-admin/set-project-timezone#configure-your-project-timezone), for every viewer. * **User timezone**: the viewer's profile timezone, or the project timezone if they haven't set one. * **A specific timezone**: that exact zone, the same for everyone. See [Choosing a chart timezone](#choosing-a-chart-timezone) for how to set this. ## Choosing a chart timezone Open the **Run query** settings (the dropdown next to the **Run query** button in Explore) and use the **Timezone** picker to choose how the chart resolves its zone. There are three options: ![The Run query settings dropdown in Explore, showing the Timezone picker alongside Auto-fetch results and Row limit](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/personal-settings/timezone/chart-timezone-picker-light.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=69472dce099f1b5cb520b68a56baea4b) | Option | What viewers see | When to use | | - | - | - | | **Project timezone**\*(default)\* | Everyone sees the project's timezone. If the project timezone changes later, the chart follows. | Shared reports and dashboards where the numbers should mean the same thing for everyone. | | **User timezone** | Each viewer sees their own profile timezone, or the project timezone if they haven't set one. | Personal exploration, or internal dashboards where each viewer should see their own day boundaries. | | **A specific timezone** | A fixed zone (e.g. `America/New_York`), the same for everyone, frozen regardless of project or viewer. | A chart that must always report in one zone, such as a regional report. | **Project timezone** is the default, and it is not frozen at save time: it always resolves to the current project timezone, so a later change to the project setting flows through to the chart. ## How filters work ### Relative date filters Relative filters like "yesterday," "last 7 days," and "this month" are computed in the chart's **resolved timezone**. On a chart resolved to America/New\_York, "yesterday" is the day that just ended in New York. ### Absolute date filters Absolute date filters (a specific date or range) are unambiguous. `2024-03-15` is `2024-03-15`, and behaves the same for every viewer. Filters that include a time of day (for example "events after 9am on March 15") are more subtle. By default the datetime picker works in each viewer's browser timezone, so the same typed value can resolve to a different moment for different viewers. To keep these filters consistent, a project admin can turn on **Project time zone in filter inputs** in Project settings → Timezone. The toggle is disabled until the project has an explicit timezone, so leaving the Default time zone field blank keeps it off. To enable the toggle and keep UTC, select **UTC** from the list. ![The Project time zone settings page with the Project time zone in filter inputs toggle](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/personal-settings/timezone/project-timezone-filter-inputs-setting-light.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=48b4321e096f9c9a15458231fbabff92) When it's on: * The picker shows and interprets values in the project timezone, so the same typed value means the same moment for everyone. * A line under the picker shows the equivalent local time, and a label shows the active timezone. * Existing saved filters aren't rewritten. They keep the same moment, just shown in the new zone. If a chart overrides its timezone with the [timezone picker](#choosing-a-chart-timezone), the filter inputs follow that override instead of the project timezone. ![Absolute date filter picker showing values in the project query timezone](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/personal-settings/timezone/date-filter-input-project-timezone-light.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=92c066758032c5d35a2277ee3265d95a) ### Cell-click filters Clicking a bar or cell filters on the value as shown, not the underlying instant. Click "March 2024" and you get March 2024 in the chart's timezone, exactly what you saw. ## Day-grouped vs hour-grouped charts Day and hour groupings respond to timezone differently, which changes how charts look across viewers. ### Day-or-coarser grouping A chart grouped by **day, week, month, quarter, or year** buckets data by calendar boundaries, so when the resolved timezone changes (for example on a User-timezone chart) those boundaries move and the same events can land in different bars. Two viewers can then see different numbers on the same daily chart. This is correct, since each sees their own calendar, but it can be surprising. See [Choosing a chart timezone](#choosing-a-chart-timezone) to control it. ### Sub-day grouping A chart grouped by **hour, minute, or smaller** buckets data by instants. The boundaries are the same for every viewer; only the labels shift (your "9am EDT" is someone else's "2pm BST," but the bar contains the same events). Sub-day grouping is consistent across viewers. The exception is half-hour and 45-minute offset zones (India, Nepal, parts of Australia), where bucket boundaries don't align with whole-hour zones. ## MIN/MAX date and timestamp metrics A `min` or `max` metric renders by the type of the column it aggregates, following the same calendar-vs-instant rule as dimensions: * **`DATE` column** (or a day-or-coarser date interval like `_month`): a plain calendar date at that grain, never shifted. * **`TIMESTAMP` column**: shifted into the resolved timezone, like a timestamp dimension. > [!NOTE] > > Custom MIN/MAX metrics built in the Explore view pick this up automatically. Metrics defined in dbt or Lightdash YAML need a project recompile (Refresh dbt or `lightdash deploy`) before the new formatting applies. ## Daylight-saving transitions Lightdash buckets data by local time in the resolved timezone, so daylight-saving transitions show up in your charts. * On a **daily** chart, the fall-back day spans 25 hours and the spring-forward day spans 23. Each bar still counts exactly the events in that calendar day, and drilling in returns them all. * On an **hourly** chart, the two 1 AM hours on the fall-back day merge into a single bar with double the count, and the missing 2 AM hour on the spring-forward day simply has no bar. The hourly charts below count one event per hour in America/New\_York. On the fall-back day (3 November), every hour has one event except 1 AM, which holds two: summer-time 1 AM and winter-time 1 AM land in the same bar. ![Hourly bar chart for 3 November in America/New\_York: every hour has one event except the 1 AM bar, which is doubled because the clocks fell back](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/personal-settings/timezone/dst-fall-back-light.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=05fe979a73f3e57ce4baac8320e6bdc7) On the spring-forward day (10 March), the clocks jump from 2 AM to 3 AM, so the 2 AM bar is missing entirely. ![Hourly bar chart for 10 March in America/New\_York: every hour has one event except 2 AM, which has no bar because that hour was skipped when the clocks sprang forward](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/personal-settings/timezone/dst-spring-forward-light.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=acb24011af09b498c6555dcf35db6d82) ## Your profile timezone In your Profile settings, you can set a **Default timezone**. It affects only charts set to **User timezone**, which resolve to your profile zone when you view them. It does **not** affect: * Charts set to **Project timezone** or to a specific timezone. * Embedded dashboards (an embed has no viewer profile to read). If you don't set a profile timezone, charts in User timezone mode fall back to the project timezone. Scheduled deliveries are the exception to "no viewer": a delivery runs its queries as the person who created it, so a User-timezone chart in a delivery uses the creator's profile timezone, not each recipient's. ## Dashboards Every chart on a dashboard keeps its own timezone setting, so one dashboard can mix Project-timezone charts (same for everyone) with User-timezone charts (per viewer). Each chart's badge shows the zone it resolved to. A dashboard date filter sends the same value to every chart, but each chart reads it in its own zone. So a "last 7 days" filter can cover a different window on a Project-timezone chart than on the User-timezone chart next to it. ## Scheduled deliveries Scheduled reports have two independent timezone settings: | Setting | Controls | Example | | - | - | - | | **Delivery time** | When the report fires | "Send at 9am every Monday" uses the delivery timezone | | **Chart data** | What "yesterday" / "last week" mean in the report | "Last 7 days" uses each chart's resolved timezone | The two don't have to match. A delivery scheduled for "9am New York" can contain a chart in UTC: the report fires at 9am New York and shows UTC-bucketed data. For most schedules, the cleanest setup is: * **Delivery time** in the recipient's working timezone (so the report arrives at a useful hour). * **Chart data** on the project timezone (so the numbers are consistent and explicable). ## Embedded dashboards An embedded dashboard has no signed-in viewer, so there's no profile timezone to read. Its zone resolves one of two ways: * **A `timezone` URL parameter** sets one zone for the whole session and overrides every chart. Available on iframe embeds only, not the React SDK. See [embedding URL parameters](/embed/iframe#timezone). * **Otherwise**, each chart uses its own setting: the project timezone, or a specific zone if one was pinned. A User-timezone chart falls back to the project, since there's no profile to read. ## When things go wrong Common symptoms and their usual causes. When something looks off, the chart's badge and the connection's data-timezone preview show exactly what Lightdash is using. > [accordion] Two viewers see different numbers on the same chart > > This usually means the chart is on **User timezone**, so each viewer gets their own day boundaries. Check the chart's badge and switch it to **Project timezone** if everyone should match. > [accordion] A daily chart shows a partial 'today' bar the author didn't see > > The chart could be on **User timezone**, with a viewer further west still inside a day the author has finished. Switch it to **Project timezone** to make it consistent. > [accordion] All timestamps are off by an hour or more > > The [**data timezone**](/workspace-admin/set-project-timezone#configure-your-connection) on the connection is probably incorrect. Open Project settings → Connection → Data timezone and use **Preview** to confirm how values are read. > [accordion] A CSV export shows different times than the Lightdash UI > > The export may have run with a different chart timezone. Re-export from a chart set to the zone you want. > [accordion] A 'yesterday' filter returns no data, but yesterday clearly has data > > Your project timezone might be set to a zone where "yesterday" hasn't started yet. Check it under Project settings → Timezone. > [accordion] An hourly chart looks like it skipped or doubled an hour > > This is likely a daylight-saving transition in the period shown. Switch the chart to UTC to confirm it's a DST artifact, not a data problem. *** ## Example: one row, four configurations Imagine one row in your `orders` table: | Column | Type | Stored value | | - | - | - | | `order_date` | `DATE` | `2026-05-19` | | `order_created_at` | `TIMESTAMP` (UTC) | `2026-05-19 02:00:00 UTC` | Same row, same warehouse. Here's what changes as you layer settings on. `order_date` reads `2026-05-19` in every one of these, so it's left out. | Configuration | `order_created_at` shows | Grouped by day | Same for every viewer? | | - | - | - | - | | Project timezone `UTC` | `2026-05-19 02:00` | `2026-05-19` | Yes | | Project timezone `America/New_York` | `2026-05-18 22:00` | `2026-05-18` | Yes | | One chart pinned to `Asia/Tokyo` (project stays NY) | `2026-05-19 11:00` | `2026-05-19` | Yes on that chart, but the dashboard now mixes zones | | Chart set to User timezone | the viewer's local time | the viewer's local day | No, each viewer sees their own day | *** **The pattern.** Timestamp rendering and bucketing shift with the resolved zone. DATE values never shift. But anything derived from "now" (relative filters) always uses the resolved zone, regardless of column type. # Python SDK Source: https://docs.lightdash.com/sdk/python-sdk Query your semantic layer with native Python syntax The Lightdash Python SDK lets you query your semantic layer directly from Python. Use it in Jupyter notebooks, Python scripts, or anywhere you use Python to ensure everyone pulls from a single source of truth. > [card] [See it in action](https://github.com/lightdash/python-sdk/blob/main/examples/getting_started.ipynb) > > Try the getting started Jupyter notebook for a hands-on walkthrough. ## Installation ```bash theme={null} pip install lightdash ``` ## Before you start To use the SDK, you need three things from your Lightdash instance: 1. **`instance_url`** — the URL where you log into Lightdash (for example, `https://app.lightdash.cloud` for Lightdash Cloud, or your self-hosted URL like `https://lightdash.mycompany.com`). 2. **`project_uuid`** — the unique ID of the project you want to query. 3. **`access_token`** — a personal access token (PAT) used to authenticate as you. You don't need to be an admin to do any of this. You just need access to the project you want to query. ### How to get your project UUID 1. Log in to Lightdash and open the project you want to query. 2. Look at the URL in your browser's address bar. It looks like this: ``` https://app.lightdash.cloud/projects/3675b69e-8324-4110-bdca-059031aa8da3/home ``` 3. Copy the long string between `/projects/` and the next `/`. In the example above, the project UUID is `3675b69e-8324-4110-bdca-059031aa8da3`. ### How to get a personal access token 1. Click your avatar (top-right corner) and go to **Settings**. 2. In the left-hand menu, under your name, click **Personal access tokens**. 3. Click **Generate new token**. 4. Give it a description (for example, "Python SDK") and pick an expiration date. 5. Click **Generate token**. 6. **Copy the token immediately and save it somewhere safe** — you won't be able to see it again after closing the dialog. If you lose it, just generate a new one. > [!WARNING] > > Treat your access token like a password. Don't commit it to git or share it. For scripts, load it from an environment variable (for example, `os.environ["LIGHTDASH_TOKEN"]`) instead of pasting it directly into your code. For more details, see [Personal access tokens](/personal-settings/create-personal-tokens). ## Quick start ```python theme={null} from lightdash import Client client = Client( instance_url="https://app.lightdash.cloud", access_token="your-token", project_uuid="your-uuid", ) model = client.get_model("orders") # Build and execute a query result = ( model.query() .metrics(model.metrics.revenue, model.metrics.profit) .dimensions(model.dimensions.country) .filter(model.dimensions.status == "active") .sort(model.metrics.revenue.desc()) .limit(100) .execute() ) # Get results as a DataFrame df = result.to_df() # Or as a list of dictionaries records = result.to_records() ``` ## Query builder The SDK provides two patterns for building queries: **single-call** and **chainable builder**. ### Single-call pattern Pass all parameters at once for simple queries: ```python theme={null} query = model.query( metrics=[model.metrics.revenue, model.metrics.profit], dimensions=[model.dimensions.country], filters=model.dimensions.status == "active", sort=model.metrics.revenue.desc(), limit=100 ) result = query.execute() ``` ### Chainable builder pattern Build queries incrementally with method chaining. Each method returns a new immutable `Query` object: ```python theme={null} query = ( model.query() .metrics(model.metrics.revenue) .dimensions(model.dimensions.country, model.dimensions.date) .filter(model.dimensions.status == "active") .sort(model.metrics.revenue.desc()) .limit(100) ) ``` Key characteristics: * **Immutable** — each method returns a new `Query` object, safe for reuse * **Lazy evaluation** — API calls only happen when `.execute()` is called * **Order-independent** — methods can be called in any order * **Composable** — create base queries and extend them ```python theme={null} # Create a reusable base query base = model.query().metrics(model.metrics.revenue).dimensions(model.dimensions.country) # Extend it for different use cases by_active = base.filter(model.dimensions.status == "active") by_inactive = base.filter(model.dimensions.status == "inactive") ``` ## Dimensions and metrics Access dimensions and metrics as attributes on the model: ```python theme={null} # Access via attribute country = model.dimensions.country revenue = model.metrics.revenue # List all available all_dimensions = model.dimensions.list() all_metrics = model.metrics.list() ``` Features: * **Lazy loading** — fetched from API on first access, then cached * **Fuzzy matching** — typos suggest closest matches * **Tab completion** — works in Jupyter/IPython for discovery * **Rich display** — HTML rendering in notebooks ## Filters Use Python comparison operators on dimensions to create filters: ```python theme={null} # Equality and inequality model.dimensions.country == "USA" model.dimensions.country != "USA" # Numeric comparisons model.dimensions.amount > 1000 model.dimensions.amount >= 1000 model.dimensions.amount < 500 model.dimensions.amount <= 500 # String operations model.dimensions.name.starts_with("John") model.dimensions.name.ends_with("son") model.dimensions.name.includes("Smith") # List membership model.dimensions.country.in_(["USA", "UK", "Canada"]) # Null checks model.dimensions.email.is_null() model.dimensions.email.is_not_null() # Range checks model.dimensions.order_date.between("2024-01-01", "2024-12-31") model.dimensions.amount.not_between(100, 500) ``` ### Supported operators by data type | Operator | Numeric | String | Boolean | Date | | - | - | - | - | - | | `is null` | Yes | Yes | Yes | Yes | | `is not null` | Yes | Yes | Yes | Yes | | `equals` / `is` | Yes | Yes | Yes | Yes | | `is not` | Yes | Yes | - | Yes | | `is less than` | Yes | - | - | - | | `is greater than` | Yes | - | - | - | | `starts with` | - | Yes | - | - | | `ends with` | - | Yes | - | - | | `includes` | - | Yes | - | - | | `in the last` | - | - | - | Yes | | `in the next` | - | - | - | Yes | | `in the current` | - | - | - | Yes | | `is before` | - | - | - | Yes | | `is after` | - | - | - | Yes | | `is between` | Yes | - | - | Yes | | `is not between` | Yes | - | - | Yes | ### Combining filters Use `&` (AND) and `|` (OR) to combine filters: ```python theme={null} # AND: Both conditions must be true f = (model.dimensions.country == "USA") & (model.dimensions.amount > 1000) # OR: Either condition must be true f = (model.dimensions.status == "active") | (model.dimensions.status == "pending") # Complex combinations f = ( (model.dimensions.country == "USA") & ((model.dimensions.amount > 1000) | (model.dimensions.priority == "high")) ) ``` Multiple `.filter()` calls on a query are combined with AND logic: ```python theme={null} query = ( model.query() .filter(model.dimensions.country == "USA") .filter(model.dimensions.amount > 1000) # AND-ed with above ) ``` ## Sorting Sort results using the `.sort()` method: ```python theme={null} from lightdash import Sort # Using metric/dimension methods (recommended) query = model.query().sort(model.metrics.revenue.desc()) query = model.query().sort(model.dimensions.country.asc()) # Multiple sorts query = model.query().sort( model.metrics.revenue.desc(), model.dimensions.country.asc() ) # Control null positioning query = model.query().sort(model.dimensions.name.asc(nulls_first=True)) # Using Sort class directly query = model.query().sort(Sort("orders_revenue", descending=True)) ``` ## Results Query results implement a unified `ResultSet` interface. ### Converting results ```python theme={null} result = query.execute() # To pandas DataFrame df = result.to_df() # or result.to_df(backend="pandas") # To polars DataFrame df = result.to_df(backend="polars") # To list of dictionaries records = result.to_records() # To JSON string json_str = result.to_json_str() ``` ### Iterating over results ```python theme={null} # Iterate over rows for row in result: print(row) # Get total count total = len(result) ``` ### Pagination For large result sets, results are paginated automatically: ```python theme={null} result = query.execute() # Access specific page page_2 = result.page(2) # Iterate through all pages for page in result.iter_pages(): process(page) # Lazy DataFrame loading (polars only) lazy_df = result.to_df_lazy() ``` Available properties on the result: * `result.query_uuid` — unique identifier for the query * `result.total_results` — total number of rows * `result.total_pages` — number of pages * `result.fields` — field metadata ## SQL runner Execute raw SQL queries directly against your data warehouse: ```python theme={null} # Execute SQL result = client.sql("SELECT * FROM orders WHERE status = 'active' LIMIT 100") df = result.to_df() # With custom limit result = client.sql("SELECT * FROM orders", limit=1000) # Introspection tables = client.sql_runner.tables() fields = client.sql_runner.fields("orders") fields = client.sql_runner.fields("orders", schema="public") ``` ## Exception handling The SDK provides specific exceptions for different error conditions: ```python theme={null} from lightdash import LightdashError, QueryError, QueryTimeout, QueryCancelled try: result = query.execute() except QueryTimeout as e: print(f"Query timed out: {e.query_uuid}") except QueryCancelled as e: print(f"Query was cancelled: {e.query_uuid}") except QueryError as e: print(f"Query failed: {e.message}") except LightdashError as e: print(f"Lightdash error: {e.message} (status: {e.status_code})") ``` Exception hierarchy: * `LightdashError` — base exception for all SDK errors * `QueryError` — query execution failed (HTTP 400) * `QueryTimeout` — query exceeded timeout (HTTP 408) * `QueryCancelled` — query was cancelled (HTTP 499) ## Complete example ```python theme={null} from lightdash import Client, QueryError, QueryTimeout # Initialize client client = Client( instance_url="https://app.lightdash.cloud", access_token="your-api-token", project_uuid="your-project-uuid", ) # Get a model model = client.get_model("orders") # Build a query with filters query = ( model.query() .metrics(model.metrics.total_revenue, model.metrics.order_count) .dimensions(model.dimensions.country, model.dimensions.order_date) .filter( (model.dimensions.status == "completed") & (model.dimensions.order_date >= "2024-01-01") ) .sort(model.metrics.total_revenue.desc()) .limit(50) ) try: result = query.execute() df = result.to_df() print(f"Fetched {len(result)} rows") print(df.head()) except QueryTimeout: print("Query took too long - try adding more filters") except QueryError as e: print(f"Query failed: {e.message}") ``` *** For the full SDK source and more examples, see the [Python SDK on GitHub](https://github.com/lightdash/python-sdk). # Self-hosting Source: https://docs.lightdash.com/self-host Deploy, configure, and operate your own Lightdash instance on Kubernetes or Docker Compose Lightdash is open-source, so you can deploy and operate your own instance instead of using Lightdash Cloud. This covers your install paths — Docker Compose, Kubernetes/Helm, or an on-prem enterprise setup — plus the production deployment checklist for running it at scale. You'll also find how to upgrade between versions and how to customize your deployment: SSO, SMTP, external storage, logging, and other environment configuration. For a security review, start with [Data flows and telemetry](/self-host/data-flows-and-telemetry) — it lists exactly what stays inside your deployment, what leaves it, and how to control every outbound destination. # Configure a Slack integration for self-hosted Lightdash Source: https://docs.lightdash.com/self-host/customize-deployment/configure-a-slack-app-for-lightdash Create a Slack app and wire its credentials into your instance for unfurls and deliveries [Self-hosted](/support/feature-badges#self-hosted) For using the integration, see [Slack integration](/integrations/slack). In this guide we will show you how you can enable [the Slack integration](/integrations/slack) on your on self-hosted Lightdash server. ### Create a new Slack app on your organization First we will have to create a Slack APP [https://api.slack.com/apps?new\_app=1](https://api.slack.com/apps?new%5Fapp=1) You can select `From an app manifest` to make it easier. ![Slack's Create an app dialog offering two choices: From scratch, and From an app manifest](https://mintcdn.com/lightdash/nYjP2cCgaq2zpRDo/images/self-host/customize-deployment/configure-a-slack-app-for-lightdash/slack-create-new-app-2d375ed270fefd13d61b835a38a22080.png?fit=max\&auto=format\&n=nYjP2cCgaq2zpRDo\&q=85\&s=4f813799ac417ef027519f46aeecbef9) Then select the workspace you want to enable this into. Later you can `enable distribution` if you want to use a different Slack workspace. ![Slack's workspace picker on step 1 of 3, with a workspace selected and a Next button](https://mintcdn.com/lightdash/nYjP2cCgaq2zpRDo/images/self-host/customize-deployment/configure-a-slack-app-for-lightdash/slack-select-worskpace-d078476820529509c8ef925794f931bc.png?fit=max\&auto=format\&n=nYjP2cCgaq2zpRDo\&q=85\&s=3923ca23314decc55deab60da74be535) Then copy this manifest to allow URL unfurls in your app. **Make sure you update `your-lightdash-deployment-url.com` in the manifest below** (for example, `app.lightdash.cloud`). ```json theme={null} display_information: name: Lightdash description: Share Lightdash URLs on your Slack background_color: '#7262ff' features: bot_user: display_name: Lightdash always_online: false unfurl_domains: - your-lightdash-deployment-url.com oauth_config: redirect_urls: - https://your-lightdash-deployment-url.com/api/v1/slack/oauth_redirect - https://your-lightdash-deployment-url.com/api/v1/auth/slack/callback scopes: bot: - app_mentions:read - channels:join - channels:read - channels:history - chat:write - chat:write.customize - files:read - files:write - groups:read - groups:history - links:read - links:write - users:read - im:write settings: event_subscriptions: request_url: https://your-lightdash-deployment-url.com/slack/events bot_events: - app_mention - link_shared - message.channels interactivity: is_enabled: true request_url: https://your-lightdash-deployment-url.com/slack/events org_deploy_enabled: false socket_mode_enabled: false token_rotation_enabled: false ``` Keep every bot scope in the manifest — the list is the set Lightdash needs, not a menu to pick from. When the Slack integration is installed, Lightdash requests these scopes, and each Slack feature checks for the ones it uses. A feature whose scopes are missing stays off until you reinstall the Slack integration with them: without the scheduled delivery scopes, for example, the Slack destination in the scheduled delivery form is disabled with a prompt to reinstall. `chat:write.customize` is what lets the bot post with the [bot avatar](/integrations/slack#slack-bot-avatar) set for your organization; without it, messages use the app's default icon. Finally, click on `create` ### Copying credentials Now copy the following credentials from your new app. From `Basic Information` ![The App Credentials section of a Slack app, listing App ID, Client ID, and hidden Client Secret and Signing Secret fields](https://mintcdn.com/lightdash/nYjP2cCgaq2zpRDo/images/self-host/customize-deployment/configure-a-slack-app-for-lightdash/slack-basic-information-9a846bde79778d77d0c2616734fac8f1.png?fit=max\&auto=format\&n=nYjP2cCgaq2zpRDo\&q=85\&s=56e7be90fee2ef0654da0cf1ee944f13) * Client ID * Client secret (show and copy) * Signing secret (show and copy) ### Adding credentials to your local environment Now you need to add the following environment variables to your Lightdash server using the credentials we previously copied * `SLACK_CLIENT_ID`: Client ID (make sure it is between quotes, so it is a string, not a number) * `SLACK_CLIENT_SECRET`: Client secret * `SLACK_SIGNING_SECRET`: Signing secret * `SLACK_STATE_SECRET`: This can be any string Restart your Lightdash service, now you should be able to use [the Slack integration](/integrations/slack) on your self-hosted Lightdash. ## Enable Socket Mode (Alternative Setup) Socket Mode allows your Slack app to receive events and interactions over a WebSocket connection instead of HTTP requests. This can be useful for development or when you cannot expose your Lightdash instance to the public internet. ### When to use Socket Mode * Your Lightdash instance is not publicly accessible * You're developing or testing the Slack integration locally ### Configuring Socket Mode #### Step 1: Enable Socket Mode in your Slack App 1. Go to your Slack app settings and navigate to the **Socket Mode** section in the sidebar. 2. Toggle the **Enable Socket Mode** switch to enable it. ![Enable Socket Mode in Slack App settings](https://mintcdn.com/lightdash/nYjP2cCgaq2zpRDo/images/self-host/customize-deployment/configure-a-slack-app-for-lightdash/slack-socket-mode-enable.png?fit=max\&auto=format\&n=nYjP2cCgaq2zpRDo\&q=85\&s=70128658e2588a9c680211408cf5e21c) 3. After enabling Socket Mode, you'll be prompted to generate an app-level token. Enter a name for your token (e.g., "lightdash-socket-token"). ![Generate app-level token dialog](https://mintcdn.com/lightdash/nYjP2cCgaq2zpRDo/images/self-host/customize-deployment/configure-a-slack-app-for-lightdash/slack-socket-mode-gen-token.png?fit=max\&auto=format\&n=nYjP2cCgaq2zpRDo\&q=85\&s=1e02554cd19b6b0445a424c62ec30ca4) 4. Click **Generate** to create the token, then copy the generated token value. You'll need this for the next step. ![Copy the generated app-level token](https://mintcdn.com/lightdash/nYjP2cCgaq2zpRDo/images/self-host/customize-deployment/configure-a-slack-app-for-lightdash/slack-socket-mode-gen-copy.png?fit=max\&auto=format\&n=nYjP2cCgaq2zpRDo\&q=85\&s=fb3fcf5dc67c32ece9d5d5266b239052) #### Step 2: Update Lightdash Environment Variables Add the following environment variables to your Lightdash server configuration: * `SLACK_APP_TOKEN`: The app-level token you just generated and copied from Step 1 * `SLACK_SOCKET_MODE`: Set to `"true"` to enable Socket Mode #### Step 3: Re-install the Slack Integration After updating your environment variables, restart your Lightdash service, then re-install the Slack integration in your Lightdash instance to complete the Socket Mode setup. Your Slack integration will now use Socket Mode to communicate with Slack instead of HTTP webhooks. # Configure a Github integration for self-hosted Lightdash Source: https://docs.lightdash.com/self-host/customize-deployment/configure-github-for-lightdash Create a GitHub app and wire its credentials into your instance so Lightdash can write to dbt repos [Self-hosted](/support/feature-badges#self-hosted) For connecting a dbt repository, see [dbt projects](/integrations/dbt/projects). In this guide we will show you how you can enable the Github integration on your on self-hosted Lightdash server. ### Create a new Github app Go to app settings in Github, either organization or account developer settings and click `New Github App` ![Github Create App Pn](https://mintcdn.com/lightdash/nYjP2cCgaq2zpRDo/images/self-host/customize-deployment/configure-github-for-lightdash/github-create-app.png?fit=max\&auto=format\&n=nYjP2cCgaq2zpRDo\&q=85\&s=22c02302a4949b28534dd21da0a86191) **Settings:** 1. Set the app name: must be unique across Github 2. Add a description 3. Homepage URL: e.g. `https://lightdash.com` 4. Callback URL: `https:///api/v1/github/oauth/callback` 5. Enable `Expire user authorization tokens` 6. Enable `Request user authorization (OAuth) during installation` ![Github Oauth Refresh Token Pn](https://mintcdn.com/lightdash/nYjP2cCgaq2zpRDo/images/self-host/customize-deployment/configure-github-for-lightdash/github-oauth-refresh-token.png?fit=max\&auto=format\&n=nYjP2cCgaq2zpRDo\&q=85\&s=e4debaa367ea265db207c55cf508a172) 7. Enable \*\*Redirect on update \*\*on Post Installation 8. Deactivate webhooks ![Github Deactivate Webhooks Pn](https://mintcdn.com/lightdash/nYjP2cCgaq2zpRDo/images/self-host/customize-deployment/configure-github-for-lightdash/github-deactivate-webhooks.png?fit=max\&auto=format\&n=nYjP2cCgaq2zpRDo\&q=85\&s=b3ffaf169f33535abb33302399d7eaf2) **Repository Permissions:** * Checks: `Read and write` * Contents: `Read and write` * Pull requests: `Read and write` * Workflows (optional): `Read and write` **Account Permissions:** None **Where can this GitHub App be installed?** Any account ### **Generate Certificate and Secret** After creating your Github account you will need to generate a Client Secret. Copy it and keep it safe, this will get used for the `GITHUB_CLIENT_SECRET` environment variable. ![Github Generate Client Secret Pn](https://mintcdn.com/lightdash/nYjP2cCgaq2zpRDo/images/self-host/customize-deployment/configure-github-for-lightdash/github-generate-client-secret.png?fit=max\&auto=format\&n=nYjP2cCgaq2zpRDo\&q=85\&s=cba6a81cad2f6828c9e4089c14ebca3a) And a Private Key. Convert the contents of the private key file into `base64` , this will get used for the `GITHUB_PRIVATE_KEY` environment variable. ![Github Generate Private Key Pn](https://mintcdn.com/lightdash/nYjP2cCgaq2zpRDo/images/self-host/customize-deployment/configure-github-for-lightdash/github-generate-private-key.png?fit=max\&auto=format\&n=nYjP2cCgaq2zpRDo\&q=85\&s=4d0fa0d1ef863d1919f1b5bdd0856f4f) You should save both the Client Secret and the Private Key in a safe place as you might need them at a later time. ### Adding credentials to your local environment Now you need to add the following environment variables to your Lightdash server. * `GITHUB_PRIVATE_KEY` : This is the `base64` string of the Private Key generated for your Github app * `GITHUB_CLIENT_SECRET` : This is the client secret generated for your Github app * `GITHUB_CLIENT_ID`: Copy this from your Github app settings > General * `GITHUB_APP_ID`: Copy this from your Github app settings > General * `GITHUB_APP_NAME`: This is the name you set for your app, you can find it in app settings. # Configure a Google Sheets integration for self-hosted Lightdash Source: https://docs.lightdash.com/self-host/customize-deployment/configure-google-sheets-integration Enable Google Sheets uploads and scheduled deliveries on a self-hosted Lightdash instance [Self-hosted](/support/feature-badges#self-hosted) For using the integration, see [Google Sheets](/integrations/google-sheets). ### Enable Google SSO To authenticate Google users, first you need to enable [Google SSO](/self-host/customize-deployment/use-sso-login-for-self-hosted-lightdash#google) on your server. If you still want to keep users to login via email/password or another SSO provider, set `AUTH_GOOGLE_ENABLED=false`. This hides Google as a login option while still allowing the Google Sheets integration to work. Lightdash requests the necessary OAuth scopes -`drive.file` and `spreadsheets (optional)` when users connect to Google Sheets. ### Create an API key for Google file picker We use Google Drive picker API to allow you to select your spreadsheet files on `Syncs` To create a Google Drive picker API you need to add a new API key in [APIs and services in Google Cloud](https://console.cloud.google.com/apis/credentials). Your Google project must have the following API's enabled: * Google Picker API * Google Sheets API Save the API key in a new environment variable `GOOGLE_DRIVE_API_KEY` ### Allow access from Google's infrastructure The [Google Sheets add-on](/integrations/google-sheets/add-on) sends its sign-in and query requests from Google's Apps Script infrastructure, not from users' browsers, so your instance needs to be reachable from outside your network, not only from your users. See [Sign in with your Lightdash account](/integrations/google-sheets/add-on#sign-in-with-your-lightdash-account) for details. # Configure Lightdash to use an external database Source: https://docs.lightdash.com/self-host/customize-deployment/configure-lightdash-to-use-an-external-database Point Lightdash at a managed PostgreSQL database with the settings it needs [Self-hosted](/support/feature-badges#self-hosted) To connect your data warehouse, see [Connect a project](/integrations/connect-project). Lightdash requires a PostgreSQL database, version 12 or greater. In production, we recommend using a managed database service (depending on your cloud provider). This ensures that your database is highly available and secure. You can also use a self-hosted database, but you will need to manage the database yourself. The following configuration shows an example of how to configure Lightdash to use an external database. You can use this as a starting point for your own configuration. ## Configuration options for external database ```yaml theme={null} # values.yaml # Disable the internal database postgresql: enabled: false # Configure Lightdash to use an external database externalDatabase: host: lightdash-db.mycompany.com port: 5432 user: lightdash password: lightdash database: lightdash ``` Optionally you can pass any of the [PostgreSQL Environment Variables](https://www.postgresql.org/docs/current/libpq-envars.html) to the `configMap` ## Required pg extensions for external database Lightdash requires the following extensions to be installed on the database: * `uuid-ossp` — used for generating unique IDs * `pgvector` — **required for Enterprise AI features** (AI Analyst embeddings and verified answers). On managed services such as AWS RDS, Google Cloud SQL, and Azure Database for PostgreSQL, enable the `vector` extension in the instance's configuration first, then run `CREATE EXTENSION IF NOT EXISTS vector;` in the Lightdash database. ## Running Postgres in production Beyond the connection settings above, this is what to run on the database side to match Lightdash Cloud: * **Managed Postgres** (Cloud SQL / RDS / Azure Database) — version **14+** recommended (12 is the documented minimum). * **High availability:** a regional / multi-AZ primary, with a **cross-region replica for disaster recovery**. * **Backups:** daily automated backups with **point-in-time recovery enabled**, ≥ 7 days of transaction logs, and 7–31 retained backups. * **SSD storage** with auto-resize. * **Sizing:** 2 vCPU / 8 GB RAM is a solid single-org baseline; 4 vCPU / 16 GB+ for large orgs or heavy scheduler usage. * **Connection budget:** every backend and worker pod opens its own pool. Set `PGMAXCONNECTIONS: "50"` and `PGMINCONNECTIONS: "0"` in `configMap`, then make sure Postgres `max_connections` covers `pods × PGMAXCONNECTIONS` with headroom. * **Query insights / slow-query logging** enabled on the database side. * **TLS to the database** via the chart's `ssl` block, which injects `PGSSLMODE=verify-full` and `NODE_EXTRA_CA_CERTS`: ```yaml theme={null} ssl: enabled: true configMapName: lightdash-db-ca # your CA cert certFileName: ca.pem ``` ## Migrations Migrations run automatically when the Lightdash server or workers start, including on upgrade. Do not clear the `knex_migrations_lock` table by hand on `1.123.0` and later — use `migrate status` to inspect a stuck migration and `migrate unlock --actor` to release its lease. For multi-replica deployments, enable the migration job so replicas don't race. Both are covered in [troubleshoot an upgrade](/self-host/upgrading#troubleshoot-an-upgrade). # Configure Lightdash to use external storage Source: https://docs.lightdash.com/self-host/customize-deployment/configure-lightdash-to-use-external-object-storage Set up the required S3-compatible bucket on GCP, AWS, Azure, or MinIO [Self-hosted](/support/feature-badges#self-hosted) On Lightdash, we generate some files like: * Images for Slack unfurl and scheduled deliveries * Results on JSONL/CSV/Excel format These files need to be stored in a S3 Compatible Cloud storage. Some options are GCP Buckets, S3 Storage and MinIO. > [!WARNING] > > S3-compatible storage is **required**. Lightdash will fail to start if `S3_ENDPOINT`, `S3_BUCKET`, and `S3_REGION` are not set. All warehouses (including Snowflake) fetch async query results from S3. ## Configure cloud storage on Google Cloud Platform In the Google Cloud console, go to Cloud Storage and create a bucket with these details: * Give it a unique `Bucket name`, such as `lightdash-cloud-file-storage-eu` * Select a region, such as multi-region US, multi-region EU, or a single region like `europe-west1` * Select the default `Standard` storage class * Enable `Enforce public access prevention on this bucket` * Select `Uniform` access control * Set Protection to `none` Set `S3_ENDPOINT` to `https://storage.googleapis.com` and `S3_REGION` to `auto`. Then choose how Lightdash authenticates to the bucket. Google Cloud Storage accepts two methods, and they are not interchangeable. ### Option A: HMAC keys Use this option anywhere outside Google Kubernetes Engine (GKE), or when you want the simplest setup. 1. Go to **Settings > Interoperability** and create an **Access key for service account**. 2. Copy the access key and the secret. 3. Set `S3_ACCESS_KEY` and `S3_SECRET_KEY`. These keys are long-lived static secrets. Rotate them on a schedule. Google Cloud Storage supports several active keys per service account, so you can rotate without downtime. ### Option B: Workload identity, with no keys Use this option when Lightdash runs on GKE and you do not want static secrets in the cluster. Lightdash sends a short-lived Google OAuth token instead of signing requests with a key. Set `S3_AUTH_MODE=gcp_oauth` and leave `S3_ACCESS_KEY` and `S3_SECRET_KEY` unset. > [!WARNING] > > `S3_USE_CREDENTIALS_FROM` does not enable this option, even though its `ecs` and `ec2` > values look like they should. Every source that setting accepts is an **AWS** credential > provider, and Google Cloud Storage cannot verify AWS credentials. On GKE, use > `S3_AUTH_MODE=gcp_oauth`. Grant these permissions to the Google service account that the pod runs as: 1. Bind the Kubernetes service account to the Google service account, as described in the [GKE workload identity documentation](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity). 2. Grant the `roles/storage.objectUser` role **on the bucket**. Do not grant a project-wide role such as Editor. 3. Grant the `roles/iam.serviceAccountTokenCreator` role **on the service account itself**. The member and the resource are the same service account. Lightdash needs this role to sign download URLs. 4. Enable the `iamcredentials.googleapis.com` API in the project. > [!WARNING] > > If you skip step 3, the deployment looks healthy. Uploads, downloads, and result caching > all work. Only signed download links fail, and only when a user asks for one. The error is > `Permission 'iam.serviceAccounts.signBlob' denied on resource`. Set these environment variables: ```bash theme={null} S3_ENDPOINT=https://storage.googleapis.com S3_REGION=auto S3_BUCKET=your-bucket-name S3_AUTH_MODE=gcp_oauth S3_FORCE_PATH_STYLE=true ``` Both URL styles work with Google Cloud Storage. Path style also works for bucket names that contain dots, which break TLS certificate matching in the other style. Signed URLs in this mode last at most 7 days, which is a Google Cloud Storage limit. Lightdash fails to start if `S3_EXPIRATION_TIME` exceeds 604800 seconds. To develop locally against a bucket that uses this mode, run: ```bash theme={null} gcloud auth application-default login --impersonate-service-account=SERVICE_ACCOUNT_EMAIL ``` Your own user credentials cannot sign URLs, and the error is `Cannot sign data without 'client_email'`. Impersonating the service account fixes it. Do not download a service account key file. ## Configure cloud storage on AWS * Navigate to the S3 section of the AWS Management Console and click on the Create Bucket button. * Give your bucket a name and select the region where you want to store your data. * Next, you need to set the permissions for your bucket. Make it private. To export your S3 credentials, you need to follow these steps: * Navigate to the IAM section and click on the Users tab. * Click on the user whose credentials you want to export. * Click on the Security Credentials tab and locate the Access Keys section. * Click on the Create Access Key button. * Download the CSV file that contains your Access Key ID and Secret Access Key. Check [this guide](https://docs.aws.amazon.com/general/latest/gr/s3.html) to see what's the right `S3_ENDPOINT` for your bucket ## Configure cloud storage using MinIO Creating a bucket in MinIO * Login to the MinIO console and click on "Buckets" in the side bar * Click on "Create Bucket" * Give your bucket a name and click "Create Bucket" Creating access credentials in MinIO * Click on "Access Keys" in the side bar * Click "Create access key" * Give a name to your new access key and click "Create" * Download the JSON file containing both your Access Key ID and Secret Access Key MinIO needs path style bucket URLs, for this you will need to set `S3_FORCE_PATH_STYLE: true` in your environment variables. ## Azure Storage Azure Blob Storage is not natively compatible with the S3 API. While Lightdash supports external object storage by allowing integration with S3-compatible APIs, Azure's storage service does not provide this compatibility out of the box. This means that you **cannot use Azure Blob Storage as a drop-in replacement for S3** in Lightdash deployments. Instead, you can use one of the following S3-compatible solutions within your Azure setup: * [**MinIO**](https://min.io)**:** S3-compatible object storage * [**s3proxy**](https://github.com/gaul/s3proxy)**:** A lightweight proxy that adds an S3-compatible API layer on top of Azure Blob Storage. ## Configure Lightdash to use S3 credentials To enable Lightdash to use your S3 bucket for cloud storage, you'll need to set the following environment variables: ```bash theme={null} S3_ENDPOINT # required S3_REGION # required S3_BUCKET # required S3_ACCESS_KEY # optional if using IAM role S3_SECRET_KEY # optional if using IAM role S3_EXPIRATION_TIME # optional, defaults to 259200 seconds (3 days) ``` For a comprehensive list of all possible S3-related environment variables and other configurations, please visit the [Environment Variables documentation](/self-host/customize-deployment/environment-variables#s3). ### Use separate storage for query results Query results use the main S3 configuration by default. To store them with a different S3-compatible provider, set the `RESULTS_S3_*` variables that differ from it — credentials and path-style addressing have `RESULTS_S3_*` equivalents too: ```bash theme={null} RESULTS_S3_ENDPOINT=https://s3.eu-west-1.amazonaws.com RESULTS_S3_REGION=eu-west-1 RESULTS_S3_BUCKET=my-lightdash-query-results ``` Any omitted result storage setting inherits its corresponding `S3_*` value. > [!WARNING] > > Raw JSONL result downloads use a presigned URL that browsers fetch directly from `RESULTS_S3_ENDPOINT`. This endpoint must be reachable from users' browsers; `S3_PUBLIC_ENDPOINT` does not apply to the query results bucket. The bucket can remain private, but an IP policy that limits `GetObject` to Lightdash's backend egress addresses will block these downloads. ### Use separate storage for uploads AI agent avatars and homepage announcement images are served through permanent links, so they must not be deleted by a lifecycle rule. If your main bucket has one, point these uploads at a bucket without one: ```bash theme={null} UPLOADS_S3_BUCKET=my-lightdash-uploads ``` The uploads bucket shares the endpoint, region, credentials and auth mode of the main S3 configuration. Leave it unset if your main bucket keeps objects indefinitely. Once set, keep it: uploads made while it was set are only looked up in that bucket. Available from Lightdash 3.56.0. ### Authenticate without static keys How you do this depends on the cloud provider, because the two mechanisms are unrelated. **On AWS.** Omit `S3_ACCESS_KEY` and `S3_SECRET_KEY`, and the AWS SDK looks for an IAM role automatically. To control which credential sources it tries and in what order, set `S3_USE_CREDENTIALS_FROM`. For more detail, read the [AWS SDK for JavaScript documentation on setting credentials in Node.js](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-credentials-node.html). **On Google Cloud.** Set `S3_AUTH_MODE=gcp_oauth`. See [Option B: workload identity, with no keys](#option-b-workload-identity-with-no-keys). `S3_USE_CREDENTIALS_FROM` does not work here, because every source it accepts is an AWS credential provider. Signed URLs last at most 7 days in both cases, whatever you set `S3_EXPIRATION_TIME` to. The limit comes from the signing algorithm, not from Lightdash. ## Production bucket strategy For an enterprise deployment, use a **dedicated bucket per purpose**, each with a scoped credential that can only touch its own bucket. This is how Lightdash Cloud sets up storage: * **Results / cache bucket** — add a lifecycle rule deleting objects after **1 day**. Results are ephemeral, so this keeps the bucket small and cheap. * **Pre-aggregations bucket** (if using [pre-aggregates](/self-host/nats-workers/pre-aggregate-workers)) — lifecycle delete after **\~30 days**. * **Data-apps bucket** (if using [data apps](/self-host/enterprise-features/data-apps)) — persistent, with **no** delete lifecycle. * **Uploads bucket** (`UPLOADS_S3_BUCKET`) — persistent, with **no** delete lifecycle. Holds AI agent avatars and homepage announcement images, which are served through permanent links. Required if the main bucket has a delete lifecycle rule. **Block all public access** on every bucket, and prefer short-lived credentials over static keys. On EKS, use IAM roles for service accounts (IRSA). On GKE, set `S3_AUTH_MODE=gcp_oauth` to use workload identity. In both cases, signed URLs last at most 7 days. If users share download links that must outlive the signed-URL TTL (`S3_EXPIRATION_TIME`, default 3 days), enable `PERSISTENT_DOWNLOAD_URLS_ENABLED: "true"` — see [persistent download URLs](/self-host/customize-deployment/environment-variables#persistent-download-urls). # Configure OpenTelemetry tracing for self-hosted Lightdash Source: https://docs.lightdash.com/self-host/customize-deployment/configure-opentelemetry-tracing-for-self-hosted-lightdash Export distributed traces from your Lightdash instance to any OpenTelemetry-compatible backend [Self-hosted](/support/feature-badges#self-hosted) For instance health metrics, see [Prometheus metrics](/self-host/customize-deployment/configure-prometheus-metrics-for-self-hosted-lightdash). Lightdash can export distributed traces using the OpenTelemetry SDK, so you can follow a request or scheduled job across the API server, scheduler, and warehouse queries in any OpenTelemetry-compatible backend (for example Grafana Tempo, Jaeger, Honeycomb, or Datadog). Tracing runs in one of two exclusive modes: * **Sentry mode (default)**: spans are created and exported through Sentry, controlled by the [Sentry environment variables](/self-host/customize-deployment/environment-variables#sentry). * **OpenTelemetry mode**: spans are created by the OpenTelemetry SDK and exported according to the standard `OTEL_*` environment variables. Sentry still captures errors, but receives no spans. ## Enabling OpenTelemetry tracing By default, Lightdash traces through Sentry. To switch to OpenTelemetry mode, set the following environment variable on every Lightdash container (API server and scheduler): ```bash theme={null} LIGHTDASH_OTEL_TRACES_ENABLED=true ``` Then point the OTLP exporter at your collector: ```bash theme={null} OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318 ``` ## Configuration options | Variable | Description | | :- | :- | | `LIGHTDASH_OTEL_TRACES_ENABLED` | Switches tracing to OpenTelemetry mode: spans are created by the OpenTelemetry SDK and Sentry receives errors only. When `false`, tracing runs through Sentry. (default=false) | | `LIGHTDASH_OTEL_TRACES_SAMPLE_RATE` | Trace sampling ratio from 0.0 to 1.0. Falls back to `SENTRY_TRACES_SAMPLE_RATE` (deprecated) when unset. (default=1) | | `LIGHTDASH_OTEL_ALWAYS_SAMPLE_AI_TRACES` | Set to `false` to stop always-sampling AI agent traces, so they follow the global sampling ratio instead. (default=true) | | `LIGHTDASH_OTEL_DB_TRACES_ENABLED` | Adds spans for application database (Postgres) queries to traces, including the SQL statement. Requires OpenTelemetry mode. (default=false) | | `LIGHTDASH_OTEL_DB_TRACES_MAX_QUERY_LENGTH` | Maximum length of the SQL statement recorded on database spans; longer statements are truncated. Must be a non-negative integer. (default=1022) | | `OTEL_SDK_DISABLED` | Standard OpenTelemetry kill switch. When `true`, OpenTelemetry mode is off even if `LIGHTDASH_OTEL_TRACES_ENABLED=true`. | | `OTEL_TRACES_EXPORTER` | Comma-separated exporters: `otlp`, `console`, `zipkin`, or `none`. Unsupported values are ignored with a startup warning; `none` overrides any other value. (default=otlp) | | `OTEL_EXPORTER_OTLP_PROTOCOL` | OTLP protocol: `grpc`, `http/json`, or `http/protobuf`. `OTEL_EXPORTER_OTLP_TRACES_PROTOCOL` takes precedence. Unsupported values fall back to the default. (default=http/protobuf) | | `OTEL_EXPORTER_OTLP_ENDPOINT` | Base URL of your OTLP collector. Handled by the OpenTelemetry Node SDK, along with `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` and `OTEL_EXPORTER_OTLP_HEADERS`. | | `OTEL_SERVICE_NAME` | Service name attached to exported spans. (default=lightdash) | | `OTEL_LOG_LEVEL` | Enables OpenTelemetry SDK and exporter diagnostics at the given level (e.g. `DEBUG`). Lightdash redacts credentials, tokens, and span payloads from diagnostic output. | > [!NOTE] > > `OTEL_TRACES_SAMPLER` and `OTEL_TRACES_SAMPLER_ARG` are overridden by Lightdash. Control sampling with `LIGHTDASH_OTEL_TRACES_SAMPLE_RATE` instead. ## Choosing an exporter Lightdash defers exporter and protocol selection to the OpenTelemetry Node SDK's standard environment variable handling: * `OTEL_TRACES_EXPORTER` supports `otlp` (default), `console`, `zipkin`, and `none`. You can combine exporters with a comma-separated list. If the list contains `none`, no traces are exported regardless of the other values. * With the `otlp` exporter, `OTEL_EXPORTER_OTLP_PROTOCOL` (or the traces-specific `OTEL_EXPORTER_OTLP_TRACES_PROTOCOL`) selects `grpc`, `http/json`, or `http/protobuf` (default). * Unsupported exporter or protocol values are ignored with a warning in the Lightdash logs at startup. For example, to export traces over gRPC with an authentication header: ```bash theme={null} LIGHTDASH_OTEL_TRACES_ENABLED=true OTEL_TRACES_EXPORTER=otlp OTEL_EXPORTER_OTLP_PROTOCOL=grpc OTEL_EXPORTER_OTLP_ENDPOINT=https://otlp.example.com:4317 OTEL_EXPORTER_OTLP_HEADERS="authorization=Bearer " ``` ## Sampling `LIGHTDASH_OTEL_TRACES_SAMPLE_RATE` sets the head-sampling ratio for trace roots, from `0.0` (nothing) to `1.0` (everything, the default). Child spans follow their root's decision, so a sampled request captures the whole waterfall. Two behaviours to be aware of: * **AI agent traces are always sampled** regardless of the ratio, so a broken agent run always has a trace to debug. Set `LIGHTDASH_OTEL_ALWAYS_SAMPLE_AI_TRACES=false` to make them follow the global ratio instead. * **`OTEL_TRACES_SAMPLER` and `OTEL_TRACES_SAMPLER_ARG` are overridden** by Lightdash's own sampler and have no effect. Requests to health checks (`/api/v1/health`, `livez`), status polling endpoints, `favicon.ico`, and `robots.txt` are never traced. ## Finding a request's trace Every API response carries an `x-trace-id` header with the trace ID of the request that produced it, so you can go from a request in your proxy or application logs to its trace in your backend. The same ID appears in the Lightdash logs for that request. The header is only set when the request was sampled. Requests dropped by `LIGHTDASH_OTEL_TRACES_SAMPLE_RATE` have no exported trace and no header. In OpenTelemetry mode the backend does not continue the `sentry-trace` and `traceparent` headers sent by the Lightdash web app, because the browser span is only exported to Sentry and would leave the trace without a root. A `traceparent` header set by your own ingress or middleware is continued as normal. ## Database query tracing Set `LIGHTDASH_OTEL_DB_TRACES_ENABLED=true` to add a span for each application database (Postgres) query, so you can see where a request spends time inside Lightdash's own database: ```bash theme={null} LIGHTDASH_OTEL_TRACES_ENABLED=true LIGHTDASH_OTEL_DB_TRACES_ENABLED=true ``` * Database spans only appear inside an existing trace, so they follow the sampling decision of their parent request or job. * Each span records the SQL statement, truncated to `LIGHTDASH_OTEL_DB_TRACES_MAX_QUERY_LENGTH` characters (default `1022`). Invalid values fall back to the default with a warning. * This traces queries to Lightdash's application database only, not queries sent to your data warehouse. ## Troubleshooting At startup, Lightdash logs a line confirming the tracing configuration, including the active exporters, OTLP protocol, and sampling ratio. This confirms configuration only; exporter connectivity is not validated at startup. If traces aren't arriving in your backend, set `OTEL_LOG_LEVEL=DEBUG` to enable OpenTelemetry SDK and exporter diagnostics in the Lightdash logs. Diagnostic output is redacted before logging: URL credentials and query strings are stripped, values containing tokens or API keys are omitted, and span payloads are not printed. ## Metrics This page covers traces only. For instance health metrics (CPU, memory, event loop, query durations), see [Prometheus metrics](/self-host/customize-deployment/configure-prometheus-metrics-for-self-hosted-lightdash), which can also feed an OpenTelemetry backend through the collector's Prometheus receiver. # Configure Prometheus metrics for self-hosted Lightdash Source: https://docs.lightdash.com/self-host/customize-deployment/configure-prometheus-metrics-for-self-hosted-lightdash Expose Prometheus metrics for instance health, plus custom counters driven by application events [Self-hosted](/support/feature-badges#self-hosted) To monitor product usage, see [Usage analytics](/workspace-admin/usage-analytics). Lightdash can expose Prometheus metrics to help you monitor the performance and health of your Lightdash instance. This guide explains how to enable and configure Prometheus metrics for your self-hosted Lightdash deployment. ## Enabling Prometheus metrics By default, Prometheus metrics are disabled in Lightdash. To enable them, set the following environment variable: ```bash theme={null} LIGHTDASH_PROMETHEUS_ENABLED=true ``` ## Configuration options You can customize the Prometheus metrics endpoint using the following environment variables: | Variable | Description | | :- | :- | | `LIGHTDASH_PROMETHEUS_ENABLED` | Enables/Disables Prometheus metrics endpoint (default=false) | | `LIGHTDASH_PROMETHEUS_PORT` | Port for Prometheus metrics endpoint (default=9090) | | `LIGHTDASH_PROMETHEUS_PATH` | Path for Prometheus metrics endpoint (default=/metrics) | | `LIGHTDASH_PROMETHEUS_PREFIX` | Prefix for metric names. | | `LIGHTDASH_GC_DURATION_BUCKETS` | Buckets for duration histogram in seconds. (default=0.001, 0.01, 0.1, 1, 2, 5) | | `LIGHTDASH_EVENT_LOOP_MONITORING_PRECISION` | Precision for event loop monitoring in milliseconds. Must be greater than zero. (default=10) | | `LIGHTDASH_PROMETHEUS_LABELS` | Labels to add to all metrics. Must be valid JSON | | `LIGHTDASH_PROMETHEUS_EVENT_METRICS_ENABLED` | Enables Prometheus counters for product events (e.g. chart views, downloads). (default=false) | | `LIGHTDASH_PROMETHEUS_EXTENDED_METRICS_ENABLED` | Enables extended Prometheus metrics including warehouse query timings. (default=false) | | `LIGHTDASH_PROMETHEUS_ALL_QUERY_METRICS_ENABLED` | Emits a Prometheus metric for every individual query (high cardinality). (default=false) | | `LIGHTDASH_PROMETHEUS_HTTP_METRICS_ENABLED` | Enables the OpenTelemetry `http.server.request.duration` histogram with semconv labels and route templates. (default=false) | Operator-configurable counter metrics driven by application events are set through `LIGHTDASH_CUSTOM_METRICS_CONFIG_PATH` — see [Custom event metrics](#custom-event-metrics) below. ## Available metrics Lightdash exposes the following metrics: ### Process metrics These metrics provide information about the Node.js process running Lightdash: | Metric | Type | Description | | :- | :- | :- | | `process_cpu_user_seconds_total` | counter | Total user CPU time spent in seconds | | `process_cpu_system_seconds_total` | counter | Total system CPU time spent in seconds | | `process_cpu_seconds_total` | counter | Total user and system CPU time spent in seconds | | `process_start_time_seconds` | gauge | Start time of the process since unix epoch in seconds | | `process_resident_memory_bytes` | gauge | Resident memory size in bytes | | `process_virtual_memory_bytes` | gauge | Virtual memory size in bytes | | `process_heap_bytes` | gauge | Process heap size in bytes | | `process_open_fds` | gauge | Number of open file descriptors | | `process_max_fds` | gauge | Maximum number of open file descriptors | ### Node.js metrics These metrics provide information about the Node.js runtime: | Metric | Type | Description | | :- | :- | :- | | `nodejs_eventloop_lag_seconds` | gauge | Lag of event loop in seconds | | `nodejs_eventloop_lag_min_seconds` | gauge | The minimum recorded event loop delay | | `nodejs_eventloop_lag_max_seconds` | gauge | The maximum recorded event loop delay | | `nodejs_eventloop_lag_mean_seconds` | gauge | The mean of the recorded event loop delays | | `nodejs_eventloop_lag_stddev_seconds` | gauge | The standard deviation of the recorded event loop delays | | `nodejs_eventloop_lag_p50_seconds` | gauge | The 50th percentile of the recorded event loop delays | | `nodejs_eventloop_lag_p90_seconds` | gauge | The 90th percentile of the recorded event loop delays | | `nodejs_eventloop_lag_p99_seconds` | gauge | The 99th percentile of the recorded event loop delays | | `nodejs_active_resources` | gauge | Number of active resources that are currently keeping the event loop alive, grouped by async resource type | | `nodejs_active_resources_total` | gauge | Total number of active resources | | `nodejs_active_handles` | gauge | Number of active libuv handles grouped by handle type | | `nodejs_active_handles_total` | gauge | Total number of active handles | | `nodejs_active_requests` | gauge | Number of active libuv requests grouped by request type | | `nodejs_active_requests_total` | gauge | Total number of active requests | | `nodejs_heap_size_total_bytes` | gauge | Process heap size from Node.js in bytes | | `nodejs_heap_size_used_bytes` | gauge | Process heap size used from Node.js in bytes | | `nodejs_external_memory_bytes` | gauge | Node.js external memory size in bytes | | `nodejs_heap_space_size_total_bytes` | gauge | Process heap space size total from Node.js in bytes | | `nodejs_heap_space_size_used_bytes` | gauge | Process heap space size used from Node.js in bytes | | `nodejs_heap_space_size_available_bytes` | gauge | Process heap space size available from Node.js in bytes | | `nodejs_version_info` | gauge | Node.js version info | | `nodejs_gc_duration_seconds` | histogram | Garbage collection duration by kind | | `nodejs_eventloop_utilization` | gauge | The calculated Event Loop Utilization (ELU) as a percentage | ### PostgreSQL metrics These metrics provide information about the PostgreSQL connection pool: | Metric | Type | Description | Labels | | :- | :- | :- | :- | | `pg_pool_max_size` | gauge | Max size of the PG pool | | | `pg_pool_size` | gauge | Current size of the PG pool | | | `pg_active_connections` | gauge | Number of active connections in the PG pool | | | `pg_idle_connections` | gauge | Number of idle connections in the PG pool | | | `pg_queued_queries` | gauge | Number of queries waiting in the PG pool queue | | | `pg_connection_acquire_time` | histogram | Time to acquire a connection from the PG pool in milliseconds | | | `pg_query_duration` | histogram | Histogram of PG query execution time in milliseconds | | ### Queue metrics | Metric | Type | Description | | :- | :- | :- | | `queue_size` | gauge | Number of jobs in the queue | ### Query metrics These metrics track query execution performance. The `context` label is either `scheduled` or `interactive` based on the execution context. | Metric | Type | Description | Labels | | :- | :- | :- | :- | | `lightdash_query_status_total` | counter | Total number of queries by terminal status | `status`, `context` | | `lightdash_query_state_transitions_total` | counter | Query state transitions | `from`, `to`, `context` | | `lightdash_query_queue_wait_duration_seconds` | histogram | Time spent waiting in queue before execution | `context` | | `lightdash_query_total_duration_seconds` | histogram | Total query duration from creation to results ready | `context` | | `lightdash_query_warehouse_duration_seconds` | histogram | Warehouse query execution duration | `warehouse_type`, `context` | | `lightdash_query_overhead_duration_seconds` | histogram | Lightdash overhead: total duration minus warehouse execution time | `context` | | `lightdash_query_cache_hit_total` | counter | Total number of query cache hits and misses | `result`, `context`, `has_pre_aggregate_match` | ### Pre-aggregate metrics These metrics track the pre-aggregate system, including materialization, DuckDB resolution, and file management: | Metric | Type | Description | Labels | | :- | :- | :- | :- | | `lightdash_pre_aggregate_match_total` | counter | Total number of pre-aggregate match attempts | `result`, `miss_reason`, `format` | | `lightdash_pre_aggregate_materialization_total` | counter | Total number of pre-aggregate materializations by outcome | `status`, `trigger` | | `lightdash_pre_aggregate_active_materializations` | gauge | Current number of active pre-aggregate materializations | | | `lightdash_pre_aggregate_materialization_duration_seconds` | histogram | Pre-aggregate materialization duration | `status`, `trigger` | | `lightdash_pre_aggregate_materialization_poll_duration_seconds` | histogram | Time spent polling for materialization query completion in seconds | `status`, `trigger` | | `lightdash_pre_aggregate_materialization_warehouse_duration_seconds` | histogram | Warehouse execution time during materialization in seconds | `status`, `trigger` | | `lightdash_pre_aggregate_materialization_promote_duration_seconds` | histogram | Time to check file size and promote materialization to active in seconds | `status`, `trigger` | | `lightdash_pre_aggregate_materialization_file_size_bytes` | histogram | File size of pre-aggregate materialization in bytes | `format` | | `lightdash_pre_aggregate_parquet_conversion_duration_seconds` | histogram | Duration of JSONL to Parquet conversion | `status` | | `lightdash_pre_aggregate_duckdb_resolution_total` | counter | Total number of DuckDB pre-aggregate resolution attempts | `status`, `reason` | | `lightdash_pre_aggregate_duckdb_resolution_duration_seconds` | histogram | DuckDB pre-aggregate resolution duration | `status` | | `lightdash_pre_aggregate_duckdb_query_latency_seconds` | histogram | Total DuckDB query latency in seconds | | | `lightdash_pre_aggregate_duckdb_parquet_read_duration_seconds` | histogram | Time spent in READ\_PARQUET operators in seconds | | | `lightdash_pre_aggregate_duckdb_bytes_read` | histogram | Bytes read from S3/parquet by DuckDB queries | | | `lightdash_pre_aggregate_duckdb_scan_amplification` | histogram | Ratio of rows scanned to rows returned in DuckDB queries | | | `lightdash_pre_aggregate_fallback_total` | counter | Total number of opportunistic pre-aggregate fallbacks to warehouse | `reason` | ### AI agent metrics These metrics track the performance of the AI agent: | Metric | Type | Description | Labels | | :- | :- | :- | :- | | `ai_agent_generate_response_duration_ms` | histogram | AI agent generate response time in milliseconds | | | `ai_agent_stream_response_duration_ms` | histogram | AI agent stream response time in milliseconds | | | `ai_agent_stream_first_chunk_ms` | histogram | AI agent time to first chunk (any type) | | | `ai_agent_ttft_ms` | histogram | AI agent time to first token (TTFT) | `model`, `mode` | | `ai_repofs_github_tree_duration_ms` | histogram | Duration of the AI agent's GitHub Git Trees fetch (per-repo file listing, on first descent into a mount) in milliseconds | | | `ai_repofs_github_file_duration_ms` | histogram | Duration of a per-file GitHub Contents read in milliseconds | `outcome` (`found`, `missing`, `error`) | | `ai_repofs_github_requests_total` | counter | Count of AI agent GitHub API requests by kind | `kind` (`tree`, `file`, `search`, `list`) | | `ai_writeback_sandbox_create_duration_ms` | histogram | Duration of AI writeback E2B sandbox create/resume in milliseconds | | | `ai_writeback_compile_duration_ms` | histogram | Duration of in-sandbox `lightdash compile` during AI writeback in milliseconds | `status` | | `ai_writeback_run_duration_ms` | histogram | End-to-end AI writeback run duration in milliseconds | `status` | ### S3 metrics | Metric | Type | Description | Labels | | :- | :- | :- | :- | | `lightdash_s3_results_upload_duration_seconds` | histogram | S3 results upload duration | `source` | ### HTTP server metrics When `LIGHTDASH_PROMETHEUS_HTTP_METRICS_ENABLED` is set to `true`, Lightdash exposes a standardized [OpenTelemetry HTTP server semantic convention](https://opentelemetry.io/docs/specs/semconv/http/http-metrics/) histogram. Buckets are in seconds and labels use route templates (not raw URLs) to keep cardinality bounded. | Metric | Type | Description | Labels | | :- | :- | :- | :- | | `http_server_request_duration_seconds` | histogram | Duration of inbound HTTP requests in seconds | `http_request_method`, `http_response_status_code`, `http_route`, `url_scheme`, `network_protocol_version` | ### Custom event metrics Lightdash supports operator-configurable Prometheus counter metrics that are driven by application events. These are defined via a JSON configuration file specified by the `LIGHTDASH_CUSTOM_METRICS_CONFIG_PATH` environment variable. Each entry in the config file creates a counter metric that increments when a matching application event fires. This allows you to track custom business-level metrics such as user logins or query executions without modifying the application code. To turn it on, set `LIGHTDASH_PROMETHEUS_ENABLED=true` and `LIGHTDASH_PROMETHEUS_EVENT_METRICS_ENABLED=true`, and point `LIGHTDASH_CUSTOM_METRICS_CONFIG_PATH` at a JSON file inside the Lightdash working directory. Set them on every process you scrape, including scheduler workers, because each process only counts the events it emits. ```json theme={null} { "metrics": [ { "eventName": "ai_agent_tool_call_failed", "metricName": "lightdash_ai_agent_tool_call_failed_total", "help": "AI agent tool calls that returned an error", "labelNames": ["toolName"] } ] } ``` Each entry needs `eventName`, `metricName`, `help`, and `labelNames`. Label names must match the event's property keys exactly (for example `projectId`, not `project_id`); a property the event doesn't have is recorded as `unknown`. Avoid high-cardinality labels such as `threadId` or `promptId`. For AI agents, useful events include `ai_agent_request.outcome` (label `outcome`, `success` or `error`), `ai_agent_tool_call_failed` (labels `toolName`, `aiAgentId`), and `ai_agent.response_streamed` (labels such as `aiAgentId`, `model`, or `surface`). Events don't carry upstream HTTP status codes or error text from your LLM provider, so you can't build a counter for those. `mcp_tool_call` counts calls to the [Lightdash MCP server](/agents/lightdash-mcp), not calls agents make to external MCP servers. ## Using metrics for monitoring and alerting You can use these metrics to create dashboards and alerts in your monitoring system. Some common use cases include: * Monitoring memory usage and setting alerts for potential memory leaks * Tracking PostgreSQL connection pool utilization * Monitoring event loop lag to detect performance issues * Setting up alerts for high CPU usage For example, you might want to create alerts for: * High memory usage: `process_resident_memory_bytes > threshold` * Event loop lag: `nodejs_eventloop_lag_p99_seconds > threshold` * Database connection pool saturation: `pg_active_connections / pg_pool_max_size > 0.8` ## OpenTelemetry support Lightdash metrics are also compatible with OpenTelemetry. You can use the [OpenTelemetry Collector](https://opentelemetry.io/docs/collector) with the [Prometheus receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/prometheusreceiver) to scrape Lightdash's Prometheus metrics endpoint and export them to any OpenTelemetry-compatible backend. Lightdash can also export distributed traces directly over OTLP. See [Configure OpenTelemetry tracing](/self-host/customize-deployment/configure-opentelemetry-tracing-for-self-hosted-lightdash). Example OpenTelemetry Collector configuration: ```yaml theme={null} receivers: prometheus: config: scrape_configs: - job_name: 'lightdash' scrape_interval: 15s static_configs: - targets: ['lightdash:9090'] exporters: # Configure your preferred exporter (e.g., OTLP, Jaeger, etc.) otlp: endpoint: "your-otlp-endpoint:4317" service: pipelines: metrics: receivers: [prometheus] exporters: [otlp] ``` ## Setting up a Prometheus server If you don't already have a Prometheus server set up, here are some resources to help you get started: ### General Prometheus setup * [Prometheus Getting Started Guide](https://prometheus.io/docs/prometheus/latest/getting_started) - Official documentation on how to install and configure Prometheus * [Prometheus Installation](https://prometheus.io/docs/prometheus/latest/installation) - Different ways to install Prometheus * [Prometheus Configuration](https://prometheus.io/docs/prometheus/latest/configuration/configuration) - Detailed configuration options for Prometheus ### Setting up Prometheus in Google Cloud Platform (GCP) * [Google Cloud Managed Service for Prometheus](https://cloud.google.com/stackdriver/docs/managed-prometheus) - Google Cloud's managed Prometheus service * [Installing Prometheus on GKE](https://cloud.google.com/stackdriver/docs/managed-prometheus/setup-managed) - Setting up Prometheus on Google Kubernetes Engine * [Google Cloud Operations Suite Integration](https://cloud.google.com/stackdriver/docs/solutions/gke/prometheus) - Integrating Prometheus with Google Cloud Operations Suite ### Setting up Prometheus in Amazon Web Services (AWS) * [Amazon Managed Service for Prometheus](https://aws.amazon.com/prometheus) - AWS managed Prometheus service * [Getting Started with Amazon Managed Service for Prometheus](https://docs.aws.amazon.com/prometheus/latest/userguide/what-is-Amazon-Managed-Service-Prometheus.html) - Official AWS documentation * [Setting up Prometheus on Amazon EKS](https://docs.aws.amazon.com/eks/latest/userguide/prometheus.html) - Deploying Prometheus on Amazon Elastic Kubernetes Service # Add headless browser on self-hosting Source: https://docs.lightdash.com/self-host/customize-deployment/enable-headless-browser-for-lightdash Run the headless browser that renders chart and dashboard images for email and Slack deliveries [Self-hosted](/support/feature-badges#self-hosted) To set up a delivery, see [Scheduled deliveries](/explore/create-scheduled-deliveries). Images can be requested on `Slack unfurl` or using our `Scheduler` If you are running Lightdash on self-hosting, you will also have to run this headless browser on your infrastructure. ## How it works ![Diagram: scheduled deliveries and Slack unfurls trigger image generation in Lightdash, which opens a socket to the headless browser; the browser loads the chart page and returns a screenshot for email or Slack](https://mintcdn.com/lightdash/TfSVtH62HpmC1vjo/images/self-host/customize-deployment/enable-headless-browser-for-lightdash/headless-browser-schema-62b496e0d9f5f705ae823c7d4fdec946.png?fit=max\&auto=format\&n=TfSVtH62HpmC1vjo\&q=85\&s=4198e4b6950a73d6120e4feaa2dd3a70) When Lightdash needs to generate an image, it will open a new socket connection to the headless browser on `ws://HEADLESS_BROWSER_HOST:HEADLESS_BROWSER_PORT` Then using `playwright` we will browse the chart/dashboard on lightdash on `SITE_URL` We load the chart/dashboard on the browser and then a screenshot when it finishes loading Then we store that image in S3 (if enabled) or locally and then return the image URL. If the image was requested by Slack unfurl, we will unfurl the image using the Slack API. If the image was requested by Scheduler, we will send the image to the destination(s) (email or Slack) ## Configure headless browser on lightdash > [!NOTE] > > Lightdash uses Browserless for headless browser functionality with the `ghcr.io/browserless/chromium` image. Match the version Lightdash Cloud runs, which the official [Helm chart](https://github.com/lightdash/helm-charts) pins as the `browserless-chrome.image.tag` default — deploy that tag rather than choosing your own. In order to make this work, there are a few key ENV variables that need to be configured correctly. * `HEADLESS_BROWSER_HOST` : If you're running docker, this could be `headless-browser`, or `localhost` if you're running it locally (or with network:host) * `HEADLESS_BROWSER_PORT` : Optional port for headless browser, defaults to 3001 * `SITE_URL` : The URL for your Lightdash instance. ### Headless browser environment variables | Variable | Description | | :- | :- | | `HEADLESS_BROWSER_HOST` | Hostname for the headless browser | | `HEADLESS_BROWSER_PORT` | Port for the headless browser (default=3001) | | `HEADLESS_BROWSER_MAX_SCREENSHOT_RETRIES` | Maximum number of times the scheduler retries a failed screenshot before giving up. (default=5) | | `HEADLESS_BROWSER_RETRY_BASE_DELAY_MS` | Base delay in milliseconds for exponential-backoff retries on failed screenshots. (default=3000) | | `HEADLESS_BROWSER_SCREENSHOT_TIMEOUT_MS` | Maximum time in milliseconds Lightdash waits for a dashboard's tiles and charts to report ready before taking a screenshot. Also applies to per-element operations during capture. Must not exceed the headless-browser container's own session timeout. (default=180000) | | `USE_SECURE_BROWSER` | Use secure WebSocket connections for headless browser (default=false) | This SITE\_URL variable (eg: [https://eu1.lightdash.cloud](https://eu1.lightdash.cloud)) needs to be accessible from this headless browser service, either by a local connection, or via Internet. Otherwise it will not be able to open a page and generate the image. This means that if you are using docker locally, make sure the headless browser pod can reach the lightdash pod. Or follow the [docker documentation](https://docs.docker.com/compose/compose-file/compose-file-v3/#network_mode) to enable `network:host` ## Timeouts and retries If you're exporting large dashboards via scheduled deliveries or Slack, you may need to tune timeout and retry settings. There are two layers of configuration: the Browserless container and the Lightdash backend. ### Browserless container Set these environment variables on the **headless browser pod/container** (the `ghcr.io/browserless/chromium` image): | Variable | Default | Description | | - | - | - | | `TIMEOUT` | `30000` | Maximum time (ms) Browserless allows a browser session to run before terminating it. Increase this if large dashboards time out during export. A value of `120000` (2 minutes) works well for most cases. | | `CONNECTION_TIMEOUT` | `180000` | Maximum time (ms) Browserless waits on a connection. The chart default of 180s can truncate very large dashboards — raise to `300000` (5 min) if exports are cut off. | | `HEALTH` | `false` | When `true`, Browserless rejects new sessions under memory pressure (HTTP 429) instead of risking an OOM kill mid-screenshot. | | `MAX_MEMORY_PERCENT` | — | Memory threshold (percent) above which `HEALTH` sheds new sessions. Set e.g. `85` to reject load before the container OOMs. | ### Lightdash backend On the **Lightdash backend** (the main app or scheduler worker), the screenshot retry settings — `HEADLESS_BROWSER_MAX_SCREENSHOT_RETRIES` and `HEADLESS_BROWSER_RETRY_BASE_DELAY_MS` — are documented in [Headless browser environment variables](#headless-browser-environment-variables) above. Two scheduler variables also govern screenshot exports, and their canonical reference lives in the [Scheduler environment variables](/self-host/customize-deployment/environment-variables#scheduler): * `SCHEDULER_JOB_TIMEOUT` — maximum time (ms) for any scheduler job (including screenshot exports) to complete (default `600000`, 10 minutes). * `SCHEDULER_SCREENSHOT_TIMEOUT` — maximum time (ms) for taking a single chart or dashboard screenshot. Increase this if individual captures time out, separate from the overall job timeout. ### Troubleshooting large dashboard exports If scheduled deliveries fail for large dashboards, try the following in order: 1. **Increase `TIMEOUT` on the Browserless container** to at least `120000` (2 minutes). This is the most common fix. 2. **Check that `SITE_URL` is reachable** from the headless browser container. The browser needs to load the full dashboard page, including all chart queries. 3. If exports still fail intermittently, increase `HEADLESS_BROWSER_MAX_SCREENSHOT_RETRIES` to give it more attempts. 4. If jobs are timing out entirely, increase `SCHEDULER_JOB_TIMEOUT`. The default of 10 minutes should be sufficient for most dashboards. ## Run Lightdash behind an identity-aware proxy or a private hostname If `SITE_URL` sits behind an identity-aware proxy such as Google Cloud IAP, scheduled deliveries and Slack unfurls fail with an error like `Unable to get cookie for user : Invalid IAP credentials: empty token`. Before each screenshot, the Lightdash backend signs the headless browser in with a server-to-server request to `INTERNAL_LIGHTDASH_HOST`, which defaults to `SITE_URL`. That request carries no proxy credentials, so the proxy rejects it. The same request fails with `getaddrinfo ENOTFOUND ` when `SITE_URL` is a hostname that only resolves on a VPN, a Tailscale network, or a private DNS zone, so browsers can reach it but the backend pod can't. CSV and XLSX deliveries keep working either way, because they query the warehouse directly without the headless browser. Set `INTERNAL_LIGHTDASH_HOST` on the backend and scheduler to an in-cluster URL that resolves from the pod and doesn't go through the proxy, such as the Lightdash Kubernetes service (`http://lightdash.lightdash.svc.cluster.local:8080`). The headless browser loads charts and dashboards from the same host, so it must be reachable from the headless browser container too. With `SECURE_COOKIES=true`, the internal host must use HTTPS — see the next section. ## Run Lightdash on a fully internal HTTPS network If you run Lightdash with `SECURE_COOKIES=true` and you don't want the headless browser to leave the cluster to reach Lightdash, `INTERNAL_LIGHTDASH_HOST` still needs to be **HTTPS**. Plain HTTP does not work in this configuration: Lightdash emits HSTS on every response, so once Chrome (running inside browserless) has loaded a page from the internal hostname over HTTP it pins that hostname to HTTPS and auto-upgrades every subsequent asset request — which then fails against a plain-HTTP ClusterIP. The typical setup is to terminate TLS on the internal Lightdash hostname (with an internal Ingress, an nginx/envoy sidecar, an internal AWS ALB, etc.) using a **self-signed certificate**, and tell the Lightdash backend to skip TLS validation for screenshot traffic to that host: ```yaml theme={null} # values.yaml configMap: SECURE_COOKIES: 'true' SITE_URL: https://lightdash.mycompany.com INTERNAL_LIGHTDASH_HOST: https://lightdash-internal.svc.cluster.local INTERNAL_LIGHTDASH_HOST_IGNORE_HTTPS_ERRORS: 'true' ``` `INTERNAL_LIGHTDASH_HOST_IGNORE_HTTPS_ERRORS=true` is opt-in and default off. When enabled, the Lightdash backend skips TLS validation on: * the internal `getUserCookie` request from the backend to `INTERNAL_LIGHTDASH_HOST`, and * the Playwright/Chromium request that renders the screenshot inside the headless browser. **Security trade-off.** TLS validation is disabled for that traffic. Only enable this flag when the network path between the Lightdash backend, the headless browser and `INTERNAL_LIGHTDASH_HOST` is itself trusted — typically inside a Kubernetes cluster network or a private VPC. The default `ghcr.io/browserless/chromium` image does not trust self-signed certificates out of the box, so without this flag you will see `net::ERR_CERT_AUTHORITY_INVALID` from Playwright and `DEPTH_ZERO_SELF_SIGNED_CERT` from the backend's own internal fetch. > [!TIP] > > If you can issue a publicly-trusted certificate for the internal hostname (e.g. via Let's Encrypt with DNS-01, AWS ACM, an internal subdomain of a public domain), the default browserless image already trusts it and you don't need this flag. This is only worth the effort if a publicly-trusted cert on the internal hostname is straightforward in your infrastructure — many teams find it isn't, which is why this flag exists. # Environment variables Source: https://docs.lightdash.com/self-host/customize-deployment/environment-variables Complete reference of the environment variables that configure a Lightdash deployment [Self-hosted](/support/feature-badges#self-hosted) This is a reference to all environment variables that can be used to configure a Lightdash deployment. ## Postgres database These variables configure the Postgres database Lightdash uses to store its own application data (not your warehouse). | Variable | Description | | :- | :- | | `PGHOST` | **(Required)** Hostname of postgres server to store Lightdash data | | `PGPORT` | **(Required)** Port of postgres server to store Lightdash data | | `PGUSER` | **(Required)** Username of postgres user to access postgres server to store Lightdash data | | `PGPASSWORD` | **(Required)** Password for PGUSER | | `PGDATABASE` | **(Required)** Database name inside postgres server to store Lightdash data | | `PGCONNECTIONURI` | Connection URI for postgres server to store Lightdash data in the format postgresql://user:password\@host:port/db?params. This is an alternative to providing the previous PG variables. | | `PGMAXCONNECTIONS` | Maximum number of connections to the database | | `PGMINCONNECTIONS` | Minimum number of connections to the database | | `ALLOW_MISSING_MIGRATIONS` | When `true`, disables Knex's migration list validation so Lightdash can start against a database that has migrations applied which don't exist as files on disk. Use this during rollbacks (e.g. v2 → v1) when the database stays on the newer version. Pending migrations (code ahead of DB) are still detected. (default=false) | Lightdash also accepts all [standard postgres environment variables](https://www.postgresql.org/docs/9.3/libpq-envars.html). ## Server and networking Core variables that control how the Lightdash server runs, how it's reached, and how sessions and cookies behave. | Variable | Description | | :- | :- | | `PORT` | Port the Lightdash backend listens on (default=8080) | | `SITE_URL` | Site url where Lightdash is being hosted. It should include the protocol. E.g [https://lightdash.mycompany.com](https://lightdash.mycompany.com) (default=[http://localhost:8080](http://localhost:8080)) | | `INTERNAL_LIGHTDASH_HOST` | Internal Lightdash host for the Headless browser to send requests when your Lightdash instance is not accessible from the Internet. Needs to support `https` if `SECURE_COOKIES=true` (default=Same as `SITE_URL`) | | `INTERNAL_LIGHTDASH_HOST_IGNORE_HTTPS_ERRORS` | When `true`, skips TLS certificate validation on screenshot traffic going to `INTERNAL_LIGHTDASH_HOST`. Use this if you need to terminate TLS in front of Lightdash on a fully internal hostname with a self-signed or otherwise untrusted certificate. Opt-in, default `false`. **Security trade-off:** disables TLS validation for that traffic, so only enable it when the network path is trusted (e.g. cluster-internal). See [Run Lightdash on a fully internal HTTPS network](/self-host/customize-deployment/enable-headless-browser-for-lightdash#run-lightdash-on-a-fully-internal-https-network). | | `STATIC_IP` | Server static IP so users can add the IP to their warehouse allow-list. (default=[http://localhost:8080](http://localhost:8080)) | | `LIGHTDASH_SECRET` | **(Required)** Secret key used to secure various tokens in Lightdash. Lightdash also derives from it the AES-256-GCM key that encrypts stored credentials, such as warehouse connection secrets. This **must** be fixed between deployments. If the secret changes, you won't have access to Lightdash data. | | `SECURE_COOKIES` | Only allows cookies to be stored over a https connection. We use cookies to keep you logged in. This is recommended to be set to true in production. (default=false) | | `COOKIES_MAX_AGE_HOURS` | How many hours a user session exists before the user is automatically signed out. For example if 24, then the user will be automatically after 24 hours of inactivity. | | `TRUST_PROXY` | This tells the Lightdash server that it can trust the X-Forwarded-Proto header it receives in requests. This is useful if you use `SECURE_COOKIES=true` behind a HTTPS terminated proxy that you can trust. (default=false) | | `LIGHTDASH_MAX_PAYLOAD` | Maximum HTTP request body size (default=5mb) | | `LIGHTDASH_MODE` | Mode for Lightdash (default, demo, pr, etc.) (default=default) | | `ALLOW_MULTIPLE_ORGS` | If set to `true`, new users registering on Lightdash will have their own organization, separated from others (default=false) | | `LIGHTDASH_DISABLE_UPDATE_CHECK` | When `true`, stops the API server from polling Docker Hub (`hub.docker.com`) for the latest Lightdash release. Use this if your deployment blocks outbound traffic to Docker Hub. It also stops the calls to the GitHub API (`api.github.com`) for [release highlights](/self-host/upgrading#when-to-upgrade). When disabled, the "update available" badge and release highlights are hidden in the UI. (default=false) | ## Licensing | Variable | Description | | :- | :- | | `LIGHTDASH_LICENSE_KEY` | License key for Lightdash Enterprise Edition. See [enterprise features](/self-host/enterprise-features) for details. [Get your license key](https://calendly.com/lightdash-cloud/enterprise?utm_source=docs\&utm_medium=referral\&utm_campaign=enterprise_licensing\&utm_content=license_key_cta) | ## Query limits and behavior Control how many rows a query can return, page sizes, exports, and chart-version retention. | Variable | Description | | :- | :- | | `LIGHTDASH_QUERY_MAX_LIMIT` | Query max rows limit (default=5000) | | `LIGHTDASH_QUERY_DEFAULT_LIMIT` | Default number of rows to return in a query (default=500) | | `LIGHTDASH_QUERY_MAX_PAGE_SIZE` | Maximum page size for paginated queries (default=2500) | | `LIGHTDASH_QUERY_RETRY_ON_TRANSIENT_ERRORS` | When `true`, the frontend automatically retries failed queries on transient errors (5xx server responses and network errors) up to 3 times with exponential backoff (1s, 2s, 4s). 4xx client errors are never retried. Useful for instances where warehouse connections occasionally drop or the backend is briefly overwhelmed. (default=false) | | `LIGHTDASH_PIVOT_TABLE_MAX_COLUMN_LIMIT` | Configure maximum number of columns in pivot table (default=200) | | `LIGHTDASH_CSV_CELLS_LIMIT` | Max cells on CSV file exports (default=100000) | | `LIGHTDASH_DASHBOARD_MAX_TILES_PER_TAB` | Maximum number of tiles allowed per tab on a dashboard (default=50) | | `LIGHTDASH_DASHBOARD_MAX_TABS_PER_DASHBOARD` | Maximum number of tabs allowed per dashboard (default=20) | | `LIGHTDASH_DASHBOARD_MAX_CONCURRENT_TILE_QUERIES` | Caps how many tile queries an open dashboard runs concurrently in each viewer's browser, instead of every tile firing its query to the warehouse as soon as the dashboard loads. Tiles currently visible on screen are started first; others wait for a free slot. A query started by a data refetch (for example, after a filter change) also waits for a free slot like any other tile query. Unset by default (no cap) | | `MAX_DOWNLOADS_AS_CODE` | Maximum number of downloads as code (default=100) | ## Scheduler Variables that control the scheduler worker and background cleanup jobs. | Variable | Description | | :- | :- | | `SCHEDULER_ENABLED` | Enables/Disables the scheduler worker that triggers the scheduled deliveries. (default=true) | | `SCHEDULER_CONCURRENCY` | How many scheduled delivery jobs can be processed concurrently. (default=3) | | `SCHEDULER_JOB_TIMEOUT` | After how many milliseconds the job should be timeout so the scheduler worker can pick other jobs. (default=600000, 10 minutes) | | `SCHEDULER_SCREENSHOT_TIMEOUT` | Timeout in milliseconds for taking screenshots | | `SCHEDULER_SHUTDOWN_TIMEOUT` | How many milliseconds a stopping scheduler worker waits for in-flight jobs to finish before releasing them for retry. Keep it below your pod's termination grace period. (default=60000, 1 minute) | | `SCHEDULER_INCLUDE_TASKS` | Comma-separated list of scheduler tasks to include | | `SCHEDULER_EXCLUDE_TASKS` | Comma-separated list of scheduler tasks to exclude | | `SCHEDULER_POLL_INTERVAL` | Polling interval in milliseconds for the scheduler worker to check for new jobs. | | `QUERY_HISTORY_CLEANUP_ENABLED` | Enables the background job that periodically deletes old query-history rows. (default=true) | | `QUERY_HISTORY_CLEANUP_SCHEDULE` | Cron expression controlling how often query history is cleaned up. (default=`0 2 * * *`) | | `QUERY_HISTORY_RETENTION_DAYS` | How many days the cleanup job keeps query-history rows before deleting them. (default=32) | | `APP_STATE_HISTORY_CLEANUP_ENABLED` | Enables the background job that periodically deletes old data app shared-state history versions. (default=true) | | `APP_STATE_HISTORY_RETENTION_DAYS` | How many days the cleanup job keeps data app shared-state history versions before deleting them. (default=90) | | `APP_STATE_HISTORY_KEEP_VERSIONS` | How many of each key's newest shared-state history versions are always kept, regardless of age. (default=50) | ## Headless browser Configure the headless browser used for screenshots and PDF exports. | Variable | Description | | :- | :- | | `HEADLESS_BROWSER_HOST` | Hostname for the headless browser | | `HEADLESS_BROWSER_PORT` | Port for the headless browser (default=3001) | | `HEADLESS_BROWSER_MAX_SCREENSHOT_RETRIES` | Maximum number of times the scheduler retries a failed screenshot before giving up. (default=5) | | `HEADLESS_BROWSER_RETRY_BASE_DELAY_MS` | Base delay in milliseconds for exponential-backoff retries on failed screenshots. (default=3000) | | `HEADLESS_BROWSER_SCREENSHOT_TIMEOUT_MS` | Maximum time in milliseconds Lightdash waits for a dashboard's tiles and charts to report ready before taking a screenshot. Also applies to per-element operations during capture. Must not exceed the headless-browser container's own session timeout. (default=180000) | | `USE_SECURE_BROWSER` | Use secure WebSocket connections for headless browser (default=false) | > [!NOTE] > > The headless-browser container has its own session timeout (for example, browserless v2's `TIMEOUT`, which defaults to 30 seconds). That value must be greater than or equal to `HEADLESS_BROWSER_SCREENSHOT_TIMEOUT_MS`, otherwise the browser will terminate the session before Lightdash's readiness wait expires and the screenshot will fail. If you raise `HEADLESS_BROWSER_SCREENSHOT_TIMEOUT_MS` for dashboards that legitimately take longer than three minutes to render, raise the browser container's session timeout to match. ## Personal access tokens Variables that control PAT availability and lifetime. | Variable | Description | | :- | :- | | `DISABLE_PAT` | Disables Personal Access Tokens (default=false) | | `PAT_ALLOWED_ORG_ROLES` | Comma-separated list of organization roles allowed to use Personal Access Tokens (default=All roles) | | `PAT_MAX_EXPIRATION_TIME_IN_DAYS` | Maximum expiration time in days for Personal Access Tokens | ## Timezone and localization | Variable | Description | | :- | :- | | `LIGHTDASH_QUERY_TIMEZONE` | Instance-wide default timezone applied to queries when a user/project has no override. | | `LIGHTDASH_ENABLE_TIMEZONE_SUPPORT` | Enables per-query timezone support. On by default; set to `false` to turn it off instance-wide. | | `LIGHTDASH_ENABLE_IMPROVED_EXCEL_DATES` | When `true`, exports timestamps to Excel as native date cells instead of strings. (default=false) | ## Soft delete Configure whether deletions are soft (recoverable) and for how long. | Variable | Description | | :- | :- | | `SOFT_DELETE_ENABLED` | When `true`, deleting charts, dashboards, spaces, saved SQL, schedulers, and data apps marks them as soft-deleted instead of removing them immediately. Soft-deleted items can be restored or permanently deleted later. (default=false) | | `SOFT_DELETE_RETENTION_DAYS` | Number of days soft-deleted items are retained before becoming eligible for permanent cleanup. Only applies when `SOFT_DELETE_ENABLED=true`. (default=30) | ## Custom metrics | Variable | Description | | :- | :- | | `LIGHTDASH_CUSTOM_METRICS_CONFIG_PATH` | Filesystem path to a JSON config file defining Prometheus counter metrics driven by application events. See [Custom event metrics](/self-host/customize-deployment/configure-prometheus-metrics-for-self-hosted-lightdash#custom-event-metrics). Also accepted as `CUSTOM_METRICS_CONFIG_PATH`. | ## UI customization Replace default URLs and tweak in-product UI surfaces. | Variable | Description | | :- | :- | | `SIGNUP_URL` | Overrides the URL the login page links to for new sign-ups. Useful on instances that gate sign-up behind a custom flow. | | `HELP_MENU_URL` | Replaces the default help-menu link in the Lightdash UI with your own support/runbook URL. | | `HEADWAY_ENABLED` | Enables the Headway changelogs widget in the Lightdash menu (default=true) | | `LIGHTDASH_DASHBOARD_DISABLE_SENTRY_TRACKING` | When `true`, suppresses Sentry tracking on the embedded dashboard frame. (default=false) | ## Map basemaps [Map charts](/visualizations/map) use CARTO for the Light, Dark, and Voyager backgrounds, including the Voyager fallback when OpenStreetMap tiles fail. Lightdash requests these tiles through its backend and keeps the API key out of the browser. OpenStreetMap and Satellite backgrounds do not use this key. | Variable | Description | | :- | :- | | `CARTO_API_KEY` | CARTO **Basemaps** API key. Optional; unset by default. Without a key, Lightdash still requests anonymous tiles, which can display CARTO's "API key required" watermark. | To configure a key: 1. [Request a free CARTO Basemaps API key](https://carto.com/basemaps/apikey/). Complete the form with your email and project details; CARTO emails the key to you. Review the usage limits and terms linked on that page. 2. Set `CARTO_API_KEY` in the environment of every Lightdash backend replica using your deployment's secret management. For example, `CARTO_API_KEY=your-carto-basemaps-api-key`. If you restrict the key, allow your backend's outbound public IP addresses: tile requests originate from the server, so website-only restrictions do not authorize these requests. 3. Restart or roll out the backend, then open a map with a Light, Dark, or Voyager background. The map should render without the watermark. If an old watermark remains, force-refresh the browser to discard cached tiles. For Helm deployments, you can reference an existing Kubernetes Secret. Create a Secret named `lightdash-carto` in the release's namespace with a `CARTO_API_KEY` entry, then add this to your Helm values: ```yaml theme={null} extraEnv: - name: CARTO_API_KEY valueFrom: secretKeyRef: name: lightdash-carto key: CARTO_API_KEY ``` Allow outbound HTTPS from the backend to `basemaps.cartocdn.com`. CARTO's usage limits still apply; the backend proxy does not remove provider quotas. ## Feature toggles Enable or disable individual product features across the instance. | Variable | Description | | :- | :- | | `CUSTOM_VISUALIZATIONS_ENABLED` | Enables/Disables custom chart functionality (default=false) | | `EXTENDED_USAGE_ANALYTICS` | When `true`, adds "Dashboard views (top 20)" and "Chart views (top 20)" tables to the [User Activity dashboard](/workspace-admin/usage-analytics#user-activity-dashboard) in Project Settings > Usage Analytics. (default=false) | | `DISABLE_DASHBOARD_COMMENTS` | Disables dashboard comments (default=false) | | `ORGANIZATION_WAREHOUSE_CREDENTIALS_ENABLED` | Enables organization warehouse settings (default=false) | | `EDIT_YAML_IN_UI_ENABLED` | Enables the in-UI YAML editor for tables and metrics. (default=false) | | `ECHARTS_V6_ENABLED` | Opt into the ECharts v6 renderer. (default=false) | | `FUNNEL_BUILDER_ENABLED` | Enables the funnel chart builder. (default=false) | | `SAVE_CREDENTIALS_FORM_ENABLED` | Enables the "save credentials" form so warehouse credentials can be stored per-user. (default=false) | | `AUTH_MOBILE_LOGIN_ENABLED` | Controls sign-in from the Lightdash mobile apps (iOS/Android, published as **Lightdash AI**). Mobile sign-in works against any Lightdash instance, including self-hosted ones — users enter their instance's own URL and sign in with the same account they use on the web app. Set to `false` to disable mobile sign-in for this instance. (default=true) | > [!NOTE] > > `PARTIAL_COMPILATION_ENABLED` has been removed and no longer controls server or CLI behavior. Project create, update, and refresh paths use partial compilation, and CLI compilation uses it by default. To report failures normally handled by partial compilation as errors in a supported CLI command, use [`--no-partial-compilation`](/workflow/cli/reference#partial-compilation) for that run. ## Feature flags Use these to force feature flags on or off across your deployment regardless of cloud-side targeting or per-organization overrides. Both variables accept a comma-separated list of feature-flag IDs (kebab-case strings — the flag IDs themselves, not env-var names). Useful for local dev flows where you want to toggle flags without touching targeting rules. | Variable | Description | | :- | :- | | `LIGHTDASH_ENABLE_FEATURE_FLAGS` | Comma-separated list of feature-flag IDs to force-enable for everyone in your instance. Example: `embedding,user-impersonation,scim-token-management` | | `LIGHTDASH_DISABLE_FEATURE_FLAGS` | Comma-separated list of feature-flag IDs to force-disable for everyone. Takes precedence over per-org overrides. Example: `dashboard-comments-enabled` | Lightdash doesn't validate these IDs. An ID that no longer gates anything, for example a flag that has been retired or made always-on, is ignored without an error and has no effect, so you can remove it from the list. ## Athena | Variable | Description | | :- | :- | | `ATHENA_WAREHOUSE_IAM_ROLE_AUTH` | Set to `true` to enable IAM role authentication for Athena warehouse connections. When enabled, users can choose between Access Keys and IAM Role auth in the connection form. IAM Role auth uses the AWS default credential chain instead of explicit access keys — on a pod running in EKS, that picks up the pod's role through IRSA or EKS Pod Identity with no keys stored; outside EKS it picks up the ECS task role or EC2 instance profile. Set **Assume Role ARN** on the connection to run Athena queries through a separate role instead. Default: `false`. | ## Snowflake | Variable | Description | | :- | :- | | `SNOWFLAKE_WAREHOUSE_ERROR_MESSAGE` | Custom error message displayed when users encounter Snowflake warehouse access errors. Use `{warehouseName}` as a placeholder for the actual warehouse name. Include `\n` in the value to insert line breaks in the rendered error. Example: `You don't have access to warehouse {warehouseName}.\nPlease reach out to your admin.` | | `SNOWFLAKE_UNAUTHORIZED_ERROR_MESSAGE` | Custom error message displayed when users encounter Snowflake authorization errors (e.g., "Object does not exist or not authorized"). Use `{snowflakeTable}` and `{snowflakeSchema}` as placeholders. Include `\n` in the value to insert line breaks in the rendered error. Example: `You don't have access to the {snowflakeTable} table.\nPlease go to '{snowflakeSchema}' and request access.` | ## SMTP This is a reference to all the SMTP environment variables that can be used to configure a Lightdash email client. | Variable | Description | | :- | :- | | `EMAIL_SMTP_HOST` | **(Required)** Hostname of email server | | `EMAIL_SMTP_PORT` | Port of email server (default=587) | | `EMAIL_SMTP_SECURE` | Secure connection (default=true) | | `EMAIL_SMTP_USER` | **(Required)** Auth user | | `EMAIL_SMTP_PASSWORD` | Auth password \[1] | | `EMAIL_SMTP_ACCESS_TOKEN` | Auth access token for Oauth2 authentication \[1] | | `EMAIL_SMTP_ALLOW_INVALID_CERT` | Allow connection to TLS server with self-signed or invalid TLS certificate (default=false) | | `EMAIL_SMTP_SENDER_EMAIL` | **(Required)** The email address that sends emails | | `EMAIL_SMTP_SENDER_NAME` | The name of the email address that sends emails (default=Lightdash) | | `EMAIL_SMTP_IMAGE_INLINE_CID` | Embed images directly into emails as CID attachments instead of referencing external URLs. Useful for deployments behind firewalls where email clients cannot reach internal image URLs (default=false) | | `EMAIL_SMTP_USE_AUTH` | Whether to authenticate with the SMTP server. Set to `false` for open relays inside a trusted network. (default=true) | \[1] `EMAIL_SMTP_PASSWORD` or `EMAIL_SMTP_ACCESS_TOKEN` needs to be provided ## SSO These variables enable you to control Single Sign On (SSO) functionality. | Variable | Description | | :- | :- | | `AUTH_DISABLE_PASSWORD_AUTHENTICATION` | If "true" disables signing in with plain passwords (default=false) | | `AUTH_ENABLE_GROUP_SYNC` | If "true" enables assigning SSO groups to Lightdash groups (default=false) | | `AUTH_ENABLE_OIDC_LINKING` | Enables linking a new OIDC identity to an existing user if they already have another OIDC with the same email (default=false) | | `AUTH_ENABLE_OIDC_TO_EMAIL_LINKING` | Enables linking OIDC identity to an existing user by matching their full email address. Required when using [SCIM](/workspace-admin/sso/scim) with SSO (default=false) | | `AUTH_GOOGLE_OAUTH2_CLIENT_ID` | Required for Google SSO | | `AUTH_GOOGLE_OAUTH2_CLIENT_SECRET` | Required for Google SSO | | `AUTH_OKTA_OAUTH_CLIENT_ID` | Required for Okta SSO | | `AUTH_OKTA_OAUTH_CLIENT_SECRET` | Required for Okta SSO | | `AUTH_OKTA_OAUTH_ISSUER` | Required for Okta SSO | | `AUTH_OKTA_DOMAIN` | Required for Okta SSO | | `AUTH_OKTA_AUTHORIZATION_SERVER_ID` | Optional for Okta SSO with a custom authorization server | | `AUTH_OKTA_EXTRA_SCOPES` | Optional for Okta SSO scopes (e.g. groups) without a custom authorization server | | `AUTH_ONE_LOGIN_OAUTH_CLIENT_ID` | Required for One Login SSO | | `AUTH_ONE_LOGIN_OAUTH_CLIENT_SECRET` | Required for One Login SSO | | `AUTH_ONE_LOGIN_OAUTH_ISSUER` | Required for One Login SSO | | `AUTH_AZURE_AD_OAUTH_CLIENT_ID` | Required for Azure AD | | `AUTH_AZURE_AD_OAUTH_CLIENT_SECRET` | Required for Azure AD | | `AUTH_AZURE_AD_OAUTH_TENANT_ID` | Required for Azure AD | | `AUTH_AZURE_AD_OIDC_METADATA_ENDPOINT` | Optional for Azure AD | | `AUTH_AZURE_AD_X509_CERT_PATH` | Optional for Azure AD | | `AUTH_AZURE_AD_X509_CERT` | Optional for Azure AD | | `AUTH_AZURE_AD_PRIVATE_KEY_PATH` | Optional for Azure AD | | `AUTH_AZURE_AD_PRIVATE_KEY` | Optional for Azure AD | | `DATABRICKS_OAUTH_CLIENT_ID` | Client ID for Databricks OAuth | | `DATABRICKS_OAUTH_CLIENT_SECRET` | Client secret for Databricks OAuth (optional) | | `DATABRICKS_OAUTH_AUTHORIZATION_ENDPOINT` | Authorization endpoint URL for Databricks OAuth | | `DATABRICKS_OAUTH_TOKEN_ENDPOINT` | Token endpoint URL for Databricks OAuth | | `AUTH_OIDC_CLIENT_ID` | Required for the generic OIDC provider | | `AUTH_OIDC_CLIENT_SECRET` | Required for the generic OIDC provider | | `AUTH_OIDC_METADATA_DOCUMENT_URL` | OIDC discovery (`.well-known/openid-configuration`) URL for the generic OIDC provider | | `AUTH_OIDC_X509_CERT` | Optional X.509 public key certificate (PEM contents) for generic OIDC | | `AUTH_OIDC_X509_CERT_PATH` | Optional filesystem path to an X.509 public key certificate (PEM) for generic OIDC | | `AUTH_OIDC_PRIVATE_KEY` | Optional private key (PEM contents) for generic OIDC `private_key_jwt` | | `AUTH_OIDC_PRIVATE_KEY_PATH` | Optional filesystem path to a private key (PEM) for generic OIDC `private_key_jwt` | | `AUTH_OIDC_AUTH_METHOD` | OIDC client auth method (e.g. `client_secret_basic`, `client_secret_post`, `private_key_jwt`) (default=`client_secret_basic`) | | `AUTH_OIDC_AUTH_SIGNING_ALG` | Signing algorithm used for `private_key_jwt` (default=`RS256`) | | `AUTH_OIDC_SCOPES` | Space-separated list of additional scopes to request from the OIDC provider | | `SNOWFLAKE_OAUTH_CLIENT_ID` | Client ID for Snowflake OAuth (warehouse connection sign-in) | | `SNOWFLAKE_OAUTH_CLIENT_SECRET` | Client secret for Snowflake OAuth | | `SNOWFLAKE_OAUTH_AUTHORIZATION_ENDPOINT` | Authorization endpoint URL for Snowflake OAuth | | `SNOWFLAKE_OAUTH_TOKEN_ENDPOINT` | Token endpoint URL for Snowflake OAuth | ## S3 These variables allow you to configure [S3 Object Storage](/self-host/customize-deployment/configure-lightdash-to-use-external-object-storage), which is required to self-host Lightdash. | Variable | Description | | :- | :- | | `S3_ENDPOINT` | **(Required)** S3 endpoint for storing results | | `S3_PUBLIC_ENDPOINT` | Public-facing S3 endpoint used when generating signed download URLs returned to users. Defaults to `S3_ENDPOINT`. Set this when the bucket is reached internally on a different hostname than from the user's browser (e.g. a MinIO/cluster setup). | | `S3_BUCKET` | **(Required)** Name of the S3 bucket for storing files | | `S3_REGION` | **(Required)** Region where the S3 bucket is located | | `S3_ACCESS_KEY` | Access key for authenticating with the S3 bucket | | `S3_SECRET_KEY` | Secret key for authenticating with the S3 bucket | | `S3_AUTH_MODE` | How Lightdash authenticates requests to the bucket. `default` (the default value) signs requests with SigV4 and AWS credentials; use it for AWS S3, MinIO, and Google Cloud Storage HMAC keys. `gcp_oauth` sends a Google OAuth bearer token instead, which lets Lightdash reach Google Cloud Storage from a GKE workload identity service account with no static keys. See [external storage](/self-host/customize-deployment/configure-lightdash-to-use-external-object-storage#option-b-workload-identity-with-no-keys). One value applies to every storage bucket. | | `S3_USE_CREDENTIALS_FROM` | Configures the credential provider chain for **AWS** authentication when you do not set an access key and secret. Accepts `env` (environment variables), `token_file` (token file credentials), `ini` (initialization file credentials), `ecs` (container metadata credentials), and `ec2` (instance metadata credentials). List several values in order of preference. Every source is an AWS credential provider, so none of them works on Google Cloud. To authenticate to Google Cloud Storage without keys, set `S3_AUTH_MODE` instead. | | `S3_EXPIRATION_TIME` | Expiration time for scheduled deliveries files (default=259200, 3d) | | `S3_FORCE_PATH_STYLE` | Force path style addressing, needed for MinIO setup e.g. `http://your.s3.domain/BUCKET/KEY` instead of `http://BUCKET.your.s3.domain/KEY` (default=false) | | `RESULTS_S3_ENDPOINT` | S3 endpoint for the query results bucket (default=S3\_ENDPOINT) | | `RESULTS_S3_BUCKET` | Name of the S3 bucket used for storing query results (default=S3\_BUCKET) | | `RESULTS_S3_REGION` | Region where the S3 query storage bucket is located (default=S3\_REGION) | | `RESULTS_S3_ACCESS_KEY` | Access key for authenticating with the S3 query storage bucket (default=S3\_ACCESS\_KEY) | | `RESULTS_S3_SECRET_KEY` | Secret key for authenticating with the S3 query storage bucket (default=S3\_SECRET\_KEY) | | `RESULTS_S3_FORCE_PATH_STYLE` | Force path style addressing for the query results bucket (default=S3\_FORCE\_PATH\_STYLE) | | `UPLOADS_S3_BUCKET` | Bucket for long-lived uploads: AI agent avatars and homepage announcement images (default=S3\_BUCKET). Set it when `S3_BUCKET` has a lifecycle rule that deletes objects, otherwise those uploads disappear once the rule fires. Every other setting is inherited from `S3_*`. Keep it set once uploads have landed there: unsetting it makes them unreachable. Available from Lightdash 3.56.0. | ## Persistent download URLs When enabled, CSV and dashboard ZIP exports return a stable Lightdash-hosted URL (e.g. `https://lightdash.example.com/api/v1/file/{id}`) instead of a direct S3 signed URL. Each time this URL is accessed, Lightdash generates a short-lived S3 signed URL and redirects to it — so the underlying URL never goes stale and download links survive IAM credential rotation. The variables below act as instance-wide defaults. Organization admins can override them per organization (and per channel) from **Settings → Organization → Exporting**. See [Configuring download link expiration](/explore/create-scheduled-deliveries#configuring-download-link-expiration). Scheduled-delivery links longer than 7 days automatically switch to a persistent URL, even if `PERSISTENT_DOWNLOAD_URLS_ENABLED` is `false`. AWS presigned S3 URLs cannot live past 7 days, so this prevents links from silently breaking. | Variable | Description | | :- | :- | | `PERSISTENT_DOWNLOAD_URLS_ENABLED` | Enables persistent download URLs (default=false) | | `PERSISTENT_DOWNLOAD_URL_EXPIRATION_SECONDS` | How long the persistent URL remains accessible (default=259200, 3 days). When persistent URLs are enabled, `S3_EXPIRATION_TIME` is ignored and each redirect generates a signed URL that expires after 5 minutes. | | `PERSISTENT_DOWNLOAD_URL_EXPIRATION_SECONDS_EMAIL` | Override expiration for email download links. Falls back to `PERSISTENT_DOWNLOAD_URL_EXPIRATION_SECONDS` when not set. | | `PERSISTENT_DOWNLOAD_URL_EXPIRATION_SECONDS_SLACK` | Override expiration for Slack download links. Falls back to `PERSISTENT_DOWNLOAD_URL_EXPIRATION_SECONDS` when not set. | | `PERSISTENT_DOWNLOAD_URL_EXPIRATION_SECONDS_MSTEAMS` | Override expiration for MS Teams download links. Falls back to `PERSISTENT_DOWNLOAD_URL_EXPIRATION_SECONDS` when not set. | ## Cache [Enterprise](/support/feature-badges#enterprise) | Variable | Description | | :- | :- | | `RESULTS_CACHE_ENABLED` | Deprecated - forces results caching on or off for every project and locks each project's own setting. Unset it and turn on results caching per project under **Project settings → Results caching** instead | | `AUTOCOMPLETE_CACHE_ENABLED` | Enables caching for filter autocomplete results (default=false) | | `CACHE_STALE_TIME_SECONDS` | Defines how long cached results remain valid before being considered stale (default=86400, 24h) | These variables are **deprecated**; use the `RESULTS_S3_*` versions instead. | Variable | Description | | :- | :- | | `RESULTS_CACHE_S3_BUCKET` | Deprecated - use RESULTS\_S3\_BUCKET (default=S3\_BUCKET) | | `RESULTS_CACHE_S3_REGION` | Deprecated - use RESULTS\_S3\_REGION (default=S3\_REGION) | | `RESULTS_CACHE_S3_ACCESS_KEY` | Deprecated - use RESULTS\_S3\_ACCESS\_KEY (default=S3\_ACCESS\_KEY) | | `RESULTS_CACHE_S3_SECRET_KEY` | Deprecated - use RESULTS\_S3\_SECRET\_KEY (default=S3\_SECRET\_KEY) | ## Logging | Variable | Description | | :- | :- | | `LIGHTDASH_LOG_LEVEL` | The minimum level of log messages to show. `DEBUG`, `AUDIT`, `HTTP`, `INFO`, `WARN` `ERROR` (default=INFO) | | `LIGHTDASH_LOG_FORMAT` | The format of log messages. `PLAIN`, `PRETTY`, `JSON` (default=pretty) | | `LIGHTDASH_LOG_OUTPUTS` | The outputs to send log messages to (default=console) | | `LIGHTDASH_LOG_CONSOLE_LEVEL` | The minimum level of log messages to display on the console (default=LIGHTDASH\_LOG\_LEVEL) | | `LIGHTDASH_LOG_CONSOLE_FORMAT` | The format of log messages on the console (default=LIGHTDASH\_LOG\_FORMAT) | | `LIGHTDASH_LOG_FILE_LEVEL` | The minimum level of log messages to write to the log file (default=LIGHTDASH\_LOG\_LEVEL) | | `LIGHTDASH_LOG_FILE_FORMAT` | The format of log messages in the log file (default=LIGHTDASH\_LOG\_FORMAT) | | `LIGHTDASH_LOG_FILE_PATH` | The path to the log file. Requires `LIGHTDASH_LOG_OUTPUTS` to include `file` to enable file output. (default=./logs/all.log) | | `LIGHTDASH_LOG_AUDIT_ACTOR_AS_STRING` | When `true`, audit log events serialize the `actor` field to a JSON string instead of a nested object. Enable this if your log indexer (e.g. Elasticsearch) maps the `actor` field as text and would otherwise drop it. (default=false) | ### Audit log events Lightdash writes audit log events to the application log, at the `audit` log level. `audit` is below `info`, so set `LIGHTDASH_LOG_LEVEL=audit` or `LIGHTDASH_LOG_LEVEL=debug` to write them — with the default level, Lightdash does not write them. Set `LIGHTDASH_LOG_FORMAT=json` to get each entry as structured JSON instead of a plain-text line. Each entry has: * `id` and `timestamp`. * `actor`: `type` (`session`, `pat`, `oauth`, `service-account` or `anonymous`) and, for user actors, the user `uuid`, `email`, `organizationRole`, and `impersonatedBy` when the action ran under [impersonation](/support/support-access). * `action` and `resource` (`type`, `organizationUuid`, `projectUuid` when relevant, and `metadata`). * `context`: `ip`, `userAgent` and `requestId`. * `status`: `allowed`, `denied` or `allowed-bypass`. If your log indexer maps the `actor` field as text, set `LIGHTDASH_LOG_AUDIT_ACTOR_AS_STRING=true` to serialize it to a JSON string instead of a nested object. These access changes write an explicit event that names the target and, where a role changed, the before and after value: | Change | `action` | `resource.metadata` | | - | - | - | | Group membership change (in the app, through the API, or SCIM) | `update` on resource type `Group`, with `resource.metadata.event = group.membership_changed` | `groupUuid`, `operation` (`add`, `remove`, `replace` or `delete`), `memberUuids` | | Organization role set replaced | `organization_role_set.replaced` | target `userUuid`, the role set `before` and `after`, and the roles `added` and `removed` | | Project role set replaced | `project_role_set.replaced` | target `userUuid`, the role set `before` and `after`, and the roles `added` and `removed` | | Project group role set replaced | `project_group_role_set.replaced` | target `groupUuid`, the role set `before` and `after`, and the roles `added` and `removed` | | Direct access grant, revoke or role change on a dashboard, chart, SQL chart, document or app | `direct_access.grant`, `direct_access.revoke` or `direct_access.role_change` (plus `direct_access.reset` and `direct_access.replace` for bulk changes) | `resourceUuid`, `principalType`, `principalUuid`, `beforeRole`, `afterRole`. `reset` and `replace` carry `revokedUsers`, `revokedGroups`, `appliedUsers` and `appliedGroups` instead | | Login, logout, leaving an organization, impersonation start and stop | `login`, `logout`, `leave_organization`, `impersonation_start`, `impersonation_stop` | login provider and similar context | Other access changes — a user joining an organization, a single role assignment, adding, updating or removing a user's project access, and adding or removing a user's space access — only write the permission-check entry for the request that made the change (`actor`, `action`, `resource`, and `status` of `allowed` or `denied`). That entry doesn't name the user whose access changed or the role involved. ## Prometheus | Variable | Description | | :- | :- | | `LIGHTDASH_PROMETHEUS_ENABLED` | Enables/Disables Prometheus metrics endpoint (default=false) | | `LIGHTDASH_PROMETHEUS_PORT` | Port for Prometheus metrics endpoint (default=9090) | | `LIGHTDASH_PROMETHEUS_PATH` | Path for Prometheus metrics endpoint (default=/metrics) | | `LIGHTDASH_PROMETHEUS_PREFIX` | Prefix for metric names. | | `LIGHTDASH_GC_DURATION_BUCKETS` | Buckets for duration histogram in seconds. (default=0.001, 0.01, 0.1, 1, 2, 5) | | `LIGHTDASH_EVENT_LOOP_MONITORING_PRECISION` | Precision for event loop monitoring in milliseconds. Must be greater than zero. (default=10) | | `LIGHTDASH_PROMETHEUS_LABELS` | Labels to add to all metrics. Must be valid JSON | | `LIGHTDASH_PROMETHEUS_EVENT_METRICS_ENABLED` | Enables Prometheus counters for product events (e.g. chart views, downloads). (default=false) | | `LIGHTDASH_PROMETHEUS_EXTENDED_METRICS_ENABLED` | Enables extended Prometheus metrics including warehouse query timings. (default=false) | | `LIGHTDASH_PROMETHEUS_ALL_QUERY_METRICS_ENABLED` | Emits a Prometheus metric for every individual query (high cardinality). (default=false) | | `LIGHTDASH_PROMETHEUS_HTTP_METRICS_ENABLED` | Enables the OpenTelemetry `http.server.request.duration` histogram with semconv labels and route templates. (default=false) | ## OpenTelemetry tracing See [Configure OpenTelemetry tracing](/self-host/customize-deployment/configure-opentelemetry-tracing-for-self-hosted-lightdash) for setup, exporter selection, and sampling behaviour. | Variable | Description | | :- | :- | | `LIGHTDASH_OTEL_TRACES_ENABLED` | Switches tracing to OpenTelemetry mode: spans are created by the OpenTelemetry SDK and Sentry receives errors only. When `false`, tracing runs through Sentry. (default=false) | | `LIGHTDASH_OTEL_TRACES_SAMPLE_RATE` | Trace sampling ratio from 0.0 to 1.0. Falls back to `SENTRY_TRACES_SAMPLE_RATE` (deprecated) when unset. (default=1) | | `LIGHTDASH_OTEL_ALWAYS_SAMPLE_AI_TRACES` | Set to `false` to stop always-sampling AI agent traces, so they follow the global sampling ratio instead. (default=true) | | `LIGHTDASH_OTEL_DB_TRACES_ENABLED` | Adds spans for application database (Postgres) queries to traces, including the SQL statement. Requires OpenTelemetry mode. (default=false) | | `LIGHTDASH_OTEL_DB_TRACES_MAX_QUERY_LENGTH` | Maximum length of the SQL statement recorded on database spans; longer statements are truncated. Must be a non-negative integer. (default=1022) | | `OTEL_SDK_DISABLED` | Standard OpenTelemetry kill switch. When `true`, OpenTelemetry mode is off even if `LIGHTDASH_OTEL_TRACES_ENABLED=true`. | | `OTEL_TRACES_EXPORTER` | Comma-separated exporters: `otlp`, `console`, `zipkin`, or `none`. Unsupported values are ignored with a startup warning; `none` overrides any other value. (default=otlp) | | `OTEL_EXPORTER_OTLP_PROTOCOL` | OTLP protocol: `grpc`, `http/json`, or `http/protobuf`. `OTEL_EXPORTER_OTLP_TRACES_PROTOCOL` takes precedence. Unsupported values fall back to the default. (default=http/protobuf) | | `OTEL_EXPORTER_OTLP_ENDPOINT` | Base URL of your OTLP collector. Handled by the OpenTelemetry Node SDK, along with `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` and `OTEL_EXPORTER_OTLP_HEADERS`. | | `OTEL_SERVICE_NAME` | Service name attached to exported spans. (default=lightdash) | | `OTEL_LOG_LEVEL` | Enables OpenTelemetry SDK and exporter diagnostics at the given level (e.g. `DEBUG`). Lightdash redacts credentials, tokens, and span payloads from diagnostic output. | > [!NOTE] > > `OTEL_TRACES_SAMPLER` and `OTEL_TRACES_SAMPLER_ARG` are overridden by Lightdash. Control sampling with `LIGHTDASH_OTEL_TRACES_SAMPLE_RATE` instead. ## Security | Variable | Description | | :- | :- | | `LIGHTDASH_CSP_REPORT_ONLY` | Enables Content Security Policy (CSP) reporting only mode. This is recommended to be set to false in production. (default=true) | | `LIGHTDASH_CSP_ALLOWED_DOMAINS` | List of domains that are allowed to load resources from. Values must be separated by commas. | | `LIGHTDASH_CSP_REPORT_URI` | URI to send CSP violation reports to. | | `LIGHTDASH_CORS_ENABLED` | Enables Cross-Origin Resource Sharing (CORS). Set to `false` to disable CORS for the instance. (default=true) | | `LIGHTDASH_CORS_ALLOWED_DOMAINS` | Instance-level list of domains that are allowed to make cross-origin requests. Values must be separated by commas. | ## Analytics & Event Tracking RudderStack product telemetry is enabled by default on self-hosted deployments and points at `https://analytics.lightdash.com`. For the full payload, disable and redirect options, and the security-review checklist, see [Data flows and telemetry](/self-host/data-flows-and-telemetry). | Variable | Description | | :- | :- | | `RUDDERSTACK_WRITE_KEY` | RudderStack key used to track events (by default Lightdash's key is used). See [redirect telemetry to your own RudderStack](/self-host/data-flows-and-telemetry#configuration-3-send-telemetry-to-your-own-rudderstack). | | `RUDDERSTACK_DATA_PLANE_URL` | RudderStack data plane URL to which events are tracked (by default Lightdash's data plane is used) | | `RUDDERSTACK_ANALYTICS_DISABLED` | Set to `true` to stop the backend and browser from sending any RudderStack events. Takes precedence over `RUDDERSTACK_WRITE_KEY` and `RUDDERSTACK_DATA_PLANE_URL`. See [disable outbound telemetry](/self-host/data-flows-and-telemetry#configuration-2-disable-outbound-rudderstack-telemetry). | ### Usage analytics storage These settings configure storage for the [usage analytics project](/workspace-admin/usage-analytics-project). Follow the [self-hosted setup](/self-host/enterprise-features/usage-analytics) to enable collection. The base [S3 configuration](#s3) is required even when overriding the usage bucket. Authentication mode, credential providers and path-style addressing are inherited from that configuration. | Variable | Description | | - | - | | `USAGE_EVENTS_S3_ENDPOINT` | Usage storage endpoint. Defaults to `S3_ENDPOINT`. | | `USAGE_EVENTS_S3_BUCKET` | Usage storage bucket. Defaults to `S3_BUCKET`. | | `USAGE_EVENTS_S3_REGION` | Usage storage region. Defaults to `S3_REGION`. | | `USAGE_EVENTS_S3_ACCESS_KEY` | Usage storage access key. Defaults to `S3_ACCESS_KEY`. | | `USAGE_EVENTS_S3_SECRET_KEY` | Usage storage secret key. Defaults to `S3_SECRET_KEY`. | | `USAGE_EVENTS_FLUSH_INTERVAL_MS` | Buffered event flush interval in milliseconds. Default: `60000`. This is not the analytics data refresh interval. | | `USAGE_EVENTS_FLUSH_BATCH_SIZE` | Event count that triggers a buffered flush. Default: `1000`. | | `USAGE_EVENTS_BUFFER_MAX_SIZE` | Maximum buffered event count per writer. Default: `10000`. | ## AI agents Enterprise-only. For setup steps (which provider to pick, how to point at an LLM gateway, how to enable verified answers), see [AI agents](/self-host/enterprise-features/ai-agents). The tables below cover AI provider and runtime settings. | Variable | Description | | - | - | | `AI_COPILOT_ENABLED` | Enables AI agents (default=false) | | `ASK_AI_BUTTON_ENABLED` | Enables the "Ask AI" button in the interface for direct access to AI agents, when disabled agents can be accessed from `/ai-agents` route (default=false) | | `AI_EMBEDDING_ENABLED` | Enables AI embedding functionality for verified answers similarity matching (default=false) | | `AI_DEFAULT_PROVIDER` | Default AI provider to use (`openai`, `azure`, `anthropic`, `google`, `vertex`, `openrouter`, `bedrock`) (default=openai) | | `AI_DEFAULT_EMBEDDING_PROVIDER` | Default AI provider for embeddings (`openai`, `bedrock`, `azure`) (default=openai) | | `AI_COPILOT_DEBUG_LOGGING_ENABLED` | Enables debug logging for AI agents (default=false) | | `AI_COPILOT_TELEMETRY_ENABLED` | Enables telemetry for AI agents (default=false) | | `AI_COPILOT_THREAD_DUMP_ENABLED` | Enables the [AI thread debug dump](/support/ai-thread-debug-dump) download action for organization AI admins (default=false) | | `AI_COPILOT_REQUIRES_FEATURE_FLAG` | Requires a feature flag to use AI agents (default=false) | | `AI_COPILOT_MAX_QUERY_LIMIT` | Maximum number of rows returned in AI-generated queries and by the MCP `run_metric_query` tool (default=5000) | | `AI_COPILOT_RUN_SQL_MAX_LIMIT` | Maximum number of rows the AI agent `run_sql` tool can return. Falls back to `AI_COPILOT_MAX_QUERY_LIMIT`, then to 5000. | | `AI_VERIFIED_ANSWER_SIMILARITY_THRESHOLD` | Similarity threshold (0-1) for verified answer matching (default=0.6) | | `AI_COPILOT_MCP_TIMEOUT_MS` | Timeout in milliseconds when connecting to an external MCP server (default=20000). | | `AI_TOOL_DESCRIPTION_MAX_CHARS` | Maximum tool-result description length sent to the AI agent (default=600). | | `AI_ANALYTICS_PROJECT_UUID` | UUID of the project used to render the internal AI usage analytics dashboard. | | `AI_ANALYTICS_DASHBOARD_UUID` | UUID of the dashboard used to render the internal AI usage analytics dashboard. | | `ANALYTICS_EMBED_SECRET` | Secret used to sign the embed token for the AI usage analytics dashboard. [**Insights**](/agents/visibility) can't load until this, `AI_ANALYTICS_PROJECT_UUID` and `AI_ANALYTICS_DASHBOARD_UUID` are all set. | | `AI_AGENT_MCP_ALLOW_PRIVATE_ADDRESSES` | When `true`, allows AI agent [MCP server](/agents/connect-external-mcp-servers) URLs to point at private/internal network addresses (e.g. `127.0.0.1`, RFC1918 ranges). Useful for self-hosted deployments where MCP servers run inside the same private network. Leave unset or `false` to enforce public-address-only validation (default=false). | Provide credentials for the provider set in `AI_DEFAULT_PROVIDER`. For provider selection and end-to-end setup, see [Self-hosted AI agents](/self-host/enterprise-features/ai-agents). #### Data app gateway overrides Optional HTTP(S) base URLs for the Data app coding agent using instance-managed credentials. For scope, authentication, URL conventions, and an example, see [Separate gateway routes for Data apps](/self-host/enterprise-features/ai-agents#separate-gateway-routes-for-data-apps). | Variable | Coding agent | Fallback when unset or empty | | - | - | - | | `DATA_APPS_ANTHROPIC_BASE_URL` | Claude using Anthropic | `ANTHROPIC_BASE_URL` | | `DATA_APPS_BEDROCK_BASE_URL` | Claude or Codex using Bedrock | `BEDROCK_BASE_URL` | | `DATA_APPS_OPENAI_BASE_URL` | Codex using OpenAI | `OPENAI_BASE_URL` | #### OpenAI Configuration | Variable | Description | | - | - | | `OPENAI_API_KEY` | (Required when using OpenAI) API key for OpenAI | | `OPENAI_MODEL_NAME` | OpenAI model name to use (default=gpt-6-sol) | | `OPENAI_EMBEDDING_MODEL` | OpenAI embedding model for verified answers (default=text-embedding-3-small) | | `OPENAI_BASE_URL` | Optional base URL for OpenAI compatible API | | `OPENAI_AVAILABLE_MODELS` | Comma-separated list of models available in the model picker (default=All supported models) | | `OPENAI_ZERO_DATA_RETENTION` | Set to `true` if your OpenAI account or LLM gateway enforces Zero Data Retention (ZDR). (default=false) | | `OPENAI_CUSTOM_HEADERS` | JSON object of extra HTTP headers to send with every OpenAI request | | `OPENAI_SUPPORTS_STREAMING` | Set to `false` if the endpoint behind `OPENAI_BASE_URL` (e.g. an LLM gateway) doesn't support streaming (SSE) completions — Lightdash will make non-streaming requests instead (default=true) | | `OPENAI_USE_CHAT_COMPLETIONS` | Set to `true` if the endpoint behind `OPENAI_BASE_URL` only implements the Chat Completions API (`/chat/completions`) and not the Responses API. Reasoning summaries are unavailable in this mode. (default=false) | #### Anthropic Configuration | Variable | Description | | - | - | | `ANTHROPIC_API_KEY` | (Required when using Anthropic) API key for Anthropic | | `ANTHROPIC_MODEL_NAME` | Anthropic model name to use (default=claude-sonnet-5-5) | | `ANTHROPIC_BASE_URL` | Optional HTTP(S) base URL for an Anthropic-compatible gateway. Configure the base before `/v1`; the configured `ANTHROPIC_API_KEY` is sent as a bearer token. | | `ANTHROPIC_AVAILABLE_MODELS` | Comma-separated list of models available in the model picker (default=All supported models) | | `ANTHROPIC_CUSTOM_HEADERS` | JSON object of extra HTTP headers to send with every Anthropic request | | `ANTHROPIC_SUPPORTS_STREAMING` | Set to `false` if your Anthropic endpoint or gateway doesn't support streaming (SSE) completions — Lightdash will make non-streaming requests instead (default=true) | #### Google Gemini Configuration | Variable | Description | | :- | :- | | `GEMINI_API_KEY` | Required when using Google Gemini. | | `GEMINI_MODEL_NAME` | Default Gemini model (default=gemini-3.8-flash). | | `GEMINI_BASE_URL` | Optional HTTP(S) base URL for a Gemini-compatible gateway. | | `GEMINI_AVAILABLE_MODELS` | Comma-separated list of supported models available in the model picker (default=all supported models). | | `GEMINI_SUPPORTS_STREAMING` | Set to `false` for an endpoint without streaming support (default=true). | #### Google Vertex AI Configuration | Variable | Description | | :- | :- | | `GOOGLE_VERTEX_API_KEY` | Vertex AI API key. Takes precedence over Application Default Credentials. | | `GOOGLE_VERTEX_PROJECT` | Google Cloud project ID. Required when using Application Default Credentials instead of an API key. | | `GOOGLE_VERTEX_LOCATION` | Location for Application Default Credentials (default=global). | | `GOOGLE_VERTEX_MODEL_NAME` | Default Vertex model (default=gemini-3.8-flash). | | `GOOGLE_VERTEX_FAST_MODEL_NAME` | Model for lightweight tasks (default=GOOGLE\_VERTEX\_MODEL\_NAME). Both configured models appear in the model picker. | | `GOOGLE_VERTEX_SUPPORTS_STREAMING` | Set to `false` for an endpoint without streaming support (default=true). | #### Azure AI Configuration | Variable | Description | | - | - | | `AZURE_AI_API_KEY` | (Required when using Azure AI) API key for Azure AI | | `AZURE_AI_ENDPOINT` | (Required when using Azure AI) Endpoint for Azure AI | | `AZURE_AI_API_VERSION` | (Required when using Azure AI) API version for Azure AI | | `AZURE_AI_DEPLOYMENT_NAME` | (Required when using Azure AI) Deployment name for Azure AI | | `AZURE_EMBEDDING_DEPLOYMENT_NAME` | Deployment name for Azure embedding model (default=text-embedding-3-small) | | `AZURE_USE_DEPLOYMENT_BASED_URLS` | Use deployment-based URLs for Azure OpenAI API calls (default=true) | | `AZURE_AI_DEPLOYMENT_SUPPORTS_REASONING` | Set to `true` if your Azure deployment exposes a reasoning-capable model (e.g. `o3`). Enables reasoning-mode prompts. (default=false) | | `AZURE_AI_USE_CHAT_COMPLETIONS` | Set to `true` if your endpoint (e.g. a gateway that mirrors the Azure OpenAI URL layout) only implements the Chat Completions API and not the Responses API. Reasoning summaries are unavailable in this mode. (default=false) | | `AZURE_AI_REASONING_EFFORT` | Overrides the reasoning effort sent to a reasoning-capable deployment: `none`, `minimal`, `low`, `medium` or `high`. Only used when `AZURE_AI_DEPLOYMENT_SUPPORTS_REASONING=true`. Set it to a value your model accepts when the default fails, e.g. `minimal` for a `gpt-5-mini` deployment on Chat Completions, which rejects the default `none`. (default: `medium` on the Responses API, `none` on Chat Completions) | | `AZURE_AI_CUSTOM_HEADERS` | JSON object of extra HTTP headers to send with every Azure AI request | | `AZURE_AI_SUPPORTS_STREAMING` | Set to `false` if your Azure AI endpoint or gateway doesn't support streaming (SSE) completions — Lightdash will make non-streaming requests instead (default=true) | #### OpenRouter Configuration | Variable | Description | | - | - | | `OPENROUTER_API_KEY` | (Required when using OpenRouter) API key for OpenRouter | | `OPENROUTER_MODEL_NAME` | OpenRouter model name to use (default=openai/gpt-5.2-2025-12-11) | | `OPENROUTER_AVAILABLE_MODELS` | Comma-separated list of additional model IDs available in the model picker. The configured default model is always included. | | `OPENROUTER_PROVIDER_ORDER` | Comma-separated ordered list of upstream providers to prefer (default=unset). | | `OPENROUTER_SORT_ORDER` | Provider sorting method (`price`, `throughput`, `latency`) (default=unset) | | `OPENROUTER_ALLOWED_PROVIDERS` | Comma-separated list of allowed providers (default=unrestricted) | | `OPENROUTER_CUSTOM_HEADERS` | JSON object of extra HTTP headers to send with every OpenRouter request | | `OPENROUTER_SUPPORTS_STREAMING` | Set to `false` if your OpenRouter endpoint or gateway doesn't support streaming (SSE) completions — Lightdash will make non-streaming requests instead (default=true) | #### AWS Bedrock Configuration | Variable | Description | | - | - | | `BEDROCK_API_KEY` | (Required if not using IAM credentials) API key for Bedrock (alternative to IAM credentials) | | `BEDROCK_ACCESS_KEY_ID` | (Required if not using API key) AWS access key ID for Bedrock | | `BEDROCK_SECRET_ACCESS_KEY` | (Required if using access key ID) AWS secret access key for Bedrock | | `BEDROCK_SESSION_TOKEN` | AWS session token (for temporary credentials) | | `BEDROCK_USE_DEFAULT_CREDENTIALS` | Set to `true` to use the standard AWS credential chain instead of an API key or static credentials. | | `BEDROCK_REGION` | **(Required)** AWS region for Bedrock | | `BEDROCK_MODEL_NAME` | Bedrock model name to use (default=claude-sonnet-4-5) | | `BEDROCK_MAX_OUTPUT_TOKENS` | Maximum output tokens per model call, sent to Bedrock as the `maxTokens` inference setting. Raise it if long answers are cut off or come back empty. Must be a positive integer; invalid values stop the backend at startup. For models with a fixed thinking budget, the budget is added on top of this cap. (default=24000) | | `BEDROCK_EMBEDDING_MODEL` | Bedrock embedding model for verified answers (default=cohere.embed-english-v3) | | `BEDROCK_BASE_URL` | Optional HTTP(S) base URL for a Bedrock-compatible gateway. Routes backend Bedrock calls and Bedrock-backed Data app coding agents through the gateway. | | `CLAUDE_CODE_SKIP_BEDROCK_AUTH` | Set to `true` or `1` to omit AWS authentication from Claude Code when `BEDROCK_BASE_URL` points to a gateway that performs upstream authentication. The backend still requires a supported Bedrock credential mode. | | `BEDROCK_AVAILABLE_MODELS` | Comma-separated list of models available in the model picker (default=All supported models) | | `BEDROCK_INFERENCE_PROFILE_PREFIX` | Optional prefix prepended to Bedrock model IDs to target a cross-region inference profile (e.g. `us`, `eu`). Overrides the default region-based prefix derived from `BEDROCK_REGION`. | | `BEDROCK_CUSTOM_HEADERS` | JSON object of extra HTTP headers to send with every Bedrock request | | `BEDROCK_SUPPORTS_STREAMING` | Set to `false` if your Bedrock endpoint or gateway doesn't support streaming (SSE) completions — Lightdash will make non-streaming requests instead (default=true) | #### Supported Models The model picker shows the current supported catalog for each configured provider. Use `*_AVAILABLE_MODELS` to limit selection where supported. OpenAI-compatible gateways can also expose custom model IDs; OpenRouter uses your configured default and additional model IDs, and Vertex uses its configured default and fast model. Model names can resolve to exact snapshots. Bedrock also adds an inference-profile prefix based on `BEDROCK_REGION` or `BEDROCK_INFERENCE_PROFILE_PREFIX`. Autopilot cleanup qualification applies to the resolved provider/model pair; see [model qualification](/self-host/enterprise-features/ai-agents#model-qualification-and-cleanup). ## Slack Integration These variables enable you to configure the [Slack integration](/integrations/slack). | Variable | Description | | :- | :- | | `SLACK_SIGNING_SECRET` | Required for Slack integration | | `SLACK_CLIENT_ID` | Required for Slack integration | | `SLACK_CLIENT_SECRET` | Required for Slack integration | | `SLACK_STATE_SECRET` | Required for Slack integration (default=slack-state-secret) | | `SLACK_APP_TOKEN` | App token for Slack | | `SLACK_PORT` | Port for Slack integration (default=4351) | | `SLACK_SOCKET_MODE` | Enable socket mode for Slack (default=false) | | `SLACK_CHANNELS_CACHED_TIME` | Time in milliseconds to cache Slack channels (default=600000, 10 minutes) | | `SLACK_SUPPORT_URL` | URL for Slack support | | `SLACK_LINK_SHARE_IMAGE_PREVIEW_ENABLED` | Enables image previews when Lightdash links are unfurled in Slack. (default=true) | ## dbt Configure how Lightdash runs the dbt subprocess during project compilation. | Variable | Description | | - | - | | `ALLOW_DBT_COMMANDS_ACCESS_TO_ENV_VARS` | Comma-separated list of environment variable names from the Lightdash server's environment to pass through to the dbt subprocess. Use this when your dbt project reads values with `env_var()` (for example in macros) that you want to source from the host machine instead of setting per-project in Lightdash. By default the dbt subprocess does not inherit the server's environment. Only the names on this allowlist are forwarded. | ## GitHub Integration These variables enable you to configure [Github integrations](/self-host/customize-deployment/configure-github-for-lightdash) | Variable | Description | | :- | :- | | `GITHUB_PRIVATE_KEY` | **(Required)** GitHub private key for GitHub App authentication | | `GITHUB_APP_ID` | **(Required)** GitHub Application ID | | `GITHUB_CLIENT_ID` | **(Required)** GitHub OAuth client ID | | `GITHUB_CLIENT_SECRET` | **(Required)** GitHub OAuth client secret | | `GITHUB_APP_NAME` | **(Required)** Name of the GitHub App | | `GITHUB_REDIRECT_DOMAIN` | Domain for GitHub OAuth redirection | | `GITHUB_WEBHOOK_SECRET` | Secret used to verify incoming GitHub webhook signatures (e.g. for dbt PR previews) | ## GitLab Integration These variables enable you to configure the GitLab integration for dbt project sync. | Variable | Description | | :- | :- | | `GITLAB_CLIENT_ID` | OAuth client ID for the GitLab application | | `GITLAB_CLIENT_SECRET` | OAuth client secret for the GitLab application | | `GITLAB_REDIRECT_DOMAIN` | Domain used to build the GitLab OAuth callback URL. Defaults to the subdomain of `SITE_URL`. | ## Microsoft Teams Integration These variables enable you to configure Microsoft Teams integration. | Variable | Description | | :- | :- | | `MICROSOFT_TEAMS_ENABLED` | Enables Microsoft Teams integration (default=false) | ## Google Cloud Platform These variables enable you to configure Google Cloud Platform integration. | Variable | Description | | :- | :- | | `GOOGLE_CLOUD_PROJECT_ID` | Google Cloud Platform project ID | | `GOOGLE_DRIVE_API_KEY` | Google Drive API key | | `AUTH_GOOGLE_ENABLED` | Enables Google authentication (default=false) | | `AUTH_ENABLE_GCLOUD_ADC` | Enables Google Cloud Application Default Credentials (default=false) | | `AUTH_GOOGLE_INCLUDE_BIGQUERY_SCOPE` | When `true`, bundles the BigQuery scope into the Google login flow so BigQuery SSO users complete a single consent screen instead of two (default=false) | ## Embedding Enterprise-only. To turn embedding on, add `embedding` to [`LIGHTDASH_ENABLE_FEATURE_FLAGS`](#feature-flags). For setup steps and how the allow-list of iframe origins works, see [embedding](/self-host/enterprise-features#embedding). | Variable | Description | | :- | :- | | `EMBED_ALLOW_ALL_DASHBOARDS_BY_DEFAULT` | When creating new embeds, allow all dashboards by default (default=false) | | `EMBED_ALLOW_ALL_CHARTS_BY_DEFAULT` | When creating new embeds, allow all charts by default (default=false) | | `LIGHTDASH_IFRAME_EMBEDDING_DOMAINS` | List of domains that are allowed to embed Lightdash in an iframe. Values must be separated by commas. | | `EMBED_EVENT_SYSTEM_ENABLED` | Enables the embed event system that lets host pages subscribe to embedded-dashboard events. (default=false) | | `EMBED_EVENT_SYSTEM_POST_MESSAGE_ENABLED` | When `true`, the embed event system also dispatches events via `window.postMessage` to the parent frame. (default=false) | | `EMBED_EVENT_RATE_LIMIT_MAX_EVENTS` | Maximum number of embed events per rate-limit window. (default=10) | | `EMBED_EVENT_RATE_LIMIT_WINDOW_MS` | Embed event rate-limit window in milliseconds. (default=1000) | ## Service account Enterprise-only. See [service accounts](/self-host/enterprise-features#service-accounts) for setup. | Variable | Description | | :- | :- | | `SERVICE_ACCOUNT_ENABLED` | Enables service account functionality (default=false) | ## Sentry These variables enable you to configure Sentry for error tracking. | Variable | Description | | :- | :- | | `SENTRY_DSN` | Sentry DSN for both frontend and backend | | `SENTRY_BE_DSN` | Sentry DSN for backend only | | `SENTRY_FE_DSN` | Sentry DSN for frontend only | | `SENTRY_BE_SECURITY_REPORT_URI` | URI for Sentry backend security reports | | `SENTRY_TRACES_SAMPLE_RATE` | Sample rate for Sentry traces (0.0 to 1.0) (default=0.1) | | `SENTRY_PROFILES_SAMPLE_RATE` | Sample rate for Sentry profiles (0.0 to 1.0) (default=0.2) | | `SENTRY_ANR_ENABLED` | Enables Sentry Application Not Responding detection (default=false) | | `SENTRY_ANR_CAPTURE_STACKTRACE` | Captures stacktrace for ANR events (default=false) | | `SENTRY_ANR_TIMEOUT` | Timeout in milliseconds for ANR detection | ## Intercom & Pylon These variables enable you to configure Intercom and Pylon for customer support and feedback. | Variable | Description | | :- | :- | | `INTERCOM_APP_ID` | Intercom application ID | | `INTERCOM_APP_BASE` | Base URL for Intercom API (default=[https://api-iam.intercom.io](https://api-iam.intercom.io)) | | `PYLON_APP_ID` | Pylon application ID | | `PYLON_IDENTITY_VERIFICATION_SECRET` | Secret for verifying Pylon identities | ## Kubernetes These variables enable you to configure Kubernetes integration. | Variable | Description | | :- | :- | | `K8S_NODE_NAME` | Name of the Kubernetes node | | `K8S_POD_NAME` | Name of the Kubernetes pod | | `K8S_POD_NAMESPACE` | Namespace of the Kubernetes pod | | `LIGHTDASH_CLOUD_INSTANCE` | Identifier for Lightdash cloud instance | ## **Organization appearance** These variables allow you to customize the default appearance settings for your Lightdash instance's organizations. This color palette will be set for all organizations in your instance. You can't choose another one while these env vars are set. | Variable | Description | | :- | :- | | `OVERRIDE_COLOR_PALETTE_NAME` | Name of the default color palette | | `OVERRIDE_COLOR_PALETTE_COLORS` | Comma-separated list of hex color codes for the default color palette (must be 20 colors) | ## Instance branding Enterprise-only. Replaces the Lightdash logo and name on the login page, navigation bar, and browser tab. A signed-in organization's [brand appearance](/workspace-admin/appearance#brand-appearance) takes precedence. | Variable | Description | | :- | :- | | `LIGHTDASH_INSTANCE_LOGO` | Square PNG, JPEG, WebP, GIF, or SVG logo, as an `https://` URL or a base64 data URL. | | `LIGHTDASH_INSTANCE_NAME` | Name shown in place of "Lightdash" on the login page and in browser tab titles. | ## Pre-aggregates Enterprise-only. For setup steps and when a pre-aggregate worker is needed, see [pre-aggregates](/self-host/enterprise-features/pre-aggregates). | Variable | Description | | :- | :- | | `PRE_AGGREGATES_ENABLED` | Enables pre-aggregates. Requires `LIGHTDASH_LICENSE_KEY` and the bucket below; disable per instance with `LIGHTDASH_DISABLE_FEATURE_FLAGS=pre-aggregates`. (default=false) | | `PRE_AGGREGATES_PARQUET_ENABLED` | Store materializations as Parquet files instead of JSON Lines. Set `true`. (default=false) | | `PRE_AGGREGATE_DUCKDB_QUERY_MEMORY_LIMIT` | DuckDB memory limit for pre-aggregate queries (e.g. `4GB`). | | `PRE_AGGREGATE_RESULTS_S3_BUCKET` | S3 bucket for pre-aggregate Parquet storage. Required when configuring pre-aggregate result storage. | | `PRE_AGGREGATE_RESULTS_S3_REGION` | Region for the pre-aggregate S3 bucket. Required when configuring pre-aggregate result storage. | | `PRE_AGGREGATE_RESULTS_S3_ACCESS_KEY` | Access key for the pre-aggregate S3 bucket. | | `PRE_AGGREGATE_RESULTS_S3_SECRET_KEY` | Secret key for the pre-aggregate S3 bucket. | ## Data apps runtime Enterprise-only. Sandboxes execute through [E2B](https://e2b.dev/). For setup steps (coding-agent choice, model provider, S3 bucket, sandbox provider), see [data apps](/self-host/enterprise-features/data-apps). | Variable | Description | | :- | :- | | `APPS_RUNTIME_ENABLED` | Enables the data apps runtime. (default=false) | | `APPS_CODING_AGENT` | Coding agent used to generate Data apps: `claude` (default) or `codex`. Codex uses `OPENAI_API_KEY` unless `AI_DEFAULT_PROVIDER=bedrock`. | | `APP_RUNTIME_LIGHTDASH_ORIGIN` | Origin the sandbox uses to call back into Lightdash. Defaults to `SITE_URL`. | | `APP_RUNTIME_CDN_ORIGIN` | Origin where built app bundles are served from (CDN in front of `APPS_S3_BUCKET`). | | `APP_RUNTIME_PREVIEW_ORIGIN` | Origin used to render app previews (typically a separate subdomain to isolate cookies). | | `APP_RUNTIME_CSP_ALLOWED_ORIGINS` | Comma-separated list of extra origins to add to the data apps CSP allow-list. | | `APP_RUNTIME_EXTERNAL_CONNECTION_ALLOWED_PRIVATE_HOST_CIDRS` | Comma-separated `hostname@CIDR` exceptions allowing external connections, connection tests, and OAuth client-credentials token requests to reach trusted private addresses. Both the hostname and CIDR must match. Default: empty; private addresses remain blocked. Instance-wide; requires a backend restart. See [private-network external connections](/self-host/enterprise-features/data-apps#private-network-external-connections) for syntax, prerequisites, and security boundaries. | | `LIGHTDASH_APP_SAMPLE_DATA_ENABLED` | Allows data app generation to run chart queries and share up to 10 sample rows with the app generator, so it can see real values such as date ranges, labels, and magnitudes. Users still opt in per chart with **Include sample data**. Set to `false` to disable the option instance-wide and hide it in the UI; Lightdash then never sends warehouse row values to the sandbox or the LLM during app generation. (default=true) | | `LIGHTDASH_APP_CAPTURES_ENABLED` | Allows data app screenshots, file attachments sent to the coding agent, manual and automatic thumbnails, and the app image in Slack build notifications and link previews. Set to `false` to disable all of them instance-wide and hide them in the UI. This is the ceiling for the organization-level **Allow screenshots and attachments** setting: organizations can turn captures off but can't turn them on when this is `false`. See [turning off screenshots and attachments](/data-apps#turning-off-screenshots-and-attachments). (default=true) | | `APPS_S3_BUCKET` | S3 bucket where built data app bundles are stored. Defaults to the main `S3_BUCKET`. | | `APPS_S3_REGION` | Region for the data apps S3 bucket. Defaults to `S3_REGION`. | | `APPS_S3_ACCESS_KEY` | Access key for the data apps S3 bucket. Defaults to `S3_ACCESS_KEY`. | | `APPS_S3_SECRET_KEY` | Secret key for the data apps S3 bucket. Defaults to `S3_SECRET_KEY`. | | `E2B_API_KEY` | API key for the E2B sandbox provider. | | `E2B_TEMPLATE_NAME` | E2B template used for general data app sandboxes. Defaults to Lightdash's public template (`lightdash/lightdash-data-app`) so self-hosters work out of the box. Override to use your own template. | | `E2B_TEMPLATE_TAG` | E2B template tag. Defaults to the running Lightdash version so the template matches the release. | | `E2B_AI_WRITEBACK_TEMPLATE_NAME` | E2B template used for AI writeback sandboxes. (default=`lightdash-ai-writeback`) | | `E2B_AI_WRITEBACK_TEMPLATE_TAG` | E2B AI writeback template tag. Defaults to the running Lightdash version. | `APPS_CODING_AGENT=codex` supports GPT-5.6 Sol, Terra, and Luna, with Terra as the default. When `AI_DEFAULT_PROVIDER=bedrock`, Lightdash runs those models through Amazon Bedrock instead of OpenAI directly. `AI_DEFAULT_PROVIDER` also controls AI agents; `APPS_CODING_AGENT` affects only Data apps. ## Chart library Enterprise-only. Applies when the `chart-type-registry` feature flag is on. For enabling the library and reading it from a private mirror, see [chart library](/self-host/enterprise-features/data-apps#chart-library). | Variable | Description | | :- | :- | | `LIGHTDASH_CHART_REGISTRY_URL` | Base URL of the chart library the instance reads. Unset uses Lightdash's public library at `https://lightdash.github.io/lightdash-library`. Set it to the URL of a [private mirror](/self-host/enterprise-features/data-apps#mirror-the-chart-library). An empty value turns the library off and hides the **Chart library** tab. | | `LIGHTDASH_CHART_REGISTRY_CHANNEL` | Which index the instance reads: `stable` (default) or `next`, which also lists beta chart types. | | `LIGHTDASH_CHART_REGISTRY_ALLOW_PRIVATE_HOSTS` | Set to `true` when the library URL resolves to a private or internal address, such as a mirror inside your network. Lightdash otherwise refuses private addresses. Requests still have to use `https`, redirects are still refused, and the connection stays pinned to the address Lightdash resolved. (default=false) | | `LIGHTDASH_CHART_REGISTRY_AUTHORIZATION_HEADER` | Full `Authorization` header value sent with every library request, for example `Basic ` or `Bearer `. Use it for a mirror that requires authentication. Credentials in the URL (`user:pass@host`) are not supported. Unset sends no credentials. | | `LIGHTDASH_CHART_REGISTRY_ALLOW_INSECURE` | Allows a plain `http` library URL and turns off address pinning. For local development fixtures only. Logs a security warning at startup. Do not use it for a mirror; use `LIGHTDASH_CHART_REGISTRY_ALLOW_PRIVATE_HOSTS` instead. (default=false) | ## Autopilot Enterprise-only scheduled project maintenance, always using the AI SDK and shared AI provider configuration. Enable AI agents, configure a provider at the instance or organization level, and enable the `ai-autopilot` feature flag. Apply the same environment configuration to API and scheduler processes and restart both after changes. See [Autopilot setup](/self-host/enterprise-features/ai-agents#autopilot). | Variable | Description | | :- | :- | | `MANAGED_AGENT_SCHEDULE` | Fallback cron schedule when no project schedule is selected. Default: `0 0 * * *`. | | `MANAGED_AGENT_SESSION_TIMEOUT_MS` | Per-run deadline in milliseconds. Default: `600000` (10 minutes). Cancellation is cooperative; an in-progress write may finish after the deadline. | | `MANAGED_AGENT_MAX_STEPS` | Maximum model steps per run. Default: `120`. Reaching the cap ends the run with an error and preserves recorded actions and any captured summary. | | `MANAGED_AGENT_VALIDATED_MODELS` | JSON array of exact `{ "provider", "model", "mode" }` qualifications. Mode: `observe`, `flag`, or `cleanup`. Default: a built-in list of recent Claude Opus, Claude Sonnet and GPT models qualified for `cleanup`. Setting the variable replaces that list; an empty value qualifies no model. See [model qualification](/self-host/enterprise-features/ai-agents#model-qualification-and-cleanup). | Autopilot needs no separate provider key or runtime selector. Remove the retired hosted-runtime settings from your deployment; see [upgrade guidance](/self-host/enterprise-features/ai-agents#upgrading-from-the-hosted-runtime). ## Agent identity [Beta](/support/feature-badges#beta) Enterprise-only. Applies when the `agent-identity` feature flag is on. See [Agent identity](/self-host/enterprise-features/ai-agents#agent-identity). | Variable | Description | | :- | :- | | `AGENT_RESULT_IDENTITY_CHECK_ENABLED` | Compares the identity that produced a saved result with the reader (default=true). Only the value `false` turns it off, and it turns off only this comparison. The access checks and the results cache separation stay on. See [Who can read a saved result](/agents/agent-identity#who-can-read-a-saved-result). | ## MCP Enterprise-only. For setup steps, connecting AI assistants, and network requirements, see [MCP](/self-host/enterprise-features/mcp). | Variable | Description | | :- | :- | | `MCP_ENABLED` | Enables the Lightdash Model Context Protocol (MCP) server. Requires `LIGHTDASH_LICENSE_KEY`. (default=false) | | `MCP_RUN_SQL_MAX_LIMIT` | Maximum number of rows the MCP `run_sql` tool can return. Does not inherit `AI_COPILOT_MAX_QUERY_LIMIT` (default=5000). | | `AUTH_OAUTH_SERVER_ACCESS_TOKEN_LIFETIME` | Lifetime in seconds of the access tokens Lightdash's OAuth server issues, including MCP connections (default=3600, 1 hour). | | `AUTH_OAUTH_SERVER_REFRESH_TOKEN_LIFETIME` | Lifetime in seconds of the refresh tokens Lightdash's OAuth server issues, including MCP connections; once it expires, the client repeats the browser sign-in flow (default=1209600, 2 weeks). | ## Metrics SQL API Postgres wire protocol endpoint for the semantic layer. See [Metrics SQL API](/integrations/metrics-sql-api). | Variable | Description | | :- | :- | | `PGWIRE_PORT` | Port the Metrics SQL API server listens on, e.g. `5432`. The server only starts when this is set. Requires `LIGHTDASH_LICENSE_KEY`. Disabled when unset (default). | | `PGWIRE_SSL_CERT_PATH` | Path to the PEM server certificate (leaf first, then chain) for the Metrics SQL API. Required when `PGWIRE_PORT` is set, unless TLS is explicitly disabled. The file is watched, so certificate renewals apply without a restart. | | `PGWIRE_SSL_KEY_PATH` | Path to the PEM private key for the Metrics SQL API certificate. Required alongside `PGWIRE_SSL_CERT_PATH`. | | `PGWIRE_SSL_MODE` | `require` (default) or `disabled`. With `require`, the server terminates TLS itself and rejects plaintext connections before any credentials are exchanged; Lightdash refuses to start if `PGWIRE_PORT` is set without a certificate. Set `disabled` only on fully trusted networks or behind a Postgres-aware TLS-terminating proxy — tokens are sent in plaintext. | ## NATS worker Optional NATS-backed query workers. When enabled, Lightdash routes query execution to dedicated [NATS worker pods](/self-host/nats-workers) instead of running queries on the main API server. Enable at least one warehouse worker to process the routed queries. | Variable | Description | | :- | :- | | `NATS_ENABLED` | Routes query execution through NATS worker pods. Requires at least one [warehouse worker](/self-host/nats-workers/warehouse-workers) to process the queries. (default=false) | | `NATS_URL` | NATS server connection URL. **Required when `NATS_ENABLED=true`.** | | `NATS_WORKER_PORT` | Port the NATS worker process listens on for healthchecks. | ## Initialize instance [Enterprise](/support/feature-badges#enterprise) When a new Lightdash instance is created, and there are no orgs and projects. You can initialize a new org and project using ENV variables to simplify the deployment process. See the [pricing page](https://www.lightdash.com/pricing) for what each plan includes. Only Databricks project types and GitHub dbt configuration are supported. Initial setup always creates an organization, an admin user, and at least one project. Setting `LD_SETUP_ADMIN_EMAIL` turns it on, and Lightdash then also requires `LD_SETUP_PROJECT_PAT` for a single project or [`LD_SETUP_PROJECTS`](#initialize-multiple-projects) for several. If neither is set, the server fails to start. Initialization is skipped once an organization and project exist — on subsequent restarts, only the [update instance](#update-instance) call is made. > [!WARNING] > > If you have multiple organizations or projects, the update call fails and the instance will not start. Remove the variables listed in [Update instance](#update-instance) to restart safely. | Variable | Description | | :- | :- | | `LD_SETUP_ADMIN_NAME` | Name of the admin user for initial setup (default=Admin User) | | `LD_SETUP_ADMIN_EMAIL` | **(Required)** Email of the admin user for initial setup | | `LD_SETUP_ORGANIZATION_UUID` | UUID of the organization to configure. Use when multiple organizations exist to target a specific one instead of requiring exactly one to exist. | | `LD_SETUP_ORGANIZATION_EMAIL_DOMAIN` | Comma-separated list of email domains for organization whitelisting | | `LD_SETUP_ORGANIZATION_DEFAULT_ROLE` | Default role for new organization members (default=viewer) | | `LD_SETUP_ORGANIZATION_NAME` | **(Required)** Name of the organization | | `LD_SETUP_ADMIN_API_KEY` | API key for the admin user, must start with `ldpat_` prefix | | `LD_SETUP_API_KEY_EXPIRATION` | Number of days until API key expires (0 for no expiration) (default=30) | | `LD_SETUP_SERVICE_ACCOUNT_TOKEN` | A pre-set token for the service account, must start with `ldsvc_` prefix | | `LD_SETUP_SERVICE_ACCOUNT_EXPIRATION` | Number of days until service account token expires (0 for no expiration) (default=30) | | `LD_SETUP_PROJECT_UUID` | UUID of the project to configure. Use when multiple projects exist to target a specific one instead of requiring exactly one to exist. | | `LD_SETUP_PROJECT_NAME` | **(Required)** Name of the project | | `LD_SETUP_PROJECT_CATALOG` | Catalog name for Databricks project | | `LD_SETUP_PROJECT_SCHEMA` | **(Required)** Schema/database name for the project | | `LD_SETUP_PROJECT_HOST` | **(Required)** Hostname for the Databricks server | | `LD_SETUP_PROJECT_HTTP_PATH` | **(Required)** HTTP path for Databricks connection | | `LD_SETUP_PROJECT_PAT` | **(Required)** Personal access token for Databricks | | `LD_SETUP_START_OF_WEEK` | Day to use as start of week (default=SUNDAY) | | `LD_SETUP_PROJECT_COMPUTE` | JSON string with Databricks compute configuration like `{"name": "string", "httpPath": "string"}` | | `LD_SETUP_DBT_VERSION` | Version of dbt to use (eg: v1.8) (default=latest) | | `LD_SETUP_GITHUB_PAT` | **(Required)** GitHub personal access token | | `LD_SETUP_GITHUB_REPOSITORY` | **(Required)** GitHub repository for dbt project | | `LD_SETUP_GITHUB_BRANCH` | **(Required)** GitHub branch for dbt project | | `LD_SETUP_GITHUB_PATH` | Subdirectory path within GitHub repository (default=/) | | `LD_SETUP_EMBED_SECRET` | Embed secret to provision on the initial project (used to sign embed JWTs). | | `LD_SETUP_EMBED_ALLOW_ALL_DASHBOARDS` | When `true`, allows all dashboards in the project to be embedded by default. (default=false) | > [!WARNING] > > Enabling OIDC-to-email linking trusts the email provided by your SSO provider. Any user with an OIDC account matching the admin email can access the admin account. To sign in as the admin user through SSO without an invitation code, set: ```bash theme={null} AUTH_ENABLE_OIDC_TO_EMAIL_LINKING=true ``` ## Update instance On server start, we will check the following variables, and update some configuration of the organization or project. If multiple organizations or projects exist, you must set `LD_SETUP_ORGANIZATION_UUID` and/or `LD_SETUP_PROJECT_UUID` to target a specific one. To manage only organization settings, such as allowed email domains and the default role, set `LD_SETUP_ORGANIZATION_EMAIL_DOMAIN` and `LD_SETUP_ORGANIZATION_DEFAULT_ROLE` together and leave `LD_SETUP_ADMIN_EMAIL` and the project variables unset. Lightdash updates a project only when one of its variables is set. [Enterprise](/support/feature-badges#enterprise) | Variable | Description | | :- | :- | | `LD_SETUP_ADMIN_EMAIL` | (Required if `LD_SETUP_ADMIN_API_KEY` is present) Email of the admin to update its Personal access token | | `LD_SETUP_ADMIN_API_KEY` | API key for the admin user, must start with `ldpat_` prefix | | `LD_SETUP_ORGANIZATION_UUID` | UUID of the organization to update. Required when multiple organizations exist. | | `LD_SETUP_ORGANIZATION_EMAIL_DOMAIN` | Comma-separated list of email domains for organization whitelisting | | `LD_SETUP_ORGANIZATION_DEFAULT_ROLE` | Default role for new organization members (default=viewer) | | `LD_SETUP_PROJECT_UUID` | UUID of the project to update. Required when multiple projects exist. | | `LD_SETUP_PROJECT_HTTP_PATH` | HTTP path for Databricks connection | | `LD_SETUP_PROJECT_PAT` | Personal access token for Databricks | | `LD_SETUP_DBT_VERSION` | Version of dbt to use (eg: v1.8) (default=latest) | | `LD_SETUP_GITHUB_PAT` | GitHub personal access token | | `LD_SETUP_SERVICE_ACCOUNT_TOKEN` | A pre-set token for the service account, must start with `ldsvc_` prefix | | `LD_SETUP_USER_ATTRIBUTES` | JSON array declaring [user attributes and group-value mappings](#declare-user-attributes) to reconcile on every deploy. | | `LD_SETUP_GROUP_PROJECT_ACCESS` | JSON array declaring [group → project role assignments](#declare-group--project-access) to reconcile on every deploy. | ## Initialize multiple projects Set `LD_SETUP_PROJECTS` to a JSON array to provision **multiple projects at once**. This is a drop-in replacement for the single-project `LD_SETUP_PROJECT_*` variables described in [Initialize instance](#initialize-instance-enterprise) — when `LD_SETUP_PROJECTS` is set, the legacy `LD_SETUP_PROJECT_*` and `LD_SETUP_GITHUB_*` variables are ignored. On every boot, Lightdash matches each entry to an existing project by its `name`: new names are created, existing names are updated in place. Multi-project setup supports Databricks project types and GitHub dbt configuration. > [!NOTE] > > **Project names are the primary key.** Renaming an entry creates a new project rather than renaming the existing one — charts and dashboards will stay on the old project. ### Required companion variables The admin, organization, and API key variables from [Initialize instance](#initialize-instance-enterprise) still apply. `LD_SETUP_ADMIN_EMAIL` is required — without it, `LD_SETUP_PROJECTS` is ignored. ### Schema `LD_SETUP_PROJECTS` must be a JSON array. Each entry has the following shape: | Field | Required | Description | | :- | :- | :- | | `name` | Yes | Project name. Must be non-empty and **unique within the array**. | | `warehouseConnection` | Yes | Object with a valid `type` and the fields required by that warehouse (see below). | | `dbtConnection` | Yes | Object with a valid `type` and the fields required by that dbt connection (below). | | `dbtVersion` | No | Version of dbt to use (eg: `v1.8`). Defaults to latest. | | `embed` | No | Embed config: `{ "secret": "...", "allowAllDashboards": true }`. | ### Databricks warehouse fields | Field | Required | Description | | :- | :- | :- | | `type` | Yes | Must be `"databricks"`. | | `serverHostName` | Yes | Databricks host, no protocol. Example: `dbc-xxxx.cloud.databricks.com`. | | `httpPath` | Yes | SQL warehouse HTTP path, e.g. `/sql/1.0/warehouses/abc123`. | | `database` | Yes | Schema name. (Historical naming — this is the dbt schema, not the Unity Catalog.) | | `catalog` | No | Unity Catalog name. | | `authenticationType` | No | One of `personal_access_token` (default), `oauth_m2m`, `oauth_u2m`. | | `personalAccessToken` | If `authenticationType=personal_access_token` | Databricks PAT (starts with `dapi_`). | | `oauthClientId` | If `authenticationType=oauth_m2m` | Databricks Service Principal client ID (a UUID). | | `oauthClientSecret` | If `authenticationType=oauth_m2m` | Databricks Service Principal client secret. | | `compute` | No | Array of extra SQL warehouses: `[{ "name": "...", "httpPath": "..." }]`. | | `startOfWeek` | No | Day to use as start of week (default=`SUNDAY`). | | `dataTimezone` | No | Project-level timezone override. | ### GitHub dbt connection fields | Field | Required | Description | | :- | :- | :- | | `type` | Yes | Must be `"github"`. | | `authorization_method` | Yes | Use `"personal_access_token"`. | | `personal_access_token` | Yes | GitHub personal access token. | | `repository` | Yes | Repository in `org/repo` format. | | `branch` | Yes | Branch name to pull the dbt project from. | | `project_sub_path` | Yes | Subdirectory path within the repo (use `/` for the root). | | `selector` | No | dbt [selector](https://docs.getdbt.com/reference/node-selection/yaml-selectors) name to limit which models are compiled. | ### Example ```bash theme={null} export LD_SETUP_ADMIN_EMAIL="admin@example.com" export LD_SETUP_PROJECTS='[ { "name": "Sample Project Alpha", "warehouseConnection": { "type": "databricks", "serverHostName": "alpha.cloud.databricks.com", "httpPath": "/sql/1.0/warehouses/abc123", "database": "alpha_db", "personalAccessToken": "dapi_alpha_fake_token" }, "dbtConnection": { "type": "github", "authorization_method": "personal_access_token", "personal_access_token": "ghp_fake_alpha_token", "repository": "myorg/alpha-repo", "branch": "main", "project_sub_path": "/" } }, { "name": "Sample Project Beta", "warehouseConnection": { "type": "databricks", "serverHostName": "beta.cloud.databricks.com", "httpPath": "/sql/1.0/warehouses/def456", "database": "beta_db", "personalAccessToken": "dapi_beta_fake_token" }, "dbtConnection": { "type": "github", "authorization_method": "personal_access_token", "personal_access_token": "ghp_fake_beta_token", "repository": "myorg/beta-repo", "branch": "main", "project_sub_path": "/" } } ]' ``` > [!NOTE] > > **Quote the whole value in single quotes** in your shell so that `$`, backticks, and double quotes inside the JSON are not re-interpreted. When injecting via a secret manager or Kubernetes `Secret`, no escaping is needed — just paste the JSON as-is. ### Databricks M2M OAuth example Use a [Databricks Service Principal](https://docs.databricks.com/aws/en/dev-tools/auth/oauth-m2m) when you want non-interactive, machine-to-machine authentication instead of a PAT. Lightdash exchanges the `client_id` + `client_secret` for an access token automatically on the first compile and refreshes it as needed — no user interaction is required. ```bash theme={null} export LD_SETUP_ADMIN_EMAIL="admin@example.com" export LD_SETUP_PROJECTS='[ { "name": "Sales (Databricks M2M)", "warehouseConnection": { "type": "databricks", "serverHostName": "dbc-xxxx.cloud.databricks.com", "httpPath": "/sql/1.0/warehouses/abc123", "catalog": "lightdash_prod", "database": "sales", "authenticationType": "oauth_m2m", "oauthClientId": "00000000-0000-0000-0000-000000000000", "oauthClientSecret": "dose...secret..." }, "dbtConnection": { "type": "github", "authorization_method": "personal_access_token", "personal_access_token": "ghp_...", "repository": "myorg/dbt-sales", "branch": "main", "project_sub_path": "/" } } ]' ``` If you already have an M2M Service Principal configured for dbt, the field names are different. Map your dbt profile fields to Lightdash's `warehouseConnection` like this: | `profiles.yml` (dbt) | `LD_SETUP_PROJECTS` (Lightdash) | | :- | :- | | `host` | `serverHostName` | | `http_path` | `httpPath` | | `catalog` | `catalog` | | `schema` | `database` | | `auth_type: oauth` | `authenticationType: "oauth_m2m"` | | `client_id` | `oauthClientId` | | `client_secret` | `oauthClientSecret` | M2M is non-interactive by design — Lightdash uses the OAuth client-credentials grant. No browser popup, no per-user sign-in. The Service Principal needs `CAN USE` on the SQL warehouse and the appropriate `SELECT`/`USE CATALOG`/`USE SCHEMA` grants on your data. ### Validation `LD_SETUP_PROJECTS` is parsed and validated at boot. Lightdash will **fail to start with a descriptive error** if any of the following are true: | Error | Cause | | :- | :- | | `Failed to parse LD_SETUP_PROJECTS` | The value is not valid JSON. Check your shell quoting. | | `Invalid LD_SETUP_PROJECTS: expected array` | The top-level JSON is not an array. | | `name: Project name cannot be empty` | An entry has a missing or empty `name`. | | `warehouseConnection: Required` / `dbtConnection: Required` | An entry is missing one of the two connection blocks. | | `Invalid warehouse type` | `warehouseConnection.type` is not a supported warehouse. | | `Invalid dbt connection type` | `dbtConnection.type` is not a supported dbt connection. | | `Duplicate project name "X" in LD_SETUP_PROJECTS` | Two entries share the same `name`. | | `Multiple projects found with name "X"` | Two pre-existing projects in the DB share the same name — rename one in the UI before redeploying. | > [!WARNING] > > **Credentials in `LD_SETUP_PROJECTS` are the source of truth on every boot.** If an admin rotates a PAT or OAuth secret in the UI, the next restart will overwrite it with the value from this variable. Keep the variable in sync with your secret manager, or omit a project from the array once you no longer want it managed via env. ### Migrating from `LD_SETUP_PROJECT_*` `LD_SETUP_PROJECTS` replaces the single-project `LD_SETUP_PROJECT_NAME`, `LD_SETUP_PROJECT_HOST`, `LD_SETUP_PROJECT_HTTP_PATH`, `LD_SETUP_PROJECT_PAT`, `LD_SETUP_PROJECT_SCHEMA`, `LD_SETUP_PROJECT_CATALOG`, `LD_SETUP_PROJECT_COMPUTE`, `LD_SETUP_GITHUB_*`, and `LD_SETUP_DBT_VERSION` variables. When both are set, `LD_SETUP_PROJECTS` takes precedence and the legacy variables are ignored. To migrate: 1. Move your existing project config into a JSON object (use the existing project's exact `name` so it is updated in place rather than recreated). 2. Set `LD_SETUP_PROJECTS` to a single-element array containing that object. 3. Remove the legacy `LD_SETUP_PROJECT_*` and `LD_SETUP_GITHUB_*` variables from your deployment. ## Declare user attributes Set `LD_SETUP_USER_ATTRIBUTES` to a JSON array to declare [user attributes](/workspace-admin/user-attributes) and their group-value mappings as instance config. Lightdash reconciles the array on every deploy, so you no longer need a manual post-deploy API or CLI step to (re)apply attributes after a release. [Enterprise](/support/feature-badges#enterprise) On every boot, Lightdash matches each entry to an existing user attribute by its `name`: new names are created, existing names are updated in place. Attributes that are not present in the array are left untouched — this reconcile is non-destructive and never deletes attributes you created in the UI. ### Schema Each entry in the array has the following shape: | Field | Required | Description | | :- | :- | :- | | `name` | Yes | User attribute name. Must be non-empty and **unique within the array**. | | `description` | No | Human-readable description shown in **Organization Settings** → **User Attributes**. | | `attributeDefault` | No | Default value(s) applied to users who don't have an explicit value. Accepts an array of strings (e.g. `["US", "CA"]`), a single string (normalized to a one-element array), or `null` for no default. Defaults to `null`. | | `groups` | No | Array of group mappings. Each mapping is `{ "group": "", "values": ["", ...] }` and assigns those values to every member of a [group](/workspace-admin/manage-groups). The legacy single-value form `{ "group": "...", "value": "" }` is still accepted but deprecated. Defaults to `[]`. | ### Example ```jsonc theme={null} LD_SETUP_USER_ATTRIBUTES='[ { "name": "region", "description": "sales region access", "attributeDefault": ["US", "CA"], "groups": [ { "group": "EMEA Analysts", "values": ["UK", "DE"] } ] } ]' ``` ### Group resolution Group bindings are resolved **by group name** because group UUIDs aren't known at deploy time — groups provisioned via [SCIM](/workspace-admin/sso/scim) are created by your IdP, not by Lightdash. If a group name in `groups` doesn't match any existing group at the time the deploy runs (for example, because SCIM hasn't synced it yet), Lightdash logs a warning and skips that mapping rather than failing the deploy. The mapping is retried on the next deploy, so once the group exists the binding reconciles automatically. ### Per-user mappings `LD_SETUP_USER_ATTRIBUTES` only supports group-based mappings. Per-user (by-email) values still need to be assigned through the UI or API. ## Declare group → project access Set `LD_SETUP_GROUP_PROJECT_ACCESS` to a JSON array to declare [group → project role assignments](/workspace-admin/roles) as instance config. Lightdash reconciles the array on every deploy, so you no longer need to re-apply group access through the UI or API after each release. This is the project-access equivalent of [`LD_SETUP_USER_ATTRIBUTES`](#declare-user-attributes). [Enterprise](/support/feature-badges#enterprise) This setup uses [groups](/workspace-admin/manage-groups) and optionally [custom roles](/workspace-admin/custom-roles). On every boot, Lightdash matches each entry to a group and project, then either creates the access, updates it if the role differs, or leaves it untouched when it already matches. Group accesses that are not present in the array are left untouched — this reconcile is non-destructive and never removes access you assigned in the UI. This is especially useful for instances that provision groups via [SCIM](/workspace-admin/sso/scim): SCIM group UUIDs aren't known at deploy time, so this lets you declare role mappings by group name once and have them applied automatically as groups sync from your IdP. ### Schema Each entry in the array has the following shape: | Field | Required | Description | | :- | :- | :- | | `groupName` | Yes | Name of the [group](/workspace-admin/manage-groups) to grant access to. Resolved by name so it is compatible with SCIM-synced groups. | | `projectName` | One of `projectName`/`projectUuid` | Name of the project to grant access to. | | `projectUuid` | One of `projectName`/`projectUuid` | UUID of the project to grant access to. Takes precedence if both `projectName` and `projectUuid` are provided. | | `role` | Yes | A [system role](/workspace-admin/roles) (`viewer`, `interactive_viewer`, `editor`, `developer`, or `admin`) or the name of a [custom role](/workspace-admin/custom-roles). | ### Example ```jsonc theme={null} LD_SETUP_GROUP_PROJECT_ACCESS='[ { "groupName": "Core Data Developer", "projectName": "Production", "role": "developer" }, { "groupName": "Data Analyst", "projectUuid": "abc-123", "role": "PII Analyst" } ]' ``` ### Group, project, and role resolution * **Groups** are resolved by `groupName` because group UUIDs aren't known at deploy time when groups are provisioned via [SCIM](/workspace-admin/sso/scim). * **Projects** are resolved by `projectUuid` when set, otherwise by `projectName`. * **Roles** are resolved as a system role first; if the value doesn't match a system role, Lightdash looks up a [custom role](/workspace-admin/custom-roles) with that name. If a group, project, or custom role can't be resolved at the time the deploy runs (for example, because SCIM hasn't synced the group yet), Lightdash logs a warning and skips that entry rather than failing the deploy. The entry is retried on the next deploy, so once the group, project, or role exists the access reconciles automatically. Malformed JSON or entries that fail schema validation (e.g. missing `groupName`, or neither `projectName` nor `projectUuid`) throw at boot time so configuration errors surface before the instance starts. # Organization roadmap Source: https://docs.lightdash.com/self-host/customize-deployment/organization-roadmap See the feature requests your organization has raised and where each one stands [Self-hosted](/support/feature-badges#self-hosted) [Enterprise](/support/feature-badges#enterprise) The organization roadmap is a page under **Settings → Roadmap** where users with the `view:Roadmap` permission can see every feature request their organization has raised with Lightdash, alongside everything Lightdash has shipped in the last month and everything currently planned or in progress across the product. Each item shows its current status (Backlog, Building, Shipped, Canceled) and links to the public GitHub issue and delivering pull request. Any user in a role with the `manage:Roadmap` scope can follow an item to register interest, and the follow count is visible to Lightdash when prioritizing work. The data is served by a Lightdash-operated roadmap service. Your instance's backend fetches it on behalf of signed-in users. Your browser never connects to the service directly, and the service never connects to your instance. ## Requirements 1. **An Enterprise license key that validated at boot** — the roadmap service authenticates your instance with the same [Enterprise license key](/self-host/enterprise-features) your deployment already uses. Every organization on the instance gets the roadmap once the license validates. 2. **Your organization enabled on the roadmap service** — your license must be linked to your organization on the Lightdash side. Contact your Lightdash representative to get this set up. Until then, the Roadmap page shows "Your roadmap isn't set up yet". The link is to one organization UUID, and each self-hosted instance has its own, so if you run more than one instance, share the `organizationUuid` that `GET /api/v1/org` returns on the instance you want enabled. If the message stays after setup, check that UUID first. 3. **The `view:Roadmap` permission on each user who should see it** — the built-in Admin role and the [Roadmap viewer](/workspace-admin/custom-roles) preset already include it; add it to any [custom role](/workspace-admin/custom-roles) that needs access. ## Network egress If your environment restricts outbound traffic, allow HTTPS (port 443) from your Lightdash backend to: ```text theme={null} https://roadmap.lightdash.com ``` This is outbound-only. Your instance requests your organization's roadmap, receives curated data back, and sends follow actions when a user follows an item. Follow requests include the acting user's name and email and your organization name alongside the license key and the identifier of the followed item. No other data about your instance, users, or usage is sent. ## What your organization can see * **Your feature requests** — every request your organization has raised with Lightdash, with its current status and links to the public GitHub issue and delivering pull request. * **Recently shipped** — everything Lightdash has concluded in the last month, across all customers. * **Planned and in progress** — items currently in Backlog or Building, across all customers. Any user in a role with the `manage:Roadmap` scope can follow an item to register interest with Lightdash. When a new release ships one of your organization's feature requests, it appears first, under **Requested by your organization**, in the [What's new](/self-host/upgrading#when-to-upgrade) panel and page that users who can open the roadmap see before they upgrade. Only your own organization's feature requests are returned in the requests view. Each instance's license is bound to its organization on the service side, and requests for any other organization are refused. Items only appear on the roadmap once they have a public GitHub issue, and the fields shown (title, description, status, links) are limited to what is already public there. # Sandboxes Source: https://docs.lightdash.com/self-host/customize-deployment/sandboxes How Lightdash isolates LLM-generated code, and how to configure the sandbox provider [Self-hosted](/support/feature-badges#self-hosted) ## What sandboxes are for Some Lightdash features use an AI agent (Claude Code) that **writes and runs code on your behalf**. Today that's: * **AI writeback** — the agent edits your dbt project (e.g. adds a metric or dimension), runs `lightdash compile` to validate it, and opens a pull request. * **Data app generation** — the agent generates and builds a small web app from a prompt. Running model-generated code directly on the Lightdash server would be unsafe: the code is untrusted, can run arbitrary commands, and needs its own toolchain (git, dbt, the Lightdash CLI, Node). Lightdash instead runs each agent inside a **sandbox** — an isolated, disposable environment with a constrained network. The agent does its work there, Lightdash collects the result (a PR, a built app), and the sandbox is torn down. Sandboxes are also what make these features **fast** and **multi-turn**: a sandbox can be suspended between turns and resumed later, so a conversation with the agent keeps its state without holding a container open the whole time. Sandboxes also run **Python execution** [Beta](/support/feature-badges#beta), which runs Python over query results in a one-off sandbox. See [Python execution](#python-execution). ## Sandbox providers The sandbox backend is pluggable. Lightdash talks to a provider-neutral interface, so the same feature code runs on whichever backend your deployment is configured for. You select the provider with the `SANDBOX_PROVIDER` environment variable. | Provider | `SANDBOX_PROVIDER` | Use for | Isolation | Python execution | | - | - | - | - | - | | **E2B** (default) | `e2b` | Production / managed | microVM | | | **AWS Lambda MicroVMs** | `lambda-microvm` | Production on AWS (self-hosted) | microVM | | | **Azure Container Apps Sandboxes** | `azure-sandboxes` | Production on Azure (self-hosted) | microVM | | | **Google Cloud Run Sandboxes** | `gcp-cloud-run` | GCP (self-hosted, preview) | gVisor | | | **Local Docker** | `docker` | Local development only | container | | **E2B**, **AWS Lambda MicroVMs**, and **Azure Container Apps Sandboxes** are all supported production backends. E2B is the managed default; the AWS and Azure providers are for teams who want sandboxes to run inside their own cloud account. More providers (Kubernetes, ECS) are planned. > [!WARNING] > > The **local Docker provider is for development only**. It launches plain Docker containers > via the Docker socket, which is root-equivalent on the host and provides no real isolation > between the sandbox and your machine. It **refuses to start when `NODE_ENV=production`**. > Do not use it for a production deployment. ## LLM gateway egress [Data apps](/self-host/enterprise-features/data-apps) can route Claude or Codex model traffic through a corporate LLM gateway. The sandbox connects to that gateway independently from the Lightdash backend, so both network paths must be allowed. * **E2B and Azure Sandboxes** receive the coding agent's effective gateway hostname in their per-sandbox egress allowlist, including any applicable [Data app gateway override](/self-host/enterprise-features/ai-agents#separate-gateway-routes-for-data-apps). * **AWS Lambda MicroVMs** cannot apply Lightdash's per-sandbox allowlist. If you use a restricted `LAMBDA_MICROVM_EGRESS_CONNECTOR_ARN`, configure that connector to permit the gateway hostname. * **Docker and Google Cloud Run** use their existing runtime network path. Make sure its DNS and firewall policy can reach the gateway. Existing E2B sandboxes keep the firewall rules from their creation when resumed. A changed gateway hostname requires a fresh sandbox or an update to the existing sandbox's network policy; restarting Lightdash alone does not refresh those rules. These settings affect Data app coding agents, not AI writeback. If AI writeback is enabled, its sandbox still needs its existing Anthropic and git-host egress. See [Corporate LLM gateways](/self-host/enterprise-features/ai-agents#corporate-llm-gateways) for provider configuration and the required API paths. ## E2B (production default) [E2B](https://e2b.dev) runs each sandbox as a Firecracker microVM in E2B's cloud. It's the default — if you don't set `SANDBOX_PROVIDER`, Lightdash uses E2B. To use it you need an E2B account and API key, and the agent needs an Anthropic API key: ```bash theme={null} SANDBOX_PROVIDER=e2b # default, can be omitted E2B_API_KEY=e2b_... # from your E2B dashboard ANTHROPIC_API_KEY=sk-ant-... # the agent (Claude Code) runs inside the sandbox ``` The sandbox images are E2B *templates*. Lightdash uses separate templates for data apps and for AI writeback so they can be pinned or rolled back independently. These default to the published Lightdash templates and rarely need to be set: ```bash theme={null} E2B_TEMPLATE_NAME=lightdash/lightdash-data-app E2B_TEMPLATE_TAG= # defaults to your Lightdash version E2B_AI_WRITEBACK_TEMPLATE_NAME=lightdash/lightdash-ai-writeback E2B_AI_WRITEBACK_TEMPLATE_TAG= E2B_PYTHON_TEMPLATE_NAME=lightdash-python-runner # Python execution E2B_PYTHON_TEMPLATE_TAG= ``` ## AWS Lambda MicroVMs (self-hosted production) AWS Lambda MicroVMs run each sandbox as a Firecracker microVM **inside your own AWS account**, so untrusted agent code and your repository contents never leave your infrastructure. The microVMs have **no public IP** — your backend reaches each one through an AWS-managed endpoint that requires a short-lived per-microVM token — and you control their outbound network access (see [Networking and IAM](#networking-and-iam)). This is the **recommended sandbox provider for customers deploying Lightdash on AWS** — it keeps the sandbox boundary inside your existing AWS account and avoids sending agent workloads or repository contents to a third-party service. Lightdash only needs the **image ARN** that AWS's `create-microvm-image` returns. The backend passes it to `RunMicrovm` and never builds, pulls, or otherwise touches ECR or S3 at runtime, so any pipeline that produces a `codeArtifact` zip AWS can build into a MicroVM image works, with or without ECR. ```mermaid theme={null} sequenceDiagram participant Build as Your build pipeline participant ECR as ECR (optional) participant S3 as S3 (build-time staging) participant Reg as AWS MicroVM image build participant Backend as Lightdash backend / worker participant Lambda as Lambda MicroVMs control plane Note over Build,Reg: Build time — once per image version Build->>ECR: push prebuilt image (optional shortcut) Build->>S3: upload codeArtifact zip Build->>Reg: create-microvm-image (al2023 base, ARM_64, 4 GB, /ready on 8080) Reg-->>Build: image ARN Reg->>S3: read codeArtifact zip Reg->>ECR: pull FROM image (only if the zip's Dockerfile uses one) Build->>Reg: poll until the image version is ACTIVE Note over Backend,Lambda: Runtime — every sandbox launch Backend->>Lambda: RunMicrovm(imageArn) Lambda-->>Backend: microVM ID + endpoint Backend->>Lambda: CreateMicrovmAuthToken(microVM ID) Lambda-->>Backend: proxy auth token (60 minutes) ``` ### Prerequisites Provision these with your own IaC, in the region you set as `LAMBDA_MICROVM_REGION` and in the **AWS account your backend's credentials belong to**. That's usually the account your Lightdash backend already runs in. The backend uses the standard AWS SDK credential chain, so the resources can sit in a separate account when the backend's role is in that account, for example an IRSA role there that trusts your cluster's OIDC provider: * **Two MicroVM images** — one for data app generation and one for AI writeback (they bundle different toolchains), built from the Dockerfiles in the Lightdash repo (`sandboxes/data-apps/`, `sandboxes/ai-writeback/`) and registered as a Lambda MicroVM image on the AWS-managed `al2023` base — `ARM_64`, 4 GB memory, with the agent's `/ready` hook on port 8080. Each registration returns an **image ARN** for the config below. The recommended way to produce and refresh these ARNs is `sandboxes/microvm-agent/build-microvm-image.sh` in the Lightdash repo, which runs the whole pipeline: it builds the local Docker image for the feature you pass it (`data-app` or `writeback`), provisions the ECR repository, build IAM role, and S3 staging bucket if they don't exist yet, and pushes the local image to ECR so the registered image can build `FROM` it. It then assembles a thin `FROM ` Dockerfile that adds the exec agent (`sandboxes/microvm-agent/`), zips it, and uploads it to S3 as the build's `codeArtifact` — that zip is a thin wrapper around the ECR image, not the full application. It calls AWS's `create-microvm-image` (or `update-microvm-image` when the image already exists), polls the build to an active version, and prints the image ARN to set as `LAMBDA_MICROVM_DATA_APP_IMAGE_ARN` or `LAMBDA_MICROVM_AI_WRITEBACK_IMAGE_ARN`. Run it with `./sandboxes/microvm-agent/build-microvm-image.sh data-app` and `./sandboxes/microvm-agent/build-microvm-image.sh writeback`. Pushing to ECR is the script's shortcut to avoid rebuilding the toolchain on every update, not something Lightdash requires. The data app Dockerfile copies `lightdash-query-sdk.tgz`, a generated artifact that a fresh checkout does not contain. `build-microvm-image.sh` packs it for you; building the Dockerfile directly instead needs `./sandboxes/data-apps/pack-query-sdk.sh` first, using the toolchain listed in [Build the gateway image](#2-build-the-gateway-image) under the Cloud Run provider. The writeback Dockerfile has no such prerequisite. * **Control-plane permissions on your backend's existing IAM role** — add `RunMicrovm`, `GetMicrovm`, `SuspendMicrovm`, `ResumeMicrovm`, `TerminateMicrovm`, `CreateMicrovmAuthToken`, and `lambda:PassNetworkConnector` (the backend attaches the ingress and egress connectors on every launch). If you set an execution role (see [Networking and IAM](#networking-and-iam)), also allow `iam:PassRole` on that role's ARN. Don't add an `iam:PassedToService` condition: microVMs receive the role through a different service principal than `lambda.amazonaws.com`, so the condition denies the pass. Registering an image uses AWS's `create-microvm-image`, which needs a build role (trusting `lambda.amazonaws.com`) and an S3 location to stage the build context. These are **build-time only** — not the S3 bucket Lightdash already uses for results and snapshots, and the backend never touches them at runtime. ### Configure the provider ```bash theme={null} SANDBOX_PROVIDER=lambda-microvm ANTHROPIC_API_KEY=sk-ant-... # the agent (Claude Code) runs inside the microVM # Region the microVMs run in (defaults to eu-west-1, the EU launch region) LAMBDA_MICROVM_REGION=eu-west-1 # The image ARNs from registering the two MicroVM images above. Required. LAMBDA_MICROVM_DATA_APP_IMAGE_ARN=arn:aws:lambda:::microvm-image/... LAMBDA_MICROVM_AI_WRITEBACK_IMAGE_ARN=arn:aws:lambda:::microvm-image/... ``` The backend uses its ambient AWS credentials (instance role / IRSA / standard SDK credential chain) to call the Lambda MicroVMs control plane, so no access keys are configured here. ### Networking and IAM > [!WARNING] > > **Configure the network connectors before going to production.** The AWS-managed > defaults give the microVM open inbound and outbound access, which means untrusted > agent code can reach the public internet from inside your AWS account. We currently > recommend pointing the egress connector at a VPC connector that has **no outbound > access by default**, and only opening up the destinations the agent actually needs > (your dbt repository host, the Anthropic / Bedrock API, your ECR registry). Override these to tighten the network boundary or to give the microVM an IAM role: ```bash theme={null} # IAM role the microVM assumes (e.g. to pull from a private ECR or reach AWS APIs) LAMBDA_MICROVM_EXECUTION_ROLE_ARN=arn:aws:iam::...:role/lightdash-sandbox # Network connectors. Default to AWS-managed open ingress/egress; point these at # your own VPC connectors to constrain traffic. We strongly recommend an egress # connector that denies outbound traffic by default. LAMBDA_MICROVM_INGRESS_CONNECTOR_ARN=arn:aws:lambda::aws:network-connector:aws-network-connector:ALL_INGRESS LAMBDA_MICROVM_EGRESS_CONNECTOR_ARN=arn:aws:lambda::aws:network-connector:aws-network-connector:INTERNET_EGRESS ``` The execution role trusts `lambda.amazonaws.com` with `sts:AssumeRole` and `sts:TagSession`. The sandbox reaches the internet through the egress connector rather than AWS APIs, so the role only needs CloudWatch Logs (`logs:CreateLogGroup`, `logs:CreateLogStream`, `logs:PutLogEvents`). Keep it separate from your backend's role, since the sandbox runs agent-written code with whatever the execution role allows. The microVM doesn't inherit your backend's AWS credentials. For data apps on Bedrock, Lightdash passes `BEDROCK_API_KEY` or `BEDROCK_ACCESS_KEY_ID` and `BEDROCK_SECRET_ACCESS_KEY` into the sandbox; with `BEDROCK_USE_DEFAULT_CREDENTIALS=true` it passes none. ### Upgrading The sandbox runs whatever image `LAMBDA_MICROVM_DATA_APP_IMAGE_ARN` and `LAMBDA_MICROVM_AI_WRITEBACK_IMAGE_ARN` point to, so upgrading Lightdash alone doesn't change what runs inside it. Fixes to either image (Dockerfile changes, the exec agent in `sandboxes/microvm-agent/`) only take effect once you rebuild the image: 1. From a checkout of the new Lightdash version, remove the local sandbox image (`lightdash-sandbox:local` or `lightdash-ai-writeback:local`). The build script reuses an existing local image instead of rebuilding it. 2. Run `./sandboxes/microvm-agent/build-microvm-image.sh `. It pushes the image to ECR, registers a new version of the Lambda MicroVM image, and marks it active. 3. If the script prints a different image ARN from the one you have configured, update `LAMBDA_MICROVM_DATA_APP_IMAGE_ARN` or `LAMBDA_MICROVM_AI_WRITEBACK_IMAGE_ARN` and restart the backend. ## Azure Container Apps Sandboxes (self-hosted production) [Azure Container Apps Sandboxes](https://learn.microsoft.com/azure/container-apps/sandboxes-overview) run each sandbox as an isolated, microVM-class environment **inside your own Azure subscription**, so untrusted agent code and your repository contents never leave your infrastructure. Sandboxes have **native suspend/resume** (a full memory + disk snapshot with sub-second restore), which is what keeps multi-turn agent conversations fast. This is the **recommended sandbox provider for customers deploying Lightdash on Azure** — it keeps the sandbox boundary inside your existing Azure tenant and avoids sending agent workloads or repository contents to a third-party service. > [!NOTE] > > Azure Container Apps Sandboxes is currently an Azure **preview** feature. It requires a > Microsoft Entra ID account (personal Microsoft accounts aren't supported), and its API > surface may change while in preview. ### Prerequisites Provision these in the **same Azure subscription and region your Lightdash backend runs in**, using the [`aca` CLI](https://aka.ms/aca/sandboxes/dev) or the [Sandboxes portal](https://aka.ms/aca/sandboxes/portal): * **A sandbox group per feature** — one for data app generation and one for AI writeback (they bundle different toolchains), plus an optional third for [Python execution](#python-execution). A sandbox group (`Microsoft.App/SandboxGroups`) is the management boundary that holds a feature's sandboxes and disk image. Give each group a **Memory-mode auto-suspend** lifecycle policy so idle sandboxes snapshot and scale to zero. * **A disk image per group** — build the two images from the Dockerfiles in the Lightdash repo (`sandboxes/data-apps/`, `sandboxes/ai-writeback/`), push them to a container registry (e.g. Azure Container Registry), and register each as a disk image in its sandbox group. Registration returns a disk image **ID** for the config below. (Unlike the AWS provider, there is no in-VM agent to build — Sandboxes expose a native command/file API.) The data app Dockerfile copies `lightdash-query-sdk.tgz`, a generated artifact that a fresh checkout does not contain — build and pack it into `sandboxes/data-apps/` first with `./sandboxes/data-apps/pack-query-sdk.sh`, using the toolchain listed in [Build the gateway image](#2-build-the-gateway-image) under the Cloud Run provider. The writeback Dockerfile has no such prerequisite. For Python execution, build a third image from `sandboxes/python-runner/`, which needs a `Dockerfile.local` derived first — see [Make sure the Python sandbox exists](#make-sure-the-python-sandbox-exists). * **A workload identity with the data-plane role** — grant your backend's managed identity the **Container Apps SandboxGroup Data Owner** role on each sandbox group. Lightdash uses `DefaultAzureCredential` (workload identity on AKS, or the standard Azure credential chain) to authenticate — **no client secret is configured here**. ### Configure the provider ```bash theme={null} SANDBOX_PROVIDER=azure-sandboxes ANTHROPIC_API_KEY=sk-ant-... # the agent (Claude Code) runs inside the sandbox # Where your sandbox groups live AZURE_SANDBOXES_SUBSCRIPTION_ID= AZURE_SANDBOXES_RESOURCE_GROUP= AZURE_SANDBOXES_REGION=eastus2 # Per-feature sandbox group + disk image ID (from the prerequisites above). Required. AZURE_SANDBOXES_DATA_APP_GROUP=lightdash-data-app AZURE_SANDBOXES_DATA_APP_DISK_IMAGE= AZURE_SANDBOXES_AI_WRITEBACK_GROUP=lightdash-writeback AZURE_SANDBOXES_AI_WRITEBACK_DISK_IMAGE= # Python execution only — sandbox group + disk image ID for Python sandboxes AZURE_SANDBOXES_PYTHON_GROUP=lightdash-python AZURE_SANDBOXES_PYTHON_DISK_IMAGE= # Optional — sandbox size (XS/S/M/L, default M) AZURE_SANDBOXES_RESOURCE_TIER=M ``` Egress is locked down automatically: each sandbox launches with a **default-deny egress policy** that only allows the hosts the agent needs (the Anthropic API and your git host), with **full traffic inspection** so the platform enforces the deny on all traffic and blocks non-HTTP egress. Untrusted agent code can't reach any other destination — outbound requests to non-allowlisted hosts are rejected, and all other ports are blocked. ## Google Cloud Run Sandboxes (self-hosted, preview) Use the `gcp-cloud-run` provider to run data app and [Python execution](#python-execution) sandboxes in a [Cloud Run service](https://docs.cloud.google.com/run/docs/code-execution). Lightdash connects to the service through an HTTP gateway included in the sandbox image. > [!NOTE] > > Cloud Run Sandboxes is in public preview and currently supports data app generation and > Python execution. AI writeback is not supported. Each gateway service runs a single toolchain image, so data apps and Python execution use **separate** Cloud Run services. Steps 1–5 set up the data app gateway. To run Python execution, also deploy the [Python gateway](#6-deploy-the-python-gateway-optional). ### Prerequisites * A Google Cloud project with billing enabled. * A recent version of the `gcloud` CLI that supports `gcloud beta run deploy --sandbox-launcher`. * [External object storage](/self-host/customize-deployment/configure-lightdash-to-use-external-object-storage) configured for Lightdash. * An Anthropic API key. ### 1. Enable the Google Cloud APIs Enable Cloud Run, plus Artifact Registry if you push the gateway image there: ```bash theme={null} gcloud services enable run.googleapis.com artifactregistry.googleapis.com \ --project ``` ### 2. Build the gateway image Build the gateway image from a checkout of the Lightdash repository and push it to your own registry, such as Artifact Registry. To skip the build, you can [get the published image from Docker Hub](#or-get-the-image-from-docker-hub) instead. You need: * A checkout of the Lightdash repository at the version you deploy. * The Node version in `.nvmrc` and the pnpm version in the root `package.json`. * Repository dependencies installed with `sfw pnpm install --frozen-lockfile` from the repository root. * Docker with Buildx running. From the repository root, build and push the image: ```bash theme={null} TARGET=-docker.pkg.dev///lightdash-sandbox-gateway: gcloud auth configure-docker -docker.pkg.dev ./sandboxes/data-apps/build-cloud-run-image.sh "$TARGET" --push ``` The script builds and packs the query SDK from your checkout, includes the pinned ComputeSDK gateway, and keeps `/app` owned by root, as Cloud Run requires. #### Or get the image from Docker Hub Every Lightdash release from 2.362.0 onward publishes a prebuilt Cloud Run gateway image to Docker Hub: ```text theme={null} lightdash/lightdash-data-app-sandbox-cloud-run: ``` The image is public, so you can pull it without a Docker Hub account. It is built for `linux/amd64` only. It contains: * The ComputeSDK Cloud Run gateway. The default command is `node /gateway/gateway.mjs`. * The data app template in `/app`, with its dependencies preinstalled. `/app` is already owned by root, as Cloud Run requires. * The `@lightdash/query-sdk` version that matches the release. * Node, pnpm, and the coding agents used for generation. Use the tag that matches the Lightdash version running on your backend and scheduler. The rolling `:latest` tag tracks the newest release. > [!NOTE] > > Images exist for Lightdash 2.362.0 and later only. For an earlier version, upgrade > Lightdash or [build the image yourself](#2-build-the-gateway-image). We recommend copying the image into your own registry, such as Artifact Registry, so you can scan and approve it before deploying. For example: ```bash theme={null} VERSION= TARGET=-docker.pkg.dev///lightdash-data-app-sandbox-cloud-run:$VERSION gcloud auth configure-docker -docker.pkg.dev docker pull --platform linux/amd64 \ lightdash/lightdash-data-app-sandbox-cloud-run:$VERSION docker tag lightdash/lightdash-data-app-sandbox-cloud-run:$VERSION "$TARGET" docker push "$TARGET" ``` Or copy it directly with [`crane`](https://github.com/google/go-containerregistry/tree/main/cmd/crane): ```bash theme={null} crane copy lightdash/lightdash-data-app-sandbox-cloud-run:$VERSION "$TARGET" ``` The image is published with SBOM and provenance attestations. Inspect them with: ```bash theme={null} docker buildx imagetools inspect lightdash/lightdash-data-app-sandbox-cloud-run:$VERSION ``` #### Get the image digest Whichever option you use, get the digest of the image in your registry so you can deploy by digest: ```bash theme={null} gcloud artifacts docker images describe "$TARGET" \ --format='value(image_summary.digest)' ``` ### 3. Deploy the gateway Generate a shared secret and deploy the image from your registry, ideally by digest: ```bash theme={null} SANDBOX_SECRET=$(openssl rand -hex 32) gcloud beta run deploy lightdash-sandbox-gateway \ --image -docker.pkg.dev///@sha256: \ --region \ --project \ --sandbox-launcher \ --no-cpu-throttling \ --session-affinity \ --cpu 4 \ --memory 16Gi \ --concurrency 20 \ --min-instances 1 \ --max-instances 1 \ --timeout 3600 \ --allow-unauthenticated \ --set-env-vars "SANDBOX_SECRET=$SANDBOX_SECRET" ``` Save `SANDBOX_SECRET` securely. You need the same value when configuring Lightdash. Although the Cloud Run service allows unauthenticated requests, the gateway rejects any sandbox operation that doesn't include this secret. Keep the service at one instance. Active sandboxes run inside that instance and are lost if Cloud Run replaces it during a generation. ### 4. Configure Lightdash Get the gateway URL: ```bash theme={null} gcloud run services describe lightdash-sandbox-gateway \ --region \ --project \ --format='value(status.url)' ``` Set these environment variables on both the Lightdash backend and scheduler: ```bash theme={null} SANDBOX_PROVIDER=gcp-cloud-run ANTHROPIC_API_KEY=sk-ant-... GCP_CLOUD_RUN_SANDBOX_URL= GCP_CLOUD_RUN_SANDBOX_SECRET= ``` Restart the backend and scheduler to apply the configuration. > [!WARNING] > > Cloud Run sandboxes block all outbound traffic by default, but sandboxes that need > internet access (data app generation does) are launched with egress fully open — the > sandbox layer is on/off only, with no per-host rules. To constrain what sandboxes can > reach, route the service through your VPC and filter there (next step). ### 5. Restrict sandbox egress (recommended) Sandbox traffic exits through the gateway instance's network path, so it follows the service's [VPC egress setting](https://docs.cloud.google.com/run/docs/configuring/vpc-direct-vpc) and can be filtered with standard VPC networking. None of this is provisioned by Lightdash — you configure it yourself: 1. **A subnet on the VPC network you'll filter**, in the same region as the gateway service. 2. **A Cloud Router and Cloud NAT on that network.** Once the service routes all traffic through the VPC, outbound internet access only works via NAT — without it, sandboxes *and the gateway itself* lose all egress. Reserve a static IP for the NAT if you want a stable egress IP to allowlist on your side (for example, on your git host): ```bash theme={null} gcloud compute routers create sandbox-egress-router \ --network --region --project gcloud compute routers nats create sandbox-egress-nat \ --router sandbox-egress-router --region --project \ --auto-allocate-nat-external-ips --nat-all-subnet-ip-ranges ``` 3. **Direct VPC egress on the gateway service.** This deploys a new revision, so any active sandboxes are lost — do it while no generation is running: ```bash theme={null} gcloud beta run services update lightdash-sandbox-gateway \ --region --project \ --network --subnet --vpc-egress all-traffic ``` All sandbox traffic now leaves through your VPC: its public egress IP is the NAT IP, and VPC firewall **egress rules apply to it** — a deny rule for a destination range blocks matching sandbox traffic while the rest keeps flowing. 4. **Filter what sandboxes can reach.** VPC firewall rules give you IP/CIDR-level control. For a domain-level allowlist, add [Secure Web Proxy](https://cloud.google.com/secure-web-proxy/docs/overview): create a deny-all-egress firewall rule that only allows traffic to the proxy, and allowlist the domains the sandboxes and the gateway need — at minimum `api.anthropic.com` and your object storage endpoint. Standard data app generation and builds don't download npm packages. Allow `registry.npmjs.org`, or the hosts in `LIGHTDASH_APP_DEPENDENCY_REGISTRY_HOSTS`, only if your data apps use custom npm dependencies, which install at build time. Secure Web Proxy is an explicit proxy: clients must be configured to use it (bake proxy settings into the gateway image — sandboxes share its root filesystem), and the deny-all firewall drops anything that bypasses it. ### 6. Deploy the Python gateway (optional) Python execution needs its own gateway service, built from the Python runner image. Get the image in one of two ways: * **Docker Hub** — every release publishes `lightdash/lightdash-python-sandbox-cloud-run:` (`linux/amd64` only; `:latest` tracks the newest release). * **Build it** from a checkout of the Lightdash repository at the version you deploy. This needs only Docker with Buildx and npm — no `pnpm install`: ```bash theme={null} TARGET=-docker.pkg.dev///lightdash-python-sandbox-cloud-run: ./sandboxes/python-runner/build-cloud-run-image.sh "$TARGET" --push ``` As with the data app image, copy it into your own registry and [get its digest](#get-the-image-digest). Then deploy it as a second service with a **different** secret from the data app gateway: ```bash theme={null} PYTHON_SANDBOX_SECRET=$(openssl rand -hex 32) gcloud beta run deploy lightdash-python-sandbox-gateway \ --image -docker.pkg.dev///@sha256: \ --region \ --project \ --sandbox-launcher \ --no-cpu-throttling \ --session-affinity \ --cpu 2 \ --memory 4Gi \ --concurrency 20 \ --min-instances 1 \ --max-instances 1 \ --timeout 3600 \ --allow-unauthenticated \ --set-env-vars "SANDBOX_SECRET=$PYTHON_SANDBOX_SECRET" ``` Get its URL with `gcloud run services describe lightdash-python-sandbox-gateway ...` as in [step 4](#4-configure-lightdash), and set these on both the backend and scheduler (alongside `SANDBOX_PROVIDER=gcp-cloud-run`): ```bash theme={null} GCP_CLOUD_RUN_PYTHON_SANDBOX_URL= GCP_CLOUD_RUN_PYTHON_SANDBOX_SECRET= ``` The Python gateway doesn't need an Anthropic API key. Python sandboxes launch with egress denied, and the image preinstalls pandas, numpy, scipy, pyarrow, scikit-learn, and polars — there is no `pip install` at runtime. Then [turn Python execution on](#turn-it-on). Each feature only needs its own gateway: with only the Python variables set, Python execution works and data app generation fails with a configuration error, and vice versa. ### Upgrading When you upgrade Lightdash, redeploy each gateway (data app and, if deployed, Python) with the image for the new version. Rebuild from a checkout of the new version, or copy the new version's tag from Docker Hub. Then get its digest and rerun the deploy command from [step 3](#3-deploy-the-gateway) (and [step 6](#6-deploy-the-python-gateway-optional) for the Python gateway). Cloud Run always runs the deployed gateway image. It ignores `E2B_TEMPLATE_TAG`, so upgrading Lightdash alone doesn't change what runs in the sandbox. Redeploying replaces the single gateway instance, so active sandboxes are lost. Upgrade during a quiet period. To roll back, redeploy the previous version's tag or digest. ## Local Docker provider (development) For local development you can run sandboxes as plain Docker containers on your own machine — no E2B account required. This is the recommended way to work on or try the AI features locally. It uses the same images E2B builds, but as plain local Docker images. Each feature uses a **separate** image (different toolchains), mirroring the E2B templates: | Image (default tag) | Built from | Used by | | - | - | - | | `lightdash-sandbox:local` | `sandboxes/data-apps/` | Data app generation | | `lightdash-ai-writeback:local` | `sandboxes/ai-writeback/` | AI writeback | | `lightdash-python-runner:local` | `sandboxes/python-runner/` | Python execution | ### Prerequisites * Docker running locally, with the daemon reachable from the Lightdash backend. * S3-compatible object storage configured (locally this is MinIO). Suspended-sandbox snapshots are tarred to object storage so a conversation survives the container being destroyed — see [external object storage](/self-host/customize-deployment/configure-lightdash-to-use-external-object-storage). * An Anthropic API key (`ANTHROPIC_API_KEY`) for the agent. ### Setup 1. Build the local sandbox images (each builds from `sandboxes//`): ```bash theme={null} ./sandboxes/data-apps/build-local-image.sh # -> lightdash-sandbox:local ./sandboxes/ai-writeback/build-local-image.sh # -> lightdash-ai-writeback:local ./sandboxes/python-runner/build-local-image.sh # -> lightdash-python-runner:local ``` Build only the images for the features you use. These are large (the writeback image bundles dbt, the Lightdash CLI and Claude Code) and only need rebuilding when the sandbox toolchain changes. 2. Point Lightdash at the Docker provider: ```bash theme={null} SANDBOX_PROVIDER=docker # optional — these are the defaults: SANDBOX_DOCKER_IMAGE=lightdash-sandbox:local SANDBOX_AI_WRITEBACK_DOCKER_IMAGE=lightdash-ai-writeback:local SANDBOX_PYTHON_DOCKER_IMAGE=lightdash-python-runner:local ``` 3. Restart the **backend and the scheduler** so both pick up the new environment. Data app generation runs in the scheduler worker, so a stale `SANDBOX_PROVIDER` there will keep it on E2B. (With PM2, a plain `restart` reuses the cached env — delete and re-start the processes, or restart with `--update-env`, to actually reload the env file.) ## Python execution Python execution runs Python over the results of other queries in a pipeline. Lightdash writes the referenced results into a fresh sandbox, runs the code, reads the output back, and destroys the sandbox. The sandbox has no credentials and no outbound network access. Lightdash never suspends it, so [snapshot lifecycle](#snapshot-lifecycle) settings don't apply. The sandbox image includes pandas, numpy, scipy, pyarrow, scikit-learn, and polars. Your code must return a pandas DataFrame. ### Supported providers Python execution runs on the **E2B**, **Azure Container Apps Sandboxes**, **Google Cloud Run**, and **Local Docker** providers. It doesn't work on `lambda-microvm`. ### Make sure the Python sandbox exists * **E2B** — Lightdash launches `E2B_PYTHON_TEMPLATE_NAME` (default `lightdash-python-runner`) at `E2B_PYTHON_TEMPLATE_TAG` (default: your Lightdash version). Your `E2B_API_KEY` must have access to the template at that tag. To build the template in your own E2B team, check out the Lightdash repository at your version, run the build from `sandboxes/python-runner/`, and then set both variables to the template you built: ```bash theme={null} cd sandboxes/python-runner pnpm install E2B_API_KEY=e2b_... E2B_PYTHON_TEMPLATE_TAG= pnpm run build ``` When you upgrade Lightdash, rebuild or retag the template so a build exists at the new version's tag, or pin `E2B_PYTHON_TEMPLATE_TAG`. * **Google Cloud Run** — deploy the separate Python gateway and set `GCP_CLOUD_RUN_PYTHON_SANDBOX_URL` and `GCP_CLOUD_RUN_PYTHON_SANDBOX_SECRET`. See [Deploy the Python gateway](#6-deploy-the-python-gateway-optional). * **Azure Container Apps Sandboxes** — build the image from `sandboxes/python-runner/` and register it as a disk image in a dedicated Python sandbox group. The directory ships an E2B Dockerfile, so first derive `Dockerfile.local` from it with `./sandboxes/python-runner/build-local-image.sh` (you can ignore the local image it then builds). Azure sandboxes run on `linux/amd64`, so build for that platform and register the result: ```bash theme={null} az acr build --registry --platform linux/amd64 \ --image lightdash-python-runner: \ --file sandboxes/python-runner/Dockerfile.local sandboxes/python-runner aca sandboxgroup disk create --group --region \ --image .azurecr.io/lightdash-python-runner: \ --username 00000000-0000-0000-0000-000000000000 \ --token "$(az acr login --name --expose-token --query accessToken -o tsv)" aca sandboxgroup disk list --group --region -o json ``` Set `AZURE_SANDBOXES_PYTHON_GROUP` to the group and `AZURE_SANDBOXES_PYTHON_DISK_IMAGE` to the disk image ID from `disk list`, and grant the backend identity the same data-plane role on the group. See [Azure Container Apps Sandboxes](#azure-container-apps-sandboxes-self-hosted-production). * **Local Docker** — build `lightdash-python-runner:local` with `./sandboxes/python-runner/build-local-image.sh`, or set `SANDBOX_PYTHON_DOCKER_IMAGE` to your own tag. See [Local Docker provider](#local-docker-provider-development). ### Turn it on Python execution is part of the composer, gated by the `compose-sql-runner` feature flag, which is off by default. To turn it on, set [`LIGHTDASH_ENABLE_FEATURE_FLAGS`](/self-host/customize-deployment/environment-variables#feature-flags) on the backend and the scheduler: ```bash theme={null} LIGHTDASH_ENABLE_FEATURE_FLAGS=compose-sql-runner ``` ## Snapshot lifecycle Every turn suspends its own sandbox, so in steady state nothing sits idle. Two timers configure the cloud-side idle policy as a backstop — when to auto-suspend a sandbox left running and when to auto-terminate a suspended one: ```bash theme={null} SANDBOX_IDLE_TIMEOUT_MS=1800000 # auto-suspend a running-but-idle sandbox (default 30 min) SANDBOX_SNAPSHOT_RETENTION_MS=604800000 # auto-terminate a suspended microVM (default 7 days); also how long a thread stays resumable ``` `SANDBOX_IDLE_TIMEOUT_MS` feeds the auto-suspend policy on both the **Lambda MicroVMs** and **Azure Sandboxes** providers (for Azure it sets each sandbox's Memory-mode auto-suspend interval). `SANDBOX_SNAPSHOT_RETENTION_MS` is read only by Lambda MicroVMs — on Azure, suspended-sandbox retention is governed by the sandbox group's own auto-delete policy. **E2B** manages idle sandboxes itself, and the **Docker** and **Cloud Run** providers have no cloud-side idle handling — both persist suspend-time snapshots to object storage and destroy the sandbox, so nothing idles in the first place. ## Environment variable reference | Variable | Default | Description | | - | - | - | | `SANDBOX_PROVIDER` | `e2b` | Sandbox backend: `e2b`, `lambda-microvm`, `azure-sandboxes`, `gcp-cloud-run`, or `docker`. | | `ANTHROPIC_API_KEY` | — | API key for the Claude Code agent running inside the sandbox. | | `E2B_API_KEY` | — | E2B API key (required when `SANDBOX_PROVIDER=e2b`). | | `E2B_TEMPLATE_NAME` | `lightdash/lightdash-data-app` | E2B template for data app sandboxes. | | `E2B_TEMPLATE_TAG` | Lightdash version | Tag of the data app template to launch. | | `E2B_AI_WRITEBACK_TEMPLATE_NAME` | `lightdash/lightdash-ai-writeback` | E2B template for writeback sandboxes. | | `E2B_AI_WRITEBACK_TEMPLATE_TAG` | Lightdash version | Tag of the writeback template to launch. | | `E2B_PYTHON_TEMPLATE_NAME` | `lightdash-python-runner` | E2B template for Python execution sandboxes. | | `E2B_PYTHON_TEMPLATE_TAG` | Lightdash version | Tag of the Python execution template to launch. | | `LAMBDA_MICROVM_REGION` | `eu-west-1` | AWS region the microVMs run in (`lambda-microvm`). | | `LAMBDA_MICROVM_DATA_APP_IMAGE_ARN` | — | Image ARN for data app microVMs (required when `SANDBOX_PROVIDER=lambda-microvm`). | | `LAMBDA_MICROVM_AI_WRITEBACK_IMAGE_ARN` | — | Image ARN for writeback microVMs (required when `SANDBOX_PROVIDER=lambda-microvm`). | | `LAMBDA_MICROVM_EXECUTION_ROLE_ARN` | — | Optional IAM role the microVM assumes. | | `LAMBDA_MICROVM_INGRESS_CONNECTOR_ARN` | AWS-managed `ALL_INGRESS` | Optional ingress network connector. | | `LAMBDA_MICROVM_EGRESS_CONNECTOR_ARN` | AWS-managed `INTERNET_EGRESS` | Optional egress network connector. | | `AZURE_SANDBOXES_SUBSCRIPTION_ID` | — | Azure subscription holding the sandbox groups (required when `SANDBOX_PROVIDER=azure-sandboxes`). | | `AZURE_SANDBOXES_RESOURCE_GROUP` | — | Resource group holding the sandbox groups (required when `azure-sandboxes`). | | `AZURE_SANDBOXES_REGION` | `eastus2` | Region the sandboxes run in (selects the data-plane endpoint). | | `AZURE_SANDBOXES_DATA_APP_GROUP` | — | Sandbox group for data app sandboxes (required when `azure-sandboxes`). | | `AZURE_SANDBOXES_DATA_APP_DISK_IMAGE` | — | Disk image ID for data app sandboxes (required when `azure-sandboxes`). | | `AZURE_SANDBOXES_AI_WRITEBACK_GROUP` | — | Sandbox group for writeback sandboxes (required when `azure-sandboxes`). | | `AZURE_SANDBOXES_AI_WRITEBACK_DISK_IMAGE` | — | Disk image ID for writeback sandboxes (required when `azure-sandboxes`). | | `AZURE_SANDBOXES_PYTHON_GROUP` | — | Sandbox group for Python execution sandboxes (required for Python execution when `azure-sandboxes`). | | `AZURE_SANDBOXES_PYTHON_DISK_IMAGE` | — | Disk image ID for Python execution sandboxes (required for Python execution when `azure-sandboxes`). | | `AZURE_SANDBOXES_RESOURCE_TIER` | `M` | Sandbox size: `XS`, `S`, `M`, or `L`. | | `AZURE_SANDBOXES_API_VERSION` | `2026-02-01-preview` | Azure Sandboxes data-plane API version. | | `AZURE_SANDBOXES_TOKEN_SCOPE` | `https://management.azuredevcompute.io/.default` | Entra token scope for the data plane. | | `GCP_CLOUD_RUN_SANDBOX_URL` | — | URL of the data app sandbox gateway Cloud Run service (required for data apps when `SANDBOX_PROVIDER=gcp-cloud-run`). | | `GCP_CLOUD_RUN_SANDBOX_SECRET` | — | Shared secret the data app gateway was deployed with (required for data apps when `gcp-cloud-run`). | | `GCP_CLOUD_RUN_PYTHON_SANDBOX_URL` | — | URL of the Python sandbox gateway Cloud Run service (required for Python execution when `gcp-cloud-run`). | | `GCP_CLOUD_RUN_PYTHON_SANDBOX_SECRET` | — | Shared secret the Python gateway was deployed with (required for Python execution when `gcp-cloud-run`). | | `SANDBOX_DOCKER_IMAGE` | `lightdash-sandbox:local` | Local image for data app sandboxes (`docker` provider). | | `SANDBOX_AI_WRITEBACK_DOCKER_IMAGE` | `lightdash-ai-writeback:local` | Local image for writeback sandboxes (`docker` provider). | | `SANDBOX_PYTHON_DOCKER_IMAGE` | `lightdash-python-runner:local` | Local image for Python execution sandboxes (`docker` provider). | | `SANDBOX_IDLE_TIMEOUT_MS` | `1800000` (30 min) | Auto-suspend a running-but-idle sandbox (`lambda-microvm` and `azure-sandboxes`). Ignored by `e2b`/`docker`. | | `SANDBOX_SNAPSHOT_RETENTION_MS` | `604800000` (7 days) | Lambda MicroVMs idle policy: auto-terminate a suspended microVM (also how long a thread stays resumable). Ignored by `e2b`/`azure-sandboxes`/`docker`. | # Run a dedicated scheduler worker Source: https://docs.lightdash.com/self-host/customize-deployment/scheduler Run scheduled deliveries on a dedicated worker so heavy exports can't starve the API [Self-hosted](/support/feature-badges#self-hosted) To set up a delivery, see [Scheduled deliveries](/explore/create-scheduled-deliveries). By default, the Lightdash backend runs scheduled jobs in-process. In production, run a **dedicated scheduler worker** so a heavy dashboard export can't starve the API. Run one through the Helm chart's built-in worker, or as a standalone process you start yourself. ## Helm chart Set `scheduler.enabled: true` and the chart deploys a dedicated scheduler worker: ```yaml theme={null} scheduler: enabled: true replicas: 1 # scale up if deliveries queue at peak times concurrency: 3 # jobs per replica (sets SCHEDULER_CONCURRENCY) resources: requests: cpu: 500m memory: 1425Mi ephemeral-storage: 1Gi ``` When `scheduler.enabled: true`, the chart automatically sets `SCHEDULER_ENABLED: "false"` on the backend — don't set it yourself. Tune delivery throughput with `SCHEDULER_JOB_TIMEOUT`, `SCHEDULER_SCREENSHOT_TIMEOUT`, and `scheduler.tasks.include` / `scheduler.tasks.exclude` to shard task types across worker groups. See the [scheduler environment variables](/self-host/customize-deployment/environment-variables#scheduler) for the full reference. ## Standalone worker For infrastructure that doesn't use the Helm chart, run the scheduler worker as a separate process. ### 1. Disable the scheduler worker in the main server Set the following environment variable value: ```bash theme={null} SCHEDULER_ENABLED=false ``` ### 2. Run the standalone scheduler worker Command to start scheduler worker: ```bash theme={null} yarn workspace backend scheduler ``` Note that it expects the same environment variables as the main server. ### Example docker-compose.yml ```yaml theme={null} version: "3.8" x-environment: &commonEnvironment - PGHOST=${PGHOST:-db} - PGPORT=${PGPORT:-5432} - PGUSER=${PGUSER:-postgres} - PGPASSWORD=${PGPASSWORD} - PGDATABASE=${PGDATABASE:-postgres} - SECURE_COOKIES=${SECURE_COOKIES:-false} - TRUST_PROXY=${TRUST_PROXY:-false} - LIGHTDASH_SECRET=${LIGHTDASH_SECRET} - PORT=${PORT:-8080} - SITE_URL=${SITE_URL} - EMAIL_SMTP_HOST=${EMAIL_SMTP_HOST} - EMAIL_SMTP_PORT=${EMAIL_SMTP_PORT} - EMAIL_SMTP_SECURE=${EMAIL_SMTP_SECURE} - EMAIL_SMTP_USER=${EMAIL_SMTP_USER} - EMAIL_SMTP_PASSWORD=${EMAIL_SMTP_PASSWORD} - EMAIL_SMTP_ALLOW_INVALID_CERT=${EMAIL_SMTP_ALLOW_INVALID_CERT} - EMAIL_SMTP_SENDER_NAME=${EMAIL_SMTP_SENDER_NAME} - EMAIL_SMTP_SENDER_EMAIL=${EMAIL_SMTP_SENDER_EMAIL} - HEADLESS_BROWSER_HOST=headless-browser - HEADLESS_BROWSER_PORT=3000 services: headless-browser: image: browserless/chrome restart: always ports: - "3001:3000" db: image: postgres restart: always environment: POSTGRES_PASSWORD: ${PGPASSWORD} POSTGRES_USER: ${PGUSER:-postgres} POSTGRES_DB: ${PGDATABASE:-postgres} volumes: - db-data:/var/lib/postgresql/data lightdash: image: lightdash/lightdash:latest depends_on: - db environment: <<: *commonEnvironment SCHEDULER_ENABLED: 'false' volumes: - "${DBT_PROJECT_DIR}:/usr/app/dbt" ports: - ${PORT:-8080}:${PORT:-8080} scheduler: image: lightdash/lightdash:latest entrypoint: ["yarn", "workspace", "backend", "scheduler"] depends_on: - db environment: *commonEnvironment volumes: db-data: ``` # Secure Lightdash with HTTPS Source: https://docs.lightdash.com/self-host/customize-deployment/secure-lightdash-with-https Terminate HTTPS in front of a self-hosted Lightdash instance with a load balancer, ingress, or proxy [Self-hosted](/support/feature-badges#self-hosted) ## Configuration options for HTTPS ```yaml theme={null} # values.yaml configMap: # Ensures all Lightdash links use https SITE_URL: https://lightdash.mycompany.com # Only allow cookies to be sent over HTTPS SECURE_COOKIES: 'true' # (optional) allow http traffic behind a https enabled proxy TRUST_PROXY: 'true' # Depending on your ingress implementation you may need to set the following service: type: NodePort # Example ingress controller configuration ingress: enabled: true annotations: {} hosts: - host: lightdash.mycompany.com paths: - path: /* pathType: ImplementationSpecific tls: - hosts: - lightdash.mycompany.com secretName: lightdash-tls ``` ## SECURE\_COOKIES and TRUST\_PROXY Both default to `false`. A production instance behind a TLS-terminating load balancer or ingress needs both set to `"true"`: * `SECURE_COOKIES: "true"` tells Lightdash to only send its session cookies over HTTPS. Lightdash uses cookies to keep users signed in, so this keeps sessions from traveling over plain HTTP. * `TRUST_PROXY: "true"` tells Lightdash to trust the `X-Forwarded-Proto` header from your proxy. When TLS terminates at the load balancer, requests reach Lightdash over HTTP with that header set — without `TRUST_PROXY`, Lightdash treats the request as insecure and refuses to set secure cookies. Set both together: `SECURE_COOKIES` without `TRUST_PROXY` behind a terminating proxy locks users out. Changing `SITE_URL` later means reconfiguring every OAuth integration, so set the final `https://` URL before first boot. ## Load balancer and networking Match what Lightdash Cloud configures at the load balancer: * **Redirect HTTP → HTTPS**, minimum **TLS 1.2**. * **Backend/LB timeout ≥ 300s** — long-running exports and queries are killed by the common 30–60s defaults. * **Health check** on `GET /api/v1/health`. * Request body size limit at the ingress ≥ your `LIGHTDASH_MAX_PAYLOAD` (dbt manifests for large projects are tens of MB). * Optional: IP allowlisting, WAF, or rate limiting at the load balancer. * On GKE, the chart can create a `BackendConfig` (`backendConfig.create: true`, `backendConfig.spec`) to attach timeouts, CDN, and Cloud Armor policies — this is how they're configured on Lightdash Cloud. If backend pods can't reach `SITE_URL` from inside the cluster (hairpin/NAT), set `INTERNAL_LIGHTDASH_HOST` to the in-cluster service URL — the headless browser and internal calls use it. # Configure Lightdash to use passwords or SSO for authentication Source: https://docs.lightdash.com/self-host/customize-deployment/use-sso-login-for-self-hosted-lightdash Enable password login and SSO with Okta, Google, Azure AD, OneLogin, or any OIDC provider [Self-hosted](/support/feature-badges#self-hosted) Set the environment variables listed below directly in your deployment. **Lightdash Cloud users**: configure SSO yourself from **Organization settings → Single Sign-On** — see [Configure SSO](/workspace-admin/sso/setup). Use the provider-side steps on this page (creating an OAuth app, configuring redirect URIs, etc.) to obtain the values, then enter them in the organization settings UI instead of setting environment variables. Cloud SSO also requires a [verified domain](/workspace-admin/sso/verified-domains). Saving provider credentials without a verified domain will not route users to that provider during sign-in. ## Multiple authentication methods Lightdash supports configuring multiple authentication methods simultaneously on a single instance. You can enable any combination of sign-in options, including: * Password + Okta * Password + Google + Okta * Multiple SSO providers (e.g., Google + Azure AD + One Login) Simply configure the environment variables for each authentication method you want to enable, and all configured options will appear on your login page. ## Passwords We recommend [adding the SMTP environment variables](/self-host/customize-deployment/environment-variables#smtp) so Lightdash can display a `Forgot your password?` button in the login page and send emails to reset passwords. You can override a user password in just a few steps: 1. Open the bash terminal for the docker Lightdash container 2. Override user password with this command: ```bash theme={null} cd ./packages/backend && node ./dist/overrideUserPassword.js ``` ## Email-only signup and OTP login Lightdash can offer a passwordless email-first sign-in flow: new users sign up with just their email address, and returning users on those passwordless accounts sign in with a 6-digit code emailed to them instead of a password. Signup is gated by an instance-wide feature flag and is **off by default**. OTP login for existing passwordless accounts is always available, even if the flag is later turned off — see [Security notes](#security-notes) below. > [!WARNING] > > This flow currently has **no built-in rate limiting** on the OTP request or verify endpoints. Put rate limiting in front of Lightdash (e.g. at your ingress or WAF) before enabling this feature on a production instance. ### Enable the feature flag Set the `new-onboarding` [feature flag](/self-host/customize-deployment/environment-variables#feature-flags) on your instance: ```bash theme={null} LIGHTDASH_ENABLE_FEATURE_FLAGS=new-onboarding ``` Because [SMTP](/self-host/customize-deployment/environment-variables#smtp) is used to deliver the one-time codes, you must also have SMTP configured. The `new-onboarding` flag is a single umbrella toggle that also enables the full-page organization setup experience shown after registration and the dbt-less "connect to your warehouse" onboarding path. ### What changes when the flag is on **Register page (`/register`)** * The signup form asks only for an email address — no name, no password. * Lightdash creates the account with no password, sends a 6-digit code to that address, and — once the user enters the code — takes them through the standard join-or-create-organization flow. * Passwordless users can add a password later by clicking **Forgot your password?** on the login page: the reset link now upserts a password row for accounts that didn't previously have one. **Login page (`/login`)** * When a user enters an email that belongs to a passwordless account (no password set, no SSO identity), the password field is hidden and Lightdash emails a 6-digit code instead. * Entering the code signs the user in and marks the email as verified. * The same 5-attempt limit and expiry window used elsewhere for one-time passcodes applies. For example, a new user visits `/register` and types `alex@ecom-store.com`. They receive a code by email, enter something like `123456`, and land in the standard "create or join an organization" step. The next time they visit `/login` and type `alex@ecom-store.com`, the password field is hidden and they receive a fresh 6-digit code to sign in — no password ever set. ### What stays the same * **Accounts with a password** — the password field is still shown, and the OTP login path is refused regardless of the flag. * **SSO users** — accounts with any linked SSO identity continue to sign in via SSO. OTP login is refused for them regardless of the flag. * **Invite flow** (`/invite/`) — unchanged; invited users still complete the full signup form (name + password). ### Security notes * OTP login only applies to accounts that have **no password and no SSO identity**. Any account with either is excluded from this flow. * All failure modes (unknown email, non-passwordless account, wrong code, expired code, too many attempts) return the **same generic 401** so the endpoint can't be used to probe whether an email is registered. * OTP login is intentionally **not** gated on the `new-onboarding` flag. Turning the flag off stops new email-only signups, but existing passwordless accounts can still sign in with a one-time code — otherwise a flag rollback would strand them with no way to authenticate. If you want to end passwordless sign-in for those users, have them reset their password via **Forgot your password?** first. ## SSO setup To enforce SSO, it's recommended to disable password authentication. This can be done by setting the following environment variable: | Variable | Description | Required? | Default | | :- | :- | :-: | :-: | | `AUTH_DISABLE_PASSWORD_AUTHENTICATION` | If `"true"` disables signing in with plain passwords | | false | ## Okta Lightdash supports Okta as an authentication provider. The integration uses OpenID Connect (OIDC) to authenticate users and JIT provisioning to create users in Lightdash when they first log in. ### Creating an Okta application In the Okta admin panel, navigate to **Applications** and click **Create App Integration**, choose the following settings: * **Sign-in method**: OIDC - OpenID Connect * **Application type**: Web application On the following page you'll need to use the following settings, replace `{{ lightdash_url }}` with the URL of your Lightdash instance. For example if you normally access Lightdash at `https://lightdash.example.com/login` then you should use `https://lightdash.example.com` as your `{{ lightdash_url }}`. * **Grant type**: Authorization Code * **Sign-in redirect URIs**: `{{ lightdash_url }}/api/v1/oauth/redirect/okta` * **Sign-out redirect URIs**: `{{ lightdash_url }}` * **Controlled access**: Select who can access this application Hit **Save** and you'll be taken to the application settings page. For the optimal user experience, we recommend allowing Okta to initiate the login flow. To do this, click **Edit** next to **General Settings** and set: * **Login initiated by**: App and Okta Sign-in Page * **Application visibility**: Display application icon to users * **Login flow**: Redirect to app to initiate login (OIDC Compliant) * **Initiate login URI**: `{{ lightdash_url }}/api/v1/login/okta` Hit **Save** to finish. ### Okta configuration variables From the application settings page, you'll need to copy the following values: * **Client ID** * **Client secret** You'll also need your **Okta domain**, which is the first part of your okta URL. For example if your Okta URL is [https://dev-123456.okta.com](https://dev-123456.okta.com) then your Okta domain is `dev-123456.okta.com`. Finally, you need the **Issuer URI**. This is the URL of your Okta authorization server. You can use your [Org authorization server](https://developer.okta.com/docs/concepts/auth-servers/#org-authorization-server) which uses `https://dev-123456.okta.com` as your issuer or select a custom authorization server. To find the issuer URI for a custom authorization server navigate to **API** > **Authorization Servers** and click on the authorization server and note the **Issuer URI** and **Name** of the authorization server. For example the `default` authorization server has an issuer URI of `https://dev-123456.okta.com/oauth2/default`. #### Groups & Okta If you want to use groups to control access to Lightdash, you'll need to configure Okta and Lightdash to support this. If you're **not** using a custom authorization server ID: * on `OpenID Connect ID Token` section in the Okta application settings, add `groups` to the `Groups claim` field, by setting a Groups claims type to `Filter` and a Filter to match expression to `.*` If you're using a custom authorization server ID: * you don't need to set the `AUTH_OKTA_EXTRA_SCOPES` environment variable * on the Authorization Server settings, add claim `groups`, value type `Groups`, matches regex `.*` ### Configuring Lightdash for Okta **Lightdash Cloud users**: instead of setting these environment variables, enter the client ID, client secret, Okta domain, and issuer URI in **Organization settings → Single Sign-On → Okta**. See [Configure SSO](/workspace-admin/sso/setup#okta). Make sure your organization has a [verified domain](/workspace-admin/sso/verified-domains), otherwise Okta will not appear for users during sign-in. You'll need to set the following environment variables in your Lightdash deployment: | Variable | Description | Required? | | :- | :- | :-: | | `AUTH_OKTA_DOMAIN` | The `{{ okta_domain }}`. Should not include `https://` | | | `AUTH_OKTA_OAUTH_CLIENT_ID` | The **Client ID** copied from the application settings in okta | | | `AUTH_OKTA_OAUTH_CLIENT_SECRET` | The **Client secret** copied from the application settings in okta | | | `AUTH_OKTA_OAUTH_ISSUER` | The **Issuer URI** copied from the authorization server. Should include `https://` | | | `AUTH_OKTA_AUTHORIZATION_SERVER_ID` | Optional. The **Name** of a custom authorization server if not using the org authorization server. | | | `AUTH_OKTA_EXTRA_SCOPES` | Optional. The extra **scopes** (e.g. "groups") when not using a custom authorization server | | ### Enable Automatic Assignment of Okta Users to Groups in Lightdash **This feature is deprecated and will be removed in a future release.** For more information on how to provision users and groups in Lightdash, see the [SCIM integration](/workspace-admin/sso/scim) documentation. Okta users will automatically be assigned to the same groups in Lightdash as they are in Okta if you have [configured Okta to share groups with Lightdash](/workspace-admin/sso/scim#group-role-provisioning). To enable this functionality, ensure the following environment variable is set: | Variable | Description | Required? | | :- | :- | :-: | | `AUTH_ENABLE_GROUP_SYNC` | If `"true"` enables group sync from Okta. | | read more about [Using OKTA to manage groups in Lightdash](/workspace-admin/sso/scim#group-role-provisioning) ## Google To enable Google Single Sign On (SSO) you'll need to follow these instructions to [Create the OAuth web client ID](https://support.google.com/workspacemigrate/answer/9222992?hl=en). Once you reach **Step 13** to configure the client you'll need to enter the following details: * Authorized JavaScript Origins: `https://{{ lightdash_domain }}` * Authorized redirect URIs: `https://{{ lightdash_domain }}/api/v1/oauth/redirect/google` Where `{{ lightdash_domain }}` is the domain you use to sign in to Lightdash such as `mycompany.lightdash.com` These environment variables must be provided to Lightdash to enable you to control Single Sign On (SSO) functionality for Google | Variable | Description | Required? | Default | | :- | :- | :-: | :-: | | `AUTH_GOOGLE_ENABLED` | Required to be set to `true` for Google SSO | | | | `AUTH_GOOGLE_OAUTH2_CLIENT_ID` | Required see instructions above | | | | `AUTH_GOOGLE_OAUTH2_CLIENT_SECRET` | Required see instructions above | | | | `AUTH_GOOGLE_INCLUDE_BIGQUERY_SCOPE` | When `true`, bundles the BigQuery scope into the Google login flow so BigQuery SSO users see a single consent screen instead of two | | `false` | ### Combine BigQuery SSO consent with Google login If you use [BigQuery SSO](/workspace-admin/sso#warehouse-sso-enterprise-only) to give users per-user warehouse credentials, set `AUTH_GOOGLE_INCLUDE_BIGQUERY_SCOPE=true` to request the BigQuery scope during the initial Google login. Users will complete one consent screen that covers both Lightdash login and BigQuery warehouse access instead of two separate OAuth flows. When enabled, Lightdash also requests offline access with a forced consent prompt so Google returns a refresh token for the BigQuery connection. Leave this unset (or `false`) if you do not use BigQuery SSO. Lightdash saves the BigQuery credential when a user signs in with Google, so users who are already signed in get it at their next Google sign-in. It is saved for every user who signs in, whatever their projects' connections use. On a shared connection that accepts [personal credentials](/personal-settings/personal-warehouse-connections), it replaces the shared credentials for that user until they remove it under **Settings → My warehouse connections**. Before enabling this option: * Confirm Google SSO is configured and working (`AUTH_GOOGLE_ENABLED=true`). * Add the `https://www.googleapis.com/auth/bigquery` scope to your OAuth consent screen in Google Cloud. * Enable BigQuery SSO at the project level for the warehouse connections that should use it. ## One Login To create a One Login integration: * Head to the **Administration** portal * In the navigation bar at the top select **Applications** > **Applications** * Hit the **Add App** button * Under **Find Applications** search for **OpenID Connect (OIDC)** and select it * Set the **Display Name** and **Icon** and press **Save** * Set the following values for the application * **Configuration** > **Login URL** `{{site_url}}/api/v1/login/oneLogin` * **Configuration** > **Redirect URL** `{{site_url}}/api/v1/oauth/redirect/oneLogin` * **SSO** > **Application Type** `web` * **SSO** > **Token endpoint** `post` * **SSO** > **Enable login hint** `true` * From the **SSO** page copy the client id, client secret, and issuer URL. **Lightdash Cloud users**: instead of setting these environment variables, enter the client ID, client secret, and issuer URL in **Organization settings → Single Sign-On → OneLogin**. See [Configure SSO](/workspace-admin/sso/setup#onelogin). Make sure your organization has a [verified domain](/workspace-admin/sso/verified-domains), otherwise OneLogin will not appear for users during sign-in. These variables enable you to control Single Sign On (SSO) functionality for One Login | Variable | Description | Required? | Default | | :- | :- | :-: | :-: | | `AUTH_ONE_LOGIN_OAUTH_CLIENT_ID` | Required for One Login SSO | | | | `AUTH_ONE_LOGIN_OAUTH_CLIENT_SECRET` | Required for One Login SSO | | | | `AUTH_ONE_LOGIN_OAUTH_ISSUER` | Required for One Login SSO | | | ## Azure Active Directory ### Creating an Azure AD application In the admin panel, navigate to **App Registrations** and click **New registration**, choose the following settings for the redirect URI: * **Type**: Web * **URI**: `{{ lightdash_url }}/api/v1/oauth/redirect/azuread` On the following page you'll need to use the following settings, replace `{{ lightdash_url }}` with the URL of your Lightdash instance. For example if you normally access Lightdash at `https://lightdash.example.com/login` then you should use `https://lightdash.example.com` as your `{{ lightdash_url }}`. Hit **Register** and you'll be taken to the application settings page. Copy the "Application (client) ID" and "Directory (tenant) ID" values as you'll need them later. In the left hand menu, navigate to **Certificates & secrets** and click **New client secret**. Give the secret a description and choose an expiry time. Hit **Add** and you'll be shown the secret value. Copy this value as you'll need it later. ### Configuring Lightdash for Azure AD **Lightdash Cloud users**: instead of setting these environment variables, enter the client ID, client secret, and tenant ID in **Organization settings → Single Sign-On → Azure AD**. See [Configure SSO](/workspace-admin/sso/setup#azure-active-directory). Make sure your organization has a [verified domain](/workspace-admin/sso/verified-domains), otherwise Azure AD will not appear for users during sign-in. These variables enable you to control Single Sign On (SSO) functionality for Azure Active Directory. | Variable | Description | Required? | Default | | :- | :- | :-: | :-: | | `AUTH_AZURE_AD_OAUTH_CLIENT_ID` | Required for Azure AD | | | | `AUTH_AZURE_AD_OAUTH_CLIENT_SECRET` | Required for Azure AD | | | | `AUTH_AZURE_AD_OAUTH_TENANT_ID` | Required for Azure AD | | | | `AUTH_AZURE_AD_OIDC_METADATA_ENDPOINT` | Optional for Azure AD | | | | `AUTH_AZURE_AD_X509_CERT_PATH` | Optional for Azure AD | | | | `AUTH_AZURE_AD_X509_CERT` | Optional for Azure AD | | | | `AUTH_AZURE_AD_PRIVATE_KEY_PATH` | Optional for Azure AD | | | | `AUTH_AZURE_AD_PRIVATE_KEY` | Optional for Azure AD | | | ## OpenID Connect Lightdash supports OpenID Connect-compliant SSO providers, via our configurable OIDC connector. ### Configuring Lightdash for OpenID Connect **Lightdash Cloud users**: instead of setting these environment variables, enter the client ID, client secret, and metadata document URL in **Organization settings → Single Sign-On → OpenID Connect**. See [Configure SSO](/workspace-admin/sso/setup#openid-connect). Make sure your organization has a [verified domain](/workspace-admin/sso/verified-domains), otherwise OpenID Connect will not appear for users during sign-in. These variables enable you to control Single Sign On (SSO) functionality for a generic OpenID Connect provider. | Variable | Description | Required? | Default | | :- | :- | :-: | :-: | | `AUTH_OIDC_CLIENT_ID` | | | | | `AUTH_OIDC_CLIENT_SECRET` | Required unless AUTH\_METHOD is `private_key_jwt` | | | | `AUTH_OIDC_METADATA_DOCUMENT_URL` | [URL to OIDC metadata discovery endpoint](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationRequest) | | | | `AUTH_OIDC_AUTH_METHOD` | `client_secret_basic` or `private_key_jwt` | | `client_secret_basic` | | `AUTH_OIDC_X509_CERT` | PEM-encoded content of a public key certificate for `private_key_jwt` | | | | `AUTH_OIDC_PRIVATE_KEY` | PEM-encoded content of a private key file for `private_key_jwt` | | | | `AUTH_OIDC_X509_CERT_PATH` | Path to a PEM-encoded public key certificate for `private_key_jwt` | | | | `AUTH_OIDC_PRIVATE_KEY_PATH` | Path to a PEM-encoded private key for `private_key_jwt` | | | | `AUTH_OIDC_SCOPES` | List of space-delimited OIDC scopes | | | ## SSO sign-in logs SSO sign-ins write an INFO line like this to the server logs: ```text theme={null} [Lightdash][UserService] info: Logging with OpenId email alex@example.com and groups ..., is authenticated: false ``` This line is not an error. `is authenticated` shows whether the user already had a Lightdash session when the sign-in started, so it is `false` on a normal sign-in and `true` only when a signed-in user links another identity. The line doesn't tell you whether the sign-in succeeded. To find out why a sign-in failed, look at the error the user sees and at any `warn` or `error` lines around it. # Data flows and telemetry in self-hosted Lightdash Source: https://docs.lightdash.com/self-host/data-flows-and-telemetry What data stays inside your infrastructure, what leaves it, where it goes, and how to control it [Self-hosted](/support/feature-badges#self-hosted) ## Summary * **Warehouse credentials, dbt or Lightdash YAML definitions, generated SQL, query results, dashboard and chart definitions, and underlying warehouse data are processed inside your deployment.** None of these are sent to Lightdash through product telemetry. * **Product telemetry is enabled by default** and points at Lightdash's RudderStack endpoint (`https://analytics.lightdash.com`) using a built-in write key. It can be [disabled with a single environment variable](#configuration-2-disable-outbound-rudderstack-telemetry), or [redirected to your own RudderStack instance](#configuration-3-send-telemetry-to-your-own-rudderstack). * **Enterprise Edition validates its license key against Keygen on every server start.** The request contains the license key only — no warehouse credentials, no query text, no business data. See [License validation request](#license-validation-request) for the exact payload. * **Optional integrations** (SSO, SMTP, Slack, GitHub, object storage, AI providers, MCP, sandbox providers, and Sentry) talk directly to the endpoints you configure. They are not proxied through Lightdash Cloud. The [organization roadmap](/self-host/customize-deployment/organization-roadmap) is on for every Enterprise instance whose license validates at boot and calls `https://roadmap.lightdash.com`. Everything below is grounded in the current Lightdash source code and applies to a standard self-hosted deployment on the [official Helm chart](https://github.com/lightdash/helm-charts) or Docker Compose. ## Three telemetry configurations Telemetry means the RudderStack event stream emitted by the Lightdash backend and browser. The three supported configurations map to three environment-variable combinations. ### Configuration 1: default Lightdash telemetry If you set none of the `RUDDERSTACK_*` variables, Lightdash uses a built-in write key and its own RudderStack endpoint: * **Endpoint:** `https://analytics.lightdash.com` * **Write key:** built into the release * **Enabled by default:** yes, on every fresh install * **Applies to:** the backend, the scheduler, and the browser (the frontend loads its RudderStack config from the backend's `/api/v1/health` response) If you do nothing, telemetry is on and points at Lightdash. ### Configuration 2: disable outbound RudderStack telemetry Set one variable on every Lightdash container: ```bash theme={null} RUDDERSTACK_ANALYTICS_DISABLED=true ``` When this is `true` the backend clears both the write key and the data plane URL, no matter what `RUDDERSTACK_WRITE_KEY` or `RUDDERSTACK_DATA_PLANE_URL` are set to. That means: * The backend `LightdashAnalytics.track()`, `identify()`, and `group()` calls short-circuit and send nothing. * The `/api/v1/health` response returns an empty `rudder` block, so the browser skips `rudder-sdk-js` initialization and emits no client-side events. * `RUDDERSTACK_ANALYTICS_DISABLED=true` **takes precedence** over `RUDDERSTACK_WRITE_KEY` and `RUDDERSTACK_DATA_PLANE_URL`. Set the variable on every process that runs Lightdash code: * The backend container (`lightdash-headless` / `lightdash`) * The scheduler container (`scheduler.enabled: true`) * Any NATS worker containers (`warehouseNatsWorker`, `preAggregateWorker`) Disabling RudderStack telemetry does not change product functionality. Nothing in the query, dashboard, AI, or admin surface depends on it. Prometheus metrics, in-product Usage Analytics dashboards, audit logs, query tags in your warehouse, and the optional usage event stream all keep working — they are independent systems (see [Related systems](#related-systems)). ```yaml Helm values.yaml theme={null} # lightdash/lightdash Helm chart extraEnv: - name: RUDDERSTACK_ANALYTICS_DISABLED value: "true" scheduler: extraEnv: - name: RUDDERSTACK_ANALYTICS_DISABLED value: "true" warehouseNatsWorker: extraEnv: - name: RUDDERSTACK_ANALYTICS_DISABLED value: "true" ``` ```yaml docker-compose.yml theme={null} services: lightdash: image: lightdash/lightdash:latest environment: RUDDERSTACK_ANALYTICS_DISABLED: "true" scheduler: image: lightdash/lightdash:latest environment: RUDDERSTACK_ANALYTICS_DISABLED: "true" ``` ### Configuration 3: send telemetry to your own RudderStack Point Lightdash at a RudderStack source you control: ```bash theme={null} RUDDERSTACK_WRITE_KEY=your-write-key RUDDERSTACK_DATA_PLANE_URL=https://your-rudderstack.example.com ``` * The backend uses these values in place of the built-in ones. * The browser reads them from `/api/v1/health` and initializes `rudder-sdk-js` against your endpoint. * Events go to your RudderStack destination instead of Lightdash's. Lightdash never sees them. * If `RUDDERSTACK_ANALYTICS_DISABLED=true` is also set, disable wins — no events are sent anywhere. This is a redirection of the same event stream — it is not the same thing as audit logs, Prometheus metrics, warehouse query tags, or the in-product Usage Analytics dashboards. Those systems are independent (see [Related systems](#related-systems)). ## Telemetry payload The backend emits RudderStack events through `LightdashAnalytics.track()`. Every event carries a common `context.app` block and the event's own `properties`. ### Common context on every event All telemetry events carry the following installation context: | Field | Description | | - | - | | `app.namespace` | Constant `"lightdash"` | | `app.name` | Constant `"lightdash_server"` | | `app.version` | Backend version, e.g. `"0.1500.0"` | | `app.mode` | Deployment mode: `default`, `cloud_beta`, `demo`, `pr`, `dev` — self-hosted is `default` | | `app.siteUrl` | Present only in `cloud_beta` and `demo`. **Not sent for standard self-hosted deployments.** | | `app.installId` | Value of `LIGHTDASH_INSTALL_ID` if set, otherwise a random UUID generated at process start | | `app.installType` | Value of `LIGHTDASH_INSTALL_TYPE` if set, otherwise `unknown` (Helm chart, Docker image, etc.) | | `app.installChartVersion` | Value of `LIGHTDASH_HELM_CHART_VERSION` if set, otherwise `null` | The user identifier is either the Lightdash `userId` (a UUID), the anonymous ID (`00000000-0000-0000-0000-000000000000`) when the user has enabled tracking anonymization, or the constant string `"embed"` for embedded viewers. ### Event categories | Category | What the events describe | Representative fields | | - | - | - | | Installation and lifecycle | Process start, version upgrades, feature-flag configuration | `app.version`, `app.installId`, `app.installType`, `app.installChartVersion` | | User and authentication | Signup, login, invite, password reset, personal access token, SSO identity link/removal | `userId`, `loginProvider`, `context`, `is_tracking_anonymized`; email and name only if the user has **not** enabled tracking anonymization | | Organization, project, and resource identifiers | Create/update/delete of organizations, projects, warehouse connections, spaces | `organizationId`, `projectId`, `warehouseType`, `dbtConnectionType` | | Charts, dashboards, spaces, search, sharing, scheduling, API | Content lifecycle (`saved_chart.created`, `dashboard.updated`, `space.created`, `scheduler.created`, etc.), feature usage, share link creation | Resource IDs, structural counts (dimensions, metrics, filters, sorts), chart type, and for creates/updates: **`title` and `description` of charts, dashboards, and schedulers** | | Query execution | One event per query — `query.executed`, `query.ready`, `query.completed`, `query.error` | `queryId`, `organizationId`, `projectId`, `context` (e.g. `explore`, `dashboard`), `warehouseType`, `executionSource` (`warehouse`, `pre_aggregate_duckdb`, `pre_aggregate_warehouse`, `external_source_duckdb`), `totalRowCount`, `columnsCount`, `warehouseExecutionTimeMs`, `cacheHit`, `exploreName`, `chartId`, `dashboardId` | | AI usage | One `ai.usage` event per model call | `feature` (`agent`, `deep-research`, `data-app`, `chart-metadata`, `embedding`, etc.), `provider` (`openai`, `anthropic`, `bedrock`, …), `model`, `keyManagement` (`lightdash-managed` or `self-managed`), `inputTokens`, `outputTokens`, `cacheReadTokens`, `cacheWriteTokens`, `reasoningTokens`, `totalTokens`, `organizationId`, `projectId`, `aiAgentId`, `threadId`, `promptId` | | Errors and operational events | Query errors, scheduler-job outcomes, integration-connection outcomes | `queryId`, `context`, `warehouseType`, `errorMessage` (short server-side error strings — see next section) | > [!WARNING] > > Telemetry is not fully anonymous. Events carry stable identifiers (`organizationId`, `projectId`, `userId`, chart/dashboard/space UUIDs) and, for some events, human-readable resource metadata: chart and dashboard **titles** and **descriptions**, scheduler names, warehouse type, dbt connection type, and short `errorMessage` strings from server-side failures. Do not assume every event is anonymous. ### User-level tracking anonymization Users can toggle **Anonymize my usage data** in their profile. When on: * The `is_tracking_anonymized: true` flag is set on the user record and included in identify/update events. * The `user.updated`, `user.verified`, and `user.deleted` events drop `email`, `firstName`, and `lastName`. * The `userId` and resource identifiers (`organizationId`, `projectId`, chart/dashboard UUIDs) **are still sent** — anonymization operates at the user-name/email level, not at the identifier level. This is a user-scoped setting. It does not disable telemetry, and it does not scrub identifiers or resource metadata from non-user events. To stop telemetry leaving the deployment, use [`RUDDERSTACK_ANALYTICS_DISABLED=true`](#configuration-2-disable-outbound-rudderstack-telemetry). ## Not sent through RudderStack telemetry Verified against the current backend source. RudderStack telemetry never contains: * **Warehouse credentials or authentication secrets.** Connection strings, keys, and tokens live in `LIGHTDASH_SECRET`-encrypted rows in Postgres and are never included in event payloads. * **dbt project files or complete semantic-layer definitions.** Warehouse `type` and `dbtConnectionType` are included; the manifest, `.yml` model files, and metric definitions are not. * **Generated SQL or SQL Runner query text.** Query events carry an ID, structural counts, timings, and warehouse type — never the SQL string. * **Query results, row values, or warehouse records.** Query events carry `totalRowCount` and `columnsCount` — never row data. * **Complete dashboard or chart definitions.** Create/update events carry structural counts (metrics, dimensions, filters, series types), the chart type, and the chart or dashboard **title and description**. They do not carry the full config JSON, tile layout, or filter values. * **AI prompt text, conversation text, or model responses.** `ai.usage` events carry token counts, provider, model, feature, and IDs (`aiAgentId`, `threadId`, `promptId`, `organizationId`, `projectId`). They do not carry prompt or completion text. * **Integration credentials or application secrets.** OAuth tokens, Slack bot tokens, GitHub app credentials, SMTP passwords, `LIGHTDASH_LICENSE_KEY`, `LIGHTDASH_SECRET`, and AI-provider API keys are never sent. Exceptions and potentially sensitive metadata that **is** sent: * Chart, dashboard, space, and scheduler **titles and descriptions** on create/update events. * Explore name (`exploreName`) and virtual view ID on query events. * User **email, first name, last name** on user identify/update events — unless the user has enabled tracking anonymization. * Short server-side **error messages** on error events (typed exception messages, not stack traces of user data). * Stable **UUIDs** for organizations, projects, users, charts, dashboards, spaces, schedulers, queries, and AI agents. ## Enterprise license validation Enterprise Edition (`LIGHTDASH_LICENSE_KEY` set) validates the license against [Keygen](https://keygen.sh) at server start and periodically thereafter. ### License validation request * **Endpoint:** `POST https://api.keygen.sh/v1/accounts/1ae7d3a8-4665-44e4-989d-9de54c84761a/licenses/actions/validate-key` * **Timing:** on server start and roughly once every 24 hours from the process cache * **Initiator:** the Lightdash backend and any process that instantiates `LicenseClient` (backend, scheduler, workers) * **Request headers:** `Content-Type: application/json`, `Accept: application/json` * **Request body:** ```json theme={null} { "meta": { "key": "" } } ``` * **Response:** validity, human-readable detail, and a status code. No code or configuration is pulled during validation. The request contains the license key only. It does **not** contain warehouse credentials, dbt project data, query text, query results, chart or dashboard definitions, or any organization business data. Keygen is the only Lightdash-operated external service required for Enterprise features. Once the license validates, the backend also calls `https://roadmap.lightdash.com` to serve the [organization roadmap](/self-host/customize-deployment/organization-roadmap) — see the [egress matrix](#egress-matrix) below. For full license setup steps and troubleshooting, see [Enterprise features and licensing](/self-host/enterprise-features). ## Related systems These systems are commonly conflated with RudderStack telemetry. They are independent, and each continues to work when `RUDDERSTACK_ANALYTICS_DISABLED=true`. | System | Where the data goes | Behaviour when `RUDDERSTACK_ANALYTICS_DISABLED=true` | | - | - | - | | **RudderStack product telemetry** | Outside the deployment — `https://analytics.lightdash.com` by default, or your own RudderStack endpoint if [redirected](#configuration-3-send-telemetry-to-your-own-rudderstack) | Disabled | | **In-product [Usage Analytics dashboards](/workspace-admin/usage-analytics#usage-analytics-dashboards)** | Application Postgres inside the deployment | Continues to work | | **[Warehouse query tags](/workspace-admin/usage-analytics#query-tags)** | Your warehouse's query history | Continues to work | | **[Prometheus metrics](/self-host/customize-deployment/configure-prometheus-metrics-for-self-hosted-lightdash)** and OpenTelemetry HTTP metrics | Exposed on the Lightdash instance for your scraper | Continues to work | | **Audit logs and application logs** | Wherever your log stack collects stdout | Continues to work | | **Customer-configured [usage event stream](/self-host/enterprise-features/usage-analytics)** | Your configured [usage storage bucket](/self-host/customize-deployment/environment-variables#usage-analytics-storage) | Continues to work — the event stream sink runs before the RudderStack path and is independent of it | ## Egress matrix Every default and optional outbound destination from a self-hosted Lightdash deployment. "Required" means the deployment fails without the destination for the feature it enables; "Optional" means the destination is only reached when the feature is turned on. | Destination | When it is used | Required or optional | Initiating component | Data sent | Control | | - | - | - | - | - | - | | `analytics.lightdash.com` | Default RudderStack telemetry endpoint | Optional (on by default) | Backend, scheduler, workers, browser | Event stream — see [Telemetry payload](#telemetry-payload) | `RUDDERSTACK_ANALYTICS_DISABLED=true`, or redirect with `RUDDERSTACK_WRITE_KEY` + `RUDDERSTACK_DATA_PLANE_URL` | | `api.keygen.sh` | Enterprise license validation on server start and every 24h | **Required** for Enterprise Edition. Not called at all in Community Edition. | Backend, scheduler, workers | License key inside a JSON `meta.key` field | Remove `LIGHTDASH_LICENSE_KEY` (Community only), or run the [validation proxy](https://roadmap.lightdash.com) in front | | `roadmap.lightdash.com` | [Organization roadmap](/self-host/customize-deployment/organization-roadmap) on every Enterprise instance whose license validated at boot, and optional license-validation proxy | Optional | Backend | Roadmap requests: organization UUID as a path segment and license key in the `lightdash-license-key` header. Proxy requests: license key in a JSON `key` field. No query text or business data. | Remove `LIGHTDASH_LICENSE_KEY` (Community only) to stop roadmap requests; leave `LIGHTDASH_LICENSE_VALIDATION_PROXY_ENABLED` unset so license validation goes directly to `api.keygen.sh` | | Customer data warehouse | Every query, dbt compile, warehouse worker | **Required** | Backend, scheduler, warehouse NATS workers | SQL queries, receives query results in return | Warehouse connection config — kept internal to the deployment | | Application Postgres | All persistent state (users, projects, encrypted secrets, dashboards, results cache metadata) | **Required** | Backend, scheduler, workers | Full application data | [`PGHOST`](/self-host/customize-deployment/configure-lightdash-to-use-an-external-database) and related variables | | Object storage (S3 / S3-compatible) | Results cache, exports, images, headless browser artifacts, data-app bundles | **Required** | Backend, scheduler, headless browser | Encrypted results parquet, generated CSVs/PDFs/PNGs, data-app static bundles | [`S3_*`](/self-host/customize-deployment/configure-lightdash-to-use-external-object-storage) variables | | SMTP provider | Transactional email (invites, password resets, scheduled deliveries) | Optional | Backend, scheduler | Email content: recipient address, invitation link, scheduled chart image or CSV attachment | [`SMTP_*`](/self-host/customize-deployment/environment-variables#smtp) variables | | Identity provider (Google, Okta, Azure AD, OneLogin, generic OIDC, Snowflake OAuth, Databricks OAuth) | Sign-in and SSO | Optional | Backend, browser (redirect) | OIDC/OAuth handshake — user claims from the IdP; Lightdash sends only what the OAuth flow requires | [`AUTH_*` variables](/self-host/customize-deployment/environment-variables#sso) and [SSO setup](/self-host/customize-deployment/use-sso-login-for-self-hosted-lightdash) | | AI/model provider (OpenAI, Anthropic, Azure OpenAI, OpenRouter, Bedrock) | AI agents, AI writeback, data apps, embeddings, chart metadata generation | Optional | Backend, scheduler, sandboxes (when the agent runs in a sandbox) | Prompts, tool calls, semantic-layer metadata for context, and — depending on the feature — query results the agent has already fetched from your warehouse. Provider API key. | `AI_COPILOT_ENABLED=false`, `AI_WRITEBACK_ENABLED=false`, or a private LLM gateway; see [AI providers](/self-host/enterprise-features/ai-agents) | | GitHub (or other source-control provider) | dbt project write-back and AI writeback PRs | Optional | Backend, sandboxes (AI writeback) | Git commits and pull-request contents against the dbt repo you configured; GitHub App installation token or personal access token | Do not [connect GitHub](/self-host/customize-deployment/configure-github-for-lightdash); use a self-hosted GitLab / GHES instance you control | | Slack | Scheduled deliveries, unfurls, AI agents in Slack | Optional | Backend, scheduler | Message content: chart images, CSVs, unfurl payloads; Slack bot token | Do not [install the Slack app](/self-host/customize-deployment/configure-a-slack-app-for-lightdash) | | MCP servers | [Model Context Protocol](/self-host/enterprise-features/mcp) tool calls from Lightdash AI agents | Optional | Backend, scheduler | MCP tool call payloads to the servers you register | Do not enable MCP; register only internal MCP endpoints | | E2B (`api.e2b.dev` and per-sandbox subdomains) | Default managed [sandbox provider](/self-host/customize-deployment/sandboxes) for AI writeback and data apps | Optional | Backend, scheduler | Files copied into the sandbox (dbt project, generated code), API key. Sandbox egress from inside E2B is separately allowlisted per sandbox. | `SANDBOX_PROVIDER=aws-lambda-microvms` or `SANDBOX_PROVIDER=azure-container-apps` to run sandboxes inside your own cloud | | AWS Lambda MicroVMs / Azure Container Apps Sandboxes | Alternative [sandbox providers](/self-host/customize-deployment/sandboxes) | Optional | Backend, scheduler | Same payload as E2B, but into your own AWS or Azure account | Provider-specific configuration; stays inside your cloud | | Sentry (or another DSN) | Error reporting (optional; **disabled unless a DSN is set**) | Optional | Backend, scheduler, browser | Error message, stack trace, breadcrumbs, `userId`, `organizationUuid`, `projectUuid`, `dashboardUuid` tags. Session replay is enabled on error. | Leave `SENTRY_BE_DSN` and `SENTRY_FE_DSN` unset (default). Point at your own Sentry to keep it internal. | | Google Sheets API | Optional [Google Sheets sync](/self-host/customize-deployment/configure-google-sheets-integration) | Optional | Backend, scheduler | Query results written to the target sheet; Google service-account credentials | Do not configure Google Sheets integration | | dbt Cloud API | Optional dbt Cloud integration for a project's dbt configuration | Optional | Backend | Job trigger requests, project artifact fetches; dbt Cloud API token | Do not configure a dbt Cloud connection for the project | | `api.github.com` | [Release highlights](/self-host/upgrading#when-to-upgrade) in the What's new panel and page, when the instance is behind the latest release | Optional | Backend | Unauthenticated `GET` requests for the public `lightdash/lightdash` release notes and version comparison. No license key, user, organization, or business data. | `LIGHTDASH_DISABLE_UPDATE_CHECK=true` | | Container image registry (Docker Hub / GHCR) | `docker pull` when starting or upgrading | **Required at deploy time only.** Not called at runtime. | Container orchestrator | Image pull | Mirror the image into a private registry | Community Edition (no `LIGHTDASH_LICENSE_KEY`) does not call `api.keygen.sh` or `roadmap.lightdash.com`. Every other row is identical. AI traffic doesn't pass through Lightdash-operated servers. AI agents, AI writeback, and data apps call the model provider you configure directly from your backend, scheduler, or sandbox. The [Lightdash MCP server](/self-host/enterprise-features/mcp) (`/api/v1/mcp`) and the OAuth server its clients sign in with are part of your Lightdash backend, so they add no outbound destination. ## Security-review checklist **1. Disable Lightdash-hosted telemetry (optional)** Set `RUDDERSTACK_ANALYTICS_DISABLED=true` on every Lightdash container (backend, scheduler, NATS workers). See [Configuration 2](#configuration-2-disable-outbound-rudderstack-telemetry). **2. Or, redirect telemetry to your own RudderStack** Set `RUDDERSTACK_WRITE_KEY` and `RUDDERSTACK_DATA_PLANE_URL` on every Lightdash container. Confirm the browser picks up the new endpoint by inspecting `GET /api/v1/health` — the `rudder` block should show your write key and data plane URL. See [Configuration 3](#configuration-3-send-telemetry-to-your-own-rudderstack). **3. Allow-list the domains you actually need** * `api.keygen.sh` — Enterprise Edition only, required. * `roadmap.lightdash.com` — for the organization roadmap on Enterprise Edition. * `analytics.lightdash.com` — only if you leave default telemetry on. * `api.github.com` — only for release highlights; blocked or not, upgrades are unaffected. * Your warehouse endpoint, S3 endpoint, IdP, SMTP host, AI provider endpoints, Slack, GitHub, and sandbox provider endpoints — whichever features you use. Everything else can be blocked. See the [production deployment checklist](/self-host/production-deployment-checklist#security-hardening) for a starting egress policy. **4. Keep optional integrations internal** * **AI providers:** point `ANTHROPIC_BASE_URL`, `OPENAI_BASE_URL`, or `BEDROCK_BASE_URL` at an internal LLM gateway. * **Sandboxes:** set `SANDBOX_PROVIDER=aws-lambda-microvms` or `azure-container-apps` to keep sandbox execution inside your cloud account. * **Sentry:** leave `SENTRY_BE_DSN` and `SENTRY_FE_DSN` unset, or point them at your own Sentry instance. * **GitHub:** connect a GHES or self-hosted GitLab instead of GitHub.com. * **MCP:** register only internal MCP endpoints. * **Google Sheets, Slack, dbt Cloud:** leave disabled. **5. Verify the effective configuration** * `GET /api/v1/health` returns the effective `rudder` and `sentry` config the frontend will use. * Backend startup logs record whether Sentry initialized and whether license validation succeeded. * Run a network capture or eBPF/Cilium egress log against the backend, scheduler, and worker pods to confirm the observed destinations match the allow-list. * Query the `Instance health` page in Lightdash for the running configuration snapshot. ## Further reading * [Environment variables — Analytics & Event Tracking](/self-host/customize-deployment/environment-variables#analytics--event-tracking) * [Enterprise features and license validation](/self-host/enterprise-features) * [Production deployment checklist](/self-host/production-deployment-checklist) — includes the default egress policy * [Usage Analytics dashboards and query tags](/workspace-admin/usage-analytics) * [Prometheus and OpenTelemetry metrics](/self-host/customize-deployment/configure-prometheus-metrics-for-self-hosted-lightdash) * [OpenTelemetry tracing](/self-host/customize-deployment/configure-opentelemetry-tracing-for-self-hosted-lightdash) * [AI agents and AI providers](/self-host/enterprise-features/ai-agents) * [Data apps sandboxes](/self-host/customize-deployment/sandboxes) * [MCP](/self-host/enterprise-features/mcp) * [Slack](/self-host/customize-deployment/configure-a-slack-app-for-lightdash) * [GitHub](/self-host/customize-deployment/configure-github-for-lightdash) * [External object storage](/self-host/customize-deployment/configure-lightdash-to-use-external-object-storage) * [Organization roadmap](/self-host/customize-deployment/organization-roadmap) * [Instance health](/workspace-admin/instance-health) # Self-hosting Enterprise Edition Source: https://docs.lightdash.com/self-host/enterprise-features Enterprise configuration for self-hosted Lightdash [Self-hosted](/support/feature-badges#self-hosted) Apply an Enterprise license key and configure licensed features on your self-hosted Lightdash instance. This section covers deployment setup; each feature links to its product documentation for usage and permissions. For Lightdash Cloud availability, see the feature's product documentation and [Lightdash plans](https://www.lightdash.com/pricing). ## Get a license key 1. [Contact the Lightdash team](https://calendly.com/lightdash-cloud/enterprise?utm_source=docs\&utm_medium=referral\&utm_campaign=enterprise_licensing\&utm_content=license_key_page) to request a self-hosted Enterprise license. 2. Obtain your license key from the Lightdash team. ## Apply the license key Set `LIGHTDASH_LICENSE_KEY` on **every** Lightdash container: backend, scheduler, and workers. > [tab] Environment variable > > ```bash theme={null} > LIGHTDASH_LICENSE_KEY=your-enterprise-license-key-here > ``` > [tab] Helm (Kubernetes) > > ```yaml theme={null} > secrets: > LIGHTDASH_LICENSE_KEY: your-enterprise-license-key-here > ``` > > Then update your deployment: > > ```bash theme={null} > helm upgrade lightdash lightdash/lightdash -n lightdash -f values.yaml > ``` > [tab] Docker Compose > > ```yaml theme={null} > services: > lightdash: > environment: > - LIGHTDASH_LICENSE_KEY=your-enterprise-license-key-here > ``` Restart every container after adding the key. ## License validation and network requirements Lightdash validates the license before loading Enterprise services at startup. If your deployment restricts outbound traffic, review [Enterprise license validation](/self-host/data-flows-and-telemetry#enterprise-license-validation) and the [egress matrix](/self-host/data-flows-and-telemetry#egress-matrix) before restarting. Feature-specific setup pages describe additional connections to model providers, storage, and other services. ## Verify the license After applying the key and restarting: 1. Log in to Lightdash. 2. Click the version number in the page footer to open **About Lightdash**. 3. Check the **Enterprise license** row: **Valid** means enterprise features are enabled, **Not valid** means the configured key failed validation, and **No license** means the server can't see a key. ## Features ### AI agents Configure a model provider and enable the agent runtime with the [self-hosted AI agents setup](/self-host/enterprise-features/ai-agents). For creating and using agents, see [AI agents](/agents). ### Data apps Configure the sandbox runtime, model provider, and storage with the [self-hosted data apps setup](/self-host/enterprise-features/data-apps). That page also covers the runtime needed for [Chart Studio](/visualizations/chart-studio). For building and managing apps, see [Data apps](/data-apps). ### Chart library Enable the registry and configure a private mirror if needed with the [chart library setup](/self-host/enterprise-features/data-apps#chart-library). For installing chart types, see [Chart library](/visualizations/chart-library). ### AI writeback Configure the sandbox and model credentials with the [AI writeback setup](/self-host/enterprise-features/ai-agents#ai-writeback). For repository connections and requesting changes, see [AI writeback](/agents/ai-writeback). ### MCP Enable the server and configure network access with the [self-hosted MCP setup](/self-host/enterprise-features/mcp). For client connections and authentication, see [Lightdash MCP](/agents/lightdash-mcp). ### Multi-agent Slack channels Configure [AI agents](#ai-agents) and the [self-hosted Slack integration](/self-host/customize-deployment/configure-a-slack-app-for-lightdash). Then follow [Set up a multi-agent Slack channel](/agents/set-up-slack-agents#setting-up-a-multi-agent-slack-channel) and [Enable the AI Router](/agents/enable-ai-router) for organization-level setup. ### Embedding To enable embedding on your instance, add `embedding` to `LIGHTDASH_ENABLE_FEATURE_FLAGS` and list the origins allowed to iframe your instance: ```bash theme={null} LIGHTDASH_ENABLE_FEATURE_FLAGS=embedding LIGHTDASH_IFRAME_EMBEDDING_DOMAINS=https://app.example.com,https://reports.example.com ``` If `LIGHTDASH_ENABLE_FEATURE_FLAGS` already lists flags, append `embedding` to the comma-separated list. See [feature flags](/self-host/customize-deployment/environment-variables#feature-flags). Replace the example domains with your own origins, including the protocol and no trailing slash. The instance needs a valid license. Restart the backend, then follow [Set up embedding](/embed/set-up-embedding) to configure embed secrets and authentication. See the [embedding variables reference](/self-host/customize-deployment/environment-variables#embedding) for optional settings. ### Pre-aggregates Configure storage and query execution with the [self-hosted pre-aggregates setup](/self-host/enterprise-features/pre-aggregates). For model definitions and query behavior, see [Pre-aggregates](/semantic-layer/pre-aggregates). ### Custom roles To enable custom roles on your instance, add `custom-roles` to `LIGHTDASH_ENABLE_FEATURE_FLAGS`: ```bash theme={null} LIGHTDASH_ENABLE_FEATURE_FLAGS=custom-roles ``` If `LIGHTDASH_ENABLE_FEATURE_FLAGS` already lists flags, append `custom-roles` to the comma-separated list. See [feature flags](/self-host/customize-deployment/environment-variables#feature-flags). Restart the backend, then follow [Custom roles](/workspace-admin/custom-roles) to create and assign roles. The instance needs both a valid license and this flag. ### Live data sources To enable [live data sources](/integrations/live-data-sources) on your instance, add `api-query-sources` to `LIGHTDASH_ENABLE_FEATURE_FLAGS`: ```bash theme={null} LIGHTDASH_ENABLE_FEATURE_FLAGS=api-query-sources ``` If `LIGHTDASH_ENABLE_FEATURE_FLAGS` already lists flags, append `api-query-sources` to the comma-separated list. See [feature flags](/self-host/customize-deployment/environment-variables#feature-flags). To let people sign in to Google Analytics 4, Search Console, Google Ads and YouTube Analytics, set `AUTH_GOOGLE_OAUTH2_CLIENT_ID` and `AUTH_GOOGLE_OAUTH2_CLIENT_SECRET` to the Google OAuth client used for [Google sign-in](/self-host/customize-deployment/use-sso-login-for-self-hosted-lightdash), and enable the Google Analytics Data API, Search Console API, Google Ads API, YouTube Analytics API and YouTube Data API in its Google Cloud project. For Google Ads, also add the `https://www.googleapis.com/auth/adwords` scope to the client and apply for Google Ads API access for the project. To let people sign in to PostHog, set `POSTHOG_OAUTH_CLIENT_ID` and `POSTHOG_OAUTH_CLIENT_SECRET`. Without them, people connect PostHog with a personal API key. To let people connect LinkedIn Ads, create an app in the [LinkedIn Developer Portal](https://developer.linkedin.com/) with access to the Advertising API, add `{SITE_URL}/api/v1/ee/linkedin/oauth/callback` as a redirect URL, and set `LINKEDIN_ADS_OAUTH_CLIENT_ID` and `LINKEDIN_ADS_OAUTH_CLIENT_SECRET`. Without them, LinkedIn Ads shows a **Request** button. Restart the backend, then follow [Connect a live data source](/integrations/live-data-sources/set-up-and-manage#connect-a-live-data-source). ### Service accounts A valid Enterprise license enables service accounts on your instance; no separate environment variable is required. For account creation, token rotation, and permissions, see [Service accounts](/workspace-admin/service-accounts). ### SCIM To enable SCIM provisioning on your instance, add `scim-token-management` to `LIGHTDASH_ENABLE_FEATURE_FLAGS`: ```bash theme={null} LIGHTDASH_ENABLE_FEATURE_FLAGS=scim-token-management ``` If `LIGHTDASH_ENABLE_FEATURE_FLAGS` already lists flags, append `scim-token-management` to the comma-separated list. See [feature flags](/self-host/customize-deployment/environment-variables#feature-flags). The instance needs a valid license. When SCIM runs alongside OIDC SSO, also set `AUTH_ENABLE_OIDC_TO_EMAIL_LINKING=true` so sign-ins can link to SCIM-provisioned users. Restart the backend, then follow [SCIM integration](/workspace-admin/sso/scim) for identity-provider setup. ### Enterprise SSO providers For provider-specific license requirements and environment settings, follow [Configure SSO for self-hosted Lightdash](/self-host/customize-deployment/use-sso-login-for-self-hosted-lightdash). ## Usage analytics Configure collection, object storage, and scheduled refreshes with the [self-hosted usage analytics setup](/self-host/enterprise-features/usage-analytics). For using the resulting project, see [Usage analytics project](/workspace-admin/usage-analytics-project). ## Troubleshooting If enterprise features are unavailable after applying the key: 1. Confirm `LIGHTDASH_LICENSE_KEY` is set on **every** Lightdash container (backend, scheduler, workers). On Kubernetes, check the environment of the running pod, not only the Secret: a Secret that exists but isn't mounted into the pod leaves the variable unset. 2. Confirm every container was restarted after adding the key. 3. Confirm the feature's required settings and connected services are configured using its setup page. 4. Check the [license validation network requirements](#license-validation-and-network-requirements). 5. Check the Lightdash logs for license-related errors. 6. Contact [enterprise support](https://calendly.com/lightdash-cloud/enterprise) if the issue persists. Without a valid key, Lightdash starts without its enterprise services, even when the per-feature flag is set. Requests to those features then fail with an error like `Unable to initialize service 'serviceAccountService' - no factory or provider.` When the key is present but invalid, the backend logs a warning that starts with `Enterprise license for ` on startup. ## Related documentation * [Enterprise on-prem setup](/self-host/enterprise-on-prem) * [Production deployment checklist](/self-host/production-deployment-checklist) * [Environment variables reference](/self-host/customize-deployment/environment-variables) * [Configure SSO for self-hosted Lightdash](/self-host/customize-deployment/use-sso-login-for-self-hosted-lightdash) * [Lightdash Cloud vs. self-hosted](/self-host/lightdash-cloud-vs-self-hosted) # Self-host agents Source: https://docs.lightdash.com/self-host/enterprise-features/ai-agents Configure model providers, gateways, and agent services on your Lightdash instance [Self-hosted](/support/feature-badges#self-hosted) [Enterprise](/support/feature-badges#enterprise) Enable AI agents on a self-hosted Lightdash instance, then configure your model provider, network access, and optional agent services. For creating agents, connecting Slack, and managing organization-level models, follow [Set up agents](/agents/set-up-agents). After configuring a [model provider](#model-providers), enable the extensions your deployment needs: [post-processing](#post-processing-with-duckdb-and-python), [verified answers](#verified-answers), [AI writeback](#ai-writeback), [Autopilot](#autopilot), or [agent identity](#agent-identity). ## Prerequisites * Apply a valid [Enterprise license key](/self-host/enterprise-features#apply-the-license-key). * Configure a model provider: OpenAI, Anthropic, Google Gemini, Google Vertex AI, Azure AI, OpenRouter, or AWS Bedrock. * Allow the backend and any scheduler or worker running agent jobs to reach the provider or your [corporate gateway](#corporate-llm-gateways). ## Enable AI agents Set the main switch and provide credentials for one provider — the minimal setup uses OpenAI, the default provider: ```bash theme={null} AI_COPILOT_ENABLED=true OPENAI_API_KEY= ``` Apply the same provider configuration to the backend and any scheduler or worker running agent jobs, then restart those processes. To use a different provider, set `AI_DEFAULT_PROVIDER` and its matching credentials. Optionally, set `ASK_AI_BUTTON_ENABLED=true` to show the **Ask AI** entry point; users can also reach agents at `/ai-agents`. ## Model providers Find provider credentials, supported models, and defaults in the [environment variables reference](/self-host/customize-deployment/environment-variables#ai-agents). Set `AI_DEFAULT_PROVIDER` to `openai`, `anthropic`, `google`, `vertex`, `azure`, `openrouter`, or `bedrock`, then follow that provider's configuration: ### OpenAI (default) Follow [OpenAI configuration](/self-host/customize-deployment/environment-variables#openai-configuration). Behind an OpenAI-compatible LLM gateway (LiteLLM, an internal proxy), also set `OPENAI_BASE_URL` to the gateway URL and `OPENAI_MODEL_NAME` to a model your gateway exposes. If the gateway doesn't support streaming (SSE), set `OPENAI_SUPPORTS_STREAMING=false`. If it enforces Zero Data Retention, set `OPENAI_ZERO_DATA_RETENTION=true`. If it only implements the Chat Completions API (`/chat/completions`) and returns 404 for `/responses`, set `OPENAI_USE_CHAT_COMPLETIONS=true`. ### Anthropic Follow [Anthropic configuration](/self-host/customize-deployment/environment-variables#anthropic-configuration). To send Anthropic traffic through a corporate gateway, add `ANTHROPIC_BASE_URL`. See [Corporate LLM gateways](#corporate-llm-gateways) for the required URL, authentication, and API paths. ### Google Gemini Follow [Google Gemini configuration](/self-host/customize-deployment/environment-variables#google-gemini-configuration). Use `GEMINI_BASE_URL` for a compatible gateway. ### Google Vertex AI Follow [Google Vertex AI configuration](/self-host/customize-deployment/environment-variables#google-vertex-ai-configuration). If you use Application Default Credentials, make them available to both the backend and scheduler. ### Azure AI Follow [Azure AI configuration](/self-host/customize-deployment/environment-variables#azure-ai-configuration). If your gateway only implements the Chat Completions API, set `AZURE_AI_USE_CHAT_COMPLETIONS=true`. Set `AZURE_AI_REASONING_EFFORT` to a value your deployment accepts if it rejects the default reasoning setting. ### OpenRouter Follow [OpenRouter configuration](/self-host/customize-deployment/environment-variables#openrouter-configuration). ### AWS Bedrock Follow [AWS Bedrock configuration](/self-host/customize-deployment/environment-variables#aws-bedrock-configuration), and enable the selected models in your AWS region. The agent chat provider supports Claude models; [Data apps](/self-host/enterprise-features/data-apps) has separate coding-agent model support. To send Bedrock traffic through a corporate gateway, add `BEDROCK_BASE_URL`. The gateway must support the Bedrock APIs used by every enabled Lightdash consumer. See [Corporate LLM gateways](#corporate-llm-gateways). `AI_DEFAULT_PROVIDER` is instance-wide. Setting it to `bedrock` also routes the selected [Data apps](/self-host/enterprise-features/data-apps) coding agent through Bedrock. `APPS_CODING_AGENT` chooses Claude or Codex; it does not change the provider. ## Corporate LLM gateways Lightdash can route AI agent, Autopilot, and Data app model traffic through an HTTP(S) corporate gateway. Use the base URL for the protocol your gateway exposes: * `OPENAI_BASE_URL` for an OpenAI-compatible gateway. * `ANTHROPIC_BASE_URL` for an Anthropic Messages gateway. * `BEDROCK_BASE_URL` for a Bedrock-compatible gateway. The gateway URL must include a scheme and must not contain credentials, query parameters, or a fragment. Each caller must be able to resolve and reach its configured gateway hostname. ### Separate gateway routes for Data apps If the backend and Data app sandboxes need different URLs to reach your LLM gateway, configure a sandbox-only base URL: ```bash theme={null} ANTHROPIC_BASE_URL=https://backend-gateway.example.com/anthropic DATA_APPS_ANTHROPIC_BASE_URL=https://sandbox-gateway.example.com/anthropic ``` The Data app coding agent uses the `DATA_APPS_` override when set and falls back to the shared provider URL when it is unset or empty. The same option is available for Bedrock and OpenAI; see the [environment variable reference](/self-host/customize-deployment/environment-variables#data-app-gateway-overrides) for all three variables. Anthropic URLs use the base before `/v1`; OpenAI URLs retain their API path, commonly `/v1`. These overrides apply to instance-managed credentials only. Organizations using their own AI keys retain their resolved provider endpoints. Backend AI requests, AI writeback, and onboarding keep their existing routing. Provider selection and credentials stay unchanged; the sandbox URL must accept the existing coding agent's authentication and API protocol. Provider `*_CUSTOM_HEADERS` are not forwarded to the coding agent. Restart the Lightdash backend and scheduler workers after changing these environment variables. Check [sandbox gateway egress](/self-host/customize-deployment/sandboxes#llm-gateway-egress), including the requirements for existing sandboxes. ### Anthropic-compatible gateway Configure `ANTHROPIC_BASE_URL` before the API's `/v1` segment. Lightdash accepts a trailing `/v1` and removes it, but using the unversioned base avoids ambiguity: ```bash theme={null} AI_COPILOT_ENABLED=true AI_DEFAULT_PROVIDER=anthropic ANTHROPIC_API_KEY= ANTHROPIC_BASE_URL=https://llm-gateway.example.com/anthropic ``` When `ANTHROPIC_BASE_URL` is set, Lightdash sends `ANTHROPIC_API_KEY` as an `Authorization: Bearer` token. Without a gateway, direct Anthropic requests continue to use the standard `x-api-key` header. Lightdash queries `/v1/models` to determine which models the credential can access. If the gateway does not expose the Models API, set `ANTHROPIC_AVAILABLE_MODELS` to the exact comma-separated model names the gateway accepts. An organization-level BYO Anthropic key cannot be combined with an instance-wide `ANTHROPIC_BASE_URL` unless the organization sets its own [custom base URL](/workspace-admin/ai-settings#custom-base-url), which replaces the gateway for that organization's traffic. Otherwise, remove the organization key to use the gateway, or remove the gateway URL to route that organization through its own Anthropic account. The same rule applies to organization Google Gemini keys and `GEMINI_BASE_URL`. ### Bedrock-compatible gateway Configure the gateway together with the existing Bedrock provider settings: ```bash theme={null} AI_COPILOT_ENABLED=true AI_DEFAULT_PROVIDER=bedrock BEDROCK_REGION=us-east-1 BEDROCK_API_KEY= BEDROCK_BASE_URL=https://llm-gateway.example.com/bedrock ``` The backend Bedrock provider still requires one supported credential mode: `BEDROCK_API_KEY`, static AWS credentials, or `BEDROCK_USE_DEFAULT_CREDENTIALS=true`. A custom Bedrock gateway used by Codex requires `BEDROCK_API_KEY`; Codex cannot combine an overridden endpoint with IAM/SigV4 credentials. For Claude Data apps, set `CLAUDE_CODE_SKIP_BEDROCK_AUTH=true` only when the gateway accepts Claude Code requests without AWS authentication. This setting suppresses credentials inside Claude Code; it does not remove the backend provider's credential requirement. ### Required gateway APIs One base URL can serve multiple consumers only if the gateway implements every wire protocol those consumers use: | Consumer | Required path relative to the configured base | | - | - | | AI agents and Autopilot through Anthropic | Anthropic Messages: `/v1/messages` | | Anthropic model discovery | Anthropic Models: `/v1/models` | | AI agents and Autopilot through Bedrock | Bedrock Converse: `/model/{model-id}/converse` or `/model/{model-id}/converse-stream` | | Bedrock verified-answer embeddings | Bedrock Invoke: `/model/{model-id}/invoke` | | Claude Data apps through Anthropic | Anthropic Messages: `/v1/messages` | | Claude Data apps through Bedrock | Bedrock Invoke: `/model/{model-id}/invoke-with-response-stream` | | Codex Data apps through a Bedrock gateway | OpenAI Responses: `/responses` | A gateway that supports only Bedrock Converse can serve agent chat but cannot serve Claude Data app generation. For coding-agent configuration and model naming rules, see [Self-hosted Data apps](/self-host/enterprise-features/data-apps). > [!NOTE] > > These gateway settings do not reroute AI writeback or the onboarding agent. Autopilot uses the same provider configuration as AI agents. Its scheduler must also be able to reach the gateway. ### Validate before rollout 1. Confirm the Lightdash backend and any scheduler running Autopilot can resolve and connect to the gateway hostname. 2. Open an AI agent and send a short prompt with the configured model. If model discovery fails, verify `/v1/models` or set `ANTHROPIC_AVAILABLE_MODELS`. 3. If Data apps are enabled, generate a small app with each coding agent you plan to support. This verifies the sandbox's separate network path and API wire. 4. If Autopilot is enabled, run it on a disposable project and check its recorded provider, model, and outcome. A successful configuration check does not prove the gateway accepts a model request. 5. Check gateway access logs for the expected paths in the table above. Redact authorization headers and tokens from logs. 6. Restrict direct provider egress only after all enabled consumers succeed through the gateway. ## Post-processing with DuckDB and Python [Beta](/support/feature-badges#beta) Agents can [post-process query results with DuckDB and Python](/agents/use-ai-agents#post-process-results-with-duckdb-and-python). On Lightdash Cloud this is managed for you. On a self-hosted instance each step type has its own requirement: | Step | Runs in | Needs | | - | - | - | | **DuckDB** | An embedded DuckDB engine inside Lightdash | Results storage in S3-compatible object storage | | **Python** | A one-off [sandbox](/self-host/customize-deployment/sandboxes#python-execution) | A sandbox provider with a Python image | | **External data** (attached CSVs) | The embedded DuckDB engine | The pre-aggregates bucket (`PRE_AGGREGATE_RESULTS_S3_*`) | ### 1. Configure results storage DuckDB steps read the result files of the queries they reference straight from object storage, so results storage is required. Set `S3_ENDPOINT`, `S3_BUCKET` and `S3_REGION`, or the `RESULTS_S3_*` overrides. See [external object storage](/self-host/customize-deployment/configure-lightdash-to-use-external-object-storage). If the endpoint uses HTTPS, the Lightdash image needs a CA certificate bundle. The official image ships one. On a custom image, install `ca-certificates` or set `SSL_CERT_FILE` to a PEM bundle. Without one, DuckDB steps fail with a configuration error. DuckDB shares the pre-aggregate memory budget. To cap it, set `PRE_AGGREGATE_DUCKDB_QUERY_MEMORY_LIMIT` (for example `2GB`). ### 2. Set up the Python sandbox (optional) Python steps need a sandbox provider that supports Python execution: E2B, Azure Container Apps Sandboxes, or Google Cloud Run. AWS Lambda MicroVMs doesn't support it. Follow [Python execution](/self-host/customize-deployment/sandboxes#python-execution) to build the image and configure the provider. Without a Python sandbox, DuckDB steps still work, but Python steps fail. ### 3. Configure external data (optional) To let users attach CSVs to a thread, configure the pre-aggregates bucket with `PRE_AGGREGATE_RESULTS_S3_*`. See [pre-aggregate workers](/self-host/nats-workers/pre-aggregate-workers). ### 4. Turn it on Post-processing is gated by the `compose-sql-runner` feature flag, off by default. Set it on the backend and the scheduler, then restart both: ```bash theme={null} LIGHTDASH_ENABLE_FEATURE_FLAGS=compose-sql-runner ``` Agents also need [data access](/agents/data-access) that lets them read rows. With the flag on, each agent has a **Composer queries** setting, on by default, that admins can turn off per agent. For data access rules and execution boundaries, see [Post-process results with DuckDB and Python](/agents/use-ai-agents#post-process-results-with-duckdb-and-python). ## Verified answers To enable [verified answers](/agents/verified-answers) on your instance, set `AI_EMBEDDING_ENABLED=true` and configure an embedding provider with `AI_DEFAULT_EMBEDDING_PROVIDER` (`openai`, `bedrock`, or `azure`). The embedding provider can differ from the chat provider. See the [embedding configuration](/self-host/customize-deployment/environment-variables#ai-agents) for credentials and options. ## AI writeback Enable AI writeback on your self-hosted instance by configuring a sandbox and Anthropic credentials. For supported repositories, permissions, and using writeback in chat, see [AI writeback](/agents/ai-writeback). ### Writeback prerequisites * Configure a [sandbox provider](/self-host/customize-deployment/sandboxes) that supports writeback. Google Cloud Run does not support it. * Create an Anthropic API key. Writeback uses Claude even if your AI agents use another model provider. * Configure repository access using the [AI writeback prerequisites](/agents/ai-writeback#prerequisites). ### Writeback configuration Set `ANTHROPIC_API_KEY` in your Lightdash deployment. For E2B, select Lightdash's public writeback template: ```bash theme={null} E2B_AI_WRITEBACK_TEMPLATE_NAME=lightdash/lightdash-ai-writeback ANTHROPIC_API_KEY= ``` Keep the `lightdash/` prefix: a bare template name resolves to your own E2B team. Other providers use their writeback-specific image configuration; see [sandbox providers](/self-host/customize-deployment/sandboxes#sandbox-providers). Restart the backend, then [ask an agent for a repository change](/agents/ai-writeback#using-it-in-chat) to verify the setup. #### Writeback image version Leave `E2B_AI_WRITEBACK_TEMPLATE_TAG` unset to use the sandbox build matching your Lightdash version. Override it only when you need to pin a build; an empty value selects the template's `default` tag. See the [runtime variables reference](/self-host/customize-deployment/environment-variables#data-apps-runtime) for all writeback image settings. ### Writeback dbt versions For dbt projects, the writeback sandbox runs `lightdash compile` using the project's dbt version. It ships with dbt **1.8, 1.9, 1.10, 1.11, and 1.12** preinstalled: * Projects pinned to one of those versions compile against that version. * Projects set to `latest` compile against the highest version in the sandbox. * Projects pinned below 1.8 compile against 1.8 in the sandbox. The version is selected automatically from the project's dbt connection settings. Native Lightdash YAML uses [native validation](/semantic-layer/yaml#ai-writeback-and-issues) and needs no dbt installation. ### Writeback provider usage Your sandbox provider and Anthropic bill your accounts directly. Monitor usage and configure limits with those providers before rolling out writeback. ### Writeback troubleshooting | Symptom | Check | | - | - | | The agent never offers to open a pull request | Confirm the license is valid and the project meets the [repository and permission prerequisites](/agents/ai-writeback#prerequisites) | | Sandbox creation fails | Check provider credentials and the writeback image configuration. For E2B, keep the `lightdash/` template prefix and verify that any overridden tag exists | | Writeback fails with an Anthropic error | Check `ANTHROPIC_API_KEY`, account usage limits, and rate limits | | Repository authentication fails | Check the [repository prerequisites](/agents/ai-writeback#prerequisites), then retry | ## Autopilot [Autopilot](/agents/autopilot) needs AI agents enabled and a provider configured through the [instance model settings](#model-providers) or [organization AI providers and models](/workspace-admin/ai-settings#bring-your-own-ai-providers-and-models). It uses the shared AI provider configuration, with no separate runtime selector or provider credentials. Use a provider's `*_AVAILABLE_MODELS` variable to restrict its selectable models. For model selection and organization settings, see [AI provider and usage](/agents/autopilot#ai-provider-and-usage). Enable the Autopilot feature on every API and scheduler process: ```bash theme={null} LIGHTDASH_ENABLE_FEATURE_FLAGS=ai-autopilot ``` Append `ai-autopilot` if the enable list already contains other flags, and remove it from `LIGHTDASH_DISABLE_FEATURE_FLAGS` if present. Restart the API and scheduler after changing environment variables. Keep their provider and Autopilot configuration consistent; the scheduler executes scheduled runs and needs access to the selected provider or gateway. After restarting, follow [Autopilot setup](/agents/autopilot#setup) to enable it for a project. Run it on a disposable project to verify credentials, model access, and gateway routing; enabling it does not make a model request. ### Schedule and limits Configure the fallback schedule, run deadline, and model step limit with the [Autopilot environment variables](/self-host/customize-deployment/environment-variables#autopilot). These limits do not set a spending cap; use your provider's controls to manage cost. ### Model qualification and cleanup Autopilot only flags or deletes content on models that are qualified for it. Every other model runs in observe mode. When `MANAGED_AGENT_VALIDATED_MODELS` is unset, these models are qualified for `cleanup`: | Provider | Models | | - | - | | Anthropic | Claude Opus 5.5, Claude Opus 5, Claude Opus 4.8, Claude Opus 4.7, Claude Sonnet 5.5, Claude Sonnet 5 | | Amazon Bedrock | Claude Opus 5, Claude Opus 4.7, Claude Sonnet 5 | | OpenAI | GPT-6.1 Sol, GPT-6 Sol, GPT-5.6 Sol, GPT-5.5, GPT-5.4 | Choose a qualified model in the organization settings or the provider's model environment variable when you want Autopilot to flag or delete content. A provider's default model is not necessarily qualified. Azure deployments, Google Gemini, Google Vertex AI, OpenRouter and any model not listed above start in observe mode. To qualify one, set `MANAGED_AGENT_VALIDATED_MODELS` to a JSON array of exact provider/model pairs with a mode of `observe`, `flag`, or `cleanup`. Setting the variable replaces the built-in list, so include the built-in models you still want; an empty value qualifies no model. Duplicate qualifications use the most restrictive mode; malformed configuration rejects startup. Qualify a model on disposable representative content before increasing its permissions. Use the exact model IDs shown in Autopilot; Bedrock Claude inference-profile region prefixes are also accepted without the prefix. Autopilot uses the more restrictive of the project's requested cleanup mode and the model's qualification. A downgrade appears in setup and the run summary. **Observe mode does not mean read-only:** chart creation and repair still follow the project's capability toggles. Disable those capabilities as well when evaluating without content changes. ### Upgrading from the hosted runtime Lightdash 2.262.0 removed the hosted runtime. From that version Autopilot always runs on your configured AI provider. * **Nothing to change to keep Autopilot running.** Provider credentials come from the shared AI configuration described above. Keep the schedule and timeout settings, and review the step limit and model qualifications. * **Remove the old settings.** `MANAGED_AGENT_RUNTIME`, `MANAGED_AGENT_ANTHROPIC_API_KEY`, and `MANAGED_AGENT_SKILL_IDS` are retired and ignored. Compatibility warnings may appear at startup while these variables remain set. * **No configuration rollback.** Setting `MANAGED_AGENT_RUNTIME=anthropic-managed` cannot restore the hosted runner. To roll back, redeploy a release before 2.262.0 with the credentials it needs. On releases 2.255.0 to 2.261.x both runtimes exist and the AI SDK runner is the default. `MANAGED_AGENT_RUNTIME` selects the runner there and must match on the API and scheduler processes. ## Agent identity [Beta](/support/feature-badges#beta) Enable [agent identity](/agents/agent-identity) on your self-hosted instance with the `agent-identity` feature flag. **1. Enable the feature flag** Add `agent-identity` to `LIGHTDASH_ENABLE_FEATURE_FLAGS` on every backend/API replica and on any scheduler or worker process that executes AI agent jobs: ```bash theme={null} LIGHTDASH_ENABLE_FEATURE_FLAGS=agent-identity ``` Append `agent-identity` if the list already contains other flags, and remove it from `LIGHTDASH_DISABLE_FEATURE_FLAGS` if present. **2. Restart** Restart the affected processes. Lightdash reads these variables at startup. After restarting, follow [Agent identity](/agents/agent-identity) for warehouse support, organization rules, and shared account setup. For Snowflake agent sign-in, also review [Agent identity on Snowflake](#agent-identity-on-snowflake). Lightdash checks that the identity that produced a saved result matches the reader. See [Who can read a saved result](/agents/agent-identity#who-can-read-a-saved-result). If this comparison causes a problem on your instance, set `AGENT_RESULT_IDENTITY_CHECK_ENABLED=false` to turn it off. The access checks stay on. See [Agent identity variables](/self-host/customize-deployment/environment-variables#agent-identity). Each agent query writes one structured info log line with the message `Agent query` before it runs in the warehouse. Set `LIGHTDASH_LOG_FORMAT=JSON` to keep the fields: `queryUuid`, `projectUuid`, `warehouseConnectionUuid`, `userUuid`, `identity` (`marked_person`, `connected_person` or `ai_service_account`), `actorKind`, `principalKind`, `credentialUuid`, `identityUuid`, `principalRef` and `context`. The line does not include the person's email. See [logging](/self-host/customize-deployment/environment-variables#logging). ### Agent identity audit entries and logs Lightdash writes agent identity changes and failures to the application log. It does not store them in a table. Collect them from the log output of every backend/API replica and every scheduler or worker process. #### Audit entries Admin changes write an entry at the `audit` log level. The `audit` level is below `info`, so set `LIGHTDASH_LOG_LEVEL=audit` or `LIGHTDASH_LOG_LEVEL=debug` to write them. With the default level (`http` in production), Lightdash does not write audit entries. Each entry has the `actor` who made the change, the `action`, the `resource` and the `status`. `resource.metadata.event` names the change: | `resource.type` | `resource.metadata.event` | `action` | Other `resource.metadata` fields | | - | - | - | - | | `OrganizationAgentIdentityRule` | `agent_identity.rule_updated` | `update` | `warehouseType`, `previousSource`, `source` | | `AiServiceAccount` | `agent_identity.service_account_saved` | `create` for a new key, `update` for a replaced key | `warehouseConnectionUuid`, `connectionName`, `previousGeneration`, `generation` | | `AiServiceAccount` | `agent_identity.service_account_tested` | `test` | `warehouseConnectionUuid`, `connectionName`, `previousGeneration` and `generation` (both the saved key), `result` (`success` or `failure`) | | `AiServiceAccount` | `agent_identity.service_account_deleted` | `delete` | `warehouseConnectionUuid`, `connectionName`, `previousGeneration` | `source` and `previousSource` are `marked_person` (**The person**), `agent_sign_in` (**The person's agent sign-in**) or `ai_service_account` (**A shared agent account**). `resource.organizationUuid` is on every entry, and `resource.projectUuid` is on shared agent account entries. A generation changes each time the key changes, so compare `previousGeneration` and `generation` to see that a key was replaced. If your log indexer maps the `actor` field as text, set `LIGHTDASH_LOG_AUDIT_ACTOR_AS_STRING=true`. #### Log lines Lightdash also logs these events at the default levels: | Message | Level | Fields | | - | - | - | | `Agent sign-in connect failed` | `warn` | `userUuid`, `organizationUuid`, the failure reason, the redacted error | | `Agent sign-in disconnected` | `info` | `userUuid`, `organizationUuid` | | `Agent sign-in refreshed` | `info` | `userUuid`, `organizationUuid` | | `Agent sign-in refresh token rotated` | `info` | `userUuid`, `organizationUuid` | | `Agent sign-in refresh failed` | `warn` | `userUuid`, `organizationUuid`, the refusal reason, the redacted error | | `Agent result lineage refused` | `warn` | `queryUuid`, the refused node, the reason. Depth and size refusals also have the limits. | BigQuery key refusals, Snowflake session check refusals and shared agent account test failures also log the redacted warehouse error. A status or diagnostic check that only reports a refusal logs at `debug`. #### What Lightdash does not log * Keys, tokens, client secrets and client emails are never in an audit entry or a log line. * A logged warehouse error has `errorClass`, `errorCode`, `errorCategory` and a redacted `errorMessage`. Lightdash removes key blocks, quoted text and SQL from the message, and keeps only plain words and short numbers. `errorCategory` is a fixed value, for example `invalid_grant`, `token_expired` or `permission_denied`. * No SQL or result data is logged in these entries. * In access log URLs, Lightdash replaces the values of the OAuth `code` and `state` parameters with `[REDACTED]`. ### Agent identity on Snowflake Follow [Set up the Snowflake agent integration](/agents/agent-identity#set-up-the-snowflake-agent-integration) for the in-app steps and Snowflake SQL. Lightdash encrypts the saved client secret with your instance's `LIGHTDASH_SECRET`. The setup SQL uses your instance's redirect URL: `/api/v1/oauth/redirect/snowflake-ai`, where `` is the scheme and host of `SITE_URL`. It uses the host root even when `SITE_URL` has a path. Check that this address is reachable from the browser completing sign-in. > [!WARNING] > > To test over `http://localhost`, add `OAUTH_ALLOW_NON_TLS_REDIRECT_URI = TRUE` to the integration. This is for local development only. Do not set it in production. ## Costs For self-hosted AI agents, you pay the model provider directly. Set provider spending limits before rollout, and use warehouse quotas to control query costs. Review [agent activity](/agents/visibility) alongside your provider's usage dashboard. For agent scope and context guidance, see [Data access](/agents/data-access) and [Effective analytics with agents](/agents/effective-analytics-with-agents). ### Compact filter expressions Compact filter expressions replace verbose structured filter schemas for AI agent and Model Context Protocol (MCP) query tools with a smaller expression syntax. This reduces the filter-related tool definitions and inputs sent to the model. Total savings vary by model, conversation history, caching, and tool usage; the setting does not reduce the catalog, existing conversation history, or query results. On a self-hosted deployment, enable compact filter expressions on every backend/API replica and on any scheduler or worker process that executes AI agent jobs, then redeploy or recreate those containers: ```bash theme={null} LIGHTDASH_ENABLE_FEATURE_FLAGS=ai-filter-expressions ``` If `LIGHTDASH_ENABLE_FEATURE_FLAGS` already contains other flags, append `ai-filter-expressions` to its comma-separated list. Remove it from `LIGHTDASH_DISABLE_FEATURE_FLAGS` if present. Lightdash reads both variables at process startup. Users do not need to create new agents or threads: the next response uses compact filter expressions, including in an existing thread. After enabling the feature for MCP, reconnect or refresh each client so it reloads the query tool definitions. ## Permissions Configure agent access through [agent permissions](/agents/agent-permissions) and [project roles](/workspace-admin/roles). Instance configuration does not replace those controls. ## Troubleshooting **The "Ask AI" button doesn't appear.** Confirm `AI_COPILOT_ENABLED=true`, `LIGHTDASH_LICENSE_KEY` is set, and `ASK_AI_BUTTON_ENABLED=true` if you want the top-bar entry point. Users without query access to any project also won't see it. **AI agents return provider authentication errors.** Check the API key for the selected `AI_DEFAULT_PROVIDER`. For Azure, verify `AZURE_AI_ENDPOINT`, `AZURE_AI_API_VERSION`, and `AZURE_AI_DEPLOYMENT_NAME` all match a deployment your key can call. For Bedrock, confirm the region has the target model enabled for your account. **Multi-step conversations fail against an OpenAI-compatible gateway.** If the gateway enforces Zero Data Retention, set `OPENAI_ZERO_DATA_RETENTION=true`. If it doesn't support SSE, set `OPENAI_SUPPORTS_STREAMING=false`. **Every agent request to an OpenAI-compatible gateway returns 404.** Lightdash uses the OpenAI Responses API by default. Gateways such as LiteLLM, Kong, or internal proxies often only implement the older Chat Completions API. Set `OPENAI_USE_CHAT_COMPLETIONS=true` (or `AZURE_AI_USE_CHAT_COMPLETIONS=true` for the Azure provider) to send `/chat/completions` requests instead. Extended reasoning summaries aren't available on Chat Completions: tool calls work, but reasoning models run with reasoning disabled. **Verified answers never match.** Confirm `AI_EMBEDDING_ENABLED=true` and that the embedding provider credentials are set. See the [similarity threshold setting](/self-host/customize-deployment/environment-variables#ai-agents) if legitimate matches are rejected. # Self-host data apps Source: https://docs.lightdash.com/self-host/enterprise-features/data-apps Configure a self-hosted Lightdash instance to run data apps [Self-hosted](/support/feature-badges#self-hosted) [Enterprise](/support/feature-badges#enterprise) Enable data apps on your self-hosted Lightdash instance by configuring a sandbox provider, a coding-agent provider, and object storage. For creating apps, sharing them, and permissions, see [Data apps](/data-apps). Sandbox providers are configured separately and cover several runtimes — E2B, AWS Lambda MicroVMs, Azure Container Apps, and Google Cloud Run. See [sandboxes](/self-host/customize-deployment/sandboxes) for the full provider setup; this page covers everything else data apps need. For custom chart types, see [Chart Studio](#chart-studio) to configure authoring or [Chart library](#chart-library) to install published chart types without a sandbox. ## Prerequisites * **Enterprise license** - `LIGHTDASH_LICENSE_KEY` must be set on your instance. * **S3-compatible storage** - a bucket Lightdash can write to for app source and built artifacts. If your instance isn't already using S3, [set that up first](/self-host/customize-deployment/configure-lightdash-to-use-external-object-storage). * **A configured sandbox provider** - see [sandboxes](/self-host/customize-deployment/sandboxes). * **A coding-agent provider** - Anthropic, OpenAI, or an [AWS Bedrock](https://aws.amazon.com/bedrock/) account with access to the model used by your selected agent. It serves every user's builds, so it can't be tied to one person's subscription — see [building with your own subscription](#building-with-your-own-subscription). * **A headless browser** (optional) - needed for automatic [version thumbnails](/data-apps#thumbnails). See [enabling the headless browser](/self-host/customize-deployment/enable-headless-browser-for-lightdash). ## Configuration Enable the runtime in your deployment: ```bash theme={null} APPS_RUNTIME_ENABLED=true ``` Data apps use your instance's S3 configuration. Set `APPS_S3_BUCKET` if you want a dedicated bucket for app source and built artifacts. See the [data apps runtime variables](/self-host/customize-deployment/environment-variables#data-apps-runtime) for storage overrides and the full configuration reference. Choose one of the coding-agent and provider combinations below. ### Claude through Anthropic (default) Configure Claude with an Anthropic API key: ```bash theme={null} APPS_CODING_AGENT=claude ANTHROPIC_API_KEY= ``` This uses Anthropic directly when `AI_DEFAULT_PROVIDER` is not `bedrock`. For gateway routing, set `ANTHROPIC_BASE_URL` to the base before `/v1`. With `ANTHROPIC_BASE_URL`, Lightdash uses `ANTHROPIC_API_KEY` as a bearer token and allows the gateway hostname through the sandbox firewall. The gateway must implement Anthropic Messages. See [Corporate LLM gateways](/self-host/enterprise-features/ai-agents#corporate-llm-gateways) for authentication and API-path requirements, including [separate gateway routes for Data apps](/self-host/enterprise-features/ai-agents#separate-gateway-routes-for-data-apps). ### Codex through OpenAI Configure Codex with an OpenAI API key: ```bash theme={null} APPS_CODING_AGENT=codex OPENAI_API_KEY= ``` Codex uses OpenAI directly when `AI_DEFAULT_PROVIDER` is not `bedrock`; app generation does not require an Anthropic key in this mode. For gateway routing, set `OPENAI_BASE_URL` to a gateway that supports the Responses API and the configured Codex model IDs. ### Claude or Codex through Bedrock Set `AI_DEFAULT_PROVIDER=bedrock` and choose `APPS_CODING_AGENT=claude` or `APPS_CODING_AGENT=codex`. Configure the region, credentials, and model access for that agent using the [AWS Bedrock variables](/self-host/customize-deployment/environment-variables#aws-bedrock-configuration). The sandbox firewall allows the provider endpoints required for the selected agent and region. When `BEDROCK_BASE_URL` is set, the gateway must support the protocol used by each selected consumer. Claude uses Bedrock's streaming Invoke API, while Codex uses the OpenAI Responses API through a custom gateway provider. Codex requires `BEDROCK_API_KEY` in gateway mode and sends model IDs with the `openai.` prefix; the gateway must register or translate those names. See the [required gateway APIs](/self-host/enterprise-features/ai-agents#required-gateway-apis) matrix. `AI_DEFAULT_PROVIDER` is an instance-wide setting. Setting it to `bedrock` also routes AI agents through Bedrock. `APPS_CODING_AGENT` changes only the coding agent used by data apps and Chart Studio. ### Building with your own subscription The coding-agent credential you configure here builds apps for every user on the instance, so it has to be a credential that can serve all of them: a direct `ANTHROPIC_API_KEY` or `OPENAI_API_KEY`, an Anthropic- or OpenAI-compatible gateway, or Bedrock credentials. A credential tied to one person's individual subscription, such as a Claude Code `CLAUDE_CODE_OAUTH_TOKEN`, isn't supported here. To build with your own AI coding agent and your own subscription instead, use [local data app development](/workflow/local-data-app-development#creating-a-new-app-locally): you edit the app with your own agent and credentials, and the server only runs a deterministic Vite build (no AI) when you upload. ### Gateway networking The Lightdash backend and the Data app sandbox make separate connections to the gateway. E2B and Azure Sandboxes receive the configured gateway hostname in their dynamic egress allowlist. AWS Lambda MicroVMs use a pre-provisioned egress connector instead, so `LAMBDA_MICROVM_EGRESS_CONNECTOR_ARN` must permit the gateway hostname. Docker and Cloud Run follow their existing runtime network policy. See [LLM gateway egress](/self-host/customize-deployment/sandboxes#llm-gateway-egress). Restart the backend after configuring the runtime and provider. Follow [Creating a new app](/data-apps#creating-a-new-app) to verify generation. ### Private-network external connections [External connections](/data-apps/external-connections) block private and internal network addresses by default. To let a data app call a trusted internal HTTPS API, set `APP_RUNTIME_EXTERNAL_CONNECTION_ALLOWED_PRIVATE_HOST_CIDRS` in the Lightdash backend's deployment environment: ```bash theme={null} APP_RUNTIME_EXTERNAL_CONNECTION_ALLOWED_PRIVATE_HOST_CIDRS="api.internal.example@10.20.0.0/16,auth.internal.example@10.30.1.5/32" ``` This example allows private addresses in `10.20.0.0/16` for `api.internal.example` and only `10.30.1.5` for `auth.internal.example`. Use the hostnames and narrowest address ranges needed by your services. Restart the backend after changing the variable; malformed entries cause a configuration error at startup. * Each entry pairs an exact hostname with an IPv4 or IPv6 CIDR. Do not include a URL scheme, port, path, or wildcard. Hostnames are case-insensitive and a trailing DNS dot is ignored. * Repeat a hostname to approve multiple ranges, for example `api.internal.example@10.20.0.0/16,api.internal.example@fd12:3456::/48`. * A private destination must match both the hostname and one of its CIDRs. Lightdash checks every DNS answer and rejects the request if any private address is outside the approved ranges. Public addresses keep their existing behavior. * For OAuth 2.0 client credentials, approve the token endpoint's hostname and private address range separately if it differs from the API host. * The backend must already have network access and DNS resolution for both services. HTTPS remains required, including a valid certificate trusted by the backend. This setting does not create network routes or disable certificate verification. After restarting, create the connection under **Project Settings → Data app connections** with the API's HTTPS base URL, authentication, and allowed methods and paths. Use the wizard's test request to verify it before linking an app. See [testing a connection](/data-apps/external-connections#testing-a-connection). > [!WARNING] > > This is an instance-wide trust policy for external connections across all projects. A hostname entry covers every HTTPS port, and explicitly approved ranges can include sensitive internal services, loopback, or cloud metadata addresses. Only approve destinations you trust with data from linked apps, and keep connection methods and paths appropriately restricted. Leaving the variable unset or empty preserves the existing private-network block. The exception applies only to requests through external connections, including connection tests and OAuth client-credentials token requests. Connection permissions, credential handling, DNS pinning, redirect blocking, request limits, and rate limits remain in place. Direct browser image loading, sandbox networking, and other backend requests are unaffected. If a test returns `blocked_ip`, check the exact hostname and every address it resolves to from the backend against the configured CIDRs. For `Failed to obtain OAuth access token`, also check the token endpoint's entry, network access, certificate, and client credentials. ## Chart Studio [Chart Studio](/visualizations/chart-studio) builds custom chart types on the same runtime, with its own switch. It turns on for every organization once the instance has an Enterprise license and a [configured sandbox provider](/self-host/customize-deployment/sandboxes). It doesn't need `APPS_RUNTIME_ENABLED`, so you can offer Chart Studio while leaving data apps off. Builds use the same coding-agent provider and bucket as data apps. ## Chart library Enable the chart library on your self-hosted Lightdash instance, or configure a private mirror for a restricted network. For browsing, installing, and using chart types, see [Chart library](/visualizations/chart-library). Lightdash reads the library from a static website. The public library lives at `https://lightdash.github.io/lightdash-library`. Instances that cannot reach it can read a mirror of the same files from inside their own network instead. ### Chart library prerequisites * **Enterprise license** - `LIGHTDASH_LICENSE_KEY` must be set on your instance. * **Outbound access to the library** - the backend fetches the library over `https`. The browser never talks to the library directly; images and other assets are proxied through the backend. The library does not need data apps or Chart Studio configured. To also let people edit chart types, configure the [Chart Studio runtime](#chart-studio). ### Enable the chart library Add the flag to your deployment and restart the backend: ```bash theme={null} LIGHTDASH_ENABLE_FEATURE_FLAGS=chart-type-registry ``` If `LIGHTDASH_ENABLE_FEATURE_FLAGS` already contains flags, append `chart-type-registry` to the comma-separated list. See [feature flags](/self-host/customize-deployment/environment-variables#feature-flags). Open the [chart library](/visualizations/chart-library#finding-the-library) to verify that the backend can fetch the index. If the library cannot be reached, the tab is hidden and already-installed chart types keep working. ### Chart library configuration | Variable | Description | | :- | :- | | `LIGHTDASH_CHART_REGISTRY_URL` | Base URL of the chart library the instance reads. Unset uses Lightdash's public library at `https://lightdash.github.io/lightdash-library`. Set it to the URL of a [private mirror](/self-host/enterprise-features/data-apps#mirror-the-chart-library). An empty value turns the library off and hides the **Chart library** tab. | | `LIGHTDASH_CHART_REGISTRY_CHANNEL` | Which index the instance reads: `stable` (default) or `next`, which also lists beta chart types. | | `LIGHTDASH_CHART_REGISTRY_ALLOW_PRIVATE_HOSTS` | Set to `true` when the library URL resolves to a private or internal address, such as a mirror inside your network. Lightdash otherwise refuses private addresses. Requests still have to use `https`, redirects are still refused, and the connection stays pinned to the address Lightdash resolved. (default=false) | | `LIGHTDASH_CHART_REGISTRY_AUTHORIZATION_HEADER` | Full `Authorization` header value sent with every library request, for example `Basic ` or `Bearer `. Use it for a mirror that requires authentication. Credentials in the URL (`user:pass@host`) are not supported. Unset sends no credentials. | | `LIGHTDASH_CHART_REGISTRY_ALLOW_INSECURE` | Allows a plain `http` library URL and turns off address pinning. For local development fixtures only. Logs a security warning at startup. Do not use it for a mirror; use `LIGHTDASH_CHART_REGISTRY_ALLOW_PRIVATE_HOSTS` instead. (default=false) | ### Mirror the chart library A deployment with no route to the public internet can serve the library from inside its network. The library is a static tree of files, so any artifact proxy or object store that can mirror a website works, for example a remote repository in your artifact manager that caches `https://lightdash.github.io/lightdash-library`, or a bucket you sync the tree into. Mirror the tree as published. Lightdash reads `index.json` at the base URL and the chart files beneath it (`charts///...`), and it verifies every downloaded artifact against the checksums in the index, so a mirror cannot alter chart code without the install failing. Then point the instance at the mirror: ```bash theme={null} LIGHTDASH_CHART_REGISTRY_URL=https://artifacts.internal.example/lightdash-library LIGHTDASH_CHART_REGISTRY_ALLOW_PRIVATE_HOSTS=true # Only if the mirror requires authentication LIGHTDASH_CHART_REGISTRY_AUTHORIZATION_HEADER="Bearer " ``` * `LIGHTDASH_CHART_REGISTRY_ALLOW_PRIVATE_HOSTS` is needed whenever the mirror's hostname resolves to a private address. It lifts only that check. The mirror must still be served over `https` with a certificate the backend trusts, redirects are refused, and the connection stays pinned to the resolved address. Do not use `LIGHTDASH_CHART_REGISTRY_ALLOW_INSECURE` for a mirror. * `LIGHTDASH_CHART_REGISTRY_AUTHORIZATION_HEADER` holds the complete header value. Treat it as a secret: deliver it from your secret store rather than writing it into plain configuration. On Kubernetes, add the key to the Secret your deployment already injects, or use an `extraEnv` entry with a `secretKeyRef`. * If the mirror uses a certificate from an internal certificate authority, give the backend the CA bundle with `NODE_EXTRA_CA_CERTS`. Lightdash does not offer a way to skip certificate validation for the library. * Artifact proxies often rewrite the content type of binary files to `application/octet-stream`. Lightdash detects PNG, JPEG, WebP and GIF screenshots from their contents, so the library still renders previews behind such a proxy. Restart the backend after changing any of these variables. ### Turn off the chart library Set `LIGHTDASH_CHART_REGISTRY_URL` to an empty string. The **Chart library** tab disappears and no library requests are made. Chart types already installed keep working, and Chart Studio is unaffected. ### Troubleshoot the chart library **The Chart library tab doesn't appear.** Check that `LIGHTDASH_LICENSE_KEY` is set, `chart-type-registry` is in `LIGHTDASH_ENABLE_FEATURE_FLAGS`, and the signed-in user can install chart types in the project. If all of that is in place, the backend could not fetch the library index: check the backend logs for the request to `LIGHTDASH_CHART_REGISTRY_URL`. **The logs say the library host resolves to a private address.** The mirror is on an internal address and `LIGHTDASH_CHART_REGISTRY_ALLOW_PRIVATE_HOSTS` is not set. **The logs show a certificate error against the mirror.** The backend does not trust the mirror's certificate. Add the issuing CA bundle with `NODE_EXTRA_CA_CERTS`. **Installs fail with a checksum mismatch.** The mirror served a file that differs from the published one. Check that the mirror serves the tree unchanged and is not injecting or rewriting content. ## Provider usage Your sandbox and model providers bill your accounts directly. Monitor usage and configure limits with those providers before rolling out data apps. ## Troubleshooting **The "Data apps" entry doesn't appear in the New menu.** Check that `APPS_RUNTIME_ENABLED=true`, `LIGHTDASH_LICENSE_KEY` is set, and the signed-in user has the `create:DataApp` scope. **Chart Studio doesn't appear in the Browse menu.** Check that `LIGHTDASH_LICENSE_KEY` is set and your [sandbox provider](/self-host/customize-deployment/sandboxes) has all its required variables, for example `E2B_API_KEY` with E2B. `APPS_RUNTIME_ENABLED` isn't needed. **Builds fail immediately with a sandbox creation error.** Check your sandbox provider's credentials and template configuration — see [sandboxes](/self-host/customize-deployment/sandboxes). **Builds fail mid-generation with an Anthropic error.** For direct Anthropic, check account usage limits and confirm `ANTHROPIC_API_KEY` is valid. With `ANTHROPIC_BASE_URL`, confirm the sandbox can reach the gateway and that it accepts bearer authentication at `/v1/messages`. **Codex builds fail with an OpenAI authentication or model error.** Confirm `APPS_CODING_AGENT=codex`. For OpenAI, verify `OPENAI_API_KEY`; if `OPENAI_BASE_URL` is set, the gateway must support the Responses API and the model IDs shown in the Data app model picker. For a Bedrock gateway, verify `BEDROCK_API_KEY`, `/responses` support, and the `openai.`-prefixed model ID. **App queries fail with a warehouse network-policy or IP allowlist error.** A data app's queries run through the Lightdash backend like any chart query, not from the sandbox or the viewer's browser. The blocked IP is the outbound address of your Lightdash backend, or of your [warehouse worker](/self-host/nats-workers/warehouse-workers) pods if you run them. Allowlist that address, or the NAT gateway the traffic leaves through, in the warehouse's network policy. **Builds fail mid-generation with a Bedrock error.** Confirm `BEDROCK_REGION` is set to a region where the selected agent's model is available, and that either `BEDROCK_API_KEY` or the `BEDROCK_ACCESS_KEY_ID` / `BEDROCK_SECRET_ACCESS_KEY` pair is valid. If you use IAM credentials, the principal must have permission to invoke the selected model. With `BEDROCK_BASE_URL`, confirm the gateway supports the selected agent's API and is allowed by the sandbox network policy. Codex requires an exact OpenAI Bedrock model ID with the `openai.` prefix. # Self-host the MCP server Source: https://docs.lightdash.com/self-host/enterprise-features/mcp Enable the Model Context Protocol server on a self-hosted Lightdash instance [Self-hosted](/support/feature-badges#self-hosted) [Enterprise](/support/feature-badges#enterprise) Enable the [Lightdash MCP server](/agents/lightdash-mcp) on your self-hosted instance and make its endpoint reachable by your AI clients. This page covers deployment configuration and network access; use the feature documentation for client setup, authentication, tools, and permissions. ## Prerequisites * **Enterprise license** — `LIGHTDASH_LICENSE_KEY` must be set on your instance. * **HTTPS** — MCP clients connect over HTTPS. See [secure Lightdash with HTTPS](/self-host/customize-deployment/secure-lightdash-with-https) if your instance is HTTP-only. ## Enable MCP Set the following environment variable on your Lightdash backend, then restart it: ```bash theme={null} MCP_ENABLED=true ``` Lightdash includes the OAuth server; you don't need a separate OAuth service. Organization administrators can still [turn MCP access off](/agents/lightdash-mcp#turn-mcp-access-on-or-off), even when `MCP_ENABLED=true`. ## Optional configuration | Variable | Description | | :- | :- | | `MCP_ENABLED` | Enables the Lightdash Model Context Protocol (MCP) server. Requires `LIGHTDASH_LICENSE_KEY`. (default=false) | | `MCP_RUN_SQL_MAX_LIMIT` | Maximum number of rows the MCP `run_sql` tool can return. Does not inherit `AI_COPILOT_MAX_QUERY_LIMIT` (default=5000). | | `AUTH_OAUTH_SERVER_ACCESS_TOKEN_LIFETIME` | Lifetime in seconds of the access tokens Lightdash's OAuth server issues, including MCP connections (default=3600, 1 hour). | | `AUTH_OAUTH_SERVER_REFRESH_TOKEN_LIFETIME` | Lifetime in seconds of the refresh tokens Lightdash's OAuth server issues, including MCP connections; once it expires, the client repeats the browser sign-in flow (default=1209600, 2 weeks). | `run_metric_query` has no separate MCP variable — its row cap is `AI_COPILOT_MAX_QUERY_LIMIT` (default 5000), the same instance-wide setting that limits AI agent queries (see [AI agent environment variables](/self-host/customize-deployment/environment-variables#ai-agents)). It isn't configurable per organization, and a requested limit above the cap is clamped without the response saying so. To reduce the filter-related query schema sent to the model, enable [compact filter expressions](/self-host/enterprise-features/ai-agents#compact-filter-expressions). That section covers deployment and client-refresh requirements. ## MCP URL format Once enabled, the MCP endpoint is available at: ```text theme={null} https:///api/v1/mcp ``` Replace `` with your instance's domain (e.g. `lightdash.yourcompany.com`). ## Connect an AI assistant Follow [Connect a client](/agents/lightdash-mcp#connect-a-client) to generate configuration using your instance's URL. For headless integrations, see [custom integrations](/agents/lightdash-mcp#custom-integrations). ## Network requirements If your Lightdash instance sits behind a firewall or VPN, ensure the MCP client can reach it over HTTPS. See the [MCP network requirements](/agents/lightdash-mcp#network-requirements) for additional domains that may need allow-listing depending on the AI assistant. The client needs `/api/v1/mcp`, the OAuth endpoints under `/api/v1/oauth/`, and the `/.well-known/oauth-*` discovery paths. Some clients connect from their vendor's cloud rather than from the user's machine, so an instance that's only reachable on your internal network works from one client and fails from another. For those clients, allow the vendor's published outbound IP ranges to reach these paths. Allow more than `GET`: Claude's cloud calls `POST /api/v1/oauth/token` and `POST /api/v1/oauth/register`, and it needs `POST` and `GET` (it opens an SSE stream) on `/api/v1/mcp` itself. A `GET`-only or exact-path allowlist rule lets OAuth discovery pass but leaves the connection stuck after you click **Continue connecting** in Claude. To check that the endpoint is reachable from a given network, run: ```bash theme={null} curl -i https:///api/v1/mcp ``` A reachable instance returns `401 Unauthorized` with a `WWW-Authenticate` header pointing at your `SITE_URL`. If that URL isn't the public HTTPS address of your instance, OAuth discovery fails. Also check discovery directly: ```bash theme={null} curl https:///.well-known/oauth-authorization-server ``` Its `issuer` and `token_endpoint` should both be your instance's public HTTPS address (`SITE_URL`), not an internal hostname. ### Outbound egress for OAuth client ID metadata documents Lightdash 2.580.0 and later accepts [OAuth client ID metadata documents](https://datatracker.ietf.org/doc/draft-ietf-oauth-client-id-metadata-document/) as a way for MCP clients to identify themselves, instead of registering a client first. Claude uses this: it presents an `https` URL as its `client_id`, for example `https://claude.ai/oauth/mcp-oauth-client-metadata`. When a user opens the authorization page for that client, the Lightdash backend fetches the document at that URL itself, over HTTPS, with no redirects and a 5-second timeout — so your backend pods need direct outbound HTTPS access to `claude.ai`, not routed through a proxy that blocks it. If that fetch fails, the authorization page returns `400 Invalid client_id or redirect_uri` instead of the consent page. > [!NOTE] > > Versions 2.580.0–2.589.3 reject client ID metadata documents that advertise extra grant types, which Claude's document does — you need 2.589.4 or later. ## Troubleshooting | Symptom | Likely cause | | - | - | | `/api/v1/mcp` returns an error or 404 | Check the license and deployment configuration, then confirm **Allow MCP access** is enabled in **Settings** → **MCP** → **General** | | OAuth flow fails | The Lightdash instance isn't reachable from the browser performing the OAuth redirect | | AI assistant can't connect | The MCP URL is wrong or the instance isn't accessible over HTTPS | | Connection hangs after **Continue connecting** | The allowlist only permits `GET` or an exact path on `/api/v1/mcp` — allow `POST` and `GET` on `/api/v1/mcp`, and `POST` on `/api/v1/oauth/token` and `/api/v1/oauth/register` | | Authorization page returns 400 `Invalid client_id or redirect_uri` | Check you're on Lightdash 2.589.4 or later and that backend pods have outbound HTTPS access to the client's `client_id` host (e.g. `claude.ai`). If `client_id` is an opaque ID rather than a URL, the client registered dynamically instead — check `POST /api/v1/oauth/register` is allowed through and look at the backend logs | # Self-host pre-aggregates Source: https://docs.lightdash.com/self-host/enterprise-features/pre-aggregates Enable pre-aggregate query routing on a self-hosted Lightdash instance [Self-hosted](/support/feature-badges#self-hosted) [Enterprise](/support/feature-badges#enterprise) Enable managed [pre-aggregates](/semantic-layer/pre-aggregates) on your self-hosted instance with object storage and, when NATS is enabled, a dedicated worker. This page covers deployment setup; use the feature documentation for definitions, query matching, and refresh schedules. ## Prerequisites * **Enterprise license** — `LIGHTDASH_LICENSE_KEY` must be set on your instance. * **S3-compatible storage** — a dedicated bucket Lightdash can write Parquet files to. Don't reuse the results cache bucket: query history cleanup would delete active materializations. See [S3 storage configuration](/self-host/nats-workers/pre-aggregate-workers#s3-storage-configuration) for the bucket variables and provider examples. ## Where pre-aggregates run Where materializations and pre-aggregate queries execute depends on whether NATS is enabled: | NATS | What runs them | Notes | | - | - | - | | `NATS_ENABLED` unset | The API process serves queries and the scheduler process materializes | No extra deployment. Materialization stages the full result on that pod's local disk and runs DuckDB in-process, so size the scheduler pod for your largest pre-aggregate. | | `NATS_ENABLED=true` | A worker that consumes the `pre-aggregate` stream | Workers consume only the [streams they are started for](/self-host/nats-workers#streams-and-workers). The Helm chart pins its warehouse worker to `warehouse`, so set `preAggregateNatsWorker.enabled: true` to run a [pre-aggregate worker](/self-host/nats-workers/pre-aggregate-workers) alongside it. | > [!WARNING] > > With NATS enabled and no worker on the `pre-aggregate` stream, matching queries remain queued until they expire. Warehouse [execution fallback](/semantic-layer/pre-aggregates#execution-fallback) handles serving errors, not a missing worker. ## Enable pre-aggregates Set the main switch, keep Parquet materialization on, and point Lightdash at the bucket. Lightdash refuses to start when `PRE_AGGREGATES_ENABLED` is `true` without a bucket. ```bash theme={null} PRE_AGGREGATES_ENABLED=true PRE_AGGREGATES_PARQUET_ENABLED=true PRE_AGGREGATE_RESULTS_S3_BUCKET=lightdash-pre-aggregates PRE_AGGREGATE_RESULTS_S3_REGION=us-east-1 ``` Configure the storage endpoint and authentication using [S3 storage configuration](/self-host/nats-workers/pre-aggregate-workers#s3-storage-configuration). Bucket credentials fall back to the base S3 credentials; use the default AWS credential chain when no explicit credentials are configured. Keep `PRE_AGGREGATES_PARQUET_ENABLED=true` for Parquet materializations. Set a DuckDB query memory limit using the [worker sizing guidance](/self-host/nats-workers/pre-aggregate-workers#duckdb-memory-tuning). The full variable list is in the [pre-aggregates reference](/self-host/customize-deployment/environment-variables#pre-aggregates). Restart the backend, scheduler, and any workers that use this configuration. Follow [define pre-aggregates](/semantic-layer/pre-aggregates#defining-pre-aggregates) to configure a materialization. ## Turn pre-aggregates off Pre-aggregates are enabled for the whole instance, with no per-organization switch. To turn them off, set: ```bash theme={null} PRE_AGGREGATES_ENABLED=false ``` Restart the backend, scheduler, and workers that use this configuration. ## Verify pre-aggregates After deploying a definition, confirm a Parquet file appears in the configured bucket. Use [monitoring and debugging](/semantic-layer/pre-aggregates/monitoring) to check materialization status and query routing. ## Troubleshooting **Materialization jobs stay queued, or matching queries expire.** NATS is enabled and no worker consumes the `pre-aggregate` stream. Confirm a worker pod runs against the same NATS URL and was started either without `--stream` or with `--stream pre-aggregate`. A worker started with `--stream warehouse` never picks these jobs up. **Materializations fail with an S3 permissions error.** Check the endpoint, credentials, and bucket permissions in [S3 storage configuration](/self-host/nats-workers/pre-aggregate-workers#s3-storage-configuration) on every process that materializes or serves queries. **Queries never route to a pre-aggregate.** Check the pre-aggregate definition matches the query shape — see [pre-aggregate query matching](/semantic-layer/pre-aggregates#query-matching). # Self-hosted usage analytics Source: https://docs.lightdash.com/self-host/enterprise-features/usage-analytics Configure storage, processing, and monitoring for self-hosted usage analytics [Self-hosted](/support/feature-badges#self-hosted) [Enterprise](/support/feature-badges#enterprise) Configure object storage and scheduled processing for the [usage analytics project](/workspace-admin/usage-analytics-project) on your self-hosted instance. This page covers deployment setup, monitoring, and recovery; use the feature documentation to create the project, grant access, and use its dashboards. Use this page to understand [how it works](#how-it-works), [configure the deployment](#configure-the-deployment), [enable processing](#enable-processing), [verify setup](#verify-setup), or [troubleshoot processing](#troubleshooting-processing). For dashboard and metric definitions, see the [product guide](/workspace-admin/usage-analytics-project#build-your-own-analysis). ## How it works Usage analytics separates event capture, scheduled processing and interactive queries. A working query only verifies the data and storage access needed by that query. ```mermaid theme={null} flowchart TD activity["Backend and worker activity"] --> raw["Raw JSONL files in object storage"] raw --> refresh["Scheduler refresh"] inventory["Application database inventory"] --> refresh refresh --> parquet["Parquet events, snapshots and summaries"] parquet --> duckdb["DuckDB queries"] duckdb --> analytics["Dashboards and Explore"] ``` The backend and workers buffer supported events and upload compressed JSONL files under `events/raw/`, partitioned by organization, event stream and UTC date. Capture runs asynchronously and is best-effort: buffered events can be lost if a process stops or uploads exhaust their retries. Creating the analytics project is not required for capture. The scheduler's `compactUsageEvents` task runs the following stages in order on the `usage-events-compaction` queue: | Stage | Published data | | - | - | | `compaction` | Converts raw event files into typed Parquet under `events/compacted/`, then removes the successfully processed raw inputs. | | `dimensions` | Refreshes inventory snapshots from the application database, including users, content and the People membership snapshot. | | `users` | Builds daily per-user activity summaries from compacted events for the **User activity** Explore. | The refresh follows the [data freshness schedule](/workspace-admin/usage-analytics-project#data-freshness-and-history). It processes closed UTC days; today's raw events wait for a subsequent refresh. Inventory snapshots reflect the database when that stage runs. Publication is separate for each output, not one transaction across the pipeline. A failed refresh can leave some datasets updated and others missing or showing their last complete version. **People** activity charts depend on user summaries; its population and returning/inactive-person charts also use the membership snapshot. Query timing charts can still read available query-event files while either People dependency is missing or stale. For interactive queries, the backend checks the caller's analytics permissions and selects files for the authorized organization. DuckDB reads those Parquet files using short-lived signed URLs and returns results through the normal Explore query flow. It does not query your business warehouse for this data. ## Configure the deployment 1. [Upgrade Lightdash](/self-host/upgrading) to **3.156.0 or later** and keep the backend, scheduler and workers on the same release. 2. Apply the [enterprise license](/self-host/enterprise-features#apply-the-license-key) to all Lightdash components. 3. Configure [S3-compatible object storage](/self-host/customize-deployment/configure-lightdash-to-use-external-object-storage). Usage storage inherits the base S3 configuration, not the pre-aggregate storage settings. To use a separate bucket or credentials, set the [usage analytics storage variables](/self-host/customize-deployment/environment-variables#usage-analytics-storage). The base S3 configuration is still required. 4. Ensure the backend, scheduler and any query workers can reach the storage endpoint. The capture and refresh processes need to list, read, write and delete usage objects; analytics queries need authenticated reads. Keep the bucket private and configure credentials through your deployment's secret management. 5. Keep the [scheduler](/self-host/customize-deployment/scheduler) running to process captured data and publish inventory snapshots. Apply configuration consistently to the backend, scheduler and workers, then roll out those components. Do not apply a short-lived query-results cleanup policy to usage data you intend to retain: if your base bucket has a delete lifecycle rule for query results, set `USAGE_EVENTS_S3_BUCKET` to a bucket without one. ## Enable processing Usage analytics is available by default with a valid Enterprise license and configured usage storage. An organization administrator can [create the analytics project](/workspace-admin/usage-analytics-project#create-your-analytics-project) without requesting feature enablement. Nightly processing selects organizations that have an analytics project. Creating the project starts background processing; organizations without one continue capturing events but are skipped by the nightly job. Raw event capture runs on deployments with a license key and working usage storage configuration. [RudderStack telemetry](/self-host/data-flows-and-telemetry) is a separate system: disabling it does not disable usage analytics. Deleting the analytics project stops future nightly selection for that organization. It does not stop raw uploads, cancel queued or running jobs, or delete stored usage files. Retain or expire usage objects through your storage policy, including raw files for organizations without an analytics project. ## Verify setup Create the analytics project and generate activity in that organization, then allow the scheduled data refresh to complete. Follow [Check a processing run](#check-a-processing-run) to verify the full pipeline. Successful project creation verifies access to storage, but does not prove that events have been collected or processed. Run a chart in the analytics project for a closed day with known activity. Check that the user, content and date match that activity. To update installed dashboards after an upgrade, follow [Update models and dashboards](/workspace-admin/usage-analytics-project#update-models-and-dashboards). For retained database records from before capture began, use [historical backfill](/workspace-admin/usage-analytics-project#historical-backfill). Usage files can contain user identities and content metadata. Restrict bucket access and choose a retention policy that matches your organization's requirements. ## Troubleshooting processing Start with scheduler logs for the affected refresh and identify which stage failed or left work pending. Use your deployed release when investigating: available models, log fields and monitoring signals depend on that release. ### Check a processing run Search scheduler logs for `Usage processing stage started` and `Usage processing stage finished`. Correlate records with the same `runId`. Finished records include `stage`, `durationSeconds` and `outcome`; stage summaries can also include `failed`, `remaining` and `limitReached`. Check the final record with `stage="pipeline"`, which covers the full sequence: | Outcome | Meaning | | - | - | | `success` | All stages completed with no reported failures or known remaining work. | | `partial` | No failures were reported, but deferred, capped or skipped work remains. | | `failed` | A stage threw an error or reported failed partitions or snapshots. Other outputs from that run can still be available. | A successful `compaction` stage is not proof that inventory and user summaries finished. A completed queue job alone is also insufficient: reported compaction failures can mark the pipeline as failed even when the job handler returns normally. A start record without a matching finish can indicate an interrupted or still-running process; check worker health and elapsed time. After a successful pipeline run, refresh a chart for a closed day with known activity. Pipeline success describes the work discovered by that run; it cannot prove that every event was captured. ### Monitor refresh completion If you [enable Prometheus metrics](/self-host/customize-deployment/configure-prometheus-metrics-for-self-hosted-lightdash), scrape the scheduler workers and use the full-pipeline success timestamp: ```promql theme={null} lightdash_usage_processing_last_finished_timestamp_seconds{ stage="pipeline", outcome="success" } ``` The value is the completion time, not the scrape time. `lightdash_usage_processing_running` and `lightdash_usage_processing_last_started_timestamp_seconds` show current stage execution. `lightdash_usage_processing_work` reports failed or remaining work and whether a stage reached its work limit. Counts have different units across stages, so do not add them together. These metrics belong to individual processes and reset when workers are replaced. Use retained scrape history across scheduler replicas, keep deployments separate, and treat an absent success timestamp as unknown rather than healthy. Monitor failed and partial outcomes as well as the age of the last success; a recent success does not clear a later failure. Logs and worker-health checks are still needed for crashes between scrapes. ### Investigate empty People charts while query charts work Open the affected chart's **Explore from here** action to identify its source. For **User activity**, inspect the `users` stage. For People population and returning/inactive-person metrics, inspect the `dimensions` stage and its membership snapshot errors. Existing event files can serve latency charts even when these outputs are missing or stale. Also check the chart's date filters and capture coverage. A missing partition is unknown coverage, not proof that nobody was active. For metric definitions and supported historical data, use the [product guide](/workspace-admin/usage-analytics-project#data-freshness-and-history). ### Resolve storage errors Check the [usage storage configuration](/self-host/customize-deployment/environment-variables#usage-analytics-storage) on every backend, scheduler and worker replica. Confirm the endpoint is reachable and that the configured identity has the required list, read, write and delete access to usage objects. A successful read of an existing event file does not verify permission to publish snapshots or clean up raw inputs. After fixing credentials, permissions or networking, roll out any changed configuration and follow [Recover a failed or partial run](#recover-a-failed-or-partial-run). Preserve raw files and compaction checkpoints under `events/compaction/`; the pipeline uses them to resume cleanup without publishing the same inputs twice. Events that were never successfully uploaded cannot be recovered by rerunning processing. ### Investigate a missing run Check that the scheduler is running, can reach the application database and storage, and resolves the organization as eligible for processing. If you use [scheduler task inclusion or exclusion](/self-host/customize-deployment/environment-variables#scheduler), ensure `compactUsageEvents` is allowed. Inspect the scheduler queue and worker logs for a run that is still active before arranging another run. ### Recover a failed or partial run Fix the reported cause, then check the next serialized run. Nightly jobs make one whole-job attempt; individual storage operations can retry within that attempt. Deferred work queues follow-up history-processing jobs, which have their own retries. The nightly job also reschedules exhausted history-processing jobs. Nightly processing prioritizes the previous **seven closed UTC dates**, excluding today. Follow-up history jobs process older retained raw files and rebuild user activity summaries from compacted events. This is separate from the [database history backfill](/workspace-admin/usage-analytics-project#historical-backfill). Work limits can leave a run partial, so monitor subsequent outcomes until the backlog clears. Storage retention still determines which files remain available. If scheduled recovery stops making progress or you need an immediate rerun, contact the Lightdash team with your deployed version, affected UTC dates, `runId`, and sanitized stage errors. Coordinate the rerun through the scheduler's serialized queue; do not run competing standalone compactors or enqueue duplicate jobs while a run is active. Do not include credentials, event payloads, or signed storage URLs in a support report. For model and dashboard changes, use [Sync content](/workspace-admin/usage-analytics-project#update-models-and-dashboards); it does not rerun this pipeline. # Enterprise on-prem setup Source: https://docs.lightdash.com/self-host/enterprise-on-prem Deploy FedRAMP-ready Lightdash Enterprise Edition on premises on your own infrastructure [Self-hosted](/support/feature-badges#self-hosted) This guide covers the setup requirements and best practices for deploying Lightdash Enterprise Edition on-prem (on prem, on-premises, on premises). Lightdash Enterprise supports FedRAMP-ready deployments for government and regulated industries. ## Prerequisites * Postgres database with the `pgvector` extension installed ## Accessing the Lightdash image The Lightdash image is available on [DockerHub](https://hub.docker.com/repository/docker/lightdash/lightdash/tags). Pin a specific version in production rather than `latest`: ```bash theme={null} docker pull lightdash/lightdash:0.2248.3 ``` For the versioning policy, upgrade cadence, and how to rehearse upgrades in UAT, see [Upgrade your instance](/self-host/upgrading). ## License key A license key is required for Enterprise Edition features. Set it via the `LIGHTDASH_LICENSE_KEY` environment variable — the Lightdash team shares your key via 1Password. See [enterprise features](/self-host/enterprise-features) for configuration, validation, and network requirements. ### After activating your license key Once your license key is active, each Enterprise feature is enabled from its section on the [enterprise features](/self-host/enterprise-features) page — AI agents, data apps, embedding, MCP, custom roles, service accounts, SCIM, pre-aggregates, AI writeback, and multi-agent Slack channels. If you need help enabling features or troubleshooting your deployment, contact the Lightdash team. ## Migration from OSS If you're migrating from the open-source version to Enterprise Edition: 1. Migrate to a commercial version matching your current OSS version 2. Once a single container is running the commercial version, the connected database will be upgraded to include the commercial schemas 3. Any other OSS containers will fail on restart but can be run temporarily 4. Roll out the commercial version to all containers as soon as the first container successfully migrates # Lightdash Cloud vs. Self-Hosted Source: https://docs.lightdash.com/self-host/lightdash-cloud-vs-self-hosted What you get and what you take on when you choose Lightdash Cloud or self-hosting Self-hosting is great for hobbyist projects or if you want to go wild with a completely custom implementation (maybe you'd prefer the whole app was translated into pirate-speak). For most companies and teams, we recommend Lightdash Cloud. To self-host Lightdash securely in production, you should have an excellent understanding of running services with Docker and kubernetes, as well as the security considerations. If you're unsure whether to self-host or use Lightdash Cloud, here are some things to consider: ## When to use Lightdash Cloud Unless you have a specific need to self-host, we recommend using Lightdash Cloud: * Suitable for most teams * Get started with Lightdash quickly * Secure and reliable out-of-the-box. * No need to maintain your own infrastructure. * Always have the latest version of Lightdash. * Incredible support from the core Lightdash team and maintainers. ## When to self-host There are a few reasons why you might want to self-host Lightdash: * You're a large enterprise and want to run a proof-of-concept on your own infrastructure. This can be a great way to get your hands on Lightdash, while your infosec team approves the use of Lightdash Cloud. For enterprise features on self-hosted instances, see our [enterprise features](/self-host/enterprise-features) documentation. * You're a hobbyist and want to run Lightdash on your own infrastructure. * You want to customise Lightdash to your specific needs. ## Move from Lightdash Cloud to self-hosted Moving an existing Cloud organization to your own instance means running the infrastructure yourself, then copying your content across: 1. Deploy Lightdash following the [production deployment checklist](/self-host/production-deployment-checklist). Enterprise features you use on Cloud, such as embedding, AI agents and data apps, need an [Enterprise license key](/self-host/enterprise-features) on the new instance. 2. Create the project on the new instance and connect the same dbt project and warehouse. 3. Copy charts, dashboards and spaces with `lightdash download` and `lightdash upload` ([content as code](/workflow/content-as-code#download-an-entire-project)), and organization resources such as custom roles, users, groups and user attributes with `lightdash download --organization` and `lightdash upload --organization` ([organization content as code](/workflow/content-as-code#organization-content-as-code)). 4. If you embed Lightdash, [generate an embed secret](/embed/set-up-embedding) and choose the allowed content on the new project. Embed settings aren't part of content as code, and URLs signed with your Cloud secret don't work on the new instance. ## Move from self-hosted to Lightdash Cloud Moving a self-hosted instance to Lightdash Cloud means setting up a new Cloud project and copying your content across: 1. Create a project on Lightdash Cloud and connect the same dbt project and warehouse you use on your self-hosted instance. 2. Copy charts, dashboards and spaces with `lightdash download` and `lightdash upload` ([content as code](/workflow/content-as-code#download-an-entire-project)), and organization resources such as custom roles, users, groups and user attributes with `lightdash download --organization` and `lightdash upload --organization` ([organization content as code](/workflow/content-as-code#organization-content-as-code)). 3. Recreate any [service accounts](/workspace-admin/service-accounts) on the new Cloud organization and update any CI/CD jobs, deployed services, or scripts to use the new tokens. Service accounts aren't part of content as code, so their secrets don't move with the rest of your content. # NATS workers Source: https://docs.lightdash.com/self-host/nats-workers Scale Lightdash query processing with dedicated NATS worker pods using the Helm chart [Self-hosted](/support/feature-badges#self-hosted) By default, Lightdash processes all queries on the main API server. NATS workers move query execution onto dedicated pods, improving responsiveness under load and letting you scale query capacity independently. Lightdash uses [NATS](https://nats.io/) — a lightweight, high-performance messaging system — with [JetStream](https://docs.nats.io/nats-concepts/jetstream), its built-in persistent streaming layer, to distribute work between the API server and worker pods. NATS powers two opt-in features in Lightdash: [warehouse workers](/self-host/nats-workers/warehouse-workers), which process interactive and background warehouse queries on dedicated pods, and [pre-aggregate workers](/self-host/nats-workers/pre-aggregate-workers), which materialize pre-aggregates and serve queries from DuckDB. ## Requirements * **Helm chart** version **2.7.2** or later * **Lightdash** version [**0.2675.0**](https://hub.docker.com/r/lightdash/lightdash/tags) or later. Older images will fail with `MODULE_NOT_FOUND`. Upgrading the Helm chart alone does not change how Lightdash works. NATS features are entirely opt-in — your existing deployment will behave exactly the same until you explicitly enable the new Helm values described below. ## Architecture ```mermaid theme={null} flowchart LR API[Lightdash API] -->|publish job| NATS[NATS JetStream] NATS -->|deliver message| Worker[Worker pod
concurrency: 100] Worker -->|return result| API ``` The Lightdash API publishes jobs to NATS JetStream. Worker pods consume messages from their stream and process them concurrently (default 100 concurrent jobs per pod). ## Streams and workers The API publishes each job to one of three JetStream streams: | Stream | Jobs | Worker | | - | - | - | | `warehouse` | Interactive and background warehouse queries | [Warehouse worker](/self-host/nats-workers/warehouse-workers) | | `pre-aggregate` | Materializations, queries served from a pre-aggregate, and DuckDB compose queries on an Enterprise instance | [Pre-aggregate worker](/self-host/nats-workers/pre-aggregate-workers) | | `duckdb` | DuckDB compose queries on an instance without an Enterprise license | None in the Helm chart; start one with `--stream duckdb` or run a worker without `--stream` | A worker started with `--stream ` consumes only that stream. A worker started without `--stream` consumes every stream the instance registers. The Helm chart pins its workers: the warehouse worker runs with `--stream warehouse` and the pre-aggregate worker with `--stream pre-aggregate`, so each stream you use needs its own worker enabled. A job published to a stream with no worker waits for `NATS_QUEUE_TIMEOUT_MS` (3 minutes by default) and then fails; nothing falls back to the API process. ## Enabling NATS ```yaml theme={null} nats: enabled: true config: cluster: enabled: false jetstream: enabled: true fileStore: enabled: false memoryStore: enabled: true maxSize: 1Gi ``` The JetStream configuration shown above reflects the defaults when `nats.enabled` is set to `true`. This deploys a NATS StatefulSet and sets `NATS_ENABLED=true` on the backend, which means the backend will start routing queries through NATS. You should always enable at least a [warehouse worker](/self-host/nats-workers/warehouse-workers) alongside NATS to process those queries — otherwise queries will be enqueued with no worker to pick them up. > [!WARNING] > > Do not enable `nats.enabled: true` without also enabling `warehouseNatsWorker.enabled: true`. The backend routes queries to NATS when `NATS_ENABLED` is set, so queries will stall if no worker is running to process them. ## Auto-configured environment variables The chart automatically sets these environment variables in the shared ConfigMap — you do not need to set them manually: | Variable | Set when | Value | | - | - | - | | `NATS_ENABLED` | `nats.enabled: true` | `"true"` | | `NATS_URL` | `nats.enabled: true` | `nats://-nats:4222` | Additional environment variables are auto-configured per worker deployment — see [Warehouse workers](/self-host/nats-workers/warehouse-workers) and [Pre-aggregate workers](/self-host/nats-workers/pre-aggregate-workers) for details. ## NATS JetStream configuration JetStream supports two [storage backends](https://docs.nats.io/nats-concepts/jetstream/streams#storagetype) — we recommend memory store, but you can use file store depending on your needs. ### Memory store vs file store | | Memory store (recommended) | File store | | - | - | - | | **How it works** | Messages are held in RAM | Messages are persisted to disk | | **Performance** | Faster — no disk I/O overhead | Slower — writes go through disk | | **Persistence** | Messages are lost if NATS restarts | Messages survive NATS restarts | | **Infrastructure** | No PersistentVolumeClaim needed | Requires a PersistentVolumeClaim | | **When to use** | Most deployments. Lightdash messages are small (just a query UUID) and are deleted once processed. | High message volume exceeding available RAM, or if you need messages to survive NATS pod restarts. | For more details, see the NATS documentation on [JetStream](https://docs.nats.io/nats-concepts/jetstream) and [stream storage types](https://docs.nats.io/nats-concepts/jetstream/streams#storagetype). ### Configuration reference ```yaml theme={null} nats: enabled: true config: cluster: enabled: false # single-node NATS, no clustering jetstream: enabled: true fileStore: enabled: false # no disk persistence memoryStore: enabled: true maxSize: 1Gi # max memory for message storage ``` | Setting | Recommended | Description | | - | - | - | | `nats.config.jetstream.memoryStore.enabled` | `true` | Enable memory-backed storage | | `nats.config.jetstream.memoryStore.maxSize` | `1Gi` | Maximum memory for JetStream message storage | | `nats.config.jetstream.fileStore.enabled` | `false` | Enable disk-backed storage | | `nats.config.cluster.enabled` | `false` | Single-node NATS (no clustering) | ### Pod disruption NATS is a stateful component — if the NATS pod restarts, in-flight messages are lost (queries will be retried by users). The chart protects against unplanned eviction with: * `cluster-autoscaler.kubernetes.io/safe-to-evict: "false"` annotation * `PodDisruptionBudget` with `maxUnavailable: 0` # Pre-aggregate workers Source: https://docs.lightdash.com/self-host/nats-workers/pre-aggregate-workers Configure and scale pre-aggregate worker pods for materialization and DuckDB query serving [Self-hosted](/support/feature-badges#self-hosted) [Enterprise](/support/feature-badges#enterprise) Pre-aggregate workers handle two jobs: 1. **Materializations** — Run a query against your warehouse, convert the results to a materialization format, and upload to S3 2. **DuckDB queries** — When a user query [matches a pre-aggregate](/semantic-layer/pre-aggregates#query-matching), read the materialized data from S3 and execute the query using DuckDB Both job types are distributed via the NATS `pre-aggregate` stream. Without NATS, the API and scheduler processes run them in-process instead; see [where pre-aggregates run](/self-host/enterprise-features/pre-aggregates#where-pre-aggregates-run). ### Pre-aggregate materializations Scheduled jobs materialize warehouse query results and store them on S3: ```mermaid theme={null} flowchart LR API[Lightdash API] -->|publish materialization job| NATS[NATS JetStream] NATS -->|deliver| Worker[Pre-aggregate worker] Worker -->|execute SQL| WH[(Data warehouse)] WH -->|rows| Worker Worker -->|store data| S3[(S3 storage)] ``` ### Pre-aggregate queries When a user query matches a pre-aggregate, the worker serves it using DuckDB against materialized data on S3 — without hitting your data warehouse: ```mermaid theme={null} flowchart LR API[Lightdash API] -->|publish query job| NATS[NATS JetStream] NATS -->|deliver| Worker[Pre-aggregate worker] Worker -->|read data| S3[(S3 storage)] S3 -->|data| Worker Worker -->|DuckDB result| API ``` ## Prerequisites * A valid [Enterprise license key](/self-host/enterprise-features) * An S3-compatible bucket for materialized data (AWS S3, GCS, MinIO) * NATS and warehouse workers enabled (see [NATS workers overview](/self-host/nats-workers)) ## Example configuration Start from the NATS and warehouse worker configuration: ```yaml theme={null} nats: enabled: true config: cluster: enabled: false jetstream: enabled: true fileStore: enabled: false memoryStore: enabled: true maxSize: 1Gi warehouseNatsWorker: enabled: true replicas: 1 concurrency: 100 resources: requests: cpu: 250m memory: 1.5Gi limits: memory: 1.5Gi ``` Then add a pre-aggregate worker alongside it: ```yaml theme={null} preAggregateNatsWorker: enabled: true replicas: 1 concurrency: 8 resources: requests: cpu: 650m memory: 4Gi ephemeral-storage: 9Gi limits: memory: 4Gi ephemeral-storage: 9Gi ``` The Helm chart auto-configures these environment variables: | Variable | Set from | Value | | - | - | - | | `NATS_ENABLED` | `nats.enabled: true` | `"true"` | | `NATS_URL` | `nats.enabled: true` | `nats://-nats:4222` | | `NATS_WORKER_CONCURRENCY` | `preAggregateNatsWorker.concurrency` | `100` | | `PRE_AGGREGATES_ENABLED` | `preAggregateNatsWorker.enabled: true` | `"true"` | | `PRE_AGGREGATES_PARQUET_ENABLED` | `preAggregateNatsWorker.enabled: true` | `"true"` | See the [overview](/self-host/nats-workers) for details on JetStream configuration options. ## S3 storage configuration Pre-aggregates require a **dedicated S3 bucket** separate from your main Lightdash results cache bucket. This prevents query history cleanup from deleting active materialization files. | Variable | Required | Description | Fallback | | - | - | - | - | | `S3_ENDPOINT` | Yes | S3-compatible endpoint URL | — | | `PRE_AGGREGATE_RESULTS_S3_BUCKET` | Yes | Dedicated bucket for materialized data | — | | `PRE_AGGREGATE_RESULTS_S3_REGION` | Yes | S3 region for the bucket | — | | `PRE_AGGREGATE_RESULTS_S3_ACCESS_KEY` | No | Access key for the bucket | `S3_ACCESS_KEY` | | `PRE_AGGREGATE_RESULTS_S3_SECRET_KEY` | No | Secret key for the bucket | `S3_SECRET_KEY` | `S3_ENDPOINT` and `S3_FORCE_PATH_STYLE` are inherited from your base [S3 configuration](/self-host/customize-deployment/configure-lightdash-to-use-external-object-storage). Access keys fall back to the base S3 credentials if not set separately. > [!WARNING] > > The credentials used for the pre-aggregate bucket must have **`s3:PutObject`** permission (in addition to `s3:GetObject`, `s3:ListBucket`, and `s3:DeleteObject`). Without `PutObject`, materialization jobs will fail to upload results to the bucket. On other S3-compatible storage (GCS, MinIO), grant the equivalent write permission. > [tab] AWS S3 > > ```yaml theme={null} > configMap: > S3_ENDPOINT: "https://s3.us-east-1.amazonaws.com" > PRE_AGGREGATE_RESULTS_S3_BUCKET: "my-lightdash-pre-aggs" > PRE_AGGREGATE_RESULTS_S3_REGION: "us-east-1" > secrets: > PRE_AGGREGATE_RESULTS_S3_ACCESS_KEY: "AKIA..." > PRE_AGGREGATE_RESULTS_S3_SECRET_KEY: "..." > ``` > [tab] Google Cloud Storage > > GCS is S3-compatible via [HMAC keys](https://cloud.google.com/storage/docs/authentication/hmackeys). Generate an HMAC key pair in **Cloud Storage > Settings > Interoperability**. > > ```yaml theme={null} > configMap: > S3_ENDPOINT: "https://storage.googleapis.com" > PRE_AGGREGATE_RESULTS_S3_BUCKET: "my-lightdash-pre-aggs" > PRE_AGGREGATE_RESULTS_S3_REGION: "auto" > secrets: > PRE_AGGREGATE_RESULTS_S3_ACCESS_KEY: "GOOG..." > PRE_AGGREGATE_RESULTS_S3_SECRET_KEY: "..." > ``` > [tab] MinIO > > ```yaml theme={null} > configMap: > S3_ENDPOINT: "https://minio.example.com" > S3_FORCE_PATH_STYLE: "true" > PRE_AGGREGATE_RESULTS_S3_BUCKET: "lightdash-pre-aggs" > PRE_AGGREGATE_RESULTS_S3_REGION: "us-east-1" > secrets: > PRE_AGGREGATE_RESULTS_S3_ACCESS_KEY: "minioadmin" > PRE_AGGREGATE_RESULTS_S3_SECRET_KEY: "..." > ``` > [!TIP] > > We recommend setting a **retention / lifecycle policy** on the pre-aggregate bucket to automatically clean up old files. Lightdash manages its own materializations, but a lifecycle policy prevents orphaned files from accumulating. Choose a retention period that makes sense for your deployment. ## Configuration reference All configuration is set through your Helm `values.yaml` under `preAggregateNatsWorker`: ### Scaling | Helm value | Default | Description | | - | - | - | | `preAggregateNatsWorker.replicas` | `1` | Number of worker pods. Scale horizontally for more parallel capacity. | | `preAggregateNatsWorker.concurrency` | `100` | Maximum concurrent jobs per pod. Maps to `NATS_WORKER_CONCURRENCY` env var. Each materialization stages its full result on local disk, so keep this well below the chart default: 8 fits the 9Gi ephemeral storage above. | ### Resources | Helm value | Recommended (request) | Recommended (limit) | Description | | - | - | - | - | | `preAggregateNatsWorker.resources.requests.cpu` | `650m` | — | CPU request per pod | | `preAggregateNatsWorker.resources.requests.memory` | `4Gi` | `4Gi` | Memory request and limit per pod | | `preAggregateNatsWorker.resources.requests.ephemeral-storage` | `9Gi` | `9Gi` | Local disk for temporary files during materialization | Pre-aggregate workers need significantly more resources than warehouse workers because they run **DuckDB in-process** for both materializing data and serving queries against materialized data. > [!WARNING] > > **Ephemeral storage is critical.** During materialization, warehouse query results are written to a local temporary file before being converted and uploaded to S3. Large materializations can consume several gigabytes of local disk. If the pod runs out of ephemeral storage, it will be evicted. ### DuckDB memory tuning DuckDB runs inside the pre-aggregate worker process. There are two types of DuckDB instances: | Instance type | Used for | Memory limit | Concurrency | | - | - | - | - | | **Shared query instance** | Serving pre-aggregate queries | Configurable (see below) | Shared across all concurrent queries | | **Isolated materialization instances** | Converting and uploading results | 256MB per instance, 1 thread | One per active materialization | By default, the shared query instance has **no memory cap**. Under concurrent load, this can cause OOM kills. Set a limit: ```yaml theme={null} configMap: PRE_AGGREGATE_DUCKDB_QUERY_MEMORY_LIMIT: "3GB" ``` **Sizing guideline:** Start with 2–3GB and adjust based on observed memory usage. The limit should leave enough headroom for the Node.js process, active materializations, and OS overhead within the pod's total memory. ### Optional environment variables These can be set via `extraEnv` or `configMap` if you need to override the defaults: | Variable | Default | Description | | - | - | - | | `NATS_QUEUE_TIMEOUT_MS` | `180000` (3 min) | How long a message can wait in the queue before being discarded. | | `PRE_AGGREGATE_DUCKDB_QUERY_MEMORY_LIMIT` | Unlimited | Memory cap for the shared DuckDB query instance (e.g., `2GB`, `3GB`). When unset, DuckDB will use all available pod memory and is likely to cause OOM kills under concurrent load. We strongly recommend setting this. | | `PRE_AGGREGATES_MAX_ROWS` | Unlimited | Maximum rows per materialization. Results are truncated to this limit with a warning. Can also be set per pre-aggregate in dbt YAML via `max_rows`. | ## Troubleshooting ### Materializations stay queued, or matching queries fail after 3 minutes No worker consumes the `pre-aggregate` stream. See [troubleshooting pre-aggregates](/self-host/enterprise-features/pre-aggregates#troubleshooting). ### Pre-aggregate queries hitting the warehouse instead of DuckDB 1. Verify that `PRE_AGGREGATES_ENABLED` is set to `"true"` on the pre-aggregate worker pod 2. Verify that `PRE_AGGREGATES_PARQUET_ENABLED` is set to `"true"` on the pre-aggregate worker pod 3. Confirm the pre-aggregate worker pod is running and healthy 4. Check that an active materialization exists in **Project Settings > Pre-aggregates** 5. Review query matching rules — see [monitoring and debugging](/semantic-layer/pre-aggregates/monitoring) ### Worker OOM kills Pre-aggregate workers run DuckDB which can consume significant memory: 1. Set `PRE_AGGREGATE_DUCKDB_QUERY_MEMORY_LIMIT` (e.g., `3GB`) to cap DuckDB memory 2. Increase the worker's memory request and limit 3. Reduce `concurrency` to limit parallel DuckDB queries ### Materialization failures Common causes: * **S3 access denied** — Verify `PRE_AGGREGATE_RESULTS_S3_*` credentials and bucket permissions * **Warehouse timeout** — Large materializations may exceed warehouse query timeout limits * **Disk pressure** — Materialization writes temporary files to local disk. Increase ephemeral storage if you see evictions. * **Too many rows** — Materializations should not contain very large datasets. We recommend keeping materializations under 100,000 rows for optimal performance. You can use `max_rows` in your [pre-aggregate definition](/semantic-layer/pre-aggregates#row-limits) or the `PRE_AGGREGATES_MAX_ROWS` environment variable to enforce a limit. # Warehouse workers Source: https://docs.lightdash.com/self-host/nats-workers/warehouse-workers Configure and scale dedicated warehouse query worker pods [Self-hosted](/support/feature-badges#self-hosted) Warehouse workers process interactive and background SQL queries against your data warehouse. When a user runs a query in Lightdash, the API server publishes a job to the NATS `warehouse` stream, and a warehouse worker picks it up, executes the SQL, and returns the results. ```mermaid theme={null} flowchart LR API[Lightdash API] -->|publish query job| NATS[NATS JetStream] NATS -->|deliver| Worker[Warehouse worker] Worker -->|execute SQL| WH[(Data warehouse)] WH -->|rows| Worker Worker -->|result| API ``` ## Example configuration A complete Helm values configuration with NATS and a warehouse worker: ```yaml theme={null} nats: enabled: true config: cluster: enabled: false jetstream: enabled: true fileStore: enabled: false memoryStore: enabled: true maxSize: 1Gi warehouseNatsWorker: enabled: true replicas: 1 concurrency: 100 resources: requests: cpu: 250m memory: 1.5Gi limits: memory: 1.5Gi ``` The chart auto-configures `NATS_ENABLED=true` and `NATS_URL` for you. See the [overview](/self-host/nats-workers) for details on JetStream configuration options. ## Configuration reference All configuration is set through your Helm `values.yaml` under `warehouseNatsWorker`: ### Scaling | Helm value | Default | Description | | - | - | - | | `warehouseNatsWorker.replicas` | `1` | Number of worker pods. Scale horizontally for more parallel query capacity. | | `warehouseNatsWorker.concurrency` | `100` | Maximum concurrent jobs per pod. Maps to `NATS_WORKER_CONCURRENCY` env var. | ### Resources | Helm value | Recommended (request) | Recommended (limit) | Description | | - | - | - | - | | `warehouseNatsWorker.resources.requests.cpu` | `250m` | — | CPU request per pod | | `warehouseNatsWorker.resources.requests.memory` | `1.5Gi` | `1.5Gi` | Memory request and limit per pod | ### Auto-configured environment variables These are set by the Helm chart: | Variable | Set from | Value | | - | - | - | | `NATS_ENABLED` | `nats.enabled: true` | `"true"` | | `NATS_URL` | `nats.enabled: true` | `nats://-nats:4222` | | `NATS_WORKER_CONCURRENCY` | `warehouseNatsWorker.concurrency` | `100` | ### Optional environment variables These can be set via `extraEnv` or `configMap` if you need to override the defaults: | Variable | Default | Description | | - | - | - | | `NATS_QUEUE_TIMEOUT_MS` | `180000` (3 min) | How long a message can wait in the queue before being discarded. | ## Troubleshooting ### Queries timing out If workers are busy, messages may expire before being processed. Scale up replicas or concurrency. ### Worker OOM kills Increase the memory request and limit. Large query result sets are held in memory during processing. ### NATS connection errors 1. Confirm the NATS pod is running and healthy 2. Verify that `NATS_URL` is set correctly on the warehouse worker pod (should be `nats://-nats:4222`) 3. Check that your network policies allow traffic between the worker pods and the NATS service on port `4222` # Production deployment checklist Source: https://docs.lightdash.com/self-host/production-deployment-checklist What to configure for an enterprise-grade self-hosted deployment with the official Helm chart [Self-hosted](/support/feature-badges#self-hosted) This is the checklist for running a production-grade, self-hosted Lightdash deployment with the official Helm chart ([lightdash/helm-charts](https://github.com/lightdash/helm-charts)). The guide gives you 3-tiers of deployments with increasing configuration options. | Tier | | | - | - | | Tier 1 | Recommended for evaluating Lightdash or a PoC | | Tier 2 | A best practice scalable production deployment | | Tier 3 | Optional features and observability | ## Tier 1: Evaluation Deployment Follow the [self-hosting guide](/self-host/self-host-lightdash) (or [docker compose](/self-host/self-host-lightdash-docker-compose) for a local spin-up) for a minimum production setup suitable for evaluating Lightdash. **Prerequisites** * [External PostgreSQL](/self-host/customize-deployment/configure-lightdash-to-use-an-external-database) — `postgresql.enabled: false` even for a PoC; a small managed instance is fine, no HA or backup requirements yet * [S3-compatible object storage](/self-host/customize-deployment/configure-lightdash-to-use-external-object-storage) — required regardless; Lightdash fails to start without it * [Enterprise license key](/self-host/enterprise-features) if you're evaluating Enterprise features — needs outbound access to `https://api.keygen.sh` **Checklist** * Deploy with the [self-hosting guide](/self-host/self-host-lightdash) * [Pin an image version](#core-configuration) - pin `image.tag` to the [latest version](https://hub.docker.com/r/lightdash/lightdash/tags) * [Set `SITE_URL`](#core-configuration) to your final `https://` URL before first boot * [Generate a strong `LIGHTDASH_SECRET`](#core-configuration) and store it somewhere durable - losing it means losing access to encrypted data * [`SECURE_COOKIES` and `TRUST_PROXY`](/self-host/customize-deployment/secure-lightdash-with-https) both `"true"` behind your TLS-terminating load balancer * [Headless browser](#headless-browser) enabled (the chart default) - image previews, PDF exports, Slack unfurls * [HTTPS end-to-end](/self-host/customize-deployment/secure-lightdash-with-https) via your ingress or load balancer * [AI Analyst](#ai-analyst) — model provider key + `pgvector` in Postgres ## Tier 2: Scalable deployment None of these steps are required but are recommended for running Lightdash beyond a PoC. ### Operations * [Choose upgrade strategy](#upgrades-and-operations) — pinned image tag, at least monthly cadence * [Monitor security advisories](/self-host/upgrading#when-to-upgrade) — poll the GitHub advisory API and alert on anything that matches your deployed version ### Workers and scaling * [Data apps](#data-apps) — sandboxes runtime, apps bucket, and a separate preview origin * [Dedicated workers](#scheduler-worker) - `scheduler.enabled: true` to enable scalable scheduled deliveries * [NATS + warehouse workers](/self-host/nats-workers) - `nats.enabled: true` **and** `warehouseNatsWorker.enabled: true` for handling large volumes of warehouse queries * [≥ 2 backend replicas](#sizing-and-availability) with pod anti-affinity and a pod disruption budget * [Size resource requests](#sizing-and-availability) * [Configure health probes](#health-probes) - readiness on `/api/v1/readyz`, not `/api/v1/health`, so a migrating pod leaves the load balancer without being restarted ### Infrastructure dependencies * [Postgres HA, backups and point-in-time recovery](#postgresql) on the external database from Tier 1, plus the `pgvector` extension if you use Enterprise AI features * [Bucket strategy and lifecycle rules](#object-storage) - a dedicated bucket per purpose, with a 1-day lifecycle delete on the results bucket * [SMTP email](/self-host/customize-deployment/environment-variables#smtp) * [Email deliverability](#email-deliverability) - transactional provider, SPF/DKIM on the sender domain * [Load balancer settings](#load-balancer-and-networking) - timeout ≥ 300s, health check on `/api/v1/health`, request body limit ≥ `LIGHTDASH_MAX_PAYLOAD` ### Security and authentication * [SSO](/self-host/customize-deployment/use-sso-login-for-self-hosted-lightdash) (Okta / Azure AD / Google / generic OIDC) with password authentication disabled * [Account linking and personal access token policy](#authentication-policy) * [CSP enforcement and explicit CORS](#security-hardening) ## Tier 3: Optional features and observability ### Enterprise features * [Pre-aggregations](/self-host/nats-workers/pre-aggregate-workers) — pre-aggregate NATS workers + a dedicated S3 bucket * [SCIM provisioning](/workspace-admin/sso/scim) from your IdP * [Results caching, embedding, service accounts, custom roles](#enterprise-feature-flags) ### Integrations (enable what you use) * [Slack](/self-host/customize-deployment/configure-a-slack-app-for-lightdash) — scheduled deliveries, unfurls, AI agents in Slack * [GitHub](/self-host/customize-deployment/configure-github-for-lightdash) or GitLab — dbt repo write-back * [Google Sheets sync](/self-host/customize-deployment/configure-google-sheets-integration) ### Observability * [Prometheus metrics](/self-host/customize-deployment/configure-prometheus-metrics-for-self-hosted-lightdash) enabled, and [scraped on every pod](#observability) * [Structured JSON logging](/self-host/customize-deployment/environment-variables#logging) shipped to your log platform * [Alerts](#observability) on HTTP error rate/latency, queue depth, and Postgres pool saturation ## Architecture: what you're deploying | Component | Chart value | What it does | | - | - | - | | Backend | (always on) | API + UI. Scale horizontally, 2+ replicas | | Scheduler worker | `scheduler.enabled` | Scheduled deliveries, Slack/email sends, exports, syncs | | NATS | `nats.enabled` | JetStream message bus for async query execution | | Warehouse NATS worker | `warehouseNatsWorker.enabled` | Executes warehouse queries + streams results to S3 | | Pre-aggregate NATS worker | `preAggregateNatsWorker.enabled` | Builds pre-aggregated materializations (Enterprise) | | Headless browser | `browserless-chrome.enabled` | Chromium pool for screenshots/PDFs | | Migration job | `migrationJob.enabled` | Pre-upgrade Helm hook that runs database migrations exactly once | | PostgreSQL | **external** (`postgresql.enabled: false`) | Application state. Don't use the bundled subchart, even for a PoC | | S3 bucket(s) | external | Query results, downloads, pre-agg materializations, data apps | The chart wires up environment variables for you in three buckets: * `configMap.*` — non-sensitive env vars, applied to backend **and** all workers * `secrets.*` — sensitive env vars, rendered into a Kubernetes Secret (or bring your own via `existingSecret`) * `extraEnv` / `schedulerExtraEnv` — raw env entries, including `valueFrom.secretKeyRef` The full list of supported environment variables lives in the [environment variables reference](/self-host/customize-deployment/environment-variables). ## Core configuration The chart's essential first-boot values — `SITE_URL` and `LIGHTDASH_SECRET` are the two to get right before you start: ```yaml theme={null} image: repository: lightdash/lightdash tag: "2.xxx.x" # always pin; upgrade deliberately configMap: SITE_URL: https://lightdash.yourcompany.com SECURE_COOKIES: "true" TRUST_PROXY: "true" LIGHTDASH_MODE: default LIGHTDASH_MAX_PAYLOAD: "40mb" # default 5mb is too small for large dbt manifests existingSecret: lightdash-secrets # LIGHTDASH_SECRET, S3 keys, SMTP password, ... ``` * **`SITE_URL`** signs invite emails, OAuth redirect URIs, Slack unfurls, and delivery links — set the final `https://` URL before first boot. * **`LIGHTDASH_SECRET`** signs session cookies and encrypts data at rest in Postgres. Set it and store it durably; losing it means losing access to encrypted data. * `SECURE_COOKIES` and `TRUST_PROXY` must both be `"true"` behind a TLS-terminating proxy, and `COOKIES_MAX_AGE_HOURS` sets session length — see [Secure Lightdash with HTTPS](/self-host/customize-deployment/secure-lightdash-with-https). * Every variable is documented in the [environment variables reference](/self-host/customize-deployment/environment-variables). For secrets, prefer `existingSecret` populated by External Secrets Operator or a CSI driver so credentials stay out of Helm values and git. ## Headless browser Enabled by default in the chart — keep it on, and tune the browserless timeouts and memory guards for large dashboards. The browser renders dashboards by calling `SITE_URL`, so it must reach that URL from inside the cluster (use `INTERNAL_LIGHTDASH_HOST` if it can't). See [Headless browser](/self-host/customize-deployment/enable-headless-browser-for-lightdash) for the container and backend variables, and [Resource recommendations](/self-host/production-deployment-checklist#recommended-resources) for sizing. ## Upgrades and operations Pin `image.tag`, upgrade at least monthly, rehearse each upgrade in a UAT instance that mirrors production, take the database backup before you start, and enable the migration Job for multi-replica deployments. Before each upgrade, [check the upgrade](/self-host/upgrading#check-the-upgrade) and set `upgrade.mode` from the result: `RollingUpdate` for `SAFE`, or `Recreate` for `UNSAFE`. Chart `2.16.284` and later runs the shutdown barrier before the migration Job when the mode is `Recreate`. Chart `2.16.283` and earlier needs the manual fallback. See [set the upgrade mode](/self-host/upgrading#configure-the-upgrade-mode) for both paths and custom deployments. Versioning policy, upgrade cadence, and advisory monitoring are in [Upgrade your instance](/self-host/upgrading). ## Scheduler worker Run a **dedicated scheduler worker** so a heavy dashboard export can't starve the API — see [Scheduler worker](/self-host/customize-deployment/scheduler). For async warehouse queries, see the [NATS workers overview](/self-host/nats-workers) and [warehouse workers](/self-host/nats-workers/warehouse-workers), including the critical rule: **never enable `nats.enabled` without `warehouseNatsWorker.enabled`**. ## Sizing and availability Size per-component resource requests and run 2+ backend replicas with pod anti-affinity and a pod disruption budget — the full component table and availability settings are in [Resource recommendations](/self-host/production-deployment-checklist#recommended-resources). ## PostgreSQL Run external managed Postgres with high availability, backups, the `uuid-ossp` and `pgvector` extensions, and a connection budget — setup and production guidance are in [Configure Lightdash to use an external database](/self-host/customize-deployment/configure-lightdash-to-use-an-external-database). ## Object storage Use a **dedicated bucket per purpose** with lifecycle rules, blocked public access, and scoped credentials — setup and the full bucket strategy are in [Configure Lightdash to use external object storage](/self-host/customize-deployment/configure-lightdash-to-use-external-object-storage). ## Email deliverability Env vars are in the [SMTP reference](/self-host/customize-deployment/environment-variables#smtp). Best practice on top: * Use a transactional provider (SES, Postmark, SendGrid) — Lightdash Cloud sends through Postmark. * Set up SPF/DKIM for the sender domain so scheduled deliveries don't land in spam. ## Load balancer and networking HTTPS end-to-end, a load-balancer timeout ≥ 300s, a health check on `GET /api/v1/health`, and a request body limit ≥ `LIGHTDASH_MAX_PAYLOAD` — covered in [Secure Lightdash with HTTPS](/self-host/customize-deployment/secure-lightdash-with-https). ## Health probes Lightdash serves three health endpoints, and they are not interchangeable: | Probe | Endpoint | Why | | - | - | - | | Liveness | `/api/v1/livez` | Answers without touching the database, so a database blip does not restart every pod at once | | Readiness | `/api/v1/readyz` | TTL-cached, gates on schema migration state. Keeps a pod out of the load balancer while it is migrating, without restarting it | | Startup | `/api/v1/livez` | Same endpoint as liveness, so a slow-starting pod is not killed before it is ready to serve | Avoid `/api/v1/health` for any of the three. It queries the database on every request, which is fine for a manual `curl` after a deploy but means a brief database blip fails every pod's check at the same time. The chart already points `startupProbe` and `livenessProbe` at `/api/v1/livez` by default. Set the readiness path explicitly: ```yaml theme={null} lightdashBackend: readinessProbe: path: /api/v1/readyz ``` Recent chart versions resolve this path for you on Lightdash `1.169.1` and later. Setting it explicitly is always supported, and an explicit value always wins. > [!WARNING] > > Only point a readiness probe at `/api/v1/readyz` on Lightdash `1.169.1` or later. Before that, a parked migration marked every working pod as not ready, so a readiness probe on `/api/v1/readyz` could pull the whole backend out of service over a single stuck migration. The `503` reasons are listed under [confirm the instance is ready](/self-host/upgrading#check-readiness). Leave worker probes alone. Worker pods serve their own handler at `/api/v1/health` (in-memory state, no database query) and do not serve `/api/v1/readyz` at all. ## Authentication policy Enterprise deployments should be SSO-only, with password authentication disabled and account linking enabled — per-provider setup is in [use SSO login for self-hosted Lightdash](/self-host/customize-deployment/use-sso-login-for-self-hosted-lightdash). Also set a personal access token policy (`PAT_ALLOWED_ORG_ROLES`, `PAT_MAX_EXPIRATION_TIME_IN_DAYS`, or `DISABLE_PAT`), and keep `ALLOW_MULTIPLE_ORGS: "false"` (default) for a single-company instance. ## Security hardening * **CSP enforcement:** `LIGHTDASH_CSP_REPORT_ONLY: "false"` (default is report-only; enforce in production), plus `LIGHTDASH_CSP_ALLOWED_DOMAINS` for any extra origins you load from. * **CORS:** leave disabled unless embedding; if embedding, `LIGHTDASH_CORS_ENABLED: "true"` with an explicit `LIGHTDASH_CORS_ALLOWED_DOMAINS` list — never `*`. * **Egress policy:** Lightdash needs your warehouse, S3, SMTP, `api.keygen.sh` (license), your IdP, and any AI provider endpoints — plus `roadmap.lightdash.com` on Enterprise Edition for the [organization roadmap](/self-host/customize-deployment/organization-roadmap). RudderStack product telemetry to `analytics.lightdash.com` is on by default and can be disabled or redirected. See [Data flows and telemetry](/self-host/data-flows-and-telemetry) for the full egress matrix and controls. * **NetworkPolicies:** the chart only ships one for NATS (keep `nats.networkPolicy.enabled: true`, the default); add your own default-deny + allow rules for backend ↔ postgres/browserless/S3 if your cluster uses them. * **Pod security:** the chart sets no `podSecurityContext` / `securityContext` by default — add `runAsNonRoot` and drop capabilities per your Pod Security Standards baseline. * **Soft delete** for content recovery: `SOFT_DELETE_ENABLED: "true"` (plus `SOFT_DELETE_RETENTION_DAYS`, default 30). ## Enterprise features License key setup and validation is covered in [enterprise license keys](/self-host/enterprise-features) — the key is validated against `https://api.keygen.sh` on every server start, so allowlist that domain in your egress policy. ### Enterprise feature flags Enable the Enterprise features you use through `configMap` — each is documented in the [environment variables reference](/self-host/customize-deployment/environment-variables): * **Caching:** `RESULTS_CACHE_ENABLED`, `AUTOCOMPLETE_CACHE_ENABLED`, `CACHE_STALE_TIME_SECONDS`. * **Governance:** `SERVICE_ACCOUNT_ENABLED`, and `custom-roles` in `LIGHTDASH_ENABLE_FEATURE_FLAGS`. * **Embedding:** `embedding` in `LIGHTDASH_ENABLE_FEATURE_FLAGS`, with `LIGHTDASH_IFRAME_EMBEDDING_DOMAINS`. ### AI Analyst Set `AI_COPILOT_ENABLED: "true"`, choose `AI_DEFAULT_PROVIDER` (`openai`, `azure`, `anthropic`, `google`, `vertex`, `openrouter`, or `bedrock`) with the matching API key, and `AI_EMBEDDING_ENABLED: "true"` for verified answers (requires `pgvector`). See [AI agents](/self-host/enterprise-features/ai-agents) for provider setup and LLM-gateway routing, and the [environment variables reference](/self-host/customize-deployment/environment-variables#ai-analyst) for guardrails such as `AI_COPILOT_MAX_QUERY_LIMIT` and `AI_COPILOT_ALLOWED_PROJECT_UUID`. For the MCP endpoint, see [MCP](/self-host/enterprise-features/mcp). ### Data apps Serve app previews from a **separate domain** (`APP_RUNTIME_PREVIEW_ORIGIN`) so untrusted app content never shares an origin with your Lightdash session cookies, and use a persistent apps bucket with no delete lifecycle. Sandbox providers and their security model are in [sandboxes](/self-host/customize-deployment/sandboxes); configuration in [self-hosting data apps](/self-host/enterprise-features/data-apps). ## Observability Enable Prometheus metrics and structured JSON logging on every pod, and scrape them from your monitoring stack: * Metrics and alerting guidance: [Prometheus metrics](/self-host/customize-deployment/configure-prometheus-metrics-for-self-hosted-lightdash). Scrape port **9090** on all pods labelled `app.kubernetes.io/name=lightdash` (the chart ships no ServiceMonitor/PodMonitoring — create one; Lightdash Cloud scrapes at a 30s interval). If you run NATS, its Prometheus exporter is on port **7777** (`nats.promExporter.enabled: true`). * Log configuration: [Configure logging](/self-host/customize-deployment/environment-variables#logging). Ship `LIGHTDASH_LOG_FORMAT: json` to your log platform; `LIGHTDASH_LOG_LEVEL: audit` adds an audit trail of user actions. * Alert on HTTP p95/error rate (`http_server_request_duration_seconds`), queue depth / scheduler job failures, Postgres pool saturation, and event-loop lag. * Distributed traces (optional): [OpenTelemetry tracing](/self-host/customize-deployment/configure-opentelemetry-tracing-for-self-hosted-lightdash). Set `LIGHTDASH_OTEL_TRACES_ENABLED: "true"` and point `OTEL_EXPORTER_OTLP_ENDPOINT` at your collector. ## Recommended resources Baseline per-component resource requests for a standard self-hosted instance deployed with the official Helm chart: | Component | CPU | Memory | Ephemeral | Replicas | | - | - | - | - | - | | Backend | 500m–1 | 1.5–4 Gi | 1–2 Gi | **2+** | | Scheduler worker | 500m | 1425 Mi | 1 Gi | 1 | | Warehouse NATS worker | 250m | 1.5 Gi | 9 Gi | 1 | | Pre-aggregate NATS worker | 650m | 4 Gi | 9 Gi | 1 | | Browserless | 2 | 4 Gi | 1 Gi | 1 | | NATS | 100m | 256 Mi–1 Gi | — | 1 | NATS workers buffer large result sets on ephemeral disk before uploading to S3 — the 9 Gi ephemeral-storage request is not a typo. ### Availability Run at least two backend replicas with pod anti-affinity and a pod disruption budget: ```yaml theme={null} replicaCount: 2 autoscaling: enabled: true minReplicas: 2 maxReplicas: 10 targetCPUUtilizationPercentage: 60 # backend only; workers scale via replicas podAntiAffinity: enabled: true # spreads each component across nodes (hard) and zones (soft) podDisruptionBudget: enabled: true minAvailable: 1 ``` # Self-Host Lightdash Source: https://docs.lightdash.com/self-host/self-host-lightdash Deploy Lightdash on Kubernetes with the official Helm chart, from minimum config to production [Self-hosted](/support/feature-badges#self-hosted) Lightdash is MIT licensed and open source. You can self-host Lightdash on your own infrastructure. This guide is designed for DevOps Engineers that are familiar with Docker, Kubernetes, and are comfortable configuring environment variables, SMTP credentials, and database connections. If you're unsure whether to self-host please read our guide on [Lightdash Cloud vs. Self-Hosted](/self-host/lightdash-cloud-vs-self-hosted). ## Prerequisites for self-hosting * Access to a kubernetes cluster and [kubectl](https://kubernetes.io/docs/tasks/tools) installed * [Helm](https://helm.sh/docs/intro/quickstart) * Docker ## Self-host Lightdash on Kubernetes The following steps will create a Lightdash instance and a postgres database to store your metadata (note: this is separate to your data warehouse with your analytics data). We recommend using kubernetes + helm but you can alternatively follow these guides for a minimum deployment without kubernetes: * [Docker compose](/self-host/self-host-lightdash-docker-compose) To deploy Lightdash on your Kubernetes cluster you can use our community maintained Helm chart: [https://github.com/lightdash/helm-charts](https://github.com/lightdash/helm-charts). This will get you started with the simplest configuration possible. At the end of this guide you can find a list of configuration options to customise your Lightdash instance and make it production ready. ### 1. Add the Lightdash Helm repository ```bash theme={null} helm repo add lightdash https://lightdash.github.io/helm-charts ``` ### 2. Create a namespace for Lightdash ```bash theme={null} kubectl create namespace lightdash ``` ### 3. Create a minimum configuration for Lightdash At minimum you should configure: * `image.tag` - the Lightdash version to run, for example `2.410.0`. Pick one from [Docker Hub](https://hub.docker.com/r/lightdash/lightdash/tags). If you leave it empty, the chart runs its default version (its `appVersion`), which changes with each chart release. The tag applies to the backend, workers, and migration job. See [Upgrade your instance](/self-host/upgrading) for why to pin it. * `secrets.LIGHTDASH_SECRET` - this variable is used by Lightdash to encrypt data at rest in the database. You must keep this secret. If this is lost, you will not be able to access your data in Lightdash. * `configMap.S3_REGION`, `configMap.S3_BUCKET`, `configMap.S3_ENDPOINT`, `secrets.S3_ACCESS_KEY` and `secrets.S3_SECRET_KEY` - These variables are for configuring external object storage with S3. For detailed information, refer to the [external object storage documentation](/self-host/customize-deployment/configure-lightdash-to-use-external-object-storage). * `service.type` - by default the Lightdash UI and API is exposed on a `ClusterIP` service. This means that it is only accessible from within the Kubernetes cluster. If you want to access Lightdash from outside the cluster, you can change this to `LoadBalancer` or `NodePort`. See the [Kubernetes documentation](https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types) for more information. * `configMap.SITE_URL` - if you know the URL that Lightdash will be accessible at, you can set this variable. This will ensure that all links in Lightdash are correct. If you don't know the URL yet, you can leave this blank and update it later. When setting up and configuring your Lightdash instance, you'll likely need to configure many additional environment variables. The Helm chart supports three ways to set environment variables: * `configMap` - for non-sensitive configuration values * `secrets` - for sensitive values like passwords and API keys * `extraEnv` - for additional environment variables not covered by the chart's built-in options For a complete list of available environment variables, see the [environment variables documentation](/self-host/customize-deployment/environment-variables). For detailed Helm chart configuration options, refer to the [Lightdash Helm charts repository](https://github.com/lightdash/helm-charts). Example `values.yaml` file containing our configuration: ```yaml theme={null} # values.yaml image: tag: "2.xxx.x" # Lightdash version to run. Empty uses the chart default secrets: LIGHTDASH_SECRET: notverysecret S3_ACCESS_KEY: secret # omit on AWS when using an IAM role, or on GKE when using S3_AUTH_MODE=gcp_oauth S3_SECRET_KEY: secret # omit on AWS when using an IAM role, or on GKE when using S3_AUTH_MODE=gcp_oauth # LIGHTDASH_LICENSE_KEY: your-enterprise-license-key # Optional: for Enterprise Edition features configMap: SITE_URL: https://lightdash.mycompany.com S3_REGION: us S3_BUCKET: lightdash S3_ENDPOINT: https://storage.provider.com # Additional environment variables not covered by configMap or secrets extraEnv: - name: CUSTOM_ENV_VAR value: "custom-value" - name: ANOTHER_CONFIG value: "another-value" service: type: NodePort ``` #### Enterprise License Key (Optional) If you have a Lightdash Enterprise license, you can enable enterprise features by adding your license key to the configuration: ```yaml theme={null} secrets: LIGHTDASH_LICENSE_KEY: your-enterprise-license-key-here ``` To obtain an Enterprise License Key, [contact our team](https://calendly.com/lightdash-cloud/enterprise?utm_source=docs\&utm_medium=referral\&utm_campaign=enterprise_licensing\&utm_content=self_host_config). For more details, see our [enterprise features documentation](/self-host/enterprise-features). ### 4. Install Lightdash with helm Create a new helm release called `lightdash` using the `lightdash/lightdash` helm chart. In this example we're also using the namespace `-n lightdash`. Finally we apply our minimum configuration from above using `-f values.yaml`. ```bash theme={null} helm install lightdash lightdash/lightdash -n lightdash -f values.yaml ``` ### 4 (alternative). Install Lightdash with kubectl If you prefer not to manage your deployment with helm, you can generate the kubernetes manifests and apply them using `kubectl`. ```bash theme={null} helm template lightdash lightdash/lightdash -n lightdash -f values.yaml > lightdash.yaml kubectl apply -f lightdash.yaml ``` Visit your `SITE_URL` to access Lightdash! ## Configure Lightdash for production Now you have a working Lightdash instance, you can customise it to your needs. The following docs cover the most common configuration options, including those we recommend before going to production: **Required configuration** * [Configure Lightdash to use external object storage](/self-host/customize-deployment/configure-lightdash-to-use-external-object-storage) **Recommended for production usage** * [Secure Lightdash with HTTPS](/self-host/customize-deployment/secure-lightdash-with-https) * [Configure Lightdash to use an external database](/self-host/customize-deployment/configure-lightdash-to-use-an-external-database) * [Configure SMTP for email notifications](/self-host/customize-deployment/environment-variables#smtp) * [Resource recommendations](/self-host/production-deployment-checklist#recommended-resources) **Optional configuration** * [Enterprise features](/self-host/enterprise-features) * [Use SSO login for self-hosted Lightdash](/self-host/customize-deployment/use-sso-login-for-self-hosted-lightdash) * [Enable scheduler in self-hosted Lightdash](/self-host/customize-deployment/scheduler) * [Configure a Slack App for Lightdash](/self-host/customize-deployment/configure-a-slack-app-for-lightdash) * [Configure environment variables for Lightdash](/self-host/customize-deployment/environment-variables) * [Enable headless browser for Lightdash](/self-host/customize-deployment/enable-headless-browser-for-lightdash) * [Configure Logging for Lightdash](/self-host/customize-deployment/environment-variables#logging) * [Configure Prometheus metrics for Lightdash](/self-host/customize-deployment/configure-prometheus-metrics-for-self-hosted-lightdash) # Self-host Lightdash using docker compose Source: https://docs.lightdash.com/self-host/self-host-lightdash-docker-compose Run a minimal Lightdash instance on your own machine with Docker Compose [Self-hosted](/support/feature-badges#self-hosted) This guide will give you a minimal Lightdash instance running on your local machine. It will not be accessible from the internet, but it will be accessible from your local machine. This is a great way to get started with Lightdash for a proof-of-concept without needing access to kubernetes. ## Prerequisites * [Docker](https://docs.docker.com/get-docker) * [Docker Compose](https://docs.docker.com/compose/install) ## 1. Clone the Lightdash repository Clone the Lightdash code to your local machine. This will create a new directory called `./lightdash` (the Lightdash directory). ```bash theme={null} # Clone the Lightdash repo git clone https://github.com/lightdash/lightdash cd lightdash ``` ## 2. Update your ENV config Edit all the ENV variables in `.env` to match your setup, eg: ```bash theme={null} PGHOST=db PGPORT=5432 PGUSER=pg_user *OR* machine username if no prior postgres set up PGPASSWORD=pg_password *OR* blank if no prior postgres set up PGDATABASE=postgres DBT_DEMO_DIR=/*path*/*to*/lightdash/project/examples/full-jaffle-shop-demo ``` ## 3. Create containers You must set the following two environment variables: * `PGPASSWORD` is the password used for the internal postgres database * `LIGHTDASH_SECRET` is the secret used to encrypt data at rest in the database. If you lose this secret, you will not be able to access your data in Lightdash. ```bash theme={null} export LIGHTDASH_SECRET="not very secret" export PGPASSWORD="password" docker compose -f docker-compose.yml --env-file .env up --detach --remove-orphans ``` To connect a [local dbt project](/integrations/connect-project#local-dbt-project), do two things before you run the command above: uncomment the `volumes` lines under the `lightdash` service in `docker-compose.yml` (they are commented out by default), and export `DBT_PROJECT_DIR` with the absolute path to your dbt project on your machine. Lightdash mounts it at `/usr/app/dbt` inside the container and reads the project from there. The error `dbt project directory not found: /dbt` names only the last folder of that path: it means `/usr/app/dbt` doesn't exist in the container, because the `volumes` lines are still commented out or `DBT_PROJECT_DIR` was empty when you started the containers. If you have a Windows machine and get the error **Error response from daemon: i/o timeout**. Go to **Docker > Settings > General** and enable the option **Expose daemon on tcp\://localhost:2375 without TLS** # Upgrade notes Source: https://docs.lightdash.com/self-host/upgrade-notes Changes that need action when you upgrade across a major Lightdash version [Self-hosted](/support/feature-badges#self-hosted) The behavior changes listed here also apply to Cloud projects from the version noted. A major version changes behavior, configuration, or an API in a way that needs action from you. This page lists those changes by major version, with what to do before or after you upgrade. For how to check, run and roll back an upgrade, see [Upgrade your instance](/self-host/upgrading). ## 2.x to 3.0 ### Pre-aggregates don't rebuild on every compile In 2.x, Lightdash rebuilt every managed pre-aggregate on every project compile (a `lightdash deploy`, a refresh from the UI, or a CLI compile). From 3.0, Lightdash materializes a pre-aggregate on a compile only the first time the pre-aggregate appears and when that compile changes its definition or the fields it reads. On a compile that leaves the definition unchanged, Lightdash doesn't rebuild it. To keep the data fresh, Lightdash refreshes a pre-aggregate on its `refresh.cron` schedule or when you refresh it manually. See [Scheduling refreshes](/semantic-layer/pre-aggregates#scheduling-refreshes) for the full behavior. What to do: 1. Add a `refresh.cron` schedule to each managed pre-aggregate whose data needs to stay fresh. Without a schedule, Lightdash keeps serving the last materialization until someone refreshes the pre-aggregate from **Project Settings > Pre-aggregates**. 2. If you refreshed pre-aggregates by refreshing the project, use **Rebuild managed** on that page instead, or call `POST /api/v1/projects/{projectUuid}/pre-aggregates/refresh` from your orchestration after `dbt run`. 3. Optional: set `refresh.on_change: false` on a pre-aggregate whose definition you edit often and would rather rebuild on its schedule. Either way, Lightdash stops serving the old data as soon as the definition changes. ```yaml theme={null} pre_aggregates: - name: orders_daily_by_status dimensions: - status metrics: - total_order_amount time_dimension: order_date granularity: day refresh: cron: "0 6 * * *" ``` Nothing changes for [external pre-aggregates](/semantic-layer/pre-aggregates/external), because you own their refresh. Lightdash keeps serving existing materializations after the upgrade. On the first compile on 3.0, Lightdash records what each pre-aggregate reads as the baseline for change detection, without rebuilding anything. You can upgrade with a rolling update: the migrations add nullable or defaulted columns only. # Upgrade your instance Source: https://docs.lightdash.com/self-host/upgrading Check, run, verify and roll back an upgrade of a self-hosted Lightdash instance [Self-hosted](/support/feature-badges#self-hosted) ## How Lightdash versioning works Lightdash uses semantic versioning, `major.minor.patch`: * **Patch versions** are small fixes. * **Minor versions** add features or larger changes that can be backwards incompatible. Read the release notes before you upgrade. * **Major versions** change the API, the self-hosted architecture, or default behavior. Read the [upgrade notes](/self-host/upgrade-notes). Lightdash ships continuously and has no LTS tag. In production, pin `image.tag` to a specific [version](https://hub.docker.com/r/lightdash/lightdash/tags) so deployments are repeatable. ## When to upgrade Upgrade at least monthly. The further behind you fall, the bigger each upgrade and each rollback gets. Upgrade UAT first, check SSO, warehouse connections, dbt refreshes, scheduled deliveries, embeds and critical dashboards, then upgrade production. UAT needs the same configuration and environment variables as production, and a recent copy of the production Lightdash database. When a newer version is out, the page footer shows **New version available!**. Click it to see what changed since your version. Set `LIGHTDASH_DISABLE_UPDATE_CHECK=true` to turn this off. Security fixes are published as [GitHub Security Advisories](https://github.com/lightdash/lightdash/security/advisories). Watch them and deploy the fixed version they name. The [security policy](https://github.com/lightdash/lightdash/security/policy) shows how to poll them automatically. ## Check the upgrade [Beta](/support/feature-badges#beta) The check tells you whether the new version can replace the old one with a rolling update, or whether you have to stop the old version first (`Recreate`). Each release publishes a `release-safety.json` file, on its [GitHub release](https://github.com/lightdash/lightdash/releases) and in its Docker image. It records whether the release can run alongside the version before it, the migrations it runs, and any version you must upgrade through first. The CLI reads a public index of these files, so the check needs no Lightdash login or access to your instance. > [!TIP] > > Ask your AI coding agent to do this for you with the `upgrade-preflight` [agent skill](/workflow/install-agent-skills#review-what-changed-between-releases), which runs `lightdash upgrade-check` and `migrate preflight` and walks you through the result. 1. Install or update the [Lightdash CLI](/workflow/cli/install) to version `1.126.0` or later. 2. Run `lightdash upgrade-check` with the version you run now and the version you want: ```bash theme={null} lightdash upgrade-check --from 3.23.1 --to 3.25.0 ``` ```text theme={null} Release safety check: 3.23.1 -> 3.25.0 Direction: upgrade Verdict: UNSAFE Unsafe rolling-update safety: 3.24.0 Minimum previous version: 2.497.1 Covered releases: 3.24.0, 3.24.1, 3.25.0 ``` The command exits `0` only when the verdict is `SAFE`. Add `--json` for automation. ### Read the result The check covers every release after `--from` up to and including `--to`. One release that isn't proven safe makes the whole upgrade `UNSAFE`. | Line | What to do | | - | - | | `Verdict: SAFE` | Deploy with a rolling update | | `Verdict: UNSAFE` | Deploy with `Recreate`: stop the old version, then start the new one. Expect a short outage | | `Unsafe` or `Unknown rolling-update safety` | Lists the releases that make the upgrade unsafe. Use `Recreate` | | `Required stops` | Upgrade to the first stop with `Recreate`, let its migrations finish, then run the check again from there | | `Minimum previous version` | If you run something older, upgrade to this version first | | `Missing release-safety index coverage` | Treat as unsafe and use `Recreate` | ### Check for table locks and long migrations To size a maintenance window, open `release-safety.json` from each GitHub release in your span. Each entry under `migrations.files` lists the `tables` it touches and whether it `locksTable`, `rewritesTable` or `scansTable`. A flag that is `true` or `unknown` means the migration may take a long time or block writes on a large table, so allow a longer window. Pause anything that writes to those tables until the migration finishes. For example, a migration on `saved_queries_versions` competes for locks with every `lightdash upload`, because each upload writes new chart versions, so stop CI jobs that run uploads during the window. `config.changes` in the same file lists environment variables the release removed, renamed, or gave a new default. Check it for any variable you set. The full format is in the [release-safety schema](https://github.com/lightdash/lightdash/blob/main/scripts/release-safety.schema.json). ## Upgrade with Kubernetes and Helm [Beta](/support/feature-badges#beta) **1. Take a database backup** Lightdash doesn't run down-migrations in production, so a backup is the only way to undo a schema change. Take a fresh backup and confirm it restores. **2. Set the upgrade mode** Set `upgrade.mode` from the [check](#check-the-upgrade): `RollingUpdate` for `SAFE`, `Recreate` for `UNSAFE`. Run migrations in a Job, which is recommended for any deployment with more than one replica: ```yaml theme={null} upgrade: mode: Recreate migrationJob: enabled: true ``` With chart `2.16.284` or later, this combination makes the chart remove the backend HorizontalPodAutoscaler (HPA), scale the backend and worker Deployments to zero, and wait for their pods to stop before running migrations. The chart stops the upgrade if shutdown or migration fails. **3. Optional: scale workloads down by hand** Only for chart `2.16.283` and earlier, or a custom deployment, with an `UNSAFE` verdict and the migration Job enabled. Old pods must not run against the new schema, so remove the backend HPA, scale to zero and wait until no Lightdash pods remain: ```bash theme={null} kubectl delete hpa -l app.kubernetes.io/instance=lightdash kubectl scale deployments -l app.kubernetes.io/instance=lightdash --replicas=0 kubectl get pods -l app.kubernetes.io/instance=lightdash ``` Helm restores the replicas and the backend HPA after a successful upgrade if autoscaling is enabled. **4. Upgrade** Set the new `image.tag` in your values file, then run: ```bash theme={null} helm repo update lightdash helm upgrade -f values.yml lightdash lightdash/lightdash ``` The migration Job runs as a pre-install and pre-upgrade hook, and the backend starts without migrating. If you override `image.command`, your command must also skip startup migrations. Without the Job, the first pod to start migrates and the others wait. **5. Confirm the instance is ready** ```bash theme={null} kubectl logs -f job/lightdash-migrate curl -sS -o /dev/null -w '%{http_code}\n' https://lightdash.example.com/api/v1/readyz ``` `/api/v1/readyz` returns `503` with `reason: schema_pending` while the running code needs migrations, or `reason: db_unavailable` when the database check fails. Once the schema is ready, it returns `200`; a parked migration run or an uninitialized migration ledger appears in `warnings` without failing readiness. See [health probes](/self-host/production-deployment-checklist#health-probes) for which endpoint to use for which probe. These examples assume a release named `lightdash`. Find yours with `kubectl get deploy,job -l app.kubernetes.io/instance=`. ## Upgrade with Docker Compose [Beta](/support/feature-badges#beta) Compose stops the old container before starting the new one, whatever the verdict. Plan for a few minutes of downtime, longer if the release has heavy migrations. **1. Take a database backup** If Postgres runs in the Compose stack, back up its volume as well. **2. Check the upgrade** Run the [check](#check-the-upgrade). If it reports required stops, upgrade to each one in turn. **3. Upgrade** Set the new image tag, then pull and recreate the container: ```bash theme={null} docker compose pull lightdash docker compose up --detach --remove-orphans ``` The new container runs migrations before it accepts traffic. **4. Confirm the instance is ready** ```bash theme={null} docker compose exec lightdash pnpm -F backend migrate-production status curl -sS -o /dev/null -w '%{http_code}\n' http://localhost:8080/api/v1/readyz ``` Expect `idle` and `200`. ## Automate upgrades [Beta](/support/feature-badges#beta) [`examples/upgrade-automation`](https://github.com/lightdash/lightdash/tree/main/examples/upgrade-automation) in the Lightdash repository is a reference GitHub Actions workflow. It runs the check, steps through required stops, and opens a pull request that bumps your pinned tag. Set `auto_merge: 'true'` to enable auto-merge for safe upgrades. Unsafe or unknown upgrades open as `HOLD:` pull requests for a person to review. After deploying, the workflow requires three consecutive ready checks with the expected running version. A parked migration fails verification even when `/api/v1/readyz` returns `200`. On failure, it opens a freeze issue and pauses upgrades until the issue is closed. It never rolls back automatically. To build your own, set the Helm mode from the check on every run: ```text theme={null} result = lightdash upgrade-check --from CURRENT --to TARGET --json stop if the result can't be read, a required stop comes before TARGET, or CURRENT is older than result.minPreviousVersion mode = RollingUpdate if result.verdict is true, otherwise Recreate helm upgrade --set-string upgrade.mode=mode --set-string image.tag=TARGET ... ``` `--set-string` overrides any `upgrade.mode` in your values file. ## Troubleshoot an upgrade [Beta](/support/feature-badges#beta) The Lightdash image includes `migrate` commands for inspecting and recovering migrations. Run them inside the deployment, for example with `kubectl exec deploy/lightdash-backend --` or `docker compose exec lightdash`: ```bash theme={null} pnpm -F backend migrate-production status ``` | Command | What it does | | - | - | | `status` | Shows the migration lease, the migration ledger and recent runs | | `preflight` | Checks a migration is safe to run, without changing the database | | `up` | Runs pending migrations | | `wait` | Waits for another process to finish migrating, or migrates itself if none is | | `unlock` | Releases migration locks. Requires `--actor ` | `status` reports one of four states: * **`idle`:** nothing is running. * **`migrating`:** a migration is running. Large tables can take a long time, so leave it alone. * **`stale`:** the migrating process stopped responding. Another process takes over after 75 seconds. * **`parked`:** a migration failed three times and stopped. Fix the cause and deploy a fixed version, or unlock and retry. > [!WARNING] > > Don't edit the `knex_migrations_lock` table by hand. A live migration may own those locks. Use `status` to look and `unlock` to release. ### The migration Job failed Read the Job's logs first: ```bash theme={null} kubectl logs job/lightdash-migrate ``` Kubernetes deletes the Job, with its logs, about 100 seconds after it finishes. Raise `migrationJob.ttlSecondsAfterFinished` if you need longer. `status` keeps the failure details either way. After you fix the cause, re-run `helm upgrade`. A Job whose pod never starts, for example one stuck `Pending`, holds the upgrade open indefinitely, because `backoffLimit` only counts pods that start. To cap it, set `migrationJob.activeDeadlineSeconds`, sized to cover the scale-down wait (`migrationJob.scaleDownWorkloads.timeoutSeconds`, default `300`), the image pull and your longest migration. If the deadline fires after the scale-down, the upgrade fails with every workload still at zero replicas. When you set a deadline, also raise `migrationJob.ttlSecondsAfterFinished`, so a Job stopped by the deadline keeps its logs long enough to read. The cluster autoscaler can evict the migration pod while it drains a node, which stops the migration partway. To prevent this, annotate the pod: ```yaml theme={null} migrationJob: podAnnotations: cluster-autoscaler.kubernetes.io/safe-to-evict: "false" ``` ### Release a lock ```bash theme={null} kubectl exec deploy/lightdash-backend -- \ pnpm -F backend migrate-production unlock --actor "alex@example.com" ``` `unlock` refuses while a live process holds the lease or a lock remains in `knex_migrations_lock`. Stop any process using those locks before you use `--force`. Afterwards, re-run `helm upgrade` if you use the migration Job, or `docker compose restart lightdash` with Docker Compose. ### Preflight a new image To find problems before a maintenance window, run `preflight` on the new image without migrating. With Docker Compose: ```bash theme={null} docker compose pull lightdash docker compose run --rm --entrypoint pnpm lightdash \ -F backend migrate-production preflight ``` On Kubernetes, run the same command as a one-off Job on the new tag with your backend's ConfigMap and Secret. Preflight checks the migration path, PostgreSQL version, privileges, and locks or long transactions on the affected tables. When a pending migration scans or rewrites a table, preflight also checks for at least 5 GiB of free disk. Set `MIGRATION_PREFLIGHT_DISK_HEADROOM_BYTES` to the available bytes; PostgreSQL cannot report this value, so leaving it unset produces a warning. Preflight ends with `proceed`, `proceed-with-warnings`, `abort` or `force-proceed`. `--strict` treats warnings as blockers, and `--force` overrides an abort. ### A migration fails with a lock timeout A migration that changes a table, for example an `ALTER TABLE` or a `CREATE INDEX`, only waits a short time for a lock on it. If another session already holds a lock on that table, the migration fails with `canceling statement due to lock timeout`, retries, and after three failed attempts `status` reports the run as `parked`. The cause is another session holding a lock on that table or one it references, such as a long-open transaction or a CI job uploading content with `lightdash upload`. Run [`preflight`](#preflight-a-new-image) on the new image to list the locks and long transactions held on the affected tables, then end or pause whatever is holding them. [Release the lock](#release-a-lock) with `unlock --actor ` and re-run the upgrade (`helm upgrade`, or `docker compose restart lightdash`). ## Roll back Roll back by redeploying the previous image tag. This keeps the migrated schema; to undo schema changes, restore a backup and lose everything written since. Roll back promptly, because the new version may write data the old one can't read. `upgrade-check` rejects rollback spans. An image from `1.259.1` or later can start against a database with newer migrations when every migration that image needs has already run. This does not guarantee that older application code can read data written by the newer release. To rebuild an instance from scratch you need the Postgres backup, your `LIGHTDASH_SECRET` and your Helm values. Without `LIGHTDASH_SECRET` you can't decrypt data stored in the database. ## Update the Lightdash CLI After an upgrade, everyone who uses the CLI should [update it](/workflow/cli/install#updating-the-lightdash-cli) to match the instance. If you run Lightdash on your laptop with Docker, pull the latest image with `docker pull lightdash/lightdash` and restart. # Lightdash semantic layer Source: https://docs.lightdash.com/semantic-layer Define your metrics, dimensions, and tables once in YAML and use them consistently across Lightdash The Lightdash semantic layer sits between your data warehouse and the people who query it. You define your business concepts once — in YAML — and everyone gets the same metric definitions, dimension logic, and table relationships everywhere they work. It's the difference between seeing a field called `cust_id` in a table called `tbl_ord_dtl` and seeing **Customer** on an **Order**. ## Core components * [**Metrics**](/semantic-layer/metrics) — the numbers your business cares about, like revenue, customer count, or order volume, each defined once with clear business logic. * [**Dimensions**](/semantic-layer/dimensions) — the attributes you slice metrics by, such as time periods, regions, or product categories. * [**Tables**](/semantic-layer/tables) — the business objects (customers, orders, products) that hold your dimensions and support your metrics. ## How it's defined You define the semantic layer in version-controlled YAML, either inside a [dbt project](/integrations/dbt) or with [Lightdash YAML](/semantic-layer/yaml) if you don't use dbt. Lightdash connects to your warehouse, reads these definitions, and generates optimized SQL at query time — handling joins, aggregations, and filters for you. Adding business-friendly labels, descriptions, and formatting turns technical fields into concepts the whole organization can use. ## Ways to use it * **In the app** — explore metrics in the [Metrics Catalog](/explore/metrics-catalog) or [query directly from tables](/explore/explore-view). * **With AI** — [Lightdash AI agents](/agents) answer natural-language questions using the same definitions and guardrails as your business users, and can propose writeback changes to your semantic layer. * **Programmatically** — the [API](/api-reference/v1/introduction) and [Python SDK](https://github.com/lightdash/python-sdk) give you the semantic layer from code, for automation, scheduled reporting, or embedding. # Caching Source: https://docs.lightdash.com/semantic-layer/caching Cut the number of queries Lightdash runs against your warehouse with results and warehouse caching Caching is available on Lightdash Cloud and on self-hosted instances with a valid Enterprise license. Filter value caching is available on all Cloud plans; results caching requires Enterprise. Lightdash supports two types of caching: 1. **[Cached Filter values](#filter-value-caching)** - enabled for every cloud user without requiring any configuration. 2. **[Cached results for Charts and Dashboards](#chart-and-dashboard-results-caching)** - available on Enterprise; project admins enable and configure it themselves. ## Filter value caching This type of caching works without any configuration for cloud users. You'll see a message in your filter values that tells you when the cached filter values were loaded from (usually within the last day). To refresh the values, click **Results loaded at**: Lightdash clears the list and queries your warehouse again, skipping the cache. If a value still looks out of date after a refresh, the warehouse table hasn't changed yet. ![Filter value dropdown listing company names, with "Results loaded at 1/20/2025, 10:56 AM" under the last value](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/semantic-layer/caching/cached-filter.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=cdd0923b82f413dcba41557b193dd81d) If you search filter values by starting to type, Lightdash will also cache those values so the next time you need the same search the values will be shown much faster. The **Results loaded at** message doesn't appear for dimensions with [`fetch_from_warehouse: false`](/semantic-layer/dimensions#filter-autocomplete), or for dimensions with a static `values` list until you start typing. Static values come from your YAML, so update them there. ## Chart and dashboard results caching [Enterprise](/support/feature-badges#enterprise) > [!NOTE] > > Results caching is off by default. Project admins turn it on and set its [cache duration](#cache-duration-per-project) themselves under **Project settings → Results caching** — there's no need to contact the Lightdash team. A cache timestamp in the dashboard header confirms it is active; if no timestamp appears, it is not enabled. > > The one exception is a self-hosted instance that still sets the deprecated `RESULTS_CACHE_ENABLED` environment variable: it forces caching on or off for every project, the toggle in project settings is locked, and the page tells the admin to contact their instance admin to change it. Popular charts and dashboards will load faster when caching is enabled. The first user to visit a chart or dashboard each day will load fresh results from the warehouse, which get cached. After that, all following visits to the same chart or dashboard will load from the cached results. Any changes to the chart query or dashboard queries (user attributes, filters, limit, date zoom) will trigger new queries to the warehouse and create a separate cached results entry. Caching popular charts and dashboards will reduce warehouse costs to the organization by reducing the number of queries; it also improves server performance and makes the user experience much faster in Lightdash. ### Scope of the cache Each project turns caching on or off, and sets its own **cache duration**, under **Project settings → Results caching** — see [Cache duration per project](#cache-duration-per-project). There is no way to enable or disable caching for an individual dashboard. These Lightdash features use caching when it's turned on for the project: * **Saved Charts** are cached based on the last refresh in any context (edit mode, view mode, dashboard refresh, etc.), but queries made while editing are NOT cached or pulled from cache. * **Dashboard tiles** (internal and embedded) will use the cache from saved charts they reference. If charts only exist on a single dashboard, they will refresh whenever you click the Refresh button on the dashboard. Embedded dashboards have no Refresh button, so embedded viewers see cached results until they expire. To control how fresh embedded data is, set the project's [cache duration](#cache-duration-per-project); a shorter duration sends more queries to the warehouse. * **SQL runner queries** including saved SQL charts and dashboard SQL chart tiles are cached through the same execution path as metric-based charts. Note that the SQL runner does not have a UI button to force-refresh or invalidate the cache — results remain cached until the cache expires. * **Metrics Catalog** queries go through the same async query service and are cached like any other query. * **[Data apps](/data-apps)** run every metric query through the same async query service and are cached like any other query, including live-linked charts. The **Refresh** button in the app header (while building or viewing) invalidates the cache for that app and re-queries the warehouse fresh for the rest of the session, the same way the dashboard refresh button does. Because the cache key is project ID plus generated SQL, apps with lots of interactive filter controls produce more distinct cache entries than an equivalent dashboard — the first hit on each filter combination still goes to the warehouse. These Lightdash features DO NOT use caching: * **Scheduled Deliveries** and **Google Sheets syncs** run a fresh warehouse query by default. To reuse unexpired cached results instead, turn on **Use cached results when available** on the delivery or sync. The option isn't offered for data app deliveries. * **Editing a saved chart** — actions in edit mode (such as changing columns, filters, or other query parameters) explicitly bypass the cache to ensure you always see fresh results while building a query. * **[External connections](/data-apps/external-connections) in data apps** — requests to third-party HTTP APIs are runtime fetches through the Lightdash proxy and are not covered by results caching. Results caching doesn't apply to [live data sources](/integrations/live-data-sources#caching). ### Cache Mechanism The cache is stored in S3 and the cache identifier is based on the project ID and the generated SQL. This means that any change to the selected columns, filters, joins, user attributes, etc. will trigger a new query to the warehouse and add a new cache entry for that query. [User attribute](/workspace-admin/user-attributes) values in a `sql_filter` are written into the generated SQL, so users with different attribute values never share a cache entry; users with the same values share one, because they see the same rows. Fields a user's `required_attributes` don't allow are checked before any SQL is built, so a query that selects one returns a `Forbidden` error instead of cached results. ### User-level caching When a project is configured to [require user credentials](/personal-settings/personal-warehouse-connections), cached results are scoped to each individual user. This means: * Each user's queries are cached separately based on their personal warehouse credentials * Users cannot access cached results from other users' queries * This ensures data access controls are maintained at the individual user level ### Filtering with time values and caching When using filters with datetime values, the specificity of the time component affects caching behavior: * **Dynamic datetime values with seconds** (e.g., `12:11:25`) will generally not benefit from caching because each query generates a unique timestamp, creating a new cache entry every time. * **Definite times** (e.g., `12:00:00`) or **dates without time components** will cache effectively because they produce consistent SQL queries that can be reused. **Best practices for cacheable time filters:** * Use date-only filters when possible (e.g., `2024-01-15` instead of `2024-01-15 12:11:25`) * Round times to the nearest hour or fixed interval (e.g., `12:00:00` instead of `12:11:25`) * Avoid filters that use dynamic "current time" functions with second precision This ensures your queries can leverage cached results and reduce warehouse load. ### Cache expiry and invalidation Cached results automatically expire after 24 hours by default. The instance default is set by `CACHE_STALE_TIME_SECONDS` and applies to every project that hasn't set its own duration. Cache expiry is **rolling, not scheduled**. It's based on the age of each cached result, not a fixed time of day. For example, if a dashboard is first loaded at 2:00 PM, its cache expires at 2:00 PM the next day. This means different dashboards and charts may have different cache ages depending on when they were last refreshed. #### Cache duration per project Project admins turn caching on and set the cache duration for a single project under **Project settings → Results caching**. This page is available to any project whose organization has a valid Enterprise license. Turn off **Use the default cache duration** and enter a whole number of minutes between `1` and `43200` (30 days). Leaving the toggle on falls back to the instance default. On a self-hosted instance that still sets the deprecated `RESULTS_CACHE_ENABLED` environment variable (see [environment variables](/self-host/customize-deployment/environment-variables#cache)), caching is forced on or off for every project and the toggle here is locked — contact your instance admin to change it instead. > [!TIP] > > If your dashboards report on "yesterday's data" and you want users to always see fresh results in the morning, set a shorter cache duration (for example, 8 hours) so that results cached during the workday expire overnight. The dashboard header displays the date and time of the chart with the oldest cache. If no time is displayed, then no charts are cached. You can invalidate and refresh cached dashboard results by pressing the dashboard refresh button. A cached result is served as stored until it expires, even one cached while the underlying table was empty or being rebuilt. If tiles show empty or null values for a filter value while Explore shows the right numbers, press the dashboard refresh button: reloading the browser page serves the same cached result. Running the same query in Explore also replaces the entry, because Explore skips the cache lookup and its fresh result becomes the newest entry for that SQL. If your tables are rebuilt on a schedule, set a [cache duration](#cache-duration-per-project) that fits that schedule. ![Dashboard header reading "Dashboard uses cached data from Jan 20, 2025 11:07 AM" beside a refresh button](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/semantic-layer/caching/dashboard-cache-time.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=527cef4b85a6264f225b16c84f6fdd33) There's no button in the Lightdash UI to invalidate a single Saved Chart's cache outside of a dashboard. You can do this through the API: set `invalidateCache: true` on a request to the [execute saved chart](/api-reference/v2/execute-saved-chart) or [execute dashboard chart](/api-reference/v2/execute-dashboard-chart) endpoint to bypass the cache and re-run that chart's query, which repopulates its cache entry. #### Clearing cached results for a project Project admins can clear every cached result for a project from **Project settings → Results caching**: * **Clear cache now** invalidates every cached result in the project immediately. The next load of each chart, dashboard, or API query runs against the warehouse and repopulates the cache. * **Scheduled clearing** runs the same clear automatically — daily or weekly, at one or more hours, in the project's default time zone. To invalidate the cache from a script or a data pipeline, call one of these endpoints with a [personal access token](/personal-settings/create-personal-tokens) (`Authorization: ApiKey `). All three require project admin access and results caching turned on for the project; query history and existing result files are kept, and the next run of the affected chart, dashboard, or project queries the warehouse and repopulates the cache: | Scope | Endpoint | | - | - | | Project | `POST /api/v1/projects/{projectUuid}/results-cache/invalidate` | | Dashboard | `POST /api/v2/dashboards/{dashboardUuid}/results-cache/invalidate` | | Saved chart | `POST /api/v2/saved/{chartUuid}/results-cache/invalidate` | Call the project-level endpoint from a data pipeline once a run finishes, so the next person to open a chart or dashboard gets fresh results instead of what was cached before the run. See the [API reference](/api-reference/v1/introduction) for full request and response details. ## Results caching vs pre-aggregates Lightdash has two independent systems for speeding up queries: **results caching** (documented above) and **pre-aggregates**. They work differently and are designed to be used together, not as replacements for each other. Both act only on query execution: they shorten or skip the warehouse part of loading a chart or dashboard. Neither changes the time your browser spends loading the dashboard and rendering its tiles, so a dashboard whose every query is served from the cache or a pre-aggregate still takes a moment to open — longer with many tiles or heavy custom visualizations. ### Results caching Results caching stores the exact result of any query that runs through Lightdash, keyed by a hash of the generated SQL, and serves subsequent identical queries from S3 until the entry expires (24 hours by default, [configurable per project](#cache-duration-per-project)). It covers every query shape — including custom metrics, table calculations, and SQL runner queries — but the first run of each unique query still hits your warehouse, and any change to the query (a different filter, column, limit, or user attribute) produces a new entry and another warehouse query. ### Pre-aggregates [Pre-aggregates](/semantic-layer/pre-aggregates) are summary tables you define in your dbt YAML. Lightdash materializes them on a schedule (or on compile, or manually) and stores the results in S3. When a user query matches the pre-aggregate's dimensions, metrics, filters, and granularity, Lightdash serves the query from the materialized data using in-memory DuckDB workers. The warehouse is not touched at query time, even on the first query. A single pre-aggregate can serve many different queries. A daily pre-aggregate with five dimensions can answer day, week, month, quarter, and year queries across any subset of those dimensions and with any narrower filter. Results caching, in contrast, needs one cache entry per unique SQL. ### Key differences | | Results caching | Pre-aggregates | | - | - | - | | **Configuration** | Automatic once enabled for your instance | Defined in dbt YAML | | **Trigger** | First query runs against warehouse, then cached | Materialized on compile, cron, or manual refresh | | **Storage** | Query result (row set) | Pre-computed summary table | | **Query execution** | Exact cached result is returned | DuckDB workers re-aggregate at query time | | **Warehouse hit on first query?** | Yes | No — only materialization hits the warehouse, not query-time serving | | **Coverage** | All metric types, all query shapes | Only re-aggregatable metrics (sum, count, min, max, average) | | **Scope** | One cache entry per unique SQL | One pre-aggregate can serve many query shapes | | **Availability** | [Enterprise](/support/feature-badges#enterprise) | [Enterprise](/support/feature-badges#enterprise); [feature enablement](/semantic-layer/pre-aggregates) | ### When to use which **Use pre-aggregates when:** * You have high-traffic dashboards with predictable query patterns * You want to reduce warehouse cost or improve latency on the first query, not just repeat visits * The metrics are re-aggregatable (sum, count, min, max, average) * You're willing to design and schedule the materializations **Use results caching when:** * Query patterns are ad-hoc or unpredictable * You need features that pre-aggregates don't support, such as `count_distinct` outside an [exact match](/semantic-layer/pre-aggregates#exact-match-queries), [Parameters](/semantic-layer/parameters), or raw SQL table calculations * You're using the SQL runner * You don't want upfront configuration work In most cases, both should be enabled. Pre-aggregates handle your heaviest, most predictable workloads. Results caching is the safety net for everything else. ### Using both together When both systems are enabled, they act as two layers of caching. A query that matches a pre-aggregate is served from the materialized data by DuckDB workers. The result of that DuckDB query can then be stored in the results cache, so subsequent identical requests skip even the DuckDB step and return the cached result directly. This means pre-aggregates eliminate the warehouse hit, and results caching eliminates repeated computation on top of that. # Dimensions reference Source: https://docs.lightdash.com/semantic-layer/dimensions The columns of your tables, and every option for defining and configuring them in YAML Dimensions usually match 1:1 with columns in your dbt models (see [additional dimensions](#additional-dimensions) for counterexamples). ## Adding dimensions to your project For a dimension to appear in Lightdash, you just need to declare it in your dbt model's YAML file. ```yaml theme={null} models: - name: my_model columns: - name: user_id # will be "User id" in LightDash description: "Unique identifier for a user." ``` Write these entries by hand, or generate one for every column in a model with [`lightdash generate`](/workflow/cli/generate). > [!WARNING] > > Dimensions cannot use window functions in their `sql`. A dimension's SQL is inserted into the same `SELECT` as the main `GROUP BY` in the generated query, and SQL does not allow window functions in that position. If you need window-function logic, either model it directly in your dbt model (so the value is precomputed before Lightdash queries it), or add a [table calculation](/explore/table-calculations) on the query results. Lightdash also supports a small set of built-in window operations through [post calculation metrics](/semantic-layer/metrics#post-calculation-metrics) (`percent_of_previous`, `percent_of_total`, `running_total`). ## Dimension configuration To customize the dimension, you can do it in your dbt model's YAML file under the `meta` tag. The syntax depends on your dbt version. If you want to declare multiple dimensions based on the same column, check [additional dimensions](#additional-dimensions) section. ```yaml dbt v1.10+ theme={null} models: - name: sales_stats config: meta: group_details: finance: label: Finance description: Finance-related fields. joins: - join: web_sessions sql_on: ${web_sessions.date} = ${sales_stats.date} columns: - name: revenue_gbp_total_est description: 'Total estimated revenue in GBP based on forecasting done by the finance team.' config: meta: dimension: type: number label: 'Total revenue' # this is the label you'll see in Lightdash description: 'My custom description' # you can override the description you'll see in Lightdash here sql: 'IF(${TABLE}.revenue_gbp_total_est = NULL, 0, ${registered_user_email})' # custom SQL applied to the column from dbt used to define the dimension hidden: false format: '[$£]#,##0.00' # GBP rounded to two decimal points groups: ['finance'] - name: forecast_date description: 'Date of the forecasting.' config: meta: dimension: type: date time_intervals: ['DAY', 'WEEK', 'MONTH', 'QUARTER'] # not required: the default time intervals for dates are `['DAY', 'WEEK', 'MONTH', 'YEAR']` urls: - label: 'Open in forecasting tool' url: 'https://finance.com/forceasts/weeks/${ value.raw }' - label: Open in Google Calendar url: 'https://calendar.google.com/calendar/u/0/r/day/${ value.formatted |split: "-" |join: "/"}' required_attributes: is_admin: 'true' ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: sales_stats meta: group_details: finance: label: Finance description: Finance-related fields. joins: - join: web_sessions sql_on: ${web_sessions.date} = ${sales_stats.date} columns: - name: revenue_gbp_total_est description: 'Total estimated revenue in GBP based on forecasting done by the finance team.' meta: dimension: type: number label: 'Total revenue' # this is the label you'll see in Lightdash description: 'My custom description' # you can override the description you'll see in Lightdash here sql: 'IF(${TABLE}.revenue_gbp_total_est = NULL, 0, ${registered_user_email})' # custom SQL applied to the column from dbt used to define the dimension hidden: false format: '[$£]#,##0.00' # GBP rounded to two decimal points groups: ['finance'] - name: forecast_date description: 'Date of the forecasting.' meta: dimension: type: date time_intervals: ['DAY', 'WEEK', 'MONTH', 'QUARTER'] # not required: the default time intervals for dates are `['DAY', 'WEEK', 'MONTH', 'YEAR']` urls: - label: 'Open in forecasting tool' url: 'https://finance.com/forceasts/weeks/${ value.raw }' - label: Open in Google Calendar url: 'https://calendar.google.com/calendar/u/0/r/day/${ value.formatted |split: "-" |join: "/"}' required_attributes: is_admin: 'true' ``` ```yaml Lightdash YAML theme={null} type: model name: sales_stats group_details: finance: label: Finance description: Finance-related fields. joins: - join: web_sessions sql_on: ${web_sessions.date} = ${sales_stats.date} dimensions: - name: revenue_gbp_total_est description: 'Total estimated revenue in GBP based on forecasting done by the finance team.' type: number label: 'Total revenue' # this is the label you'll see in Lightdash sql: 'IF(${TABLE}.revenue_gbp_total_est = NULL, 0, ${registered_user_email})' # custom SQL applied to the column from dbt used to define the dimension hidden: false format: '[$£]#,##0.00' # GBP rounded to two decimal points groups: ['finance'] - name: forecast_date description: 'Date of the forecasting.' type: date time_intervals: ['DAY', 'WEEK', 'MONTH', 'QUARTER'] # not required: the default time intervals for dates are `['DAY', 'WEEK', 'MONTH', 'YEAR']` urls: - label: 'Open in forecasting tool' url: 'https://finance.com/forceasts/weeks/${ value.raw }' - label: Open in Google Calendar url: 'https://calendar.google.com/calendar/u/0/r/day/${ value.formatted |split: "-" |join: "/"}' required_attributes: is_admin: 'true' ``` The table below shows all the dimension properties you can customize: | Property | Required | Value | Description | | :- | :- | :- | :- | | label | No | string | Custom label. If you set this property, this is what you'll see in Lightdash instead of the dimension name. | | [type](#type) | No | Dimension type | The dimension type is automatically pulled from your table schemas in Lightdash but you can override the type using this property. | | [description](#description) | No | string | Description of the dimension in Lightdash. You can use this to override the description you have for the dimension in dbt. | | sql | No | string | Custom SQL applied to the column used to define the dimension. | | [time\_intervals](#time-intervals) | No | 'default' or OFF or an array\[] containing elements of [date](#date-options), [numeric](#numeric-options), [string](#string-options) options, or [custom granularity](#using-custom-granularities) names | 'default' (or not setting the time\_intervals property) will be converted into \['DAY', 'WEEK', 'MONTH', 'QUARTER', 'YEAR'] for dates and \['RAW', 'DAY', 'WEEK', 'MONTH', 'QUARTER', 'YEAR'] for timestamps; if you want no time intervals set 'OFF'. You can also include custom granularity names defined in `lightdash.config.yml`. | | hidden | No | boolean | If set to true, the dimension is hidden from Lightdash. By default, this is set to false if you don't include this property. Hidden dimensions are also excluded from drilldowns (View underlying data). Hiding a dimension that a dashboard filter already uses doesn't remove the filter — it still applies, but shows as a [locked filter chip](/explore/dashboards/filter#locked-filters-on-hidden-fields) until an editor replaces it. A hidden dimension can't be used in a model's [`default_filters` or `required_filters`](/semantic-layer/tables#default-filters). | | [compact](#compact) | No | string | This option will compact the number value (e.g. 1,500 to 1.50K). Currently supports one of the following: \['auto', 'thousands', 'millions', 'billions', 'trillions', 'kilobytes', 'megabytes', 'gigabytes', 'terabytes', 'petabytes', 'kibibytes', 'mebibytes', 'gibibytes', 'tebibytes', 'pebibytes']. Use `auto` to dynamically pick K/M/B/T based on each value's magnitude. | | [format](#format) | No | string | This option will format the output value on the results table and CSV export. Supports spreadsheet-style formatting (e.g. #,##0.00). Use [this website](https://customformats.com) to help build your custom format. | | [separator](#separator) | No | string | This option controls the grouping and decimal characters used when rendering numbers (e.g. `1.234.567,50` for European locales). One of: `default`, `commaPeriod`, `spacePeriod`, `periodComma`, `noSeparatorPeriod`, `apostrophePeriod`. | | [groups](#groups) | No | string or string\[] | If you set this property, the dimension will be grouped in the sidebar with other dimensions with the same group label. | | [urls](#urls) | No | Array of `url`, `label` | Adding urls to a dimension allows your users to click dimension values in the UI and take actions, like opening an external tool with a url, or open at a website. You can use liquid templates to customise the link based on the value of the dimension. | | [richText](#rich-text) | No | string | Rich text template for displaying formatted content in table cells. Supports Markdown, HTML, and LiquidJS templating. | | [required\_attributes](#required-attributes) | No | Object with `user_attribute`, `value` | Limits access to users with those attributes (AND logic - all must match) | | [any\_attributes](#any-attributes) | No | Object with `user_attribute`, `value` | Limits access to users with those attributes (OR logic - at least one must match) | | [colors](#color) | No | Object with `value`, `color` | Color for the values in the chart | | [image](#image-display) | No | Object with `url` | Display images in table cells using URL templates. Supports LiquidJS templating for dynamic URLs. | | [case\_sensitive](#case-sensitive) | No | boolean | If set to `false`, string filters on this dimension will be case insensitive. Defaults to `true`. Overrides explore-level setting. | | [filter\_autocomplete](#filter-autocomplete) | No | Object | Configure the filter autocomplete suggestions for this dimension. Provide a static list of `values` (with optional display `label`s), point at a `label_dimension` in the same table to label warehouse-fetched values, source values from a dimension in another model with `options_from_dimension`, and/or disable warehouse-based autocomplete by setting `fetch_from_warehouse: false`. | | [tags](#tags) | No | string\[] | An array of string tags for categorizing and filtering dimensions programmatically. Tags can be used by AI agents, API filters, and other backend workflows. | | [convert\_timezone](#convert-timezone) | No | boolean | If set to `false`, the dimension opts out of the project query timezone for display, grouping, and extracts - the raw warehouse value is rendered instead. Defaults to `true`. Has no effect unless a project query timezone is set. | | [timestamp\_domain](#timestamp-domain) | No | `aware` or `naive` | Declares whether a `timestamp` column stores an instant (`aware`) or a bare wall clock with no zone (`naive`). Overrides what Lightdash detects from the warehouse catalog. | ## Type The types of your dimensions are pulled from your data warehouse, automatically. You can override these types using the `type` meta tag in your .yml file. If you run `lightdash generate` to generate your .yml files, then Lightdash will add the `type` from your data warehouse to your .yml files automatically. Lightdash reads column types from the warehouse's catalog each time it compiles your project. A column it can't find there, for example because the model hasn't been built in the target schema yet or the warehouse user can't read it, gets the type `string`. Warehouse types with no matching Lightdash type, such as Postgres `uuid`, `jsonb`, or array columns, are also read as `string`. Set `type` to override either case. ```yaml dbt v1.10+ theme={null} - name: user_created_date config: meta: dimension: type: date ``` ```yaml dbt v1.9 and earlier theme={null} - name: user_created_date meta: dimension: type: date ``` ```yaml Lightdash YAML theme={null} dimensions: - name: user_created_date type: date ``` We currently support these dimension types: | Dimension Types | | :- | | string | | number | | timestamp | | date | | boolean | ## Description Column descriptions in your YAML file are automatically pulled into Lightdash and you can spot them if you hover over the dimension name. ![Dimensions list with an info icon beside "User id" showing the tooltip "Unique identifier for a user."](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/semantic-layer/dimensions/screenshot-column-descriptions-3498d7b3c09c38fda5b755ce21358b2c.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=23a9d5129d8037e94e46a272ab551135) Descriptions support any formatting that works with YAML, but the three characters used most often are: ### Quotes for escaping When you surround text with double or single quotes it will escape the text between so that any special characters recognized by YAML will still pass through to the Lightdash UI. ```yaml theme={null} description: 'The contents of this column include this & that.' ``` ### Greater than symbol for folded text blocks When you use `>-` it allows you to type descriptions that are multiple lines long in the YAML file, but the text will be combined into a single line when parsed. The `lightdash generate` command will automatically add this to keep YAML files easy to read. This description in YAML: ```yaml theme={null} - name: product_tier description: >- This is a longer description... ...that requires multiple lines and it will be combined in the Lightdash UI ``` Will appear like this in the Lightdash UI: ```yaml theme={null} This is a longer description......that requires multiple lines and it will be combined in the Lightdash UI ``` ### Vertical bar for preserving line breaks If you need line breaks to stay in place when they show up in the Lightdash UI, you can use a `|` character like this: ```yaml theme={null} - name: product_tier description: | This is a longer description... ...that requires multiple lines and it will stay on multiple lines ``` And in Lightdash UI it will appear like this: ```yaml theme={null} This is a longer description... ...that requires multiple lines and it will stay on multiple lines ``` ### Using dbt doc blocks You can also use dbt docs blocks in descriptions, [more on that here](/workflow/cli/generate#using-doc-blocks-to-build-better-yml-files). ## Format You can use the `format` parameter to have your fields show in a particular format in Lightdash. Lightdash supports spreadsheet-style format expressions for all field types. To help you build your format expression, we recommend using [https://customformats.com/](https://customformats.com/). ```yaml theme={null} theme={null} models: - name: sales columns: - name: revenue meta: metrics: total_us_revenue: type: sum description: 'Total revenue in USD, with two decimal places, compacted to thousands' format: '$#,##0.00," K"' # 505,430 will appear as '$505.43 K' percent_of_total_global_revenue: type: number description: 'Percent of total global revenue coming from US revenue.' sql: ${total_us_revenue} / ${total_global_revenue} format: '0.00%' # 0.67895243 will appear as '67.89%' ``` ### Example format expressions | Description | Format Expression | Raw Value | Formatted Output | | :- | :- | :- | :- | | **Adds "km" suffix to the value** | `#,##0.00" km"` | 100000.00 | 100,000.00 km | | | | 15000.25 | 15,000.25 km | | | | 500 | 500.00 km | | **Format date with 12-hour clock** | `m/d/yyyy h:mm AM/PM` | 2023-09-05T15:45:00Z | 9/5/2023 3:45 PM | | | | 2024-01-20T08:30:00Z | 1/20/2024 8:30 AM | | **Display the full name of the day** | `dddd` | 2023-09-05T15:45:00Z | Tuesday | | | | 2024-01-20T08:30:00Z | Saturday | | **Format positive, negative, and zero values** | `"⬆️ "0;"⬇️ "0;0` | -500 | ⬇️ 500 | | | | 200 | ⬆️ 200 | | | | 0 | 0 | | **Show negative values in parentheses** | `#,##0;(#,##0);0` | -1500 | (1,500) | | | | 2500 | 2,500 | | | | 0 | 0 | | **Text formatting** | `"Delivered in "@` | 2 weeks | Delivered in 2 weeks | | | | 18 hours | Delivered in 18 hours | | **Percentage formatting** | `#,##0.00%` | 0.6758 | 67.58% | | | | 0.1 | 10.00% | | | | 0.002 | 0.20% | | **No formatting** | `0` | 12345232 | 12345232 | | | | 56.7856 | 57 | | **Currency formatting (USD)** | `[$$]#,##0.00` | 15430.75436 | \$15,430.75 | | | | 1234.50 | \$1,234.50 | | **Currency formatting (GBP)** | `[$£]#,##0.00` | 15430.75436 | £15,430.75 | | | | 1234.50 | £1,234.50 | | **Compact currency in thousands** | `[$$]#,##0,"K"` | 15430.75436 | \$15K | | | | 15430.75436 | \$15.43K | | **Compact currency in millions** | `[$$]#,##0.00,,"M"` | 13334567 | \$13.33M | | | | 120000000 | \$120.00M | > [accordion] (Legacy) format and round options > > Spreadsheet-style format expressions are the recommended way of adding formatting to your fields in Lightdash. There are legacy formatting options, listed below, which are less flexible than the spreadsheet-style formatting. > > If you use both legacy and spreadsheet-style formatting options for a single field, Lightdash will ignore the legacy `format` and `round` options and only apply the spreadsheet-style formatting expression. > > #### Format (legacy) > > ```yaml theme={null} theme={null} > models: > - name: sales_stats > columns: > - name: revenue > description: 'Total estimated revenue in GBP based on forecasting done by the finance team.' > meta: > metrics: > total_revenue: > label: 'Total revenue GBP' > type: SUM > format: 'gbp' > ``` > > These are the options: > > | Option | Equivalent format expression | Raw value | Displayed value | > | :- | :- | :- | :- | > | km | `'#,##0.00" km"'` | 10 | 10 km | > | mi | `'#,##0.00" mi"'` | 10 | 10 mi | > | usd | `'[\$\$]#,##0.00'` | 10 | \$10.00 | > | gbp | `'[\$£]#,##0.00'` | 10 | £10.00 | > | eur | `'[\$€]#,##0.00'` | 10 | €10.00 | > | jpy | `'[\$¥]#,##0.00'` | 10 | ¥10 | > | percent | `'#,##0.00%'` | 0.1 | 10.00% | > | id | `'0'` | 12389572 | 12389572 | > > `percent` multiplies the raw value by 100, and `id` strips commas and spaces from number and string values so they read as identifiers. > > #### Round (legacy) > > You can round values to appear with a certain number of decimal points. > > ```yaml theme={null} theme={null} > models: > - name: sales > columns: > - name: revenue > meta: > metrics: > total_revenue: > type: sum > round: 0 # equivalent format expression: '#,##0.0' > ``` ## Compact You can compact values in your YAML. For example, if I wanted all of my revenue values to be shown in thousands (e.g. `1,500` appears as `1.50K`), then I would write something like this in my .yml: ```yaml theme={null} theme={null} models: - name: sales columns: - name: revenue meta: dimension: compact: thousands # You can also use 'K' ``` | Value | Alias | Equivalent format expression | Example output | | :- | :- | :- | :- | | auto | | dynamic — picks K/M/B/T per value | 1.50K / 2.30M | | thousands | "K" and "thousand" | `'#,##0," K"'` or `'#,##0.00," K"'` | 1K | | millions | "M" and "million" | `'#,##0,," M"'` or `'#,##0.00,," M"'` | 1M | | billions | "B" and "billion" | `'#,##0,,," B"'` or `'#,##0.00,,," B"'` | 1B | | trillions | "T" and "trillion" | `'#,##0,,,," T"'` or `'#,##0.00,,,," T"'` | 1T | | kilobytes | "KB" and "kilobyte" | | 1KB | | megabytes | "MB" and "megabyte" | | 1MB | | gigabytes | "GB" and "gigabyte" | | 1GB | | terabytes | "TB" and "terabyte" | | 1TB | | petabytes | "PB" and "petabyte" | | 1PB | | kibibytes | "KiB" and "kibibyte" | | 1KiB | | mebibytes | "MiB" and "mebibyte" | | 1MiB | | gibibytes | "GiB" and "gibibyte" | | 1GiB | | tebibytes | "TiB" and "tebibyte" | | 1TiB | | pebibytes | "PiB" and "pebibyte" | | 1PiB | ## Separator You can use the `separator` property to control the grouping and decimal characters used when rendering numbers, so values display correctly for non-US locales (e.g. `1.234.567,50` in Europe or `1'234'567.50` in Switzerland). `separator` only changes the separator characters. It composes with `format` (including spreadsheet-style `format` expressions), `compact`, `round`, and `currency`, which still control the overall shape of the number. ```yaml theme={null} theme={null} models: - name: sales columns: - name: revenue meta: metrics: total_revenue: type: sum format: '[$€]#,##0.00' separator: periodComma # 1.234.567,50 € ``` These are the supported values: | Value | Example output | Description | | :- | :- | :- | | `default` | `1,234,567.50` | Uses the Lightdash default (comma thousands, period decimal). Same as omitting `separator`. | | `commaPeriod` | `1,234,567.50` | Comma thousands separator, period decimal separator. | | `spacePeriod` | `1 234 567.50` | Space thousands separator, period decimal separator. | | `periodComma` | `1.234.567,50` | Period thousands separator, comma decimal separator. | | `noSeparatorPeriod` | `1234567.50` | No thousands separator, period decimal separator. | | `apostrophePeriod` | `1'234'567.50` | Apostrophe thousands separator, period decimal separator (Swiss). | ## Time intervals Lightdash automatically adds intervals for dimensions that are timestamps or dates, so you don't have to! For example, here we have the timestamp dimension `created` defined in our dbt project: ```yaml theme={null} - name: created description: 'Timestamp when the user was created.' ``` Lightdash breaks this out into the default intervals automatically. So, this is how `created` appears in our Lightdash project: ![screenshot-default-intervals](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/semantic-layer/dimensions/screenshot-default-intervals-1fb6e04e2d4f617bb22f9fea86fa52c6.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=18cfce8b8b43705e8bd09a4f4e98a619) [**Formatting added to a date or timestamp dimension will be applied to all of the time intervals for that dimension.**](#format) If you want to apply different formats for different time intervals, we recommend creating [additional dimensions](#additional-dimensions) for time intervals where you want to customize the format. ### Default time intervals The default time intervals that Lightdash adds are... **For `date` type**: ```yaml theme={null} ['DAY', 'WEEK', 'MONTH', 'QUARTER', 'YEAR'] ``` **For `timestamp` type**: ```yaml theme={null} ['RAW', 'DAY', 'WEEK', 'MONTH', 'QUARTER', 'YEAR'] ``` ### Disable time intervals If you want to turn off time intervals for a dimension, you set the `time_intervals` property to `OFF`. In this example, `created` would now appear as a single, timestamp dimension without a drop-down list of time intervals in Lightdash: ```yaml dbt v1.10+ theme={null} - name: created description: 'Timestamp when the user was created.' config: meta: dimension: type: timestamp time_intervals: OFF ``` ```yaml dbt v1.9 and earlier theme={null} - name: created description: 'Timestamp when the user was created.' meta: dimension: type: timestamp time_intervals: OFF ``` ```yaml Lightdash YAML theme={null} dimensions: - name: created description: 'Timestamp when the user was created.' type: timestamp time_intervals: OFF ``` ![screenshot-intervals-off](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/semantic-layer/dimensions/screenshot-intervals-off-e786a3290b6c8b8454fe7f223a5682d8.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=c1c1dc719bc7e483389312d7a8bbf2f1) ### To customize the time intervals for a dimension, you can use the `time_intervals` parameter. If you specify time intervals manually, then this overrides the default time intervals used by Lightdash. ```yaml dbt v1.10+ theme={null} - name: created description: 'Timestamp when the user was created.' config: meta: dimension: time_intervals: ['DAY', 'DAY_OF_MONTH_NUM', 'MONTH', 'QUARTER_NAME', 'YEAR'] ``` ```yaml dbt v1.9 and earlier theme={null} - name: created description: 'Timestamp when the user was created.' meta: dimension: time_intervals: ['DAY', 'DAY_OF_MONTH_NUM', 'MONTH', 'QUARTER_NAME', 'YEAR'] ``` ```yaml Lightdash YAML theme={null} dimensions: - name: created description: 'Timestamp when the user was created.' time_intervals: ['DAY', 'DAY_OF_MONTH_NUM', 'MONTH', 'QUARTER_NAME', 'YEAR'] ``` You can see all of the standard interval options for date and timestamp fields below. You can also add custom intervals using *additional dimensions*, there's an example below the following tables. ### Date options | Option | Description | Type | Displayed value | Notes | | :- | :- | :- | :- | :- | | RAW | Original value | Date / DateTime | 2019-01-01 / 2019-01-01, 09:30:30:300 UTC | | | YEAR | Date truncated to the nearest year | Date | 2019 | | | QUARTER | Date truncated to the nearest quarter | Date | 2019-Q1 | | | MONTH | Date truncated to the nearest month | Date | 2019-01-01 | | | WEEK | Date truncated to the nearest week | Date | 2019-01-01 | The start of the week depends on your warehouse configuration | | DAY | Date truncated to the nearest day | Date | 2019-01-01 | | | HOUR | Datetime truncated to the nearest hour | DateTime | 2019-01-01, 09 UTC | | | MINUTE | Datetime truncated to the nearest minute | DateTime | 2019-01-01, 09:30 UTC | | | SECOND | Datetime truncated to the nearest second | DateTime | 2019-01-01, 09:30:30 UTC | | | MILLISECOND | Datetime truncated to the nearest millisecond | DateTime | 2019-01-01, 09:30:30:300 UTC | | ### Numeric options | Option | Description | Type | Displayed value | Notes | | :- | :- | :- | :- | :- | | DAY\_OF\_WEEK\_INDEX | Index of the day of the week | Number | 0 | The value range and start of the week depends on your warehouse configuration | | DAY\_OF\_MONTH\_NUM | Day of the month | Number | 21 | | | DAY\_OF\_YEAR\_NUM | Day of the year | Number | 127 | | | WEEK\_NUM | Week number | Number | 37 | | | MONTH\_NUM | Month number | Number | 7 | | | QUARTER\_NUM | Quarter number | Number | 3 | | | YEAR\_NUM | Year number | Number | 2019 | | | MINUTE\_OF\_HOUR\_NUM | Minute number | Number | 50 | | | HOUR\_OF\_DAY\_NUM | Hour number | Number | 22 | | ### String options | Option | Description | Type | Displayed value | | :- | :- | :- | :- | | DAY\_OF\_WEEK\_NAME | Day of the week | String | Monday | | MONTH\_NAME | Month name | String | March | | QUARTER\_NAME | Quarter name | String | Q3 | Sorting by `MONTH_NAME` or `DAY_OF_WEEK_NAME` orders results chronologically (January → December, and by your warehouse's start-of-week day order), not alphabetically — Lightdash sorts on the underlying month or day-of-week index, with no extra configuration needed. ### Using custom granularities You can define reusable custom time granularities in your `lightdash.config.yml` file and reference them in the `time_intervals` array. Unlike [custom time intervals using additional dimensions](#custom-time-intervals-with-additional-dimensions), custom granularities **appear in the date zoom dropdown** alongside standard options (Day, Week, Month, etc.). **Step 1**: Define custom granularities in `lightdash.config.yml`: ```yaml theme={null} # lightdash.config.yml custom_granularities: fiscal_quarter: label: "Fiscal Quarter" sql: "DATE_TRUNC('quarter', ${COLUMN} + INTERVAL '1 month')" week_monday: label: "Week (Mon-Sun)" sql: "DATE_TRUNC('week', ${COLUMN})" ``` **Step 2**: Reference them in your dimension's `time_intervals`: ```yaml dbt v1.10+ theme={null} - name: order_date description: 'Date the order was placed' config: meta: dimension: type: date time_intervals: ['DAY', 'WEEK', 'fiscal_quarter', 'YEAR'] ``` ```yaml dbt v1.9 and earlier theme={null} - name: order_date description: 'Date the order was placed' meta: dimension: type: date time_intervals: ['DAY', 'WEEK', 'fiscal_quarter', 'YEAR'] ``` ```yaml Lightdash YAML theme={null} dimensions: - name: order_date description: 'Date the order was placed' type: date time_intervals: ['DAY', 'WEEK', 'fiscal_quarter', 'YEAR'] ``` The `${COLUMN}` placeholder in the SQL expression is automatically replaced with the dimension's column SQL at runtime. Custom granularities also inherit `requiredAttributes` and `anyAttributes` from the parent dimension. See [lightdash.config.yml reference](/semantic-layer/lightdash-config-yml#custom-granularities-configuration) for the full configuration options and the [Date zoom guide](/explore/dashboards/date-zoom) for information on configuring the date zoom dropdown. ### Custom time intervals with additional dimensions You can also create custom time-based dimensions by using additional dimensions and groups. This approach groups custom dimensions with their parent date dimension in the sidebar, but **these dimensions do not appear in the date zoom dropdown** - they are only available as separate fields in the dimension list. > [!NOTE] > > If you need custom time intervals to appear in the **date zoom dropdown**, use [custom granularities](#using-custom-granularities) defined in `lightdash.config.yml` instead. Here's an example of how that might look if you wanted to add `year_of_week_iso` grouped with the `delivery_date` dimension. Note that by defining the `groups:` option, we ensure that the new "Year of week" option is displayed grouped with the parent dimension in the sidebar. ```yaml dbt v1.10+ theme={null} - name: delivery_date config: meta: dimension: label: "Delivery Date" type: date time_intervals: [ ... ] additional_dimensions: year_of_week_num: type: number label: "Year of week" sql: "yearofweekiso(${delivery_date})" groups: ["Delivery Date"] ``` ```yaml dbt v1.9 and earlier theme={null} - name: delivery_date meta: dimension: label: "Delivery Date" type: date time_intervals: [ ... ] additional_dimensions: year_of_week_num: type: number label: "Year of week" sql: "yearofweekiso(${delivery_date})" groups: ["Delivery Date"] ``` ```yaml Lightdash YAML theme={null} dimensions: - name: delivery_date label: "Delivery Date" type: date time_intervals: [ ... ] - name: year_of_week_num type: number label: "Year of week" sql: "yearofweekiso(${delivery_date})" groups: ["Delivery Date"] ``` ### Reference time intervals in other dimensions You can reference specific time intervals of a dimension in other dimensions. When you define time intervals for a dimension (like `session_start`), Lightdash creates separate dimensions for each interval (e.g., `session_start_day`, `session_start_month`). You can reference these in custom SQL for other dimensions. For example, if you have a `user_created_at` dimension with time intervals defined, you can calculate the duration between two dates using the `DAY` interval: ```yaml theme={null} - name: user_created_at meta: dimension: type: timestamp time_intervals: - DAY_OF_WEEK_NAME - WEEK - MONTH - RAW - DAY - HOUR_OF_DAY_NUM - QUARTER - name: first_purchase_at meta: dimension: type: timestamp time_intervals: - DAY - MONTH - QUARTER - name: duration meta: dimension: type: number sql: EXTRACT(DAY FROM ${first_purchase_at_day} - ${user_created_at_day}) ``` In this example, `${user_created_at_day}` and `${first_purchase_at_day}` reference the `DAY` time interval versions of the `user_created_at` and `first_purchase_at` dimensions. ## Groups You can group your dimensions and metrics in the sidebar using the `groups` parameter. To do this, you need to set up `group_details` in the model's configuration. Then, you can use these groups to organize metrics and dimensions. You can create nested groups up to 3 levels. ```yaml dbt v1.10+ theme={null} models: - name: baskets config: meta: group_details: product_details: label: Product Details description: 'Fields that have information about the products in the basket.' item_details: label: Item Details description: 'Fields that have information about the items in the basket.' columns: - name: basket_item_id description: 'ID for the product item within the basket.' config: meta: dimension: groups: ['product_details', 'item_details'] # this would add the dimension to a nested group: `product details` --> `item details` - name: product_name description: 'Full name of the product.' config: meta: dimension: label: 'Product name' groups: ['product_details'] # this would add the dimension under the group label: `product_details` ``` ```yaml dbt v1.9 and earlier theme={null} models: - name: baskets meta: group_details: product_details: label: Product Details description: 'Fields that have information about the products in the basket.' item_details: label: Item Details description: 'Fields that have information about the items in the basket.' columns: - name: basket_item_id description: 'ID for the product item within the basket.' meta: dimension: groups: ['product_details', 'item_details'] # this would add the dimension to a nested group: `product details` --> `item details` - name: product_name description: 'Full name of the product.' meta: dimension: label: 'Product name' groups: ['product_details'] # this would add the dimension under the group label: `product_details` ``` ```yaml Lightdash YAML theme={null} type: model name: baskets group_details: product_details: label: Product Details description: 'Fields that have information about the products in the basket.' item_details: label: Item Details description: 'Fields that have information about the items in the basket.' dimensions: - name: basket_item_id description: 'ID for the product item within the basket.' groups: ['product_details', 'item_details'] # this would add the dimension to a nested group: `product details` --> `item details` - name: product_name description: 'Full name of the product.' label: 'Product name' groups: ['product_details'] # this would add the dimension under the group label: `product_details` ``` This example would look like this in the sidebar: ![Dimensions sidebar with a Product Details group expanded to a nested Item Details group of basket item fields](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/semantic-layer/dimensions/groups-757097385f03095824be4746f585d50b.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=71a7ce511090ab8270b11581a5337e2b) ## URLs Lightdash users can interact with dimension values by clicking on them. If you're already storing URLs in your models, you can create hyperlinks to those URLs in Lightdash, like so: ```yaml dbt v1.10+ theme={null} columns: - name: candidate_profile_url label: URL of the candidate profile config: meta: dimension: urls: - label: Open in CRM url: ${ value.raw } ``` ```yaml dbt v1.9 and earlier theme={null} columns: - name: candidate_profile_url label: URL of the candidate profile meta: dimension: urls: - label: Open in CRM url: ${ value.raw } ``` ```yaml Lightdash YAML theme={null} dimensions: - name: candidate_profile_url label: URL of the candidate profile urls: - label: Open in CRM url: ${ value.raw } ``` `urls` is only available on dbt-modeled dimensions — [virtual views](/semantic-layer/virtual-views) don't support it. ### How to add custom URLs By adding custom urls you can configure the actions available to your users. Like linking to external tools, or taking actions in other tools. ![Results table with a Path cell open, showing an "Open site page" link above "View underlying data"](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/semantic-layer/dimensions/clickable-dimension-link-70554874d4e468900e9d8fadf3b53cd2.jpg?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=3d67e26a0ebbe5253b29dbf664dd95cd) In the example below, users can click on a company name and open a corresponding record in their CRM or search for the company in google or open that company's Slack channel. ```yaml dbt v1.10+ theme={null} columns: - name: company_name label: Registered trading name of the company config: meta: dimension: urls: - label: Search for company in Google url: 'https://google.com/search?${ value.formatted | url_encode }' - label: Open in CRM url: 'https://mycrm.com/companies/${ row.company.company_id.raw | url_encode }' ``` ```yaml dbt v1.9 and earlier theme={null} columns: - name: company_name label: Registered trading name of the company meta: dimension: urls: - label: Search for company in Google url: 'https://google.com/search?${ value.formatted | url_encode }' - label: Open in CRM url: 'https://mycrm.com/companies/${ row.company.company_id.raw | url_encode }' ``` ```yaml Lightdash YAML theme={null} dimensions: - name: company_name label: Registered trading name of the company urls: - label: Search for company in Google url: 'https://google.com/search?${ value.formatted | url_encode }' - label: Open in CRM url: 'https://mycrm.com/companies/${ row.company.company_id.raw | url_encode }' ``` The `${ value.formatted }` will be replaced with the value of the company name in the Lightdash UI at query run time. The `${ row.company.company_id.raw }` will be replaced with the value of the company id in the Lightdash UI at query run time. The action will be disabled if the column "company\_id" from table "company" is not part of the query. ### You can reference values from other columns in your URLs You can reference another dimension from your table in your URL. For these URLs to work, the other column you've referenced needs to be included in your results table. For example, say I've added a URL to `company_name` and it uses the field `customer_id`: ```yaml dbt v1.10+ theme={null} columns: - name: company_name label: Registered trading name of the company config: meta: dimension: urls: - label: "Open company" url: "https://example.com/company/${row.customers.customer_id.raw | url_encode }" ``` ```yaml dbt v1.9 and earlier theme={null} columns: - name: company_name label: Registered trading name of the company meta: dimension: urls: - label: "Open company" url: "https://example.com/company/${row.customers.customer_id.raw | url_encode }" ``` ```yaml Lightdash YAML theme={null} dimensions: - name: company_name label: Registered trading name of the company urls: - label: "Open company" url: "https://example.com/company/${row.customers.customer_id.raw | url_encode }" ``` This URL will only work if I have `customer_id` included in my results table. ### Liquid templating Use templates to configure values dynamically at runtime based on query results. **Available liquid tags** | Tag | Description | | :- | :- | | `${ value.formatted }` | The exact value of the dimension as seen in the Lightdash UI. For example `$1,427.20` | | `${ value.raw }` | The raw value of the dimension returned from the underlying SQL query. For example `1427.2` | | `${ row.table_name.column_name.formatted }` | The exact value of the column as seen in the Lightdash UI. For example `$1,427.20` | | `${ row.table_name.column_name.raw }` | The raw value of the dimension returned from the underlying SQL query. For example `1427.2` | **Available liquid filters** Filters can be used to make small transformations of your values: * `url_encode`: Encode a string as URL safe, for example it replaces spaces with `%20`. ```liquid theme={null} theme={null} ${ value.formatted | url_encode } ``` * `downcase`: Convert a string to lowercase. ```liquid theme={null} theme={null} ${ value.formatted | downcase } ``` * `append`: Append one string to another. ```liquid theme={null} theme={null} ${ value.formatted | append: ".html" } ``` There are [many more filters available in the Liquid documentation](https://liquidjs.com/filters/overview.html). ## Rich text The `richText` property allows you to define custom HTML/Markdown templates for displaying dimension and metric values in table cells. This enables sophisticated data presentation with formatting, styling, conditional logic, and external integrations. ![Rich text examples rendered in a Table chart](https://mintcdn.com/lightdash/5NMMM4n0puUIh3u9/images/semantic-layer/dimensions/rich-text-hero.png?fit=max\&auto=format\&n=5NMMM4n0puUIh3u9\&q=85\&s=945d325f7e51ca41d8380a8ee571acbd) Rich text only renders in the **Table chart visualization**. It does not affect the Results panel below the explore, CSV/Excel exports, or the underlying data values. To see your `richText` take effect, switch the chart type to **Table**. `richText` is supported on both **dimensions** and **metrics**. It accepts Markdown, inline HTML, and [LiquidJS](https://liquidjs.com/) templating. HTML is sanitized with a GitHub-safe allowlist that permits inline `style` attributes but strips `