> ## Documentation Index
> Fetch the complete documentation index at: https://docs.meetsilicon.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Embedding reference

> Complete API reference for embedding Silicon content securely using JWTs

> [!NOTE]
>
> Embedding is available for Silicon customers where Silicon has enabled it. [Get in touch](https://silicon.typeform.com/to/BujU5wg5) to ask about enabling it for your account.

> [!TIP]
>
> **Try it and see the code.** [embed.meetsilicon.com](https://embed.meetsilicon.com) is an interactive demo and helper that lets you preview embedded content and generate a JWT for your own project. For a working end-to-end example, see the [example embed app on GitHub](https://github.com/meetsilicon/example-embed-dashboard-with-nodejs-app) -- a Node.js app that mints tokens server-side and renders a Silicon dashboard.

## Overview

This document provides complete API reference for JWT structure and configuration options used across all embedding and sharing methods.

Silicon supports three ways to share embedded content:

* **Shareable URL** -- Generate a link that anyone can open directly in their browser, no iframe or SDK needed. Ideal for sharing dashboards with external users like clients or partners.
* **iframe embedding** -- Embed dashboards inside your own web pages using a standard `<iframe>` tag.
* **React SDK** -- Embed dashboards and charts in React/Next.js apps with full programmatic control.

All three methods use the same JWT-based authentication described below.

For role-controlled dashboard capabilities and AI access, see [Permission modes](#permission-modes).

**For method-specific implementation details, see:**

* [iframe embedding reference](https://docs.meetsilicon.com/embed/iframe.md) - URL patterns, HTML embedding
* [React SDK reference](https://docs.meetsilicon.com/embed/react-sdk.md) - React components, props, TypeScript

**For step-by-step guides, see:**

* [Embedding quickstart](https://docs.meetsilicon.com/embed/set-up-embedding.md)
* [Embedding dashboards](https://docs.meetsilicon.com/embed/embed-dashboards.md)
* [Embedding charts](https://docs.meetsilicon.com/embed/embed-charts.md)

Embedded Silicon content is available to view by anyone (not just folks with a Silicon login). Content is secured using JWT (JSON Web Tokens) with configurable expiration times.

Embeds don't link to the Silicon documentation or offer to share errors with Silicon support, and their labels and error messages don't name Silicon. React SDK components never change your page's document title.

## Known limitations

* Embedding works for dashboards, charts, [AI agents](https://docs.meetsilicon.com/embed/embed-ai-agents.md), the [metrics catalog](https://docs.meetsilicon.com/embed/embed-metrics-catalog.md), and [data apps](https://docs.meetsilicon.com/data-apps). To embed explores, use the `canExplore` flag in a dashboard or metrics catalog token.
* The **Filter dashboard to** option when clicking on individual chart segments will not work on embedded dashboards.

If you're interested in embedding and one or more of these items are blockers, please reach out.

## Embed secret

The embed secret is used to generate JWTs for embedding content. This secret acts like a password that encrypts and signs your tokens.

> [!WARNING]
>
> Keep your embed secret secure! Store it as an environment variable and never expose it in frontend code. Always generate tokens server-side.

You can regenerate the secret by clicking `Generate new secret`. If you do this, all previously generated embed URLs will be invalidated immediately.

## JWT structure

All embedding methods use JWTs to authenticate and configure embedded content. The token structure includes three main parts:

### Common fields

All tokens share these fields:

```typescript theme={null}
{
  content: {
    // Content configuration (required)
    type: 'dashboard' | 'chart' | 'aiAgent' | 'metricsCatalog' | 'dataApp' | 'apiAccess',
    projectUuid?: string,
    // ... type-specific fields
  },
  user?: {
    // User information for analytics (optional)
    externalId?: string,
    email?: string,
  },
  userAttributes?: {
    // User attributes for row-level filtering (optional)
    [attributeName: string]: string,
  },
  // Token expiration (handled by JWT library)
  exp?: number,
  iat?: number,
}
```

### Dashboard token

For embedding dashboards with multiple tiles, filters, and interactive features.

> [!WARNING]
>
> All configuration options (`dashboardFiltersInteractivity`, `canExportCsv`, `canExplore`, etc.) must be nested **inside the `content` object** -- not at the top level of the JWT payload. A common mistake is placing these properties at the root level, which will cause them to be silently ignored.

```typescript theme={null}
{
  content: {
    type: 'dashboard',

    // Dashboard identifier (required, use one)
    dashboardUuid?: string,
    dashboardSlug?: string,

    // Project identifier (optional)
    projectUuid?: string,

    // Filter interactivity
    dashboardFiltersInteractivity?: {
      enabled: 'all' | 'some' | 'none',  // Required
      allowedFilters?: string[],          // Required if enabled: 'some'
      hidden?: boolean,                   // Optional: hide filter UI
      canAddFilters?: boolean,            // Optional: let viewers add temporary filters
    },

    // Parameter interactivity
    parameterInteractivity?: {
      enabled: boolean,
    },

    // Export capabilities
    canExportCsv?: boolean,         // Allow per-chart CSV export
    canExportDashboardCsv?: boolean, // Allow dashboard CSV/XLSX ZIP export
    canExportImages?: boolean,      // Allow image/PNG export
    canExportPagePdf?: boolean,     // Allow PDF export

    // Interactive features
    canDateZoom?: boolean,          // Allow date granularity zoom
    canExplore?: boolean,           // Allow "Explore from here"
    canViewUnderlyingData?: boolean, // Allow viewing raw data
    canViewDataApps?: boolean,      // Allow rendering data app tiles
  },

  // Optional: Allow embedded users to save charts and edit dashboards
  writeActions?: {
    writeSpaceUuids: string[],        // Spaces users can write to; the first is the default
    sourceSpaceUuids?: string[],      // Extra spaces to add existing charts from
    serviceAccountUserUuid?: string,  // Actor for the write (use one)
    userUuid?: string,
    permissionsMode?: 'default' | 'roles',
  },

  // Optional: User information for query tracking
  user?: {
    externalId?: string,
    email?: string,
  },

  // Optional: User attributes for row-level filtering
  userAttributes?: {
    [attributeName: string]: string,
  },
}
```

**Example:**

```javascript theme={null}
import jwt from 'jsonwebtoken';

const token = jwt.sign({
  content: {
    type: 'dashboard',
    dashboardUuid: 'abc-123-def-456',
    dashboardFiltersInteractivity: {
      enabled: 'all',
    },
    canExportCsv: true,
    canExportImages: true,
    canExportPagePdf: true,
    canDateZoom: true,
    canExplore: true,
    canViewUnderlyingData: true,
    canViewDataApps: true,
  },
  user: {
    externalId: 'user-789',
    email: 'user@example.com',
  },
  userAttributes: {
    tenant_id: 'tenant-abc',
  },
}, SECRET, { expiresIn: '1h' });
```

### Chart token

For embedding individual saved charts with minimal UI:

> [!WARNING]
>
> Chart embedding is **only available via the React SDK**. iframe embedding for charts is not currently supported. See the [React SDK reference](https://docs.meetsilicon.com/embed/react-sdk.md) for details.

```typescript theme={null}
{
  content: {
    type: 'chart',

    // Chart identifier (required)
    contentId: string,  // savedQueryUuid

    // Project identifier (optional)
    projectUuid?: string,

    // Preview mode (optional)
    isPreview?: boolean,

    // Permission scopes (optional)
    scopes?: string[],  // e.g., ['view:Chart']

    // Export capabilities
    canExportCsv?: boolean,         // Allow CSV export
    canExportImages?: boolean,      // Allow image/PNG export
    canViewUnderlyingData?: boolean, // Allow viewing raw data
  },

  // Optional: let viewers edit and drill into the chart with Silicon.Chart isEditMode
  writeActions?: {
    writeSpaceUuids: string[],        // Must include the chart's space
    serviceAccountUserUuid?: string,
    userUuid?: string,
  },

  // Optional: User information for query tracking
  user?: {
    externalId?: string,
    email?: string,
  },
}
```

Chart tokens use `contentId` (the saved chart UUID) instead of `dashboardUuid`, and the embed is scoped to that chart alone -- it cannot reach any other content.

**Example:**

```javascript theme={null}
import jwt from 'jsonwebtoken';

const token = jwt.sign({
  content: {
    type: 'chart',
    contentId: 'saved-chart-uuid-789',
    scopes: ['view:Chart'],
    canExportCsv: true,
    canExportImages: false,
    canViewUnderlyingData: true,
  },
  user: {
    externalId: 'user-456',
    email: 'user@example.com',
  },
}, SECRET, { expiresIn: '24h' });
```

### AI agent token

For embedding a Silicon [AI agent](https://docs.meetsilicon.com/agents) so users can chat with their data from inside your app. See [Embedding AI agents](https://docs.meetsilicon.com/embed/embed-ai-agents.md) for the full walkthrough.

```typescript theme={null}
{
  content: {
    type: 'aiAgent',

    // Agent the embed is allowed to use (required)
    agentUuid: string,

    // Project identifier (optional)
    projectUuid?: string,

    // Allow "Explore from here" inside the embed (optional)
    canExplore?: boolean,

    // Show the Debug panel on agent answers (optional, defaults to false)
    canViewDebugInfo?: boolean,
  },

  // Required: AI agent embeds must include writeActions
  writeActions: {
    writeSpaceUuids: string[],          // Spaces the agent reads from and saves to; the first scopes threads
    serviceAccountUserUuid?: string,    // Use a service account as the actor
    userUuid?: string,                  // Or use an existing Silicon user as the actor
    permissionsMode?: 'default' | 'roles',
  },

  // Optional: row-level filtering for the embedded viewer
  userAttributes?: {
    [attributeName: string]: string,
  },

  // Optional: viewer identity. Not a query tag for agent queries, see User metadata
  user?: {
    externalId?: string,
    email?: string,
  },
}
```

> [!NOTE]
>
> AI agent tokens are scoped to a single agent. A token issued for one `agentUuid` cannot be used to access another agent, and dashboard or chart tokens are rejected on AI agent routes. The agent can only read dashboards and saved charts from the token's write spaces, and saves new charts into one of them. Embedded viewers can open saved charts from those spaces in the chat side panel and saved dashboards as a read-only view, with the token's `userAttributes` applied. Threads are scoped to the first write space; see [Embedding AI agents](https://docs.meetsilicon.com/embed/embed-ai-agents.md#access-control).

**Example:**

```javascript theme={null}
import jwt from 'jsonwebtoken';

const token = jwt.sign({
  content: {
    type: 'aiAgent',
    projectUuid: 'your-project-uuid',
    agentUuid: 'your-agent-uuid',
  },
  writeActions: {
    serviceAccountUserUuid: 'service-account-user-uuid',
    writeSpaceUuids: ['destination-space-uuid'],
  },
  userAttributes: {
    tenant_id: 'tenant-abc',
  },
  user: {
    email: 'customer@example.com',
  },
}, SECRET, { expiresIn: '1h' });
```

### Metrics catalog token

For embedding the project [metrics catalog](https://docs.meetsilicon.com/semantic-layer/metrics.md) so embedded users can browse metrics and, optionally, continue into Explore. See [Embedding the metrics catalog](https://docs.meetsilicon.com/embed/embed-metrics-catalog.md) for the full walkthrough.

```typescript theme={null}
{
  content: {
    type: 'metricsCatalog',

    // Project identifier (required -- pins the catalog to a single project)
    projectUuid: string,

    // Allow embedded users to open Explore from a metric (optional)
    canExplore?: boolean,
  },

  // Optional: enable saving charts from the embedded Explore. Required only
  // when canExplore is true and you want embedded users to save results.
  writeActions?: {
    writeSpaceUuids: string[],
    serviceAccountUserUuid?: string,
    userUuid?: string,
  },

  // Optional: row- and column-level filtering for the embedded viewer
  userAttributes?: {
    [attributeName: string]: string,
  },

  // Optional: user information surfaced in audit/analytics
  user?: {
    externalId?: string,
    email?: string,
  },
}
```

> [!NOTE]
>
> Metrics catalog tokens only authorize the metrics catalog surface (and, when `canExplore` is `true`, the embedded Explore launched from a metric). Dashboard, chart, AI agent, and data app tokens are rejected by the metrics catalog routes, and metrics catalog tokens are rejected on other embed routes.

**Example:**

```javascript theme={null}
import jwt from 'jsonwebtoken';

const token = jwt.sign({
  content: {
    type: 'metricsCatalog',
    projectUuid: 'your-project-uuid',
    canExplore: true,
  },
  writeActions: {
    serviceAccountUserUuid: 'service-account-user-uuid',
    writeSpaceUuids: ['destination-space-uuid'],
  },
  userAttributes: {
    tenant_id: 'tenant-abc',
  },
  user: {
    email: 'customer@example.com',
  },
}, SECRET, { expiresIn: '1h' });
```

### Data app token

For embedding a [data app](https://docs.meetsilicon.com/data-apps) as standalone content in an iframe (no dashboard). See [How to embed data apps](https://docs.meetsilicon.com/embed/embed-data-apps.md) for the full guide.

```typescript theme={null}
{
  content: {
    type: 'dataApp',

    // Data app identifier (required)
    appUuid: string,

    // Project identifier (optional)
    projectUuid?: string,

    // Preview mode (optional)
    isPreview?: boolean,
  },

  // Optional: User information for query tracking
  user?: {
    externalId?: string,
    email?: string,
  },

  // Optional: User attributes for row-level filtering
  userAttributes?: {
    [attributeName: string]: string,
  },
}
```

A `dataApp` token authorizes only the named app. It cannot render any other data app, chart, or dashboard, even if that content is on the embed allowlist, and interactivity options like `canExportCsv`, `canExplore`, and `dashboardFiltersInteractivity` do not apply to it.

> [!WARNING]
>
> A data app can run arbitrary metric queries across the project. Minting a `dataApp` token means accepting project-wide column access for the app's queries. Row-level access via [user attributes](https://docs.meetsilicon.com/workspace-admin/user-attributes.md) is unchanged.

**Example:**

```javascript theme={null}
import jwt from 'jsonwebtoken';

const token = jwt.sign({
  content: {
    type: 'dataApp',
    projectUuid: 'your-project-uuid',
    appUuid: 'your-app-uuid',
  },
  user: {
    externalId: 'user-789',
    email: 'user@example.com',
  },
  userAttributes: {
    tenant_id: 'tenant-abc',
  },
}, SECRET, { expiresIn: '1h' });
```

### API access token

Use an API access token when your host app needs to call Silicon APIs through the React SDK, for example to list spaces, dashboards, and charts with [`Silicon.useSiliconContent`](https://docs.meetsilicon.com/embed/react-sdk#siliconusesiliconcontent).

```typescript theme={null}
{
  content: {
    type: 'apiAccess',

    // Project identifier (required)
    projectUuid: string,

    // Service account used for permission checks (required)
    serviceAccountUserUuid: string,
  },

  // Optional: row-level filtering for APIs that evaluate user attributes
  userAttributes?: {
    [attributeName: string]: string,
  },

  // Optional: user information surfaced in audit/analytics
  user?: {
    externalId?: string,
    email?: string,
  },
}
```

> [!NOTE]
>
> API access tokens do not embed a specific dashboard or chart. They let the React SDK call supported Silicon API endpoints with the permissions of `serviceAccountUserUuid`.

**Example:**

```javascript theme={null}
import jwt from 'jsonwebtoken';

const token = jwt.sign({
  content: {
    type: 'apiAccess',
    projectUuid: 'your-project-uuid',
    serviceAccountUserUuid: 'service-account-user-uuid',
  },
  userAttributes: {
    tenant_id: 'tenant-abc',
  },
  user: {
    externalId: 'customer-user-123',
    email: 'customer@example.com',
  },
}, SECRET, { expiresIn: '1h' });
```

**Rules:**

* API access tokens must be generated server-side with your embed secret.
* API access is authorized through the service account. The token can only list or read content that the service account can access.
* A space UUID passed to an API hook is a filter, not a permission grant.
* API access tokens cannot perform embed write actions. Use an embed token that supports `writeActions` when embedded users need to save charts or dashboards.

## Interactivity options reference

The options below describe JWT-controlled interactivity. For dashboard role-based grants, see [Permission modes](#permission-modes).

### Dashboard filters interactivity

Controls whether users can interact with dashboard filters.

```typescript theme={null}
dashboardFiltersInteractivity?: {
  enabled: 'all' | 'some' | 'none',
  allowedFilters?: string[],  // Filter UUIDs, required if enabled: 'some'
  hidden?: boolean,           // Hide filter UI but keep filters active
  canAddFilters?: boolean,    // Let viewers add temporary session-only filters
}
```

**Options:**

* `enabled: 'all'` - All dashboard filters are visible and interactive
* `enabled: 'some'` - Only filters listed in `allowedFilters` are interactive
* `enabled: 'none'` - Filters are applied but not visible or editable
* `hidden: true` - Filters are configurable at runtime, but UI is hidden (works with 'all' or 'some')
* `canAddFilters: true` - Render an **Add filter** button so viewers can add temporary filters over any filterable field in the dashboard's explores. Only effective when filter interactivity is enabled (`enabled: 'all'`, or `enabled: 'some'` with a non-empty `allowedFilters`). Viewer-added filters live in session state and the temp-filter deep-link parameter -- a fresh embed URL starts clean. JWTs without this field behave exactly as before (button hidden). Metric filters in the picker still require the `metric-dashboard-filters` feature flag on the org.

> [!NOTE]
>
> Embed overrides targeting a [locked dashboard filter](https://docs.meetsilicon.com/explore/dashboards/filter.md#locking-dashboard-filters) are ignored, and the dashboard's saved locked value is used instead. Use a locked filter when you need to guarantee an embedded dashboard always runs with a specific value -- for example, scoping every query to the customer who owns the embed session.

#### All filters available as interactive:

All filters configured on the dashboard will be shown in the embedded dashboard and interactive.

```javascript theme={null}
dashboardFiltersInteractivity: {
  enabled: 'all',
}
```

#### Specific filters only

Only the filters you select will be shown in the embedded dashboard for users to interact with. All dashboard filters are still applied.

```javascript theme={null}
dashboardFiltersInteractivity: {
  enabled: 'some',
  allowedFilters: ['filter-uuid-1', 'filter-uuid-2'],
}
```

Configuring in the UI:

Will result in some filters in the dashboard for users to interact with:

#### Filters applied but hidden:

Filters are applied to the dashboard, but users cannot see or modify them.

```javascript theme={null}
dashboardFiltersInteractivity: {
  enabled: 'none',
}
```

#### Let viewers add their own filters:

Set `canAddFilters: true` to render an **Add filter** button in the embedded filter bar. Viewers can add temporary filters against any filterable field in the dashboard's explores. These filters live only in session state and the temp-filter deep-link parameter -- reopening the embed URL clears them, and they are never saved back to the dashboard.

```javascript theme={null}
dashboardFiltersInteractivity: {
  enabled: 'all',
  canAddFilters: true,
}
```

The Add filter button only renders when filter interactivity is enabled (`enabled: 'all'`, or `enabled: 'some'` with a non-empty `allowedFilters`). Omitting `canAddFilters` preserves the existing behavior (button hidden).

### Parameter interactivity

Controls whether users can modify dashboard parameters.

```typescript theme={null}
parameterInteractivity?: {
  enabled: boolean,
}
```

When enabled, users can change parameter values in the dashboard UI.

### Export options

Control what users can export from embedded content.

```typescript theme={null}
{
  canExportCsv?: boolean,        // Download chart data as CSV files
  canExportImages?: boolean,     // Download charts as PNG images
  canExportPagePdf?: boolean,    // Download the dashboard as PDF (dashboards only, on unless false)
}
```

**CSV Export:**

* Enables "Download CSV" in chart tile menus
* Each chart can be exported individually
* Exports the data shown in the visualization

**Image Export:**

* Enables "Download as image" in chart tile menus
* Exports charts as PNG files
* Captures current chart state

In an Explore opened with **Explore from here**, the same two options enable downloads from the chart and results panels. Google Sheets export is not offered in embeds.

**PDF Export (dashboards only):**

PDF export is on unless the token sets `canExportPagePdf: false`; in [`'roles'` mode](#dashboard-capabilities) it needs `view:EmbedPagePdfExport` instead. What the icon button in the dashboard header does depends on how the dashboard is embedded:

| Embed method | Tooltip | Output |
| - | - | - |
| React SDK | **Export as PDF** | A PDF rendered by Silicon with only the dashboard: every visible tab stacked in order, using the viewer's current filters, parameters, and date zoom |
| iframe | **Print this page** | The browser's print dialog for the embedded page |

The SDK export doesn't apply the component's `paletteUuid` or `contentOverrides`.

### Export all dashboard tiles

Set `content.canExportDashboardCsv: true` to show **Export all tiles** in the embedded dashboard header. Viewers can choose **Export all as .csv (.zip)** or **Export all as .xlsx (.zip)** to download the dashboard's chart tiles in a ZIP archive.

This option is off by default and independent of `canExportCsv`, which controls per-chart CSV downloads. It applies only to the dashboard identified by the embed token. In scope-based embed permissions, the corresponding scope is `view:EmbedDashboardCsvExport`.

Exports use formatted values, each chart's table row limit, and pivoted results. They apply the current dashboard filters, date zoom, and parameter values. The embedded export menu uses these defaults without an export-options dialog.

### Date zoom

Allows users to zoom into time-series data by changing granularity.

```typescript theme={null}
canDateZoom?: boolean
```

When enabled, the embed renders the dashboard's configured date zoom controls (the Default zoom plus any named controls), letting users change the date granularity of charts on the dashboard. See the [Date zoom guide](https://docs.meetsilicon.com/explore/dashboards/date-zoom.md) for complete documentation on this feature.

### Explore from here

Enables navigation from dashboard charts to the explore view.

```typescript theme={null}
canExplore?: boolean
```

When enabled, users see "Explore from here" in chart tile menus. This opens the full query builder with the chart's configuration pre-loaded.

Users can:

* Modify dimensions and metrics
* Apply different filters
* Change chart types
* Run custom queries

The `canExplore` option alone does not allow users to save charts, share results, or view SQL. Downloads follow `canExportCsv` and `canExportImages`. To let users save charts from Explore, configure a [writeActions claim](#write-actions). Saving from **Explore from here** always creates a new chart; it never overwrites the chart the user started from.

### View underlying data

Allows users to view the raw data table behind visualizations.

```typescript theme={null}
canViewUnderlyingData?: boolean
```

When enabled, users can click on charts to open a modal showing the underlying data table. Data cannot be exported separately (use `canExportCsv` for that).

### View data apps

Allows [data app](https://docs.meetsilicon.com/data-apps) tiles on an embedded dashboard to render and run their metric queries.

```typescript theme={null}
canViewDataApps?: boolean
```

Data app tiles run arbitrary metric queries against your semantic layer, so they need broader access than a standard chart tile. Enabling `canViewDataApps` grants the embed JWT the additional permissions a data app needs to mint a preview token and execute its queries. User attributes and SQL filters on the JWT still apply, so row-level access controls are enforced inside the data app exactly as they are on chart tiles.

When this option is off (the default), data app tiles on the dashboard render as a placeholder and no queries run. Turn it on when you trust the embed audience to see the data the app can request and you want the tile to behave the same as it does in Silicon.

## Write actions

Write actions let embedded users save changes back to Silicon. When the JWT includes a `writeActions` claim, Silicon uses a configured actor (a service account or a regular user) to perform the write on behalf of the embedded viewer, and keeps created or edited content inside the spaces the token names.

With `writeActions`, embedded users can:

* Save a new chart from the embedded Explore view.
* Edit an existing embedded dashboard with the React SDK -- rename it, add one or more saved charts, and move or resize tiles. See [`Silicon.Dashboard` edit mode](https://docs.meetsilicon.com/embed/react-sdk#with-edit-mode).
* Create a brand-new dashboard with the React SDK using [`Silicon.DashboardBuilder`](https://docs.meetsilicon.com/embed/react-sdk#silicondashboardbuilder).

This is useful when you want to let your customers explore data, change charts and dashboards, and save the result back to Silicon -- without giving them a Silicon login.

```typescript theme={null}
writeActions?: {
  writeSpaceUuids: string[],          // Required: spaces users can write to; the first is the default
  sourceSpaceUuids?: string[],        // Dashboards only: extra spaces to add existing charts from
  serviceAccountUserUuid?: string,    // Use a service account as the actor
  userUuid?: string,                  // Or use an existing Silicon user as the actor
  permissionsMode?: 'default' | 'roles', // Dashboard and AI agent permission mode
  spaceUuid?: string,                 // Deprecated: a single write space; use writeSpaceUuids
}
```

**Rules:**

* `writeSpaceUuids` takes 1 to 100 space UUIDs with no duplicates. Every space must belong to the embed's project. If any one of them doesn't exist or belongs to another project, the token gets no write actions at all. A write space the actor can't create charts in is left out of the save options.
* The first write space is the default: new content is saved there unless the user picks another write space. In AI agent embeds, it also scopes threads.
* `spaceUuid` is still accepted and behaves like a one-entry `writeSpaceUuids`. A token that sets both is rejected.
* You must provide exactly one of `serviceAccountUserUuid` or `userUuid`.
* The actor must belong to the same organization as the project and (for `userUuid`) be active.
* The actor's permissions and space access still apply -- the embed inherits whatever the actor can do in each write space.
* When editing or building a dashboard, the add-chart picker lists saved charts from the write spaces and any [source spaces](#add-charts-from-other-spaces).
* Dashboards and charts created or edited through write actions are normal Silicon objects -- they can be viewed and edited from Silicon and vice versa.
* Newly saved charts are **not** added to the embed allowlist automatically. They behave like normal private content and won't be re-embeddable unless you add them explicitly.
* In AI agent embeds, the name shown next to messages in the chat is the actor's name: the Silicon user's full name for `userUuid`, or the service account's description for `serviceAccountUserUuid`. Every embedded viewer sees the same name; the `user` claim does not change it.
* API access tokens do not support write actions. They are for supported API reads, such as listing content through the React SDK.

### Configure write actions

Configure write actions from **Settings -> Embedding** by toggling **Enable write actions** and selecting:

* **Service account** -- the Silicon actor that performs the write. You can pick an existing service account or create one inline. Only service accounts with a writable role (Admin, Developer, Editor, or an equivalent custom role) can be used.
* **Default space for created content** -- the first write space. You can pick an existing space or create one inline. On the Dashboards and Charts tabs, it's the selected dashboard's or chart's space.
* **Additional write spaces** -- optional. Embedded users can also edit content in these spaces and choose them when saving. The service account needs edit access to each one.
* **Spaces to add charts from** -- optional, Dashboards tab only. Sets [`sourceSpaceUuids`](#add-charts-from-other-spaces).

The settings panel generates a JWT snippet that includes the `writeActions` claim with the selected service account user UUID and the space UUIDs. Copy that snippet into your backend token-generation code.

### Using a service account

Service accounts are the recommended actor for embed write actions because their attribution stays consistent regardless of which embedded user is viewing.

```javascript theme={null}
import jwt from 'jsonwebtoken';

const token = jwt.sign({
  content: {
    type: 'dashboard',
    dashboardUuid: 'your-dashboard-uuid',
    canExplore: true,                  // Enables Explore in the default permission mode
  },
  writeActions: {
    serviceAccountUserUuid: 'service-account-user-uuid',
    writeSpaceUuids: ['destination-space-uuid'],
  },
  userAttributes: {
    tenant_id: 'tenant-abc',
  },
}, SILICON_EMBED_SECRET, { expiresIn: '1h' });
```

### Using a regular user

If you want saved charts attributed to a specific Silicon user (e.g. an internal owner), use `userUuid` instead. The user must be active in the organization.

```javascript theme={null}
const token = jwt.sign({
  content: {
    type: 'dashboard',
    dashboardUuid: 'your-dashboard-uuid',
    canExplore: true,
  },
  writeActions: {
    userUuid: 'silicon-user-uuid',
    writeSpaceUuids: ['destination-space-uuid'],
  },
}, SILICON_EMBED_SECRET, { expiresIn: '1h' });
```

### Save to more than one space

List several spaces in `writeSpaceUuids` to let embedded users write to all of them, for example a personal space and a shared team space:

```javascript theme={null}
writeActions: {
  serviceAccountUserUuid: 'service-account-user-uuid',
  writeSpaceUuids: ['personal-space-uuid', 'team-space-uuid'],
}
```

When the actor can create charts in more than one of the write spaces, the save dialog shows a required **Space** select that defaults to the first one. Embedded users can only choose among those spaces. `Silicon.DashboardBuilder` always creates its dashboard in the first write space.

### Add charts from other spaces

Set `sourceSpaceUuids` on a dashboard token to let embedded users add existing charts from spaces they can't write to, such as a shared library of curated charts. It takes up to 100 space UUIDs.

```javascript theme={null}
writeActions: {
  serviceAccountUserUuid: 'service-account-user-uuid',
  writeSpaceUuids: ['customer-space-uuid'],
  sourceSpaceUuids: ['curated-charts-space-uuid'],
}
```

* The add-chart picker lists saved charts from the write spaces and the source spaces. The actor needs view access to each source space.
* Charts from a source space stay in that space and can't be edited from the dashboard. Charts saved inside a dashboard can't be added from a source space, and SQL charts from a source space can appear in the picker but fail when the dashboard is saved.
* When the claim is set, the token can only list content in the write and source spaces.
* `sourceSpaceUuids` only applies to dashboard tokens. Other token types ignore it.

## Permission modes

Use `writeActions.permissionsMode` to choose how dashboard capabilities and AI agent access are authorized. Set it in the JWT you sign on your server, not in `content` or an SDK prop. The accepted values are `'default'` and `'roles'`; omitting it is equivalent to `'default'`.

| Embed type | Omitted or `'default'` | `'roles'` |
| - | - | - |
| Dashboard | JWT interactivity flags and their defaults | Only the actor's corresponding embed scopes |
| AI agent | Actor must satisfy AI access prerequisites | Same prerequisites **AND** the actor's `view:EmbedAiAgent` scope |

The mode only switches dashboard capabilities and AI access. Chart, metrics catalog, and AI agent tokens that include `writeActions` also pick up the actor's embed scopes in either mode: for example, the actor's `view:EmbedExplore` enables Explore even when the token omits `canExplore`. The [AI Debug scope](#debug-information) is the exception and only applies in `'roles'` mode. Data app embeds don't use embed scopes.

### Choose the actor and its role

Role checks use the Silicon user identified by `writeActions.userUuid`, or the service account identified by `writeActions.serviceAccountUserUuid`. Include `writeActions.writeSpaceUuids` and meet the [write-action requirements](#write-actions), even when you are configuring read-only capabilities such as export. Dashboard `'roles'` mode rejects requests if the actor cannot be resolved; it does not fall back to JWT-only permissions.

Configure embed scopes in the **Embedding** section of a [custom role](https://docs.meetsilicon.com/workspace-admin/custom-roles.md), then assign that role to the actor. Built-in roles also provide embed scopes; duplicate a system role if you want a starting point you can edit. The external viewer's `user.externalId` is not the role-bearing actor.

Permissions from the actor's organization and project roles are additive. Removing a scope from one role does not revoke a grant from another role. When testing a restrictive custom role, make sure the actor has no other role that still grants the capability.

### Dashboard capabilities

In `'roles'` mode, only the actor's embed scopes grant capabilities. JWT interactivity flags are ignored whether they are `true`, `false`, or omitted. For example, CSV export requires `view:EmbedCsvExport` even when the token contains `canExportCsv: true`. In `'default'` mode, the scope is ignored and the JWT flag decides.

The dashboard scopes replace these `content` options when using `'roles'` mode:

| JWT field (default mode) | Embed scope (roles mode) |
| - | - |
| `dashboardFiltersInteractivity.enabled` | `view:EmbedDashboardFilters` |
| `dashboardFiltersInteractivity.canAddFilters` | `view:EmbedDashboardFilterAddition` |
| `parameterInteractivity.enabled` | `view:EmbedDashboardParameters` |
| `canExportCsv` | `view:EmbedCsvExport` |
| `canExportDashboardCsv` | `view:EmbedDashboardCsvExport` |
| `canExportImages` | `view:EmbedImageExport` |
| `canExportPagePdf` | `view:EmbedPagePdfExport` |
| `canDateZoom` | `view:EmbedDateZoom` |
| `canExplore` | `view:EmbedExplore` |
| `canViewUnderlyingData` | `view:EmbedUnderlyingData` |
| `canViewDataApps` | `view:EmbedDataApps` |

The filter-interactivity scope enables all dashboard filters rather than only those in `allowedFilters`. Adding temporary filters and changing parameters have separate scopes. Hidden-filter presentation and user-attribute data restrictions still apply.

To manage dashboard capabilities through roles, set the mode and omit the JWT interactivity flags:

```javascript theme={null}
import jwt from 'jsonwebtoken';

const token = jwt.sign({
  content: {
    type: 'dashboard',
    dashboardUuid: 'your-dashboard-uuid',
  },
  writeActions: {
    serviceAccountUserUuid: 'service-account-user-uuid',
    writeSpaceUuids: ['destination-space-uuid'],
    permissionsMode: 'roles',
  },
}, process.env.SILICON_EMBED_SECRET, { expiresIn: '1h' });
```

In this example, grant or remove the corresponding embed scopes on the actor's role to control each capability. A capability without a scope grant is disabled.

> [!WARNING]
>
> Before selecting `'roles'`, grant every embed capability the actor needs. JWT flags and their defaults do not provide fallback access: PDF export requires `view:EmbedPagePdfExport`, even though it defaults to enabled in `'default'` mode.

### Compiled SQL

Embedded field details, metric details in the metrics catalog, and AI agent answers can show the SQL behind a field. Embeds hide it unless the actor has the `view:EmbedCompiledSql` scope, which has no JWT flag. Built-in roles include it from developer up. Hiding it doesn't stop fields from being queried; the SQL is also removed from the API responses the embed receives.

| Token | Compiled SQL is shown when |
| - | - |
| Dashboard, omitted or `'default'` mode | Never |
| Dashboard, `'roles'` mode | The actor has `view:EmbedCompiledSql` |
| Chart, metrics catalog, or AI agent with `writeActions` | The actor has `view:EmbedCompiledSql`, in either mode |
| Any token without `writeActions` | Never |

To keep SQL from external viewers while the actor stays a developer, give the actor a [custom role](https://docs.meetsilicon.com/workspace-admin/custom-roles.md) without `view:EmbedCompiledSql`.

### AI agent access

Both modes require an AI agent token, a resolved actor who can view the project and create charts in at least one write space, and the existing agent, space, and thread access checks. `'default'` does not mean unrestricted AI access.

To make the actor's role control access to embedded AI, add the mode to the [AI agent token](#ai-agent-token):

```javascript theme={null}
writeActions: {
  userUuid: 'silicon-user-uuid',
  writeSpaceUuids: ['destination-space-uuid'],
  permissionsMode: 'roles',
}
```

Grant `view:EmbedAiAgent` to allow access, or remove its last effective grant to block access. There is no AI-access boolean flag that bypasses this scope in `'roles'` mode. This controls embedded AI access, not access to AI in the main Silicon app, and does not change AI Explore interactivity flags. Dashboard tokens do not authorize AI agent endpoints.

#### Debug information

Agent answers have a Debug action that opens a panel with the chart's query configuration, field IDs, and the agent's tool calls with their arguments and raw output. Embedded viewers only see it when it is enabled:

| Mode | Debug is shown when |
| - | - |
| Omitted or `'default'` | The token sets `content.canViewDebugInfo: true`. The actor's role is ignored. |
| `'roles'` | The actor has the `view:EmbedAiAgentDebug` scope. `canViewDebugInfo` is ignored. |

Built-in roles from interactive viewer up include `view:EmbedAiAgentDebug`. To hide Debug in `'roles'` mode, give the actor a [custom role](https://docs.meetsilicon.com/workspace-admin/custom-roles.md) without it.

When Debug is hidden, the embed's thread and streaming responses also omit the raw output of the agent's tool calls. The steps under "How this chart was built" still show, including the fields the agent used. Debug is always available in the main Silicon app.

#### SQL and downloads on answers

The actor's role controls two more actions on embedded chart answers, in both modes. Neither has a JWT flag.

| Action | Shown when the actor has |
| - | - |
| **View SQL** | `view:EmbedCompiledSql` (built-in from developer up) |
| **Download** | `view:EmbedCsvExport` (built-in from viewer up) |

Download exports the answer's results as CSV or XLSX, exactly as shown, without row-limit options. Without `view:EmbedCompiledSql`, the SQL in the agent's tool-call steps is hidden too.

### Verify role changes

After changing the actor's scopes, reload the embed with the same unexpired JWT. The backend checks the actor's current permissions on subsequent requests; you do not need to issue another token for a role change. Changes affect all embeds using that actor and mode, not just one external viewer.

To change the mode or a JWT flag, issue a newly signed token. Removing embed scopes does not revoke tokens using `'default'` mode. Keep tokens short-lived and choose `'roles'` when you want centralized role control.

## Allowed content

### Allowed dashboards

Only dashboards added to the "allowed dashboards" list can be embedded.

You can use the "Allow all dashboards" toggle to bypass dashboard selection. When enabled, any dashboard in your project can be embedded.

### Allowed charts

Charts must be explicitly allowed for embedding. Add charts to the allowed list in your embed settings.

> [!NOTE]
>
> Chart embeds provide more granular access control than dashboards. Each chart must be individually allowed.

## User attributes

User attributes enable row-level and column-level security by filtering data based on user properties. Column-level security is especially useful when embedded users can [Explore from here](#explore-from-here), since it ensures restricted fields stay hidden in the explore view as well.

```typescript theme={null}
userAttributes?: {
  [attributeName: string]: string,
}
```

**Example:**

```javascript theme={null}
{
  userAttributes: {
    tenant_id: 'customer-123',
    region: 'us-west',
    department: 'sales',
  }
}
```

The JWT `userAttributes` field drives both row-level and column-level access controls, the same ones available to Silicon account users:

* **Row-level filtering**: attributes are substituted into any `sql_filter` on the dbt model (e.g. `${silicon.attributes.tenant_id}`), restricting which rows the embedded user can query.
* **Column-level filtering**: attributes are matched against [`required_attributes`](https://docs.meetsilicon.com/workspace-admin/user-attributes#column-filtering-with-required_attributes) and `any_attributes` rules on dimensions, metrics, and tables. Fields whose rules the embedded user's attributes don't satisfy are stripped from the explore entirely: they don't appear in the field list, can't be queried, and return Forbidden if requested directly. Metrics defined under a hidden column are hidden too unless they set their own attributes; model-level metrics only follow their own and the table's rules (see [metric access control](https://docs.meetsilicon.com/workspace-admin/user-attributes.md#metric-access-control)).

See the complete [User attributes guide](https://docs.meetsilicon.com/workspace-admin/user-attributes.md).

## User metadata

Pass user information to identify who's viewing embedded content.

```typescript theme={null}
user?: {
  externalId?: string,  // Your internal user ID
  email?: string,       // User's email address
}
```

How `externalId` reaches your warehouse depends on who runs the query:

* **Dashboard and chart embeds** run queries as the embed viewer. Each query carries the `embed` and `external_id` [query tags](https://docs.meetsilicon.com/workspace-admin/usage-analytics.md#query-tags), where `external_id` is your `externalId`. If you don't provide an `externalId`, Silicon automatically generates one based on the embed token.
* **AI agent embeds** run queries as the [write actions](#write-actions) actor. Those queries carry the actor's `user_uuid` and no `external_id`, so `externalId` does not identify the viewer in your warehouse. To attribute agent queries to a viewer, add an identifier to [`userAttributes`](#user-attributes). Every attribute on the token is emitted as a `user_attribute_<name>` [tag](https://docs.meetsilicon.com/workspace-admin/usage-analytics.md#user-attribute-tags), whether or not it is defined in Silicon.

`email` is not sent as a query tag.

**Example:**

```javascript theme={null}
{
  user: {
    externalId: 'user-12345',
    email: 'jane@example.com',
  }
}
```

## Token expiration

JWTs should have short expiration times for security. Use your JWT library's expiration parameter:

```javascript theme={null}
jwt.sign(payload, secret, { expiresIn: '1h' })
```

**Recommended expiration times:**

* **Development/testing**: `'24h'` or `'1 week'`
* **Production dashboards**: `'1h'` to `'4h'`
* **Production charts**: `'24h'` (if used in public pages)
* **Explore sessions**: `'4h'` to `'8h'` (longer for analysis sessions)

> [!WARNING]
>
> Always generate tokens server-side with short expiration times. Never generate long-lived tokens in frontend code.

## Code examples

### Node.js

```javascript theme={null}
import jwt from 'jsonwebtoken';

const SILICON_EMBED_SECRET = process.env.SILICON_EMBED_SECRET;
const projectUuid = 'your-project-uuid';

// Dashboard embed
const dashboardToken = jwt.sign({
  content: {
    type: 'dashboard',
    dashboardUuid: 'dashboard-uuid',
    dashboardFiltersInteractivity: { enabled: 'all' },
    canExportCsv: true,
  },
  userAttributes: { tenant_id: 'tenant-123' },
}, SILICON_EMBED_SECRET, { expiresIn: '1h' });

const dashboardUrl = `https://app.meetsilicon.com/embed/${projectUuid}#${dashboardToken}`;

// Chart embed
const chartToken = jwt.sign({
  content: {
    type: 'chart',
    contentId: 'chart-uuid',
    canExportCsv: true,
  },
}, SILICON_EMBED_SECRET, { expiresIn: '24h' });

const chartUrl = `https://app.meetsilicon.com/embed/${projectUuid}/chart/chart-uuid#${chartToken}`;
```

### Python

```python theme={null}
import jwt
import datetime
import os

SILICON_EMBED_SECRET = os.getenv('SILICON_EMBED_SECRET')
project_uuid = 'your-project-uuid'

# Dashboard embed
dashboard_payload = {
    'content': {
        'type': 'dashboard',
        'dashboardUuid': 'dashboard-uuid',
        'dashboardFiltersInteractivity': { 'enabled': 'all' },
        'canExportCsv': True,
    },
    'userAttributes': { 'tenant_id': 'tenant-123' },
    'exp': datetime.datetime.utcnow() + datetime.timedelta(hours=1)
}

dashboard_token = jwt.encode(dashboard_payload, SILICON_EMBED_SECRET, algorithm='HS256')
dashboard_url = f"https://app.meetsilicon.com/embed/{project_uuid}#{dashboard_token}"

# Chart embed
chart_payload = {
    'content': {
        'type': 'chart',
        'contentId': 'chart-uuid',
        'canExportCsv': True,
    },
    'exp': datetime.datetime.utcnow() + datetime.timedelta(hours=24)
}

chart_token = jwt.encode(chart_payload, SILICON_EMBED_SECRET, algorithm='HS256')
chart_url = f"https://app.meetsilicon.com/embed/{project_uuid}/chart/chart-uuid#{chart_token}"
```

### Ruby

```ruby theme={null}
require 'jwt'

silicon_embed_secret = ENV['SILICON_EMBED_SECRET']
project_uuid = 'your-project-uuid'

# Dashboard embed
dashboard_payload = {
  content: {
    type: 'dashboard',
    dashboardUuid: 'dashboard-uuid',
    dashboardFiltersInteractivity: { enabled: 'all' },
    canExportCsv: true
  },
  userAttributes: { tenant_id: 'tenant-123' },
  exp: Time.now.to_i + 3600  # 1 hour
}

dashboard_token = JWT.encode(dashboard_payload, silicon_embed_secret, 'HS256')
dashboard_url = "https://app.meetsilicon.com/embed/#{project_uuid}##{dashboard_token}"

# Chart embed
chart_payload = {
  content: {
    type: 'chart',
    contentId: 'chart-uuid',
    canExportCsv: true
  },
  exp: Time.now.to_i + 86400  # 24 hours
}

chart_token = JWT.encode(chart_payload, silicon_embed_secret, 'HS256')
chart_url = "https://app.meetsilicon.com/embed/#{project_uuid}/chart/chart-uuid##{chart_token}"
```

### Java

```java theme={null}
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

String SILICON_EMBED_SECRET = System.getenv("SILICON_EMBED_SECRET");
String projectUuid = "your-project-uuid";

// Dashboard embed
Map<String, Object> dashboardContent = new HashMap<>();
dashboardContent.put("type", "dashboard");
dashboardContent.put("dashboardUuid", "dashboard-uuid");
dashboardContent.put("canExportCsv", true);

Map<String, Object> userAttrs = new HashMap<>();
userAttrs.put("tenant_id", "tenant-123");

Map<String, Object> dashboardClaims = new HashMap<>();
dashboardClaims.put("content", dashboardContent);
dashboardClaims.put("userAttributes", userAttrs);

String dashboardToken = Jwts.builder()
    .setClaims(dashboardClaims)
    .setExpiration(new Date(System.currentTimeMillis() + 3600000)) // 1 hour
    .signWith(SignatureAlgorithm.HS256, SILICON_EMBED_SECRET)
    .compact();

String dashboardUrl = String.format(
    "https://app.meetsilicon.com/embed/%s#%s",
    projectUuid, dashboardToken
);
```

## Security best practices

### Never expose embed secret

```javascript theme={null}
// ❌ BAD: Never do this
const token = jwt.sign(payload, 'my-secret-key');  // Hardcoded secret

// ✅ GOOD: Use environment variables
const token = jwt.sign(payload, process.env.SILICON_EMBED_SECRET);
```

### Generate tokens server-side only

```javascript theme={null}
// ❌ BAD: Don't generate tokens in frontend/browser
// This exposes your secret!

// ✅ GOOD: Create a backend API endpoint
app.get('/api/embed-token', authenticateUser, (req, res) => {
  const token = jwt.sign({
    content: { type: 'dashboard', dashboardUuid: 'xyz' },
    userAttributes: { tenant_id: req.user.tenantId },
  }, process.env.SECRET);

  res.json({ token });
});
```

### Use short-lived tokens

```javascript theme={null}
// ✅ GOOD: Tokens expire quickly
jwt.sign(payload, secret, { expiresIn: '1h' })

// ⚠ CAUTION: Long-lived tokens are riskier
jwt.sign(payload, secret, { expiresIn: '30d' })
```

### Validate user ownership

```javascript theme={null}
app.get('/api/embed-token', authenticateUser, async (req, res) => {
  const user = await getUser(req.user.id);
  const requestedDashboard = req.query.dashboardId;

  // ✅ Verify user has access to dashboard
  if (!userHasAccessTo(user, requestedDashboard)) {
    return res.status(403).json({ error: 'Unauthorized' });
  }

  const token = jwt.sign({ content: { ... } }, secret);
  res.json({ token });
});
```

### Use user attributes for row- and column-level security

```javascript theme={null}
// ✅ Filter data by user's tenant
{
  userAttributes: {
    tenant_id: user.tenantId,  // From server-side user object
  }
}
```

See [User attributes reference](https://docs.meetsilicon.com/workspace-admin/user-attributes.md) for complete implementation guide.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.