Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

docs - embedding parameters (#81977)

Jeff Bruemmer0b986c55f811
diff --git a/docs/embedding/chart.md b/docs/embedding/chart.md
index 47f658bc8fe..189c5ef5ea4 100644
--- a/docs/embedding/chart.md
+++ b/docs/embedding/chart.md
@@ -45,7 +45,7 @@ Three things need to happen: you publish the embed in Metabase, you paste the ch
4. For authentication, choose **Guest**, so your app won't need to log anyone in to your Metabase. An admin needs to [turn on guest embedding](./guest-embedding.md#turning-on-guest-embedding-in-metabase) first.
5. Click the **Publish** button. Publishing only applies to guest embeds.
6. Under behavior, Metabase gives you several options for customizing how the embed works. See [web component attributes](./question-reference.md#web-component-metabase-question-attributes) for what each one does. If you'd picked SSO in step 4, this is where you'd make the embed view-only by turning off drill-through.
-7. If you're embedding a SQL question with a variable, set the parameter to **Editable** or **Locked**. Parameters are **Disabled** by default, which hides them and prevents your server from setting them. See [Configuring parameters](./guest-embedding.md#configuring-parameters).
+7. If you're embedding a SQL question with a variable, set the parameter to **Editable** or **Locked**. Parameters are **Disabled** by default, which hides them and prevents your server from setting them. See [Parameters differ between guest and SSO embeds](./parameters.md#parameters-differ-between-guest-and-sso-embeds).
8. Customize the [appearance](./appearance.md).
9. Click the **Get code** button. You'll get both the frontend and backend code based on the selections you made in the wizard.
10. Copy the client code and paste it in your app.
@@ -127,7 +127,7 @@ const payload = {
const token = jwt.sign(payload, METABASE_SECRET_KEY);
```
-To get this code from the in-app wizard, set the `customer_id` parameter to **Locked** and publish the question. See [Locked parameters](./guest-embedding.md#locked-parameters).
+To get this code from the in-app wizard, set the `customer_id` parameter to **Locked** and publish the question. See [Locked parameters](./parameters.md#restrict-data-on-guest-embeds).
For all modular embeds, you can also set a `locale` in your page-level configuration to [translate embedded content](./translations.md).
@@ -247,7 +247,7 @@ Say you want to show each customer only their own orders. How you restrict the r
### Lock a parameter on a guest embed
-Embeds with **Guest** authentication can [lock a parameter](./guest-embedding.md#locked-parameters). Your app sets the parameter's value in the signed token on your server, so the filter is controlled by your app rather than by whoever's clicking around the page. They can't see the value, and they can't change it. An embed on a customer's account page returns that account's rows, whether or not Metabase has any idea who's looking at it.
+Embeds with **Guest** authentication can [lock a parameter](./parameters.md#restrict-data-on-guest-embeds). Your app sets the parameter's value in the signed token on your server, so the filter is controlled by your app rather than by whoever's clicking around the page. They can't see the value, and they can't change it. An embed on a customer's account page returns that account's rows, whether or not Metabase has any idea who's looking at it.
Locked parameters need a question written in SQL, with a [field filter or variable](../questions/native-editor/sql-parameters.md) to lock onto. Query builder questions have no parameters to lock, so segregate their data with permissions instead.
@@ -269,17 +269,9 @@ Embeds with **SSO** don't need to lock parameters. Since Metabase knows who's vi
## Control question parameters from your app
-To drive a question's parameters from your app's own code, pass values to its [SQL parameters](../questions/native-editor/sql-parameters.md) in the format `{parameter_name: parameter_value}`. Set the values once on load, or hold the values in your app and get a callback whenever they change. Holding the values in your app is what lets you build your own parameter widgets instead of using Metabase's.
+To drive a question's [SQL parameters](../questions/native-editor/sql-parameters.md) from your app's own code, pass values keyed by variable name. You can [set starting values](./parameters.md#set-starting-values) that people can still change, [hold the values in your app](./parameters.md#control-values-from-your-app) and get a callback whenever they change, and [hide Metabase's widgets](./parameters.md#hide-parameter-widgets) when your app supplies [its own filter UI](./parameters.md#build-your-own-filter-ui). Check out [Embedding parameters](./parameters.md) for all of it.
-For both the SDK props (`initialSqlParameters`, `sqlParameters`, and `onSqlParametersChange`) and the web component equivalents, see [Modular embedding parameters](./parameters.md).
-
-### Hide a parameter
-
-To hide a parameter from the question's UI, use the [`hidden-parameters`](./question-reference.md#web-component-metabase-question-attributes) attribute (web component) or the `hiddenParameters` prop (SDK). Both work in any modular embed, on any plan.
-
-In practice you'll reach for them on an [SSO embed](./introduction.md#components-with-sso-authentication), where every parameter on the question shows up by default. On a [guest embed](./guest-embedding.md#configuring-parameters), a parameter that you haven't set to **Editable** or **Locked** is already hidden, so the embed wizard won't generate `hidden-parameters` for you. You can still add the attribute by hand to hide a parameter you've made editable.
-
-Hiding a parameter declutters the UI; it doesn't restrict what people can query. Setting a value with `initial-sql-parameters` and then hiding the widget isn't a secure way to filter data, because your app sets that value in the browser. Instead, see [Show people only their own data](#show-people-only-their-own-data), or set [data permissions](../permissions/embedding.md).
+Your app sets these values in the browser, and people can change them, so they don't restrict what anyone can query. To restrict the data itself, see [Show people only their own data](#show-people-only-their-own-data).
## Let people set up alerts on a question
@@ -341,7 +333,8 @@ On the OSS and Starter plans, Metabase adds a "Powered by Metabase" banner to gu
- [Embed a dashboard](./dashboard.md)
- [Embed the query builder](./query-builder.md)
- [Appearance](./appearance.md)
-- [Modular embedding parameters](./parameters.md)
+- [Embedding parameters](./parameters.md)
+- [Parameters reference](./parameters-reference.md)
- [Translating embeds](./translations.md)
- [Guest embeds](./guest-embedding.md)
- [Authentication](./authentication.md)
diff --git a/docs/embedding/components.md b/docs/embedding/components.md
index 249f5af2a14..a88c4c95256 100644
--- a/docs/embedding/components.md
+++ b/docs/embedding/components.md
@@ -55,7 +55,8 @@ Web components cover the components above. A few features are React-only, becaus
- [Appearance](./appearance.md)
- [Configure your embeds](./config.md)
- [Config reference](./config-reference.md), for `defineMetabaseConfig()` settings and `MetabaseProvider` props
-- [Modular embedding parameters](./parameters.md)
+- [Embedding parameters](./parameters.md)
+- [Parameters reference](./parameters-reference.md)
- [Custom visualizations in embeds](./custom-visualizations.md)
- [Translating embeds](./translations.md)
- [Authentication](./authentication.md)
diff --git a/docs/embedding/dashboard-reference.md b/docs/embedding/dashboard-reference.md
index 22a6fe38aee..269d01f8da6 100644
--- a/docs/embedding/dashboard-reference.md
+++ b/docs/embedding/dashboard-reference.md
@@ -104,5 +104,6 @@ See [Customize the menu on dashboard cards](./dashboard.md#customize-the-menu-on
- [Embed the query builder](./query-builder.md)
- [Question component reference](./question-reference.md)
- [Modular embedding components](./components.md)
-- [Modular embedding parameters](./parameters.md)
+- [Embedding parameters](./parameters.md)
+- [Parameters reference](./parameters-reference.md)
- [Appearance](./appearance.md)
diff --git a/docs/embedding/dashboard.md b/docs/embedding/dashboard.md
index 369864e62cb..850d854c302 100644
--- a/docs/embedding/dashboard.md
+++ b/docs/embedding/dashboard.md
@@ -45,7 +45,7 @@ Three things need to happen: you publish the dashboard embed in Metabase, you pa
4. For authentication, choose **Guest**, so your app won't need to log anyone in to your Metabase. An admin needs to [turn on guest embedding](./guest-embedding.md#turning-on-guest-embedding-in-metabase) first.
5. Click the **Publish** button (publishing only applies to embeds with guest authentication).
6. Under **Behavior**, Metabase gives you several options for customizing how the embed works. See [web component attributes](./dashboard-reference.md#web-component-metabase-dashboard-attributes) for what each attribute does. With guest embeds, you can only control whether people can download the data. If you'd picked SSO in step 4, this is where you'd make the embed view-only by turning off drill-through.
-7. If your dashboard has filters, set each filter to **Editable** or **Locked**, or leave it as **Disabled**. Filters are disabled by default, which hides the filter and blocks both sides from setting it: your server can't pass a value for it in the JWT, and the person viewing can't change it in the UI. See [Configuring parameters](./guest-embedding.md#configuring-parameters).
+7. If your dashboard has filters, set each filter to **Editable** or **Locked**, or leave it as **Disabled**. Filters are disabled by default, which hides the filter and blocks both sides from setting it: your server can't pass a value for it in the JWT, and the person viewing can't change it in the UI. See [Parameters differ between guest and SSO embeds](./parameters.md#parameters-differ-between-guest-and-sso-embeds).
8. Customize the [appearance](./appearance.md).
9. Click the **Get code** button. You'll get both the frontend and backend code based on the selections you made in the wizard.
10. Copy the client code and paste it in your app.
@@ -145,7 +145,7 @@ Your endpoint has to return an object with a single `jwt` field. Return anything
Remember to check permissions! With guest authentication, your endpoint is the only thing deciding who gets a token for which dashboard. An endpoint that signs whatever `entityId` it's handed will give anyone signed in to your app a token for any published dashboard.
-For more on signing, check out [Locked parameters](./guest-embedding.md#locked-parameters) and the [example token endpoint](./guest-embedding.md#refreshing-or-initializing-the-jwt-from-your-server). To get the signing code from the in-app wizard, set the **Customer** filter to **Locked**. To see the whole thing running, check out our [sample apps](./securing-embeds.md#sample-apps).
+For more on signing, check out [Locked parameters](./parameters.md#restrict-data-on-guest-embeds) and the [example token endpoint](./guest-embedding.md#refreshing-or-initializing-the-jwt-from-your-server). To get the signing code from the in-app wizard, set the **Customer** filter to **Locked**. To see the whole thing running, check out our [sample apps](./securing-embeds.md#sample-apps).
For all modular embeds, you can also set a `locale` in your page-level configuration. Metabase translates its own UI automatically; to translate content strings like dashboard names and filter labels, upload a [translation dictionary](./translations.md).
@@ -376,7 +376,7 @@ Say you want to show each customer only their own numbers. How you restrict the
### Lock a filter on a guest embed
-Embeds with **Guest** authentication can [lock a filter](./guest-embedding.md#locked-parameters). Your app sets the filter's value in the signed token on your server, so the value comes from your app rather than from whoever's clicking around the page. They can't see the value, and they can't change it. An embed on a customer's account page returns that account's rows, whether or not Metabase has any idea who's looking at it.
+Embeds with **Guest** authentication can [lock a filter](./parameters.md#restrict-data-on-guest-embeds). Your app sets the filter's value in the signed token on your server, so the value comes from your app rather than from whoever's clicking around the page. They can't see the value, and they can't change it. An embed on a customer's account page returns that account's rows, whether or not Metabase has any idea who's looking at it.
Unlike a question, which needs a SQL variable to lock onto, any dashboard filter can be locked, including filters wired up to query builder questions. Set the filter to **Locked** in the dashboard's embed settings, then pass its value in the token:
@@ -392,7 +392,7 @@ const payload = {
const token = jwt.sign(payload, METABASE_SECRET_KEY);
```
-A locked filter also narrows the options in every editable filter on the same dashboard, the way [linked filters](../dashboards/filters.md#linking-filters) do. And if the locked filter feeds a SQL question anywhere on the dashboard, the token can carry only one value for it. See [Locked parameters](./guest-embedding.md#locked-parameters).
+A locked filter also narrows the options in every editable filter on the same dashboard, the way [linked filters](../dashboards/filters.md#linking-filters) do. And if the locked filter feeds a plain variable in a SQL question anywhere on the dashboard, pass one value (unless that query uses `{% raw %}IN ({{variable}}){% endraw %}`). See [Locked parameters](./parameters.md#restrict-data-on-guest-embeds).
### Use permissions on an SSO embed
@@ -400,11 +400,7 @@ Embeds with **SSO** don't need to lock filters. Since Metabase knows who's viewi
## Control dashboard filters from your app
-To drive a dashboard's filters from your app's own code, set their values from the page. The embedding APIs call these values parameters. See [Modular embedding parameters](./parameters.md) for the props, attributes, and events:
-
-- **Set a starting value** that people can still change, with `initial-parameters` (web component) or `initialParameters` (SDK).
-- **Hold the values in your app**, with `parameters` plus the `parameters-change` event (web component), or `onParametersChange` (SDK). Your app becomes the source of truth for the filter values, which is what lets you build your own filter widgets instead of using Metabase's.
-- **Hide Metabase's filter widgets** with `hidden-parameters` (web component) or `hiddenParameters` (SDK), for when your app supplies the filter UI. See [Hide a dashboard filter](./parameters.md#hide-a-dashboard-filter).
+To drive a dashboard's filters from your app's own code, set their values from the page. The embedding APIs call these values parameters. You can [set starting values](./parameters.md#set-starting-values) that people can still change, [hold the values in your app](./parameters.md#control-values-from-your-app) and get a callback when they change, and [hide Metabase's widgets](./parameters.md#hide-parameter-widgets) when your app supplies [its own filter UI](./parameters.md#build-your-own-filter-ui). Check out [Embedding parameters](./parameters.md) for all of it.
Your app sets these values in the browser, and people can change them, so they don't restrict what anyone can query. To restrict the data itself, see [Show people only their own data](#show-people-only-their-own-data).
@@ -552,7 +548,8 @@ On the OSS and Starter plans, Metabase adds a "Powered by Metabase" banner to gu
- [Embed a chart](./chart.md)
- [Embed the query builder](./query-builder.md)
- [Appearance](./appearance.md)
-- [Modular embedding parameters](./parameters.md)
+- [Embedding parameters](./parameters.md)
+- [Parameters reference](./parameters-reference.md)
- [Translating embeds](./translations.md)
- [Guest embeds](./guest-embedding.md)
- [Authentication](./authentication.md)
diff --git a/docs/embedding/guest-embedding.md b/docs/embedding/guest-embedding.md
index e15ea9e5c72..3e502f4559d 100644
--- a/docs/embedding/guest-embedding.md
+++ b/docs/embedding/guest-embedding.md
@@ -1,12 +1,17 @@
---
title: Guest embeds
summary: Embed questions, dashboards, and documents without requiring SSO.
+redirect_from:
+ - /docs/latest/embedding/static-embedding
+ - /docs/latest/embedding/signed-embedding
---
# Guest embeds
Guest embeds are a way to embed basic Metabase components in your app without requiring you to create a Metabase account for each person viewing the charts and dashboards. But not logging people in to your Metabase has some major tradeoffs: see [limitations](#guest-embed-limitations).
+> Looking for static embedding? It's [deprecated in favor of guest embeds](./introduction.md#static-embedding-is-deprecated).
+
"Guest" refers to the authentication approach: Metabase doesn't create a session for each person. Authentication has nothing to do with data freshness. Dashboards and charts in guest embeds always show live data from your database.
Even though you're not using SSO, guest embeds are still secure: Metabase will only load the embed if the request has a JWT signed with the secret shared between your app and your Metabase. The JWT also includes a reference to the resource to load (like the ID of the embedded item), and any values for parameters.
@@ -95,7 +100,7 @@ const payload = {
const token = jwt.sign(payload, METABASE_SECRET_KEY);
```
-Replace `YOUR_METABASE_SECRET_KEY` with your [embedding secret key](#regenerating-the-embedding-secret-key). These examples use sequential IDs — the number in the item's URL. On Pro and Enterprise plans, you can use [entity IDs](../installation-and-operation/serialization.md#entity-ids-work-with-embedding) instead; they stay the same when you [serialize](../installation-and-operation/serialization.md) content from one Metabase to another, like from staging to production.
+Replace `YOUR_METABASE_SECRET_KEY` with your [embedding secret key](#regenerating-the-embedding-secret-key). These examples use sequential IDs — the number in the item's URL. On Pro and Enterprise plans, you can use [entity IDs](../installation-and-operation/serialization.md#entity-ids-work-with-embedding) instead; they stay the same when you [serialize](../installation-and-operation/serialization.md) content from one Metabase to another, like from staging to production. To use an entity ID, replace the sequential ID in the `resource` map with the item's entity ID, like `resource: { dashboard: "YOUR_ENTITY_ID" }`. If you don't serialize your Metabase, either ID works.
### Component attributes
@@ -106,8 +111,9 @@ You can set different attributes to enable/disable UI. Here are some example att
| `token` | Required. The signed JWT token from your server. |
| `with-title` | Show or hide the title. Values: `"true"` or `"false"`. |
| `with-downloads`\* | Enable or disable downloads. Values: `"true"` or `"false"`. |
-| `initial-parameters` | JSON string of initial parameter values (uncontrolled). Example: `'{"category":["Gizmo"]}'`. See [Modular embedding parameters](./parameters.md#pass-parameter-values-to-embedded-components). |
-| `parameters` | JSON string of parameter values (controlled). Example: `'{"category":["Gizmo"]}'`. See [Modular embedding parameters](./parameters.md#pass-parameter-values-to-embedded-components). |
+| `initial-parameters` | JSON string of starting parameter values (uncontrolled). Example: `'{"category":["Gizmo"]}'`. See [Embedding parameters](./parameters.md#set-starting-values). |
+| `parameters` | JSON string of parameter values (controlled). Example: `'{"category":["Gizmo"]}'`. See [Embedding parameters](./parameters.md#control-values-from-your-app). |
+| `hidden-parameters` | JSON array of slugs whose widgets to hide. Only **Editable** parameters have a widget on a guest embed, so the wizard won't generate this for you. Hiding a widget doesn't restrict the value. See [Hide parameter widgets](./parameters.md#hide-parameter-widgets). |
| `auto-refresh-interval` | Dashboards only. Auto-refresh interval in seconds. |
| `custom-context` | Forwarded to your [`guestEmbedProviderUri`](#refreshing-or-initializing-the-jwt-from-your-server) endpoint as `customContext`. Either a string (e.g., `"gadgets-tab"`), or a JSON-stringified object like `initial-parameters` (e.g., `'{"tab":"gadgets","region":"us-east"}'`). |
@@ -121,198 +127,19 @@ Appearance settings available for guest embeds depend on your Metabase plan. If
## Configuring parameters
-Parameters are disabled by default, which also makes them hidden from end-users. You can configure each parameter to be:
-
-- **Disabled**: Hidden from end-users. Can't be set. This is the default.
-- **[Editable](#editable-parameters)**: End-users can see and modify the parameter values.
-- **[Locked](#locked-parameters)**: Hidden from end-users, set by your server (not the end-users) via the JWT.
-
-To configure parameters:
-
-1. Go to your embedded question or dashboard.
-2. Click the **Share** icon and select **Embed**.
-3. Under **Parameters**, select the visibility option for each parameter, and optionally default value(s).
-4. Click **Publish**.
-
-### Editable parameters
-
-When you set Editable parameters, you can set default values for the filters, but users can change these when viewing the question or dashboard.
-
-**Server code**
-
-On the server, you pass an empty `params` object:
-
-```javascript
-// you will need to install via 'npm install jsonwebtoken' or in your package.json
-
-const jwt = require("jsonwebtoken");
-
-const METABASE_SECRET_KEY = "YOUR_METABASE_SECRET_KEY";
-
-const payload = {
- resource: { dashboard: 10 },
- params: {},
- exp: Math.round(Date.now() / 1000) + 10 * 60, // 10 minute expiration
-};
-const token = jwt.sign(payload, METABASE_SECRET_KEY);
-```
-
-**Client code**
-
-You set default parameters on the client side with the `initial-parameters` key.
-
-```html
-<script defer src="YOUR_METABASE_URL/app/embed.js"></script>
-<script>
- function defineMetabaseConfig(config) {
- window.metabaseConfig = config;
- }
-</script>
-
-<script>
- defineMetabaseConfig({
- isGuest: true,
- instanceUrl: "YOUR_METABASE_URL",
- });
-</script>
-
-<!--
-This token is a placeholder. Don't paste a fixed JWT into your HTML: sign a
-fresh one on your server for each page load, or use guestEmbedProviderUri.
--->
-<metabase-dashboard
- token="YOUR SIGNED TOKEN"
- with-title="true"
- with-downloads="false"
- initial-parameters='{"category":["Doohickey","Gizmo"]}'
->
-</metabase-dashboard>
-```
-
-See [Modular embedding parameters](./parameters.md#pass-parameter-values-to-embedded-components) for controlled parameters documentation.
+Parameters on a guest embed start out **Disabled**: the widget is hidden, and nobody can set the value. When you publish the embed, you can make each one **Editable** (people see the widget and can change the value, and your page can set a starting value) or **Locked** (your server sets the value in the JWT, and nobody sees the widget). Check out [Parameters differ between guest and SSO embeds](./parameters.md#parameters-differ-between-guest-and-sso-embeds).
### Locked parameters
-Locked parameters let you filter data without exposing the filter to the end-user. Locking parameters is useful for restricting data based on who's viewing the embed (for example, showing each customer only their own data).
-
-![Locked parameters](./images/locked-parameters.png)
-
-To use locked parameters, you need to:
-
-1. Set the parameter to **Locked** in the embed settings.
-2. Include the parameter value in your JWT token on the server.
-3. Publish the item.
-
-Here's an example of the server and client code that Metabase will generate if you lock a "category" parameter:
-
-**Server code (Node.js)**
-
-You set the locked parameter on the server, passing it in the token.
-
-```javascript
-// Install via 'npm install jsonwebtoken'
-const jwt = require("jsonwebtoken");
-
-const METABASE_SECRET_KEY = "YOUR_METABASE_SECRET_KEY";
-
-const payload = {
- resource: { dashboard: 10 },
- params: {
- category: ["Gadget"], // Set the locked parameter value to Gadget
- },
- exp: Math.round(Date.now() / 1000) + 10 * 60, // 10 minute expiration
-};
-
-const token = jwt.sign(payload, METABASE_SECRET_KEY);
-```
-
-**Client code (HTML)**
-
-The parameter is set by the JWT:
-
-```html
-<script defer src="YOUR_METABASE_URL/app/embed.js"></script>
-<script>
- window.metabaseConfig = {
- isGuest: true, // Must be set to guest
- instanceUrl: "YOUR_METABASE_URL",
- };
-</script>
-
-<!--
-This token is a placeholder. Don't paste a fixed JWT into your HTML: sign a
-fresh one on your server for each page load, or use guestEmbedProviderUri.
--->
-<metabase-dashboard
- token="YOUR_JWT_TOKEN"
- with-title="true"
- with-downloads="false"
-></metabase-dashboard>
-```
-
-The end user won't see the "category" filter, but the dashboard will only show data for the "Gadget" category (or whatever you passed to the "category" array in the `params` object in the server payload you used to sign the JWT).
-
-## Updating a locked parameter
-
-Things to keep in mind if you need to make changes to your locked parameters.
-
-### Include all locked parameters in your JWT
-
-Once you publish a question or dashboard with a locked parameter, you _must_ include the name of the locked parameter in the `params` object when you sign the JWT. If you leave the parameter out, Metabase will refuse the request and log: `You must specify a value for :<parameter-name> in the JWT`. For example, if your locked parameter is `category`, the error will read `You must specify a value for :category in the JWT`.
+Locked parameters are how you restrict data in a guest embed. Your server puts the value in the `params` object of the token it signs, and Metabase applies the filter before anything reaches the browser.
-### Pass an empty array to turn off a locked parameter
-
-If you don't want the locked filter to apply for a given token, pass an empty array, `[]`, as the value for the parameter in the JWT:
-
-```javascript
-const payload = {
- resource: { dashboard: 10 },
- params: {
- category: [], // locked filter is bypassed for this token
- },
- exp: Math.round(Date.now() / 1000) + 10 * 60,
-};
-```
-
-This is handy when you want to reuse the same dashboard or question across contexts, and conditionally skip a locked filter in some of them.
-
-### Filter name should match the locked parameter name
-
-If you rename a dashboard filter that's used as a locked parameter, update the matching key in your JWT `params` object. Locked parameters that are connected to a [SQL variable](../questions/native-editor/sql-parameters.md) don't need to be renamed on the server.
-
-### Multiple locked parameters or multiple values
-
-The values for a locked parameter in your JWT should match your filter's values exactly. The best way to set multiple locked parameters, or pass multiple values to a single locked parameter, is to pick a filter value under **Preview locked parameters** in the embed wizard and copy the server code that Metabase generates.
-
-Multiple locked parameters combine with `AND`, not `OR`. If you only want to apply a subset of the locked parameters for a given token, pass `[]` for the ones you want to skip (see [pass an empty array](#pass-an-empty-array-to-turn-off-a-locked-parameter)).
-
-## Locked parameters limit the values available to other editable parameters
-
-Because locked parameters filter data _before_ the results are displayed in the embed, locked parameters also limit the values available to any editable filter widgets on the same item.
-
-For example, say you're embedding a dashboard with two filters, State and City. If you lock the State parameter with the value "Vermont", the City filter will only show cities in Vermont in its dropdown. You don't need to wire the filters together explicitly — they'll behave like [linked filters](../dashboards/filters.md#linking-filters).
-
-## Locked parameters on dashboards with SQL questions
-
-If a locked parameter is linked to a dashboard filter that's in turn linked to a SQL question, you'll only be able to pass a _single_ value for that locked parameter in the JWT.
-
-For example, if you have a dashboard filter called "Breakfast" with the values "Hash browns", "Muffin", and "Waffles", and the filter is linked to _any_ SQL question on the dashboard, you can only pass one of those options as the locked parameter value.
-
-## Using locked parameters to power custom widgets in your app
-
-Because Metabase doesn't render locked parameters as filter widgets, you can use them to power custom filter widgets that you build yourself. You may want to build your own filter widget(s) to:
-
-- Match the widget to the look and feel of your app.
-- Add custom logic, like remembering recently used values.
-- Reuse one dashboard in different ways in different parts of your app. For example, a sales dashboard that's locked by "region" in one place and by "team" in another.
-
-When the end-user changes a value in your custom widget, re-sign a new JWT on your server with the updated `params` and swap it onto the web component's `token` attribute. The embed will re-request the data with the new locked value.
-
-Render an initial token on the component for this flow, rather than letting [`guestEmbedProviderUri`](#refreshing-or-initializing-the-jwt-from-your-server) supply the first one. An embed that starts without a token fetches one from your endpoint on load, and that token would overwrite whatever your widget had just set.
+- For the walkthrough, check out [Restrict data on guest embeds](./parameters.md#restrict-data-on-guest-embeds).
+- For the rules Metabase applies to `params`, check out [Params in a signed token](./parameters-reference.md#params-in-a-signed-token).
+- To control a locked parameter from a widget you build yourself, check out [Change a locked value from your page](./parameters.md#change-a-locked-value-from-your-page).
## Refreshing or initializing the JWT from your server
-JWTs that you sign for guest embeds have an expiration (`exp`). Once a token expires, the embed can't load fresh data, and any filter selections the viewer made will reset on the next request. To keep the embed alive without reloading the page, you can configure a guest token endpoint on your server to hand out fresh JWTs on demand.
+JWTs that you sign for guest embeds have an expiration (`exp`). Once a token expires, the embed can't load fresh data. Swapping in a new token from your page reloads the embed. That resets any selections the viewer made in Metabase's widgets. Values your page holds in the [`parameters` attribute](./parameters.md#control-values-from-your-app) are applied again. To keep the embed alive without reloading the page, you can configure a guest token endpoint on your server to hand out fresh JWTs on demand.
The endpoint can serve two flows:
@@ -458,6 +285,14 @@ function paramsFor(user, customContext) {
}
```
+## Editing a published embed
+
+If you change an embed's settings in the wizard, like a parameter's visibility or its appearance:
+
+1. Click **Publish** again.
+2. Copy the code Metabase regenerates.
+3. Update your server and page code to match. If you locked a parameter, every token you sign now has to include a value for it.
+
## Disabling embedding for a question or dashboard
1. Visit the embeddable question or dashboard.
diff --git a/docs/embedding/introduction.md b/docs/embedding/introduction.md
index 13117917984..5539ce0c48e 100644
--- a/docs/embedding/introduction.md
+++ b/docs/embedding/introduction.md
@@ -55,7 +55,7 @@ All SSO options require a Pro or Enterprise plan.
| [Custom visualizations](./custom-visualizations.md) | ✅ | ❌ |
| [Usage analytics](../usage-and-performance-tools/usage-analytics.md) | ✅ | ❌ |
| Customize layouts and behavior with [plugins](./sdk/plugins.md) | ✅ | ❌ |
-| [Locked filters](./guest-embedding.md#locked-parameters)\*\*\* | ❌ | ✅ |
+| [Locked filters](./parameters.md#restrict-data-on-guest-embeds)\*\*\* | ❌ | ✅ |
\* Each authentication method allows data downloads by default, but only [Pro and Enterprise](https://www.metabase.com/pricing) plans can disable data downloads.
@@ -81,7 +81,7 @@ With [guest authentication](./guest-embedding.md), Metabase doesn't create a ses
Guest doesn't mean unsecured. Metabase only loads the component if the request carries a JWT signed with a secret shared between your app and your Metabase. What Metabase doesn't have is an identity: with no account to check permissions against, Metabase can't tell whether a new query is one that person should be allowed to run. That's why components with guest authentication are view-only.
-**When to use guest**: embedding charts and dashboards where you don't want to offer ad-hoc querying or chart drill-through. To filter data down to what's relevant to the person viewing, use [locked parameters](./guest-embedding.md#locked-parameters), where your app sets the filter value in the signed token.
+**When to use guest**: embedding charts and dashboards where you don't want to offer ad-hoc querying or chart drill-through. To filter data down to what's relevant to the person viewing, use [locked parameters](./parameters.md#restrict-data-on-guest-embeds), where your app sets the filter value in the signed token.
## Set up modular embeds with web components or React
@@ -102,6 +102,18 @@ If you'd like to share your data with the good people of the internet, admins ca
**When to use public links and embeds**: one-off charts and dashboards. Admins can use public links when you just need to show someone a chart or dashboard without giving people access to your Metabase. And you don't care who sees the data; you want to make the item available to everyone.
+## Static embedding is deprecated
+
+Static embeds (also called signed embeds) put a signed JWT in an iframe URL, like `/embed/dashboard/YOUR_JWT_TOKEN`. Static embedding is deprecated in favor of [guest embeds](./guest-embedding.md), which use the same secret key and the same signed token, but render a web component instead of an iframe.
+
+Existing static embeds keep working. For items published with static embedding, the embed modal still offers **Use static embedding instead**. Their hash parameters are the same as the ones for public embeds, which are listed in [Appearance parameters](./public-links.md#appearance-parameters). To put filter values in the URL, see [Parameters in iframe embeds](./parameters.md#parameters-in-iframe-embeds).
+
+To migrate a static embed to a guest embed:
+
+- Keep your server-side signing code. The token payload (`resource`, `params`, and `exp`) is the same.
+- Replace the iframe with a `<metabase-dashboard>` or `<metabase-question>` element, and pass the token in its `token` attribute, as shown in [Creating a guest embed](./guest-embedding.md#creating-a-guest-embed).
+- If you use an AI coding agent, give it the [Static → guest embeds skill](https://skillsmp.com/creators/metabase/agent-skills/skills-metabase-static-embedding-to-guest-embedding-upgrade), which walks through the migration. See also [AI agent resources](./ai-agent-resources.md).
+
## Resources for AI agents
If you're using an AI agent to help you embed Metabase in your app, check out [AI agent resources](./ai-agent-resources.md).
diff --git a/docs/embedding/modular-embedding.md b/docs/embedding/modular-embedding.md
index 15d9ddc399b..aafa5448f79 100644
--- a/docs/embedding/modular-embedding.md
+++ b/docs/embedding/modular-embedding.md
@@ -170,7 +170,7 @@ When you're creating a new embed using **Admin > Embedding > Setup guide > Embed
- **Allow people to save new questions**. If you embed the query builder (visual or SQL) but disable this option, people can still do their own explorations, they just won't be able to save them.
-- **Parameters**: for dashboard filters, SQL variables, and time grouping parameters, you can add default values. Default values set here override the default values set at the dashboard or question level. For dashboard filters and parameters, you can choose whether to hide the parameter.
+- **Parameters**: for dashboard filters, SQL variables, and time grouping parameters, you can add default values. Default values set here override the default values set at the dashboard or question level. For dashboard filters and parameters, you can choose whether to hide the parameter. Check out [Embedding parameters](./parameters.md#parameters-differ-between-guest-and-sso-embeds).
- **Show title**: what it says on the tin.
@@ -180,7 +180,7 @@ When you're creating a new embed using **Admin > Embedding > Setup guide > Embed
## Pass parameter values to embedded components
-See [Modular embedding parameters](./parameters.md#pass-parameter-values-to-embedded-components).
+Your page can [set starting values](./parameters.md#set-starting-values) for dashboard filters and SQL variables, [control them from your app](./parameters.md#control-values-from-your-app), and [hide their widgets](./parameters.md#hide-parameter-widgets).
## Page-level config
diff --git a/docs/embedding/parameters-reference.md b/docs/embedding/parameters-reference.md
new file mode 100644
index 00000000000..a9174801729
--- /dev/null
+++ b/docs/embedding/parameters-reference.md
@@ -0,0 +1,143 @@
+---
+title: Embedding parameters reference
+summary: "Which attribute or prop to use, the value formats each filter type accepts, the change callback payload, and the rules for params in a signed token."
+---
+
+# Embedding parameters reference
+
+Reference material for parameters in embedded dashboards and charts. For how to use all this, check out [Embedding parameters](./parameters.md).
+
+For each attribute's or prop's type and description, see:
+
+- [Dashboard component reference](./dashboard-reference.md)
+- [Question component reference](./question-reference.md)
+
+## Which props to use
+
+| What you want | On | Web component | React SDK |
+| ------------------- | ------------ | ----------------------------- | ----------------------- |
+| Starting values | Dashboard | `initial-parameters` | `initialParameters` |
+| | SQL question | `initial-sql-parameters` | `initialSqlParameters` |
+| Controlled values | Dashboard | `parameters` | `parameters` |
+| | SQL question | `sql-parameters` | `sqlParameters` |
+| Change notification | Dashboard | `parameters-change` event | `onParametersChange` |
+| | SQL question | `sql-parameters-change` event | `onSqlParametersChange` |
+| Hide widgets | Both | `hidden-parameters` | `hiddenParameters` |
+
+## Web component attribute parsing
+
+The parameter attributes take JSON: an object keyed by slug, or for `hidden-parameters`, an array of slugs.
+
+Attribute values are parsed as [JSON5](https://json5.org/), so single quotes, unquoted keys, and trailing commas all work. Only values that start with `{` or `[` are parsed as JSON. Other values stay strings, except `true`, `false`, and bare numbers, which become booleans and numbers. So wrap even a single slug in `hidden-parameters` in `[]`. Without the brackets, a dashboard embed won't render at all, and the console shows a `TypeError` rather than a message about the attribute. A question embed still renders, but it hides every parameter whose slug appears anywhere in the string. A value that starts with `{` or `[`, but that doesn't parse, stays a string, and Metabase logs an error.
+
+Changing `initial-parameters`, `initial-sql-parameters`, or `hidden-parameters` _after_ the embed has loaded re-renders the embed from scratch with the new values. Changing `parameters` or `sql-parameters` applies the new values and re-runs the queries, without re-rendering the embed from scratch.
+
+## Value formats by parameter type
+
+These formats apply wherever you pass a value: web component attributes, SDK props, and the `params` object in a [signed token](#params-in-a-signed-token).
+
+| Parameter type | Accepts | Examples |
+| ------------------ | ------------------------------------------------------------------------------------------ | ----------------------------------------- |
+| Text, category, ID | A string, or an array of strings for multi-select filters. | `"Gizmo"`, `["Gizmo", "Gadget"]` |
+| Number | A number, a numeric string, or an array of either. Two-element arrays for between filters. | `50`, `"50"`, `[10, 20]` |
+| Boolean | `true` or `false`, or the strings `"true"` and `"false"`. | `true` |
+| Date | A string in one of the formats below. | `"past30days"`, `"2024-01-01~2024-03-31"` |
+| Time grouping | A unit name. | `"month"`, `"week"`, `"quarter"` |
+
+To clear a filter, pass `null` for its slug. To reset it to its default, leave the slug out.
+
+The [change callback](#change-payload) hands values back as arrays: push `4` and you get `[4]`. Date and time grouping values are the exception and stay strings.
+
+A **Between** number filter takes a two-element array with the lower and upper bounds, like `[10, 20]`. This works when the dashboard filter is connected to a column in a query builder question, or to a [field filter](../questions/native-editor/field-filters.md) in a SQL question. It also works for a field filter on an embedded SQL question, if the field filter's widget type is **Between**.
+
+A **Between** filter doesn't work with a [plain SQL variable](../questions/native-editor/basic-sql-parameters.md): Metabase only lets you connect a plain number variable to a filter that uses **Equal to**, so a **Between** filter can't be connected to one at all. To filter a plain variable by a range, use two variables in the SQL, like `{% raw %}WHERE total BETWEEN {{min_total}} AND {{max_total}}{% endraw %}`, and connect each one to its own **Equal to** filter. Both variables need a value, or the query won't run. To let either end stay open, put each comparison in its own [optional clause](../questions/native-editor/optional-variables.md), like `{% raw %}WHERE TRUE [[AND total >= {{min_total}}]] [[AND total <= {{max_total}}]]{% endraw %}`.
+
+In the `params` of a signed token, `[10, null]` and `[null, 20]` give a between filter an open end. Through attributes and props, pass a closed range: the embed drops the `null` and applies the remaining number as a lower bound. So `[null, 20]` doesn't mean up to 20; it's applied as 20 and up. Pass `[0, 20]` instead.
+
+### Date formats
+
+The quickest way to get these values is to set the filter in Metabase and copy it from the address bar.
+
+| Format | Meaning |
+| ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
+| `2024-01-02` | A single day. Add a time with `2024-01-02T10:20:00`. |
+| `2024-04` | A whole month. |
+| `Q2-2024` | A whole quarter. |
+| `2024-01-02~2024-05-10` | A range, inclusive. Both ends can carry a time. |
+| `~2024-01-02` | Before that day. |
+| `2024-01-02~` | After that day. |
+| `today`, `yesterday` | That day. |
+| `thisday`, `thisweek`, `thismonth`, `thisquarter`, `thisyear` | The current unit. |
+| `lastday`, `lastweek`, `lastmonth`, `lastquarter`, `lastyear` | The previous unit. |
+| `past30days`, `past3months`, `past1years` | The last N units, not counting the current one. Units: `minutes`, `hours`, `days`, `weeks`, `months`, `quarters`, `years`. |
+| `past30days~` | Same, but including the current unit. |
+| `next7days`, `next7days~` | The next N units, with or without the current one. |
+| `past30days-from-2years` | The last 30 days, starting 2 years ago. Same for `next…-from-…`. |
+| `exclude-hours-0-23` | Exclude hours of the day, `0` through `23`. List each hour, separated by hyphens. |
+| `exclude-days-Mon-Sun` | Exclude days of the week, using `Mon` through `Sun`. |
+| `exclude-months-Jan-Dec` | Exclude months, using `Jan` through `Dec`. |
+| `exclude-quarters-1-4` | Exclude quarters, `1` through `4`. |
+
+A plain SQL date variable takes a single date, like `2024-01-02`, with an optional time. Every other format in this table needs a dashboard filter connected to a column, or a [field filter](../questions/native-editor/field-filters.md).
+
+In an embed, the filter widget shows no label for the `last…` values, but the filter still applies.
+
+## Change payload
+
+`onParametersChange` (SDK) and the `parameters-change` event (web component, as `event.detail`) both deliver the same object, a [`ParameterChangePayload`](./sdk/api/ParameterChangePayload.html). `parameters`, `defaultParameters`, and `lastUsedParameters` are each keyed by parameter slug and list every parameter on the item, with `null` where there's no value.
+
+| Field | What it holds |
+| -------------------- | -------------------------------------------------------------------------------- |
+| `parameters` | The values currently applied to the embed. |
+| `defaultParameters` | Each parameter's default value. |
+| `lastUsedParameters` | The values this person last applied on this dashboard. Dashboards only. |
+| `source` | Why the callback fired. See [When the callback fires](#when-the-callback-fires). |
+
+SQL questions deliver a [`SqlParameterChangePayload`](./sdk/api/SqlParameterChangePayload.html) through `onSqlParametersChange` or `sql-parameters-change`. It's the same object without `lastUsedParameters`.
+
+### When the callback fires
+
+The [`source`](./sdk/api/ParameterChangeSource.html) field says which of these happened:
+
+| `source` | Fires when |
+| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| `initial-state` | The embed finishes loading. Once per load. |
+| `manual-change` | Someone applies a value with one of Metabase's filter widgets. On a dashboard with auto-apply turned off, editing a widget doesn't count; clicking **Apply** does. |
+| `auto-change` | You pushed values and Metabase applied something different. The payload carries what was actually applied. |
+
+Metabase normalizes values before applying them, so `auto-change` usually means one of two things:
+
+- You pushed a bare value, and Metabase [stored it as an array](#value-formats-by-parameter-type). Pushing `[4]` fires nothing.
+- You left a slug out. A push replaces every value, so each slug you didn't include resolves to its default, or `null` if it has none, and `auto-change` reports it.
+
+## Params in a signed token
+
+On guest embeds, your server passes parameter values in the `params` object of the JWT it signs. What Metabase does with them depends on the visibility you chose for each parameter in the embed wizard. The error messages below are for a parameter with the slug `category`.
+
+| Wizard setting | Token sets it | Page sets it (`initial-parameters`, widget, or URL) | Widget shows |
+| -------------- | --------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ------------ |
+| **Disabled** | Rejected: `You're not allowed to specify a value for category.` | Rejected, same error. | No |
+| **Editable** | Allowed. The widget disappears for that token. | Allowed, unless the token also sets it: `You can't specify a value for category if it's already set in the JWT.` | Yes |
+| **Locked** | Required: `You must specify a value for :category in the JWT.` | Rejected: `You can only specify a value for category in the JWT.` | No |
+
+Metabase checks these rules when a card runs its query, not when the dashboard loads. A token that breaks one of these rules still renders the dashboard's frame and widgets, and each card shows the error in place of its chart. A token that Metabase can't accept at all, like one without `params`, with a bad signature, or that has expired, stops the whole embed from loading.
+
+Other rules:
+
+- Always include `params` (even just as `{}`). A token without params is rejected with `Token is missing value for keypath [:params]`.
+- A slug that isn't in the embed's published settings is rejected with `Unknown parameter category.` That includes a filter you added to the item after you last published the embed, so publish again after you add one.
+- Pass values as arrays, one element per value: `{ category: ["Gadget", "Gizmo"] }`. A bare value like `{ category: "Gadget" }` works too, but arrays behave consistently everywhere, including in the dropdown values of editable widgets.
+- For a locked filter connected to a plain variable in a SQL question, Metabase substitutes the values as a comma-separated list. That works inside `{% raw %}IN ({{variable}}){% endraw %}`, but after `=` it's a SQL error from your database, not a Metabase error. So, unless the query is written for a list, pass one element. To deal with several values, connect the filter to a [field filter](../questions/native-editor/field-filters.md) instead, which expands to `IN (...)` on its own, and wrap the tag in `[[ ]]` so `[]` turns the clause off.
+- An empty array, `[]`, means "no value" and turns the filter off for that token.
+- A blank string, `""`, or `null` counts as no value at all. On a locked parameter that's the same as leaving the parameter out, so the token is rejected.
+- Metabase substitutes token values into text cards on the server, so a [text card variable that's connected to the filter](../dashboards/filters.md#wiring-up-dashboard-filters-to-text-cards) shows the value even though the browser never receives it.
+
+For a walkthrough, check out [Restrict data on guest embeds](./parameters.md#restrict-data-on-guest-embeds). For how to sign and refresh the token, check out [Guest embeds](./guest-embedding.md).
+
+## Further reading
+
+- [Embedding parameters](./parameters.md)
+- [Dashboard component reference](./dashboard-reference.md)
+- [Question component reference](./question-reference.md)
+- [Guest embeds](./guest-embedding.md)
+- [Modular embedding components](./components.md)
diff --git a/docs/embedding/parameters.md b/docs/embedding/parameters.md
index b2771c3c71b..1c50fc54f3d 100644
--- a/docs/embedding/parameters.md
+++ b/docs/embedding/parameters.md
@@ -1,82 +1,84 @@
---
-title: Modular embedding parameters
-summary: Pass parameter values to embedded dashboards and SQL questions in modular embedding (React SDK and web components).
+title: Embedding parameters
+summary: "Set, control, hide, and lock dashboard filters and SQL variables in embedded dashboards and charts, with web components, the React SDK, or an iframe."
+redirect_from:
+ - /docs/latest/embedding/static-embedding-parameters
+ - /docs/latest/embedding/signed-embedding-parameters
---
-# Modular embedding parameters
+# Embedding parameters
-This page covers how to pass parameter values to embedded dashboards and SQL questions.
+This page covers how to pass parameter values to embedded dashboards and SQL questions in [modular embeds](./modular-embedding.md), with either the web components or the React SDK.
-The props and attributes here set values that whoever's viewing the embed can still change. To set a value your app controls and nobody can see or change, use a [locked parameter](./guest-embedding.md#locked-parameters) on a guest embed, or [data permissions](../permissions/embedding.md) on an SSO embed.
+If you're embedding with an iframe instead, check out [Parameters in iframe embeds](#parameters-in-iframe-embeds).
-## Modular embedding SDK (React)
+## Parameters differ between guest and SSO embeds
-### Pass parameter values to a dashboard
+Depending on which authentication method you pick for an embed, the embedding wizard will offer different parameter options:
-You can set initial values for embeds (uncontrolled), and optionally keep your app in sync with values as people change them (controlled). You can pick either `initialParameters` and `parameters`, but don't combine them.
+### SSO embed parameters
-#### `initialParameters` (uncontrolled)
+With **SSO** authentication, you can set a default value and choose whether to hide a parameter's widget. Your Metabase knows who's viewing, so [data permissions](../permissions/embedding.md) and [row and column security](../permissions/row-and-column-security.md) filter the rows for you.
-Set the filter values once on load. Your app won't know when people change filters in the dashboard. Pick this when you don't need to track those changes.
+### Guest embed parameters
-```typescript
-{% include_file "{{ dirname }}/snippets/parameters/dashboards/initial-parameters.tsx" snippet="example" %}
-```
-
-See [How parameter values are resolved](#how-parameter-values-are-resolved) for null / missing-slug semantics.
+With **guest** authentication, every parameter starts out **Disabled**, and for each parameter you can pick from:
-#### `parameters` + `onParametersChange` (controlled)
+- **Disabled**: no widget, and nobody can set a value.
+- **Editable**: the widget shows, people can change the value, and your page can set a [starting value](#set-starting-values).
+- **Locked**: no widget. Your server sets the value in the signed token. Check out [Restrict data on guest embeds](#restrict-data-on-guest-embeds).
-Push values from your app, and observe every applied change via `onParametersChange`. This works like a controlled `<input value onChange>`. Your app holds the source of truth, the dashboard re-renders when the prop changes, and you receive a callback whenever applied values change.
+You can't disable a filter that [always requires a value](../dashboards/filters.md#make-a-filter-or-parameter-required).
-```typescript
-{% include_file "{{ dirname }}/snippets/parameters/dashboards/controlled-parameters.tsx" snippet="example-controlled" %}
-```
+## Restrict data on guest embeds
-`onParametersChange` receives the [dashboard parameter change payload](#dashboard-parameter-change-payload).
+![Locked parameters](./images/locked-parameters.png)
-> Don't combine `initialParameters` and `parameters` - pick one. For controlled behavior, only use `parameters`.
+Say you want each customer to see only their own rows. On an embed with guest authentication, nobody's signed in to your Metabase, so permissions can't scope rows per person. Instead, you can lock the parameter: your server sets the parameter's value in the signed token, and Metabase applies the value before running anything. And because the value is set by the token, the viewer won't be able to change it.
-### Pass parameters to SQL questions
+### Lock a parameter
-You can pass [parameter](../questions/native-editor/sql-parameters.md) values to SQL questions in the format `{parameter_name: parameter_value}`. You can set initial values for embeds (uncontrolled), and optionally keep your app in sync with values as people change them (controlled).
+1. Visit the dashboard or question, click the **Share** icon, and select **Embed**.
+2. Under **Parameters**, set the parameter to **Locked**.
+3. Optional: pick a value under **Previewing locked parameters**. The wizard writes it into the server code it generates, so you can see the exact format Metabase expects.
+4. Click **Publish**.
+5. On your server, put the value in the `params` object when you sign the token:
-These props only work with SQL questions, not query-builder questions.
-
-#### `initialSqlParameters` (uncontrolled)
-
-Set the parameter values once on load. Your app won't know when people change parameters in the question. Pick this when you don't need to track those changes.
-
-```typescript
-{% include_file "{{ dirname }}/snippets/parameters/questions/initial-sql-parameters.tsx" snippet="example" %}
+```javascript
+{% include_file "{{ dirname }}/snippets/parameters/dashboards/locked-parameters-token.ts" snippet="example" %}
```
-See [How parameter values are resolved](#how-parameter-values-are-resolved) for null / missing-slug semantics.
+Then pass the token to the component, as the `token` attribute on `<metabase-dashboard>` or the `token` prop on `StaticDashboard` in the SDK, or have the embed fetch it from your server. The dashboard shows only customer 13's rows, with no **Customer ID** widget. On a legacy [static embed](./introduction.md#static-embedding-is-deprecated), the token goes in the iframe URL instead. For fetching and refreshing the token, check out [Guest embeds](./guest-embedding.md#refreshing-or-initializing-the-jwt-from-your-server).
-#### `sqlParameters` + `onSqlParametersChange` (controlled)
+Some notes on locked parameters:
-Push values from your app, and observe every applied change via `onSqlParametersChange`. This works like a controlled `<input value onChange>` - your app holds the source of truth, the question re-renders when the prop changes, and you receive a callback whenever applied values change.
+- **Every token has to include every locked parameter.** If you leave out a parameter, Metabase refuses the request. The dashboard still renders its frame and widgets, and each card shows `You must specify a value for :slug in the JWT.` in place of its chart.
+- **A locked value narrows the options in editable widgets.** Lock **State** to Vermont, and an editable **City** filter on the same dashboard only lists Vermont cities (like [linked filters](../dashboards/filters.md#linking-filters)).
+- **Multiple locked parameters combine with AND.**
+- **To turn a locked parameter off for a given token, pass `[]` as its value.** The token still has to name the parameter; the filter just doesn't apply.
+- **The key in `params` is the parameter's slug.** On a dashboard, that's the dashboard filter's slug, even when the filter is connected to a [SQL variable](../questions/native-editor/sql-parameters.md). If you rename a locked dashboard filter, update the key in your server code to match. On an embedded SQL question, the key is the variable's name: changing the widget's label doesn't affect it, but renaming the variable in the SQL does.
+- **A locked filter only restricts the cards it's connected to.** A dashboard filter with no connected cards still shows up in the wizard, still has to be in the token, but it won't do anything. The embed renders fine, so nothing in the browser tells you.
+- **Pass one value to a locked filter that's connected to a plain SQL variable.** Metabase substitutes several values as a comma-separated list, which only works if the query is written for one, like `{% raw %}IN ({{variable}}){% endraw %}`. To send several values, connect the filter to a [field filter](../questions/native-editor/field-filters.md) instead.
-```typescript
-{% include_file "{{ dirname }}/snippets/parameters/questions/controlled-sql-parameters.tsx" snippet="example-controlled" %}
-```
+See [params in a signed token](./parameters-reference.md#params-in-a-signed-token).
-`onSqlParametersChange` receives the [SQL question parameter change payload](#sql-question-parameter-change-payload).
+## Set starting values
-## Modular embedding (web components)
+To open an embed with some filters already applied, pass starting values keyed by slug. On a dashboard, people can still change them in the widgets. A SQL question in an SSO embed [doesn't show widgets for its variables](#hide-parameter-widgets), so there the starting values are the values people get.
-### Pass parameter values to embedded components
+Without starting values, an SSO embed of a dashboard opens with the values the signed-in person last applied to that dashboard, so two people can see different starting values. Pass starting values, or [controlled values](#control-values-from-your-app), when the embed should open the same way for everyone.
-You can set dashboard filters and SQL parameters from your page, push new values at runtime, and listen for applied changes.
+If instead you want your app to be able to push values, or see when people change a widget's values, use [controlled values](#control-values-from-your-app).
-#### Seed values once with `initial-parameters` / `initial-sql-parameters`
+- [Web component](#web-component-starting-values)
+- [React SDK](#react-sdk-starting-values)
-Set values on mount via attributes. The component reads them once on load and ignores any subsequent changes to the attribute. User widget edits are not reflected back to your page.
+### Web component starting values
```html
<metabase-dashboard
dashboard-id="1"
- initial-parameters='{"state": "NY"}'
+ initial-parameters='{"state": "NY", "category": ["Gadget", "Gizmo"]}'
></metabase-dashboard>
<metabase-question
@@ -85,108 +87,223 @@ Set values on mount via attributes. The component reads them once on load and ig
></metabase-question>
```
-These examples use sequential IDs — the number in the item's URL. On Pro and Enterprise plans, you can use [entity IDs](../installation-and-operation/serialization.md#entity-ids-work-with-embedding) instead; they stay the same when you [serialize](../installation-and-operation/serialization.md) content from one Metabase to another, like from staging to production.
+Changing the attribute after load reloads the embed and discards whatever people had picked.
-Attributes carry JSON. Pass an object whose keys are parameter slugs (dashboards) or SQL variable names (questions). See [How parameter values are resolved](#how-parameter-values-are-resolved) for null / missing-slug semantics.
+### React SDK starting values
-#### Push values at runtime with `parameters` / `sqlParameters`
+{% include plans-blockquote.html feature="Modular embedding SDK" sdk=true convert_pro_link_to_embedding=true %}
-For controlled behavior, set the JS property on the element instead of the attribute. The component re-renders to apply the new values.
+Dashboards take `initialParameters`:
-```html
-<metabase-dashboard id="my-dashboard" dashboard-id="1"></metabase-dashboard>
+```typescript
+{% include_file "{{ dirname }}/snippets/parameters/dashboards/initial-parameters.tsx" snippet="example" %}
+```
-<script>
- const el = document.getElementById("my-dashboard");
- el.parameters = { state: "NY" };
-</script>
+SQL questions take `initialSqlParameters`:
+
+```typescript
+{% include_file "{{ dirname }}/snippets/parameters/questions/initial-sql-parameters.tsx" snippet="example" %}
```
-The same pattern works for `metabase-question` via the `sqlParameters` property.
+## Control values from your app
+
+When your app needs to be the source of truth for filter values, use the `parameters` attribute on the web component or the `parameters` prop in the SDK (`sql-parameters` and `sqlParameters` for SQL questions). They work like a controlled `<input>` in React: you hold the values, the embed applies whatever you hand it, and it calls you back whenever someone changes the value in the filter widget. Use controlled values when you want to [build your own filter widgets](#build-your-own-filter-ui).
+
+> _Don't_ combine controlled values with starting values: if you pass both, the embed uses the controlled values and logs a warning to the console.
+
+Controlled values work with either authentication method. On a [guest embed](./guest-embedding.md), they apply to parameters you've set to **Editable** in the embed wizard. To restrict data rather than just set a value, [lock the parameter](#restrict-data-on-guest-embeds) instead.
+
+The [callback's payload](./parameters-reference.md#change-payload) includes the applied values, each parameter's default, and a `source` that says why it fired. For what each parameter type accepts, and how to clear or reset a value, see [Value formats by parameter type](./parameters-reference.md#value-formats-by-parameter-type).
+
+Metabase stores dashboard values as arrays and hands them back that way. Push arrays, like `{ min_rating: [4] }`, if you want the callback's payload to match what you sent. A bare value works too, but Metabase normalizes it and reports the change with `source: "auto-change"`.
-To switch a component back to uncontrolled mode (leaving the last applied values in place), set the property to `undefined`.
+- [Web component](#web-component-controlled-values)
+- [React SDK](#react-sdk-controlled-values)
-#### Clearing parameters
+### Web component controlled values
-To clear a single parameter, set its value to `null`. This strictly clears the parameter and ignores its default value.
+Set the value as an attribute. To catch edits people make in Metabase's widgets, listen for `parameters-change` on the element:
```html
+<metabase-dashboard
+ id="my-dashboard"
+ dashboard-id="1"
+ parameters='{"state": "NY"}'
+></metabase-dashboard>
+
<script>
const el = document.getElementById("my-dashboard");
- // `null` strictly clears the parameter (ignores its default).
- el.parameters = { ...el.parameters, state: null };
+
+ // Fires on load, when someone changes a widget, and when Metabase
+ // normalizes a value you pushed. `source` says which.
+ el.addEventListener("parameters-change", (event) => {
+ const { source, parameters } = event.detail;
+ console.log(source, parameters);
+ });
+
+ // Push a new value. The embed re-queries without reloading.
+ el.parameters = { state: "CA" };
</script>
```
-To clear every parameter, assign an empty object `{}`.
+For a SQL question, use the `sql-parameters` attribute or `sqlParameters` property on `<metabase-question>`, and listen for `sql-parameters-change`.
+
+To hand control back to the embed, assign `null` or `undefined` to the `parameters` or `sqlParameters` property. That removes the attribute and returns the element to uncontrolled mode. A dashboard keeps the last applied values. A SQL question reloads with its `initial-sql-parameters`, or with the variables' defaults if you haven't set any.
+
+### React SDK controlled values
+
+{% include plans-blockquote.html feature="Modular embedding SDK" sdk=true convert_pro_link_to_embedding=true %}
+
+Pair `parameters` with `onParametersChange`, and keep the values in state:
+
+```typescript
+{% include_file "{{ dirname }}/snippets/parameters/dashboards/controlled-parameters.tsx" snippet="example-controlled" %}
+```
+
+For SQL questions, pair `sqlParameters` with `onSqlParametersChange`:
+
+```typescript
+{% include_file "{{ dirname }}/snippets/parameters/questions/controlled-sql-parameters.tsx" snippet="example-controlled" %}
+```
+
+You must update your state from the callback. If you don't, the embed reverts to the values in your prop on the next render (which may wipe out edits people have made).
+
+## Hide parameter widgets
+
+On an [SSO embed](./introduction.md#components-with-sso-authentication), every dashboard filter shows a widget by default. To hide a filter's widget without disabling the filter, list its slug in `hidden-parameters` (web component) or `hiddenParameters` (SDK).
+
+SQL questions work differently. In an SSO embed, a SQL question doesn't show widgets for its variables, so there's nothing to hide: the values come from `initial-sql-parameters` or `sql-parameters`, or from the variables' defaults. On a guest embed, a SQL question shows a widget for each **Editable** variable, and `hidden-parameters` hides it. In the SDK, you can add the widgets to an SSO embed yourself with `InteractiveQuestion.SqlParametersList` in a [custom layout](./question-reference.md#customize-the-layout-of-an-interactive-chart), and `hiddenParameters` applies to that list too.
+
+On a [guest embed](./guest-embedding.md), only **Editable** parameters get a widget in the first place, so the embed wizard won't generate `hidden-parameters` for you. To remove a widget in a guest embed, set the parameter to **Disabled** or **Locked** in the wizard. You can still add `hidden-parameters` by hand to hide a widget for a parameter you've made editable.
+
+Hiding a widget doesn't restrict anything: the value is still set from the browser, which means that anyone can open the console to change the value. To restrict what people can query, [lock the parameter](#restrict-data-on-guest-embeds) on a guest embed, or use [permissions](../permissions/embedding.md) on an SSO embed.
+
+- [Web component](#web-component-hidden-widgets)
+- [React SDK](#react-sdk-hidden-widgets)
+
+### Web component hidden widgets
```html
-<script>
- const el = document.getElementById("my-dashboard");
- el.parameters = {};
-</script>
+<metabase-dashboard
+ dashboard-id="1"
+ initial-parameters='{"state": "NY"}'
+ hidden-parameters='["state"]'
+></metabase-dashboard>
+```
+
+### React SDK hidden widgets
+
+{% include plans-blockquote.html feature="Modular embedding SDK" sdk=true convert_pro_link_to_embedding=true %}
+
+```typescript
+{% include_file "{{ dirname }}/snippets/parameters/dashboards/hidden-parameters.tsx" snippet="example" %}
```
-#### Observe applied changes with `parameters-change` / `sql-parameters-change`
+The same prop works on `StaticQuestion` and `InteractiveQuestion`, wherever a SQL question shows variable widgets: on a guest embed, or in a custom layout that includes `SqlParametersList`.
-Listen for events to keep your page in sync with what's actually applied:
+## Build your own filter UI
+
+If Metabase's widgets don't fit your app, you can hide them and make your own. How you push values to the charts depends on what the parameter is for. If your widget just sets a value that anyone could set, control the value from the page. That works on SSO embeds and on guest embeds where the parameter is **Editable**.
+
+- [Editable parameters](#control-editable-parameters-from-your-own-widgets)
+- [Change a locked value from your page](#change-a-locked-value-from-your-page)
+
+### Control editable parameters from your own widgets
+
+Hold the values in your app with the [controlled props](#control-values-from-your-app), hide Metabase's widgets, and the embed re-queries whenever your widget changes the value. On a guest embed, the parameter has to be **Editable** in the embed wizard.
+
+#### Web component custom filter UI
+
+Push your widget's value with the `parameters` property, and hide Metabase's widget with `hidden-parameters`:
```html
-<metabase-dashboard id="my-dashboard" dashboard-id="1"></metabase-dashboard>
+<select id="state-picker">
+ <option value="NY">New York</option>
+ <option value="CA">California</option>
+</select>
+
+<metabase-dashboard
+ id="my-dashboard"
+ dashboard-id="1"
+ parameters='{"state": "NY"}'
+ hidden-parameters='["state"]'
+></metabase-dashboard>
<script>
const el = document.getElementById("my-dashboard");
- el.addEventListener("parameters-change", (event) => {
- const { source, parameters, defaultParameters, lastUsedParameters } =
- event.detail;
- console.log(source, parameters);
- });
+ document
+ .getElementById("state-picker")
+ .addEventListener("change", (event) => {
+ // Your widget owns the value. The embed re-queries without reloading.
+ el.parameters = { state: event.target.value };
+ });
</script>
```
-The `event.detail` carries the [dashboard parameter change payload](#dashboard-parameter-change-payload).
+#### React SDK custom filter UI
+
+Pass your widget's value in `parameters`, and hide Metabase's widget with `hiddenParameters`:
-For SQL questions, listen for `sql-parameters-change` on `<metabase-question>`. Its `event.detail` carries the [SQL question parameter change payload](#sql-question-parameter-change-payload).
+```typescript
+{% include_file "{{ dirname }}/snippets/parameters/dashboards/custom-filter-ui.tsx" snippet="example" %}
+```
-## How parameter values are resolved
+If you'd rather use Metabase's own widgets for a SQL question's variables, the SDK's `InteractiveQuestion.SqlParametersList` renders them wherever you put them in a [custom layout](./question-reference.md#customize-the-layout-of-an-interactive-chart). That's also the only way to get variable widgets on a SQL question in an SSO embed, since the default layout leaves them out.
-These rules apply to all four props — `initialParameters` / `parameters` (dashboards) and `initialSqlParameters` / `sqlParameters` (SQL questions) — and to the matching web component attributes (`initial-parameters`, `parameters`, etc.). For each parameter slug:
+### Change a locked value from your page
-- **Set a value**: Pass a `string` for a single-option filter, and an array of `string`s for multi-option filters.
-- **Clear a value:** Set to `null`: the parameter is cleared and its default is not used.
-- **Reset to the default value**: Omit a value (or set to `undefined`) and the embed will fall back to the parameter's default (or `null` if it has no default).
+Sometimes one viewer is allowed more than one value, but not every value. Say an account manager covers three customers. The **Customer ID** parameter has to stay locked so the manager can't query a fourth customer, but they still need to switch between their three. A widget on your page picks the customer, your server signs a new token with that value in `params`, and you hand the token to the component. The embed re-queries with the new locked value.
-## Dashboard parameter change payload
+Because the parameter is locked, your server should check that the viewer is allowed the value before it signs the new token. If the endpoint signs whatever value it's sent, anyone can request a token for any value, and the parameter is no safer than an editable parameter that you've [hidden](#hide-parameter-widgets).
-Delivered to `onParametersChange` (SDK) and as `event.detail` for the `parameters-change` event (web components).
+#### Web component re-signed token
-{% include_file "{{ dirname }}/sdk/api/snippets/ParameterChangePayload.md" snippet="properties" %}
+```html
+<!-- Render this token on your server for each page load. Don't let
+ guestEmbedProviderUri fetch the first one; see below. -->
+<metabase-dashboard
+ id="my-dashboard"
+ token="INITIAL_SIGNED_TOKEN"
+></metabase-dashboard>
-`source` indicates why the callback fired:
+<script>
+ async function onCustomerChange(customerId) {
+ // Your endpoint checks that this viewer may see `customerId`,
+ // then signs a token with params: { customer_id: [customerId] }
+ const response = await fetch(
+ `/api/metabase-token?customer_id=${encodeURIComponent(customerId)}`,
+ );
+ const { jwt } = await response.json();
+ document.getElementById("my-dashboard").setAttribute("token", jwt);
+ }
+</script>
+```
-- `initial-state` - first applied snapshot, fired once per dashboard load.
-- `manual-change` - user edited parameters in UI.
-- `auto-change` - in the case of auto-updates, e.g. to pass normalized values back to parent.
+Render the first token into the `token` attribute yourself rather than letting [`guestEmbedProviderUri`](./guest-embedding.md#refreshing-or-initializing-the-jwt-from-your-server) fetch it. An embed that starts without a token fetches one on load, and that token would overwrite the value your widget just set.
-## SQL question parameter change payload
+There are two endpoints in play, and only one of them gets the value your widget picked. The `/api/metabase-token` endpoint in the example is yours: it signs a token for a value your page passes. The [`guestEmbedProviderUri`](./guest-embedding.md#refreshing-or-initializing-the-jwt-from-your-server) endpoint, if you've set one, signs the token the embed fetches on its own: on load when there's no `token` attribute, and after the current token expires.
-Delivered to `onSqlParametersChange` (SDK) and as `event.detail` for the `sql-parameters-change` event (web components).
+Once the token expires, the embed asks the provider endpoint for a fresh one the next time it needs data, like when someone changes a filter. That request carries only the resource id and the `custom-context` attribute, not the value your widget picked. So unless the endpoint can work the value out on its own, from `custom-context` or from your app's session, the locked value snaps back to whatever the endpoint signs by default. Check out [Sending custom context](./guest-embedding.md#sending-custom-context) for the shape the provider endpoint receives.
-{% include_file "{{ dirname }}/sdk/api/snippets/SqlParameterChangePayload.md" snippet="properties" %}
+#### React SDK re-signed token
-`source` indicates why the callback fired:
+Hold the token in state, pass it to the `token` prop on `StaticDashboard`, and set `key={token}` so the component remounts when the token changes. Without the key, the new token is stored but the dashboard doesn't re-query. Guest token refresh with `guestEmbedProviderUri` isn't supported in the SDK, so the caveats in the web component section don't apply: your app is the only thing that sets the token, including when it expires. Guest embeds in the SDK need `isGuest: true` in the `MetabaseProvider` auth config, and a page can use only one authentication method. Check out [Using guest embeds with the SDK](./guest-embedding.md#using-guest-embeds-with-the-sdk).
-- `initial-state` - first applied state, fired once per question load.
-- `manual-change` - user edited parameters in UI.
-- `auto-change` - in the case of auto-updates, e.g. to pass normalized values back to parent.
+```typescript
+{% include_file "{{ dirname }}/snippets/parameters/dashboards/guest-locked-token.tsx" snippet="example" %}
+```
-## Hide a dashboard filter
+## Parameters in iframe embeds
-To hide a filter from the dashboard's UI, use the [`hidden-parameters`](./dashboard-reference.md#web-component-metabase-dashboard-attributes) attribute (web component) or the `hiddenParameters` prop (SDK).
+Everything above applies to [modular embeds](./modular-embedding.md). The iframe-based embeds set parameters through the URL instead:
-Hiding filters can be useful when you're embedding a dashboard with SSO authentication, where every filter on the dashboard shows up by default. On a [guest embed](./guest-embedding.md), a filter that you haven't set to **Editable** or **Locked** is already hidden, so there's usually nothing left to hide.
+- **[Public links and public embeds](./public-links.md#public-embed-parameters)**: add `?slug=value` to set a filter, and `#hide_parameters=slug` to hide its widget. Anyone can edit the URL, so these don't restrict data.
+- **[Static embeds](./introduction.md#static-embedding-is-deprecated)** (deprecated): same token and rules as guest embeds. Set a parameter to **Locked** and pass its value in `params`. Editable parameters get a widget in the iframe, and take starting values from the URL with the same syntax as public embeds. Hide a widget with `#hide_parameters=slug`, and set appearance with the same [hash parameters as public embeds](./public-links.md#appearance-parameters).
+- **[Full app embedding](./full-app-embedding.md)**: filter values go in the Metabase URL you load in the iframe, the same way as in Metabase itself.
-Hiding a filter declutters the UI; it doesn't restrict what people can query. Setting a value with `initial-parameters` and then hiding the widget isn't a secure way to filter data, because your app sets that value in the browser.
+## Further reading
-To control a value that people can't see or change, use a [locked parameter](./guest-embedding.md#locked-parameters) on a guest embed, or [data permissions](../permissions/embedding.md) on an SSO embed.
+- [Parameters reference](./parameters-reference.md)
+- [Guest embeds](./guest-embedding.md)
+- [Data isolation methods](../permissions/data-isolation-methods.md)
diff --git a/docs/embedding/public-links.md b/docs/embedding/public-links.md
index ac62862319a..1efec96d222 100644
--- a/docs/embedding/public-links.md
+++ b/docs/embedding/public-links.md
@@ -55,7 +55,7 @@ https://www.example.com/public/question/cf347ce0-90bb-4669-b73b-56c73edd10cb.csv
By default, Metabase will export the results of a question that include any formatting you added (for example, if you formatted a column with floats to display as a percentage (0.42 -> 42%)).
-See docs for the [export format endpoint](https://www.metabase.com/docs/latest/api#tag/apipublic/GET/api/public/card/{uuid}/query/{export-format}).
+See docs for the [export format endpoint](https://www.metabase.com/docs/latest/api#tag/apipublic/GET/api/public/card/{uuid}/query/{export-format}).
## Simulating drill-through with public links
@@ -96,6 +96,21 @@ To customize the appearance of your question or dashboard, you can update the li
Nobody signs in to view a public link or public embed, so a question that uses a [custom visualization](../questions/visualizations/custom.md) falls back to the default visualization for its results. To render custom visualizations, you'll need an authenticated [modular embed](./modular-embedding.md) with the visualization on your [allowlist](./custom-visualizations.md).
+## Resize a dashboard iframe to fit its content
+
+Dashboards are a fixed aspect ratio, so if you'd like the iframe to size itself vertically to fit the dashboard's contents, you can use the [iFrame Resizer](https://github.com/davidjbradshaw/iframe-resizer) script. Metabase serves a copy for convenience:
+
+```html
+<script src="{your-metabase-url}/app/iframeResizer.js"></script>
+
+<iframe
+ src="https://metabase.example.com/public/dashboard/YOUR_PUBLIC_UUID"
+ onload="iFrameResize({}, this)"
+></iframe>
+```
+
+Due to iframe-resizer's licensing changes, we recommend that you use iframe-resizer version 4.3.2 or lower. The same script works on legacy [static embeds](./introduction.md#static-embedding-is-deprecated).
+
## Public embed parameters
To apply appearance or filter settings to your public embed, you can add parameters to the end of the link in your iframe's `src` attribute.
@@ -106,9 +121,64 @@ If you'd like to create a secure embed that prevents people from changing filter
## Appearance parameters
-To toggle appearance settings, add _hash_ parameters to the end of the public link in your iframe's `src` attribute.
+To toggle appearance settings, add _hash_ parameters to the end of the public link in your iframe's `src` attribute. For example, this link shows a dashboard in dark mode, without a border, and with its title:
+
+```
+your_public_link#theme=night&bordered=false&titled=true
+```
+
+Separate multiple hash parameters with an ampersand (`&`). Query parameters for [filters](#filter-parameters) go before the `#`.
+
+| Parameter name | Possible values |
+| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `background` | `true` (default), `false`. Dashboards only. |
+| `bordered` | `true` (default), `false`. |
+| `locale`\* | E.g., `ko`. See [list of locales](../configuring-metabase/localization.md#supported-languages) |
+| `titled` | `true` (default), `false`. |
+| `theme` | `null` (default), `night`. `theme=transparent` should work, but is deprecated (see [Transparent backgrounds](#transparent-backgrounds-for-embeds)) |
+| `refresh` | integer (seconds, e.g., `refresh=60`). Dashboards only. |
+| `font`\* | [font name](../configuring-metabase/fonts.md) |
+| `downloads`\*\* | `true` (default), `false`, `results`, `pdf` |
+
+\* Available on [Pro](https://www.metabase.com/product/pro) and [Enterprise](https://www.metabase.com/product/enterprise) plans
+
+\*\* Disabling downloads is available on [Pro](https://www.metabase.com/product/pro) and [Enterprise](https://www.metabase.com/product/enterprise) plans.
+
+The same hash parameters work on legacy [static embeds](./introduction.md#static-embedding-is-deprecated). For global appearance settings, such as the colors and fonts used across your entire Metabase instance, see [Customizing Metabase's appearance](../configuring-metabase/appearance.md).
-See [appearance parameters](./static-embedding-parameters.md#customizing-the-appearance-of-a-static-embed).
+### Set the language for a public or static embed
+
+{% include plans-blockquote.html feature="Locales for embeds" %}
+
+To change the UI language, set the `locale` hash parameter to one of the [supported locales](../configuring-metabase/localization.md#supported-languages). For example, to set a public dashboard's language to Korean, append `#locale=ko`:
+
+```
+https://metabase.example.com/public/dashboard/7b6e347b-6928-4aff-a56f-6cfa5b718c6b?category=&city=&state=#locale=ko
+```
+
+The `locale` parameter changes the language for Metabase UI elements, like the label of the **Export to PDF** button. To change the _content_'s language (like names of questions and dashboards), you'll need to [upload a translation dictionary](./translations.md).
+
+### Transparent backgrounds for embeds
+
+Making an embed transparent depends on what you're embedding:
+
+- Dashboards: set `background=false`. You can combine it with `theme` (e.g., `background=false&theme=night`).
+- Questions: set `theme=transparent` (deprecated, but still supported).
+
+### Disable downloads for an embedded question or dashboard
+
+{% include plans-blockquote.html feature="Disabling downloads" %}
+
+By default, Metabase includes a **Download** button on embedded questions, and an **Export to PDF** option on embedded dashboards. The `downloads` hash parameter controls them:
+
+- `true` (default): include both the Download and Export to PDF options.
+- `false`: hide both the Download and Export to PDF options.
+- `results`: show the Download option.
+- `pdf`: show the Export to PDF option (dashboards only).
+
+You can combine the explicit options: `downloads=results,pdf` is the same as `downloads=true`.
+
+The `downloads` parameter replaces the legacy `hide_download_button` parameter.
## Filter parameters
@@ -144,12 +214,28 @@ You can hide multiple filter widgets by separating the filter names with commas,
/dashboard/42#hide_parameters=id,customer_name
```
+To pass several values to a multi-select filter, repeat it:
+
+```
+/dashboard/42?category=Gadget&category=Gizmo
+```
+
Note that the name of the filter in the URL should be specified in lower case, and with underscores instead of spaces. If your filter is called "Filter for User ZIP Code", you'd write:
```
/dashboard/42?filter_for_user_zip_code=02116
```
+Values are passed to your database as typed, so they're case-sensitive and have to match your data. URL-encode values that contain spaces or other special characters, like `Hash%20browns`. For the date formats a date filter accepts, check out the [Parameters reference](./parameters-reference.md#date-formats).
+
+For filter values that people can't remove from the URL, check out [locked parameters](./parameters.md#restrict-data-on-guest-embeds) on a guest or static embed.
+
+### Maximum URL length
+
+The maximum length of an embedding URL (including all parameters) is determined by your [`MB_JETTY_REQUEST_HEADER_SIZE`](../configuring-metabase/environment-variables.md#mb_jetty_request_header_size) environment variable. When it's unset, Metabase's web server defaults to 8192 bytes.
+
+If your URL exceeds the maximum header size, the request fails with an HTTP `414 URI Too Long` response before it reaches Metabase, so nothing shows up in Metabase's log. You can set the environment variable to accept larger headers. If you're using a proxy server, you may need to set a corresponding property on the server as well.
+
## Disable public sharing
Public sharing is enabled by default.
diff --git a/docs/embedding/question-reference.md b/docs/embedding/question-reference.md
index f7b4c176085..ca64fe3ab3f 100644
--- a/docs/embedding/question-reference.md
+++ b/docs/embedding/question-reference.md
@@ -100,5 +100,6 @@ These components are available via the `InteractiveQuestion` namespace (like `<I
- [Embed the query builder](./query-builder.md)
- [Dashboard component reference](./dashboard-reference.md)
- [Modular embedding components](./components.md)
-- [Modular embedding parameters](./parameters.md)
+- [Embedding parameters](./parameters.md)
+- [Parameters reference](./parameters-reference.md)
- [Appearance](./appearance.md)
diff --git a/docs/embedding/securing-embeds.md b/docs/embedding/securing-embeds.md
index a26ecced34b..fa475397850 100644
--- a/docs/embedding/securing-embeds.md
+++ b/docs/embedding/securing-embeds.md
@@ -89,8 +89,8 @@ If you want an easier way to embed different views of data for different custome
This diagram illustrates how an embed gets secured by a signed JWT:
-1. **Visitor arrives**: your frontend gets a request to display a Metabase [embedding URL](./static-embedding.md#adding-the-embedding-url-to-your-website).
-2. **Signed request**: your backend generates a Metabase embedding URL with a [signed JWT](./guest-embedding.md#how-guest-embedding-works). The signed JWT should encode any query [parameters](./static-embedding-parameters.md) you're using to filter your data.
+1. **Visitor arrives**: your frontend gets a request to display a Metabase [embed](./guest-embedding.md#creating-a-guest-embed).
+2. **Signed request**: your backend generates a Metabase embedding URL with a [signed JWT](./guest-embedding.md#how-guest-embedding-works). The signed JWT should encode any [locked parameters](./parameters.md#restrict-data-on-guest-embeds) you're using to filter your data.
3. **Response**: your Metabase backend returns data based on the query parameters encoded in the signed JWT.
4. **Success**: your frontend displays the embedded Metabase page with the correct data.
5. **(Optional) Refresh / Initialize**: if you've configured a [`guestEmbedProviderUri`](./guest-embedding.md#refreshing-or-initializing-the-jwt-from-your-server), the embed will call that endpoint you've set up for a fresh token the next time the embed needs to make a data request after the current token has expired (like when someone changes the filter value). The embed won't automatically fetch a new token. The endpoint can also serve the first token on load, so you can use the endpoint to revoke access by refusing to issue a new token.
@@ -121,7 +121,7 @@ https://my-metabase.com/public/dashboard/184f819c-2c80-4b2d-80f8-26bffaae5d8b?st
| 2 | Basic | Active |
| 5 | Premium | Active |
-With guest embeds, we can "lock" the filter by encoding the query parameter in a signed JWT. For example, say we set up the "Status = Active" filter as a [locked parameter](./static-embedding-parameters.md#restricting-data-in-a-static-embed-with-locked-parameters). The `?status=active` query parameter will be encoded in the signed JWT, so it won't be visible or editable from the guest embedding URL:
+With guest embeds, we can "lock" the filter by encoding the query parameter in a signed JWT. For example, say we set up the "Status = Active" filter as a [locked parameter](./parameters.md#restrict-data-on-guest-embeds). The `?status=active` query parameter will be encoded in the signed JWT, so it won't be visible or editable from the guest embedding URL:
```plaintext
https://my-metabase.com/dashboard/your_signed_jwt
@@ -149,8 +149,8 @@ Let's say that we want to expose the Accounts table to our customers, so that cu
If we want to avoid creating a Metabase login for each of our customers, we'll need:
-- An [embeddable dashboard](./static-embedding.md#making-a-question-or-dashboard-embeddable) with the Accounts data.
-- A [locked parameter](./static-embedding-parameters.md) for the Account ID filter.
+- An [embeddable dashboard](./guest-embedding.md#creating-a-guest-embed) with the Accounts data.
+- A [locked parameter](./parameters.md#restrict-data-on-guest-embeds) for the Account ID filter.
- A login flow in our embedding application (the web app where we want to embed Metabase).
The flow might look something like this:
diff --git a/docs/embedding/snippets/parameters/dashboards/controlled-parameters.tsx b/docs/embedding/snippets/parameters/dashboards/controlled-parameters.tsx
index 3f65498c418..aca82826db1 100644
--- a/docs/embedding/snippets/parameters/dashboards/controlled-parameters.tsx
+++ b/docs/embedding/snippets/parameters/dashboards/controlled-parameters.tsx
@@ -16,7 +16,7 @@ const ExampleControlled = () => {
const handleParametersChange = (payload: ParameterChangePayload) => {
// Sync your local state on every applied change. `payload.source` is one of:
// "initial-state" — post-load snapshot, fired once per dashboard load
- // "manual-change" — user edited a parameter widget
+ // "manual-change" — someone changed a filter widget
// "auto-change" — your push was normalized; re-sync from `payload.parameters`
setParameters(payload.parameters);
};
@@ -31,22 +31,4 @@ const ExampleControlled = () => {
// [<endsnippet example-controlled>]
};
-const ExampleClearOne = () => (
- // [<snippet example-clear-one>]
- // Setting a parameter to `null` clears it (ignores the parameter's default).
- // Missing slugs fall back to `parameter.default ?? null`.
- <InteractiveDashboard
- dashboardId={dashboardId}
- parameters={{ state: null, city: "Austin" }}
- />
- // [<endsnippet example-clear-one>]
-);
-
-const ExampleClearAll = () => (
- // [<snippet example-clear-all>]
- // Pass an empty object to clear every parameter.
- <InteractiveDashboard dashboardId={dashboardId} parameters={{}} />
- // [<endsnippet example-clear-all>]
-);
-
-export { ExampleControlled, ExampleClearOne, ExampleClearAll };
+export { ExampleControlled };
diff --git a/docs/embedding/snippets/parameters/dashboards/custom-filter-ui.tsx b/docs/embedding/snippets/parameters/dashboards/custom-filter-ui.tsx
new file mode 100644
index 00000000000..dbef453e59a
--- /dev/null
+++ b/docs/embedding/snippets/parameters/dashboards/custom-filter-ui.tsx
@@ -0,0 +1,28 @@
+import { InteractiveDashboard } from "@metabase/embedding-sdk-react";
+import { useState } from "react";
+
+const dashboardId = 1;
+
+const Example = () => {
+ // [<snippet example>]
+ // Your widget owns the value. Metabase's State widget stays hidden.
+ const [state, setState] = useState("NY");
+
+ return (
+ <>
+ <select value={state} onChange={(event) => setState(event.target.value)}>
+ <option value="NY">New York</option>
+ <option value="CA">California</option>
+ </select>
+
+ <InteractiveDashboard
+ dashboardId={dashboardId}
+ parameters={{ state }}
+ hiddenParameters={["state"]}
+ />
+ </>
+ );
+ // [<endsnippet example>]
+};
+
+export { Example };
diff --git a/docs/embedding/snippets/parameters/dashboards/guest-locked-token.tsx b/docs/embedding/snippets/parameters/dashboards/guest-locked-token.tsx
new file mode 100644
index 00000000000..e00cdf33ad1
--- /dev/null
+++ b/docs/embedding/snippets/parameters/dashboards/guest-locked-token.tsx
@@ -0,0 +1,37 @@
+import { StaticDashboard } from "@metabase/embedding-sdk-react";
+import { useState } from "react";
+
+// The MetabaseProvider on this page needs `isGuest: true` in its authConfig.
+const INITIAL_SIGNED_TOKEN = "YOUR_SIGNED_TOKEN";
+
+const Example = () => {
+ // [<snippet example>]
+ // Render the first token yourself, for example from your server-rendered page props.
+ const [token, setToken] = useState(INITIAL_SIGNED_TOKEN);
+
+ async function onCustomerChange(customerId: string) {
+ // Your endpoint checks that this viewer may see `customerId`,
+ // then signs a token with params: { customer_id: [customerId] }
+ const response = await fetch(
+ `/api/metabase-token?customer_id=${encodeURIComponent(customerId)}`,
+ );
+ const { jwt } = await response.json();
+ setToken(jwt);
+ }
+
+ return (
+ <>
+ <select onChange={(event) => onCustomerChange(event.target.value)}>
+ <option value="13">Customer 13</option>
+ <option value="14">Customer 14</option>
+ <option value="15">Customer 15</option>
+ </select>
+
+ {/* `key` remounts the dashboard when the token changes, so it re-queries with the new locked value. */}
+ <StaticDashboard key={token} token={token} />
+ </>
+ );
+ // [<endsnippet example>]
+};
+
+export { Example };
diff --git a/docs/embedding/snippets/parameters/dashboards/hidden-parameters.tsx b/docs/embedding/snippets/parameters/dashboards/hidden-parameters.tsx
new file mode 100644
index 00000000000..f0a0b8e72e1
--- /dev/null
+++ b/docs/embedding/snippets/parameters/dashboards/hidden-parameters.tsx
@@ -0,0 +1,15 @@
+import { InteractiveDashboard } from "@metabase/embedding-sdk-react";
+
+const dashboardId = 1;
+
+const Example = () => (
+ // [<snippet example>]
+ <InteractiveDashboard
+ dashboardId={dashboardId}
+ initialParameters={{ state: "NY" }}
+ hiddenParameters={["state"]}
+ />
+ // [<endsnippet example>]
+);
+
+export { Example };
diff --git a/docs/embedding/snippets/parameters/dashboards/locked-parameters-token.ts b/docs/embedding/snippets/parameters/dashboards/locked-parameters-token.ts
new file mode 100644
index 00000000000..d6e26555f9c
--- /dev/null
+++ b/docs/embedding/snippets/parameters/dashboards/locked-parameters-token.ts
@@ -0,0 +1,19 @@
+// [<snippet example>]
+// Install via 'npm install jsonwebtoken'
+import jwt from "jsonwebtoken";
+
+const METABASE_SECRET_KEY = "YOUR_METABASE_SECRET_KEY";
+
+const payload = {
+ resource: { dashboard: 10 },
+ params: {
+ // Keyed by slug. Values are arrays. Set this from your app's session, not from the page.
+ customer_id: [13],
+ },
+ exp: Math.round(Date.now() / 1000) + 10 * 60, // 10 minute expiration
+};
+
+const token = jwt.sign(payload, METABASE_SECRET_KEY);
+// [<endsnippet example>]
+
+export { token };
diff --git a/docs/embedding/snippets/parameters/questions/controlled-sql-parameters.tsx b/docs/embedding/snippets/parameters/questions/controlled-sql-parameters.tsx
index 761ed732cc1..9895143b1bd 100644
--- a/docs/embedding/snippets/parameters/questions/controlled-sql-parameters.tsx
+++ b/docs/embedding/snippets/parameters/questions/controlled-sql-parameters.tsx
@@ -16,7 +16,7 @@ const ExampleControlled = () => {
const handleSqlParametersChange = (payload: SqlParameterChangePayload) => {
// Sync your local state on every applied change. `payload.source` is one of:
// "initial-state" — post-load snapshot, fired once per question load
- // "manual-change" — user edited a parameter widget
+ // "manual-change" — someone changed a filter widget
// "auto-change" — your push was normalized; re-sync from `payload.parameters`
setSqlParameters(payload.parameters);
};
@@ -31,14 +31,4 @@ const ExampleControlled = () => {
// [<endsnippet example-controlled>]
};
-const ExampleClear = () => (
- // [<snippet example-clear>]
- // Setting a SQL parameter to `null` clears it (ignores the parameter's default).
- <InteractiveQuestion
- questionId={questionId}
- sqlParameters={{ state: null }}
- />
- // [<endsnippet example-clear>]
-);
-
-export { ExampleControlled, ExampleClear };
+export { ExampleControlled };
diff --git a/docs/embedding/snippets/parameters/questions/initial-sql-parameters.tsx b/docs/embedding/snippets/parameters/questions/initial-sql-parameters.tsx
index 5ef24b88777..588f63a80e4 100644
--- a/docs/embedding/snippets/parameters/questions/initial-sql-parameters.tsx
+++ b/docs/embedding/snippets/parameters/questions/initial-sql-parameters.tsx
@@ -10,3 +10,5 @@ const Example = () => (
/>
// [<endsnippet example>]
);
+
+export { Example };
diff --git a/docs/embedding/start.md b/docs/embedding/start.md
index d64658164af..d985162689f 100644
--- a/docs/embedding/start.md
+++ b/docs/embedding/start.md
@@ -28,7 +28,7 @@ Jump to a SDK quickstart with a sample React application.
### [Modular embedding components](./components.md)
-A map of the components you can embed, with links to each component's docs and its attribute and prop reference.
+A map of the components you can embed, with links to each component's docs.
### [Embed a dashboard](./dashboard.md)
@@ -62,6 +62,14 @@ Every `<metabase-browser>` attribute and the `CollectionBrowser` props.
Embed an AI chat with web components or the React SDK, so people can ask questions of their data in natural language.
+### [Embedding parameters](./parameters.md)
+
+Set, control, hide, and lock dashboard filters and SQL variables in embedded dashboards and charts, with web components or the React SDK.
+
+### [Parameters reference](./parameters-reference.md)
+
+Which attribute or prop to use for each task, how web components parse parameter attributes, the value formats each filter type accepts, and the rules for params in a signed token.
+
### [Configure your embeds](./config.md)
Set the configuration that every embed on a page shares, like your Metabase URL, authentication, language, and theme, with web components or the React SDK.
diff --git a/docs/embedding/static-embedding-parameters.md b/docs/embedding/static-embedding-parameters.md
deleted file mode 100644
index bbcb3920a53..00000000000
--- a/docs/embedding/static-embedding-parameters.md
+++ /dev/null
@@ -1,212 +0,0 @@
----
-title: Parameters for static embeds
-summary: Using parameters to customize embedded static questions and dashboards.
-redirect_from:
- - /docs/latest/embedding/signed-embedding-parameters
----
-
-# Parameters for static embeds
-
-Also known as: parameters for signed embeds, or standalone embeds.
-
-Parameters are pieces of information that are passed between Metabase and your website via the [embedding URL](./static-embedding.md#adding-the-embedding-url-to-your-website). You can use parameters to specify how Metabase items should look and behave inside the iframe on your website.
-
-## Types of parameters
-
-Parameters can be signed or unsigned.
-
-### Signed parameters
-
-Signed parameters, such as filter names and values, must be added to your server code.
-
-- [Editable parameters](#adding-a-filter-widget-to-a-static-embed)
-- [Locked parameters](#restricting-data-in-a-static-embed-with-locked-parameters)
-
-### Unsigned parameters
-
-Unsigned parameters, such as appearance settings, should be added directly to your iframe's `src` attribute.
-
-- [Default values for editable parameters](#populating-an-embedded-filter-widget-with-a-default-value)
-- [Visibility settings for editable parameters](#hiding-filter-widgets-from-a-static-embed)
-- [Appearance settings](#customizing-the-appearance-of-a-static-embed)
-
-## Adding a filter widget to a static embed
-
-You can use **editable parameters** to add [filter widgets](https://www.metabase.com/glossary/filter-widget) to embedded dashboards or SQL questions.
-
-1. Go to your dashboard or SQL question. Make sure you've set up a [dashboard filter](../dashboards/filters.md) or [SQL variable](../questions/native-editor/sql-parameters.md).
-2. Click on the **Share** icon > **Embed this item in an application**.
-3. Under **Parameters**, you'll find the names of your dashboard filters or SQL variables.
-4. Select **Editable** for each parameter that should get a filter widget on your embed.
-5. Click **Publish** to save your changes.
-6. Add or update the code on your server to [match the code generated by Metabase](./static-embedding.md#previewing-the-code-for-an-embed).
-
-Editable parameters are responsible for passing filter values from the embedded filter widget (displayed on the iframe) through to the filters on your original dashboard or SQL question (in your Metabase).
-
-### You can't disable parameters when the original question or dashboard requires a value
-
-If the filter on a dashboard or question is set to [Always require a value](../dashboards/filters.md), you won't be able to disable the parameter when embedding.
-
-## Populating an embedded filter widget with a default value
-
-If you want to set a default value for your [editable filter widget](#adding-a-filter-widget-to-a-static-embed), you can pass that default value to the corresponding parameter name in your iframe's `src` attribute:
-
-```
-your_embedding_url?parameter_name=value
-```
-
-For example, if your embedded dashboard has a filter connected to an editable parameter called "Breakfast", and you want to set the default value to "Hash browns":
-
-```
-your_embedding_url?breakfast=Hash_browns
-```
-
-To specify default values for multiple filters, separate them with ampersands (&):
-
-```
-your_embedding_url?breakfast=Hash_browns&lunch=Sandwich
-```
-
-You can set multiple default values for a single filter by separating the values with ampersands (&):
-
-```
-your_embedding_url?breakfast=Hash_browns&breakfast=Pancakes
-```
-
-## Hiding filter widgets from a static embed
-
-If you have multiple editable parameters (resulting in multiple filter widgets), you can hide specific ones from your static embed by adding `#hide_parameters` to the end of the URL in your iframe's `src` attribute:
-
-```
-your_embedding_url#hide_parameters=parameter_name
-```
-
-For example, to hide a filter called "Breakfast" from your embedded dashboard:
-
-```
-your_embedding_url#hide_parameters=breakfast
-```
-
-You can hide multiple filter widgets by separating the parameter names with commas:
-
-```
-your_embedding_url#hide_parameters=breakfast,lunch
-```
-
-You can also simultaneously assign a parameter a default value _and_ hide its filter widget:
-
-```
-your_embedding_url?breakfast=Hash_browns#hide_parameters=breakfast
-```
-
-## Unsigned parameter syntax
-
-Whenever you're adding a parameter to the embedding URL in your iframe's `src` attribute, note that:
-
-- Parameter _names_ are lowercase.
-- Parameter _values_ are case-sensitive (the values must match your data).
-- Spaces should be replaced by underscores.
-
-## Restricting data in a static embed with locked parameters
-
-If you want to restrict the data that's displayed in an embedded dashboard or SQL question, you can set up a **locked parameter**. A locked parameter filters the data in a dashboard or SQL question _before_ the results are displayed to people in a static embed.
-
-1. Go to your dashboard or SQL question. Make sure you've set up a [dashboard filter](../dashboards/filters.md) or [SQL variable](../questions/native-editor/sql-parameters.md).
-2. Click on the **Share** icon > **Embed this item in an application**.
-3. Under **Parameters**, you'll find the names of your dashboard filters or SQL variables.
-4. Select **Locked** for each parameter that you want to restrict your data with.
-5. Optional: select a value under **Preview locked parameters** to see what the restricted data looks like.
-6. Click **Publish** to save your changes.
-7. Add or update the code on your server to [match the code generated by Metabase](./static-embedding.md#previewing-the-code-for-an-embed).
-
-You can use locked parameters to display filtered data based on attributes captured by your web server, such as a username or a tenant ID. For more examples, see the [reference apps repo](https://github.com/metabase/static-embedding-reference-apps).
-
-Locked parameters will apply the selected filter values to your original dashboard or SQL question, but they won't be displayed as filter widgets on your embed. Locked parameters may also limit the values that are shown in your [editable filter widgets](#adding-a-filter-widget-to-a-static-embed).
-
-If you just want to require a value for the parameter, you could set the filter as editable and configure the underlying question or dashboard to [always require a value](../dashboards/filters.md).
-
-For more on how locked parameters work, check out [guest embedding](./guest-embedding.md#locked-parameters). The rules for locked parameters are the same for static embeds.
-
-## Customizing the appearance of a static embed
-
-You can change the appearance of an embedded item by adding hash parameters (e.g., `#theme=night`) to the end of the URL in your iframe's `src` attribute.
-
-For example, the following embedding URL will display an embedded item in dark mode, without a border, and with its original title:
-
-```
-your_embedding_url#theme=night&bordered=false&titled=true
-```
-
-You can preview appearance settings from your question or dashboard's embedded appearance settings.
-
-| Parameter name | Possible values |
-| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `background` | `true` (default), `false`. Dashboards only. |
-| `bordered` | `true` (default), `false`. |
-| `locale`\* | E.g., `ko`. See [list of locales](../configuring-metabase/localization.md#supported-languages) |
-| `titled` | `true` (default), `false`. |
-| `theme` | `null` (default), `night`. `theme=transparent` should work, but is deprecated (see [Transparent backgrounds](#transparent-backgrounds-for-embeds)) |
-| `refresh` (dashboard only) | integer (seconds, e.g., `refresh=60`). |
-| `font`\* | [font name](../configuring-metabase/fonts.md) |
-| `downloads`\*\* | `true` (default), `false`, `results`, `pdf` |
-
-\* Available on [Pro](https://www.metabase.com/product/pro) and [Enterprise](https://www.metabase.com/product/enterprise) plans
-
-\*\* Disabling downloads is available on [Pro](https://www.metabase.com/product/pro) and [Enterprise](https://www.metabase.com/product/enterprise) plans.
-
-For global appearance settings, such as the colors and fonts used across your entire Metabase instance, see [Customizing Metabase's appearance](../configuring-metabase/appearance.md).
-
-## Setting the language for a static embed
-
-{% include plans-blockquote.html feature="Locales for static embeds" %}
-
-To change the UI language for a static embed, you can set its [locale](../configuring-metabase/localization.md#supported-languages). For example, to set a public link's language to Korean, append `#locale=ko`:
-
-```
-https://metabase.example.com/public/dashboard/7b6e347b-6928-4aff-a56f-6cfa5b718c6b?category=&city=&state=#locale=ko
-```
-
-If you have multiple parameters, separate them with an ampersand (`&`):
-
-```
-category=Gadget&state=Vermont#theme=night&locale=ko
-```
-
-The `locale` parameter changes the language for Metabase UI elements, like the label of "Export to PDF" button. To change the _content_'s language in a static embed (like names of questions and dashboards), you'll need to [upload a translation dictionary](./translations.md).
-
-## Transparent backgrounds for embeds
-
-Making an embed transparent depends on the type of embed:
-
-- Dashboards: set `background=false`. The `background` parameter can be combined with the `theme` parameter (e.g., `background=false&theme=night`).
-- Questions: set `theme=transparent` (deprecated, but still supported).
-
-## Disable downloads for an embedded question or dashboard
-
-{% include plans-blockquote.html feature="Disabling downloads" %}
-
-By default, Metabase will include a **Download** button on embedded questions, and an **Export to PDF** option on embedded dashboards.
-
-You can configure these options with the `downloads` parameter in the embedding URL in the iframe's `src` attribute, see [customizing the appearance of static embeds](./static-embedding.md#customizing-the-appearance-of-static-embeds).
-
-`downloads` accepts the following values:
-
-- `true` (default): include both the Download and Export to PDF options.
-- `false`: hide both the Download and Export to PDF options.
-- `results`: show the Download option.
-- `pdf`: show the Export to PDF option (dashboards only).
-
-You can combine the explicit options: `downloads=results,pdf` is the same as `downloads=true`.
-
-The `downloads` parameter replaces the legacy `hide_download_button` parameter.
-
-## Maximum request size
-
-The maximum length of a static embedding URL (including all parameters) is determined by your [`MB_JETTY_REQUEST_HEADER_SIZE`](../configuring-metabase/environment-variables.md#mb_jetty_request_header_size) environment variable. The default is 8192 bytes.
-
-If your static embedding URL exceeds the maximum header size, you'll see a log message like `URI too long`. You can update the environment variable to accept larger headers. If you're using a proxy server, you may need to set a corresponding property on the server as well.
-
-## Further reading
-
-- [Static embedding documentation](./static-embedding.md).
-- [Embedding introduction](./introduction.md).
diff --git a/docs/embedding/static-embedding.md b/docs/embedding/static-embedding.md
deleted file mode 100644
index 98bcdf42380..00000000000
--- a/docs/embedding/static-embedding.md
+++ /dev/null
@@ -1,196 +0,0 @@
----
-title: Static embedding
-redirect_from:
- - /docs/latest/embedding/signed-embedding
----
-
-# Static embedding
-
-> We recommend you use the new [Guest embedding](./guest-embedding.md) approach instead of static embedding.
-
-In general, embedding works by displaying a Metabase URL inside an iframe in your website. A **static embed** (or signed embed) is an iframe that's loading a Metabase URL secured with a signed JSON Web Token (JWT). Metabase will only load the URL if the request supplies a JWT signed with the secret shared between your app and your Metabase. The JWT also includes a reference to the resource to load, e.g., the dashboard ID, and any values for locked parameters.
-
-You can't use static embeds with [row and column security](../permissions/row-and-column-security.md), [drill-through](../questions/visualizations/drill-through.md), and user-specific data isn't captured in [usage analytics](../usage-and-performance-tools/usage-analytics.md) because signed JWTs don't create user sessions (server-side sessions). For those features, check out [Modular embedding](./modular-embedding.md).
-
-You can, however, restrict data in static embeds for specific people or groups by [locking parameters](./static-embedding-parameters.md#restricting-data-in-a-static-embed-with-locked-parameters).
-
-## How static embedding works
-
-If you want to set up interactive Metabase filters in your iframe, your web server will need to make requests to Metabase for updated data each time a website visitor updates the filter widget.
-
-To ask for updated data from Metabase, your web server will generate a new Metabase [embedding URL](#adding-the-embedding-url-to-your-website). For example, if a website visitor enters the value "true" in an [embedded filter widget](./static-embedding-parameters.md#adding-a-filter-widget-to-a-static-embed), your web server will generate a new embedding URL with an extra parameter:
-
-```
-your_metabase_embedding_url?filter=true
-```
-
-To prevent people from editing the embedding URL to get access to other parts of your Metabase (e.g., by changing the parameter to `filter=company_secrets`), your web server will add a signed JWT to the new embedding URL:
-
-```
-your_metabase_embedding_url/your_signed_jwt?filter=true
-```
-
-The signed JWT is generated using your [Metabase secret key](#regenerating-the-static-embedding-secret-key). The secret key tells Metabase that the request for filtered data can be trusted, so it's safe to display the results at the new embedding URL. Note that this secret key is shared for all static embeds, so whoever has access to that key will have access to all embedded artifacts.
-
-If you want to embed charts with additional interactive features, like [drill-down](../questions/visualizations/drill-through.md) and [self-service querying](../questions/query-builder/editor.md), see [Modular embedding](./modular-embedding.md).
-
-## Turning on the embedding feature in Metabase
-
-1. Go to **Settings** > **Admin settings** > **Embedding > Static**.
-2. Toggle **Enable static embedding**.
-
-## Making a question or dashboard embeddable
-
-![Share button to embed dashboard](./images/sharing-embed.png)
-
-To create a static embed:
-
-1. Go to the question or dashboard that you want to embed in your website.
-2. Click the **Share** icon.
-3. Select **Embed**.
-4. Select **Static embedding**.
-5. Optional: [customize the appearance of the embed](./static-embedding-parameters.md#customizing-the-appearance-of-a-static-embed)
-6. Optional: [Add parameters to the embed](./static-embedding-parameters.md).
-7. Click **Publish**.
-
-## Adding the embedding URL to your website
-
-The embedding URL for a question or dashboard is the Metabase URL that'll be displayed in your website's iframe. It's generated by your web server using your [Metabase site URL](../configuring-metabase/settings.md#site-url), [signed JWT](#how-static-embedding-works), and [parameters](./static-embedding-parameters.md):
-
-```
-metabase_site_url/embed/question/your_jwt_token?parameter_name=value
-```
-
-Once you've made a question or dashboard [embeddable](#making-a-question-or-dashboard-embeddable), you'll need to put the embedding URL for that question or dashboard on your website:
-
-1. Go to the question or dashboard > **Share** icon > **Embed**.
-2. Make any changes and copy the code.
-3. [Preview the code](#previewing-the-code-for-an-embed)
-4. Add the code to the server code that builds your website.
-5. Add the frontend code to the code that generates the page where you want the embedded item to appear.
-
-For more examples, see our [reference apps repo](https://github.com/metabase/static-embedding-reference-apps).
-
-## Previewing the code for an embed
-
-1. Go to the question or dashboard > **Share** icon > **Embed**.
-2. Click **Code**.
-3. In the top code block, you'll find the sample code for your web server. You'll also find the iframe snippet to plug into your HTML template or single page app.
-
-When you make changes to the look and feel or parameter preview settings, Metabase will update the code and highlight the changes. Make sure to copy these changes to your actual server code.
-
-Metabase generates server code for:
-
-- Clojure
-- Node.js
-- Python
-- Ruby
-
-For iframe snippets:
-
-- ERB
-- JSX
-- Mustache
-- Pug/Jade
-
-## If you serialize your Metabase, use Entity IDs in your static embeds
-
-Using [Entity IDs](../installation-and-operation/serialization.md#metabase-uses-entity-ids-to-identify-metabase-items) in your static embeds will make sure that the IDs are stable when exporting from one Metabase and importing to another Metabase.
-
-To use an Entity ID in a static embed, all you need to do is edit the `resource` map in the `payload` used to sign your token. Replace the item's (autopopulated) ID with its Entity ID and you're done.
-
-So, in the code below you'd change the `{ question: <ID> }` to:
-
-```js
-const payload = {
- resource: { question: <Entity ID goes here> },
- params: {},
- exp: Math.round(Date.now() / 1000) + (10 * 60) // 10 minute expiration
-};
-```
-
-If you don't serialize your Metabase, don't worry about which ID you use; both will work just fine.
-
-## Editing an embedded question or dashboard
-
-If you change the [parameters](./static-embedding-parameters.md) of your embedded item:
-
-1. After making your changes, copy the code Metabase generates.
-1. Click **Publish** again.
-1. [Update the code](#adding-the-embedding-url-to-your-website) on your server so that it matches the code generated by Metabase.
-
-## Disabling embedding for a question or dashboard
-
-You can find a list of all static embeds of questions and dashboards from **Admin settings** > **Embedding** > **Static**.
-
-1. Visit the embeddable question or dashboard.
-2. Click the **Share** icon (square with an arrow pointing to the top right).
-3. Select **Embed**.
-4. Select **Static embedding**
-5. Click **Unpublish**.
-
-## Customizing the appearance of static embeds
-
-See [Customizing appearance of static embeds](./static-embedding-parameters.md#customizing-the-appearance-of-a-static-embed)
-
-## Auto-refreshing the results of an embedded dashboard
-
-> Auto-refreshing is only available for dashboards, not questions.
-
-To refresh the results of a dashboard at a specific cadence, you can parameterize the embedded URL with `refresh`. For example, to set an embedded dashboard to refresh every 60 seconds, you would append `refresh=60` to the URL.
-
-For example, the following code for generating an iframe URL for a dashboard would display the dashboard's title and refresh its results every 60 seconds.
-
-```js
-var iframeUrl =
- METABASE_SITE_URL + "/embed/dashboard/" + token + "#titled=true&refresh=60";
-```
-
-For the full list options you can parameterize, see [customizing the appearance of a static embed](./static-embedding-parameters.md#customizing-the-appearance-of-a-static-embed).
-
-## Removing the "Powered by Metabase" banner
-
-![Powered by Metabase](./images/powered-by-metabase.png)
-
-The banner appears on static embeds created with Metabase's open-source version. To remove the banner, you'll need to upgrade to a [Pro](https://www.metabase.com/product/pro) or [Enterprise](https://www.metabase.com/product/enterprise) plan.
-
-## Regenerating the static embedding secret key
-
-Your embedding secret key is used to sign JWTs for all of your [embedding URLs](#adding-the-embedding-url-to-your-website).
-
-1. Go to **Admin** > **Embedding** > **Static embedding**.
-2. Under **Regenerate secret key**, click **Regenerate key**.
-
-This key is shared across all static embeds. Whoever has access to this key could get access to all embedded artifacts, so keep this key secure. If you regenerate this key, you'll need to update your server code with the new key.
-
-## Resizing dashboards to fit their content
-
-Dashboards are a fixed aspect ratio, so if you'd like to ensure they're automatically sized vertically to fit their contents you can use the [iFrame Resizer](https://github.com/davidjbradshaw/iframe-resizer) script. Metabase serves a copy for convenience:
-
-```html
-<script src="{your-metabase-url}/app/iframeResizer.js"></script>
-
-<iframe
- src="https://metabase.example.com/embed/dashboard/TOKEN"
- onload="iFrameResize({}, this)"
-></iframe>
-```
-
-Due to iframe-resizer's licensing changes, we recommend that you use iframe-resizer version 4.3.2 or lower.
-
-## Custom destinations on dashboards in static embeds
-
-You can only use the **URL** option for [custom destinations](../dashboards/interactive.md#custom-destinations) on dashboards with static embedding. External URLs will open in a new tab or window.
-
-You can propagate filter values into the external URL, unless the filter is locked.
-
-## Translating static embeds
-
-See [Translating embedded questions and dashboards](./translations.md).
-
-## Further reading
-
-- [Parameters for static embeds](./static-embedding-parameters.md).
-- [Reference apps repo](https://github.com/metabase/static-embedding-reference-apps).
-- [Embedding introduction](./introduction.md).
-- [Customizing Metabase's appearance](../configuring-metabase/appearance.md).
diff --git a/docs/permissions/data-isolation-methods.md b/docs/permissions/data-isolation-methods.md
index 9dc62d7ebdc..bb89ba7b1ea 100644
--- a/docs/permissions/data-isolation-methods.md
+++ b/docs/permissions/data-isolation-methods.md
@@ -2,7 +2,7 @@
title: Data isolation methods
summary: Compare the ways Metabase can restrict data access for internal analytics or multi-tenant setups, including row and column security, impersonation, database routing, and locked parameters.
---
-
+
# Data isolation methods
> Row and column security, impersonation, and database routing are only available on Metabase [Pro](https://www.metabase.com/product/pro) and [Enterprise](https://www.metabase.com/product/enterprise) plans.
@@ -66,7 +66,7 @@ Don't use database routing when:
## Locked parameters
-[Locked parameters](../embedding/guest-embedding.md#locked-parameters) filter an embedded dashboard or question before Metabase displays it. Your app passes the filter value in a signed JWT. The filter is invisible to the person viewing the embed, and they can't change it.
+[Locked parameters](../embedding/parameters.md#restrict-data-on-guest-embeds) filter an embedded dashboard or question before Metabase displays it. Your app passes the filter value in a signed JWT. The filter is invisible to the person viewing the embed, and they can't change it.
![Locked parameters](../embedding/images/locked-parameters.png)
@@ -87,4 +87,4 @@ Don't use locked parameters when:
- [Row and column security](./row-and-column-security.md)
- [Impersonation](./impersonation.md)
- [Database routing](./database-routing.md)
-- [Locked parameters for guest embeds](../embedding/guest-embedding.md#locked-parameters)
\ No newline at end of file
+- [Locked parameters for guest embeds](../embedding/parameters.md#restrict-data-on-guest-embeds)
diff --git a/docs/questions/query-builder/expressions/regexextract.md b/docs/questions/query-builder/expressions/regexextract.md
index b00de0219bd..a54337d19c4 100644
--- a/docs/questions/query-builder/expressions/regexextract.md
+++ b/docs/questions/query-builder/expressions/regexextract.md
@@ -39,7 +39,7 @@ regexExtract([URL], "^[^?#]+\?utm_campaign=(.*)")
Here, the regex pattern [`^[^?#]+\?` matches all valid URL strings](https://www.oreilly.com/library/view/regular-expressions-cookbook/9780596802837/ch07s13.html). You can replace `utm_campaign=` with whatever query parameter you like. At the end of the regex pattern, the [capturing group](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Groups_and_backreferences) `(.*)` gets all of the characters that appear after the query parameter `utm_campaign=`.
-Now, you can use **Campaign Name** in places where you need clean labels, such as [filter dropdown menus](../../../dashboards/filters.md), [charts](../../visualizations/visualizing-results.md), and [embedding parameters](../../../embedding/static-embedding-parameters.md).
+Now, you can use **Campaign Name** in places where you need clean labels, such as [filter dropdown menus](../../../dashboards/filters.md), [charts](../../visualizations/visualizing-results.md), and [embedding parameters](../../../embedding/parameters.md).
## Accepted data types
diff --git a/docs/troubleshooting-guide/my-dashboard-is-slow.md b/docs/troubleshooting-guide/my-dashboard-is-slow.md
index 8b729206327..fc25680a034 100644
--- a/docs/troubleshooting-guide/my-dashboard-is-slow.md
+++ b/docs/troubleshooting-guide/my-dashboard-is-slow.md
@@ -38,7 +38,7 @@ Caching takes less effort because it doesn't involve any changes to your schemas
## Embedded dashboard is slow compared to original dashboard
-1. To speed up the embedded dashboard, set up a [locked parameter to pre-filter your data](../embedding/static-embedding-parameters.md#restricting-data-in-a-static-embed-with-locked-parameters).
+1. To speed up the embedded dashboard, set up a [locked parameter to pre-filter your data](../embedding/parameters.md#restrict-data-on-guest-embeds).
**Explanation**
diff --git a/docs/util/data/nav.yml b/docs/util/data/nav.yml
index b7b2cfd1321..94a96dc4022 100644
--- a/docs/util/data/nav.yml
+++ b/docs/util/data/nav.yml
@@ -280,6 +280,8 @@ categories:
url: "embedding/ai-chat"
- name: "Filters and parameters"
url: "embedding/parameters"
+ - name: "Parameters reference"
+ url: "embedding/parameters-reference"
- name: "Config"
url: "embedding/config"
- name: "Config reference"