> ## 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.

# How to embed the metrics catalog

> Let your users browse a project's metrics and dimensions without a Silicon login

> [!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

Metrics catalog embedding lets you drop the Silicon metrics catalog directly into your application. Embedded users can browse the metrics defined in a project, search by name or category, preview a metric on a small chart, and -- if you allow it -- jump into Explore to slice the metric by any dimension in the model.

Metrics catalog embeds use the same JWT-based security model as other embed types, with a dedicated `content.type: "metricsCatalog"` token. Dashboard, chart, and AI agent tokens cannot access the metrics catalog, and a metrics catalog token cannot render other embed surfaces.

### When to use metrics catalog embedding

* Give customers a self-serve "what can I measure?" view of your semantic layer inside your product.
* Surface a metric browser next to your own charts so users can discover related metrics.
* Let embedded users start a new exploration from any metric without exposing your full Silicon workspace.

### Available features

Embedded metrics catalog supports:

* Browsing all metrics in the project the JWT is scoped to
* Searching and filtering by table, owner, and category, with any of those filter controls [hidden](https://docs.meetsilicon.com/embed/react-sdk.md#hide-filter-controls)
* Previewing a metric with its default time-series chart
* Continuing into an embedded Explore from any metric when `content.canExplore` is `true`
* Saving Explore results into the token's write spaces via [write actions](https://docs.meetsilicon.com/embed/reference.md#write-actions)
* Row- and column-level filtering via [user attributes](https://docs.meetsilicon.com/workspace-admin/user-attributes.md)

## Prerequisites

Before you embed the metrics catalog, you need:

* An embed secret for the project. See [Embedding quickstart](https://docs.meetsilicon.com/embed/set-up-embedding.md).
* At least one metric defined in the project's semantic layer. See [How to create metrics](https://docs.meetsilicon.com/semantic-layer/metrics.md).
* A React or Next.js host application -- metrics catalog embedding is only available through the React SDK.
* If you want embedded users to save charts from Explore, at least one write space and a write actor. See [Write actions](https://docs.meetsilicon.com/embed/reference.md#write-actions).

## Embed the metrics catalog with the React SDK

The React SDK ships a `Silicon.MetricsCatalog` component that renders the catalog. When the embedded viewer clicks **Explore from here** on a metric, the same component swaps in an embedded Explore view -- the host page never has to change route.

```tsx theme={null}
import Silicon from '@meetsilicon/sdk';

function MyMetricsCatalog() {
  return (
    <Silicon.MetricsCatalog
      instanceUrl="https://app.meetsilicon.com"
      token={generateMetricsCatalogToken()} // Server-side function
    />
  );
}
```

See [`Silicon.MetricsCatalog`](https://docs.meetsilicon.com/embed/react-sdk#siliconmetricscatalog) for the full prop list and styling options.

## Generate a metrics catalog embed token

Metrics catalog embeds require a JWT with `content.type: "metricsCatalog"`. Generate it server-side using your embed secret; the [embedding reference](https://docs.meetsilicon.com/embed/reference.md#metrics-catalog-token) has the complete token structure.

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

const token = jwt.sign({
  content: {
    type: 'metricsCatalog',
    projectUuid: 'your-project-uuid',
    canExplore: true,
  },
  writeActions: {
    serviceAccountUserUuid: 'service-account-user-uuid',
    writeSpaceUuids: ['destination-space-uuid'],
  },
  userAttributes: {
    tenant_id: 'tenant-abc', // Row-level filtering for the embedded viewer
  },
  user: {
    email: 'customer@example.com',
  },
}, process.env.SILICON_EMBED_SECRET, { expiresIn: '1h' });
```

**Required fields:**

* `content.type` -- must be `"metricsCatalog"`.
* `content.projectUuid` -- pins the embed to a specific project. The catalog only lists metrics from this project.

**Optional fields:**

* `content.canExplore` -- when `true`, embedded users can click **Explore from here** on any metric to open the embedded Explore view. Omit or set to `false` to keep the embed read-only.
* `writeActions` -- needed only when `canExplore` is `true` and you want embedded users to save charts they build from Explore. See [Write actions](https://docs.meetsilicon.com/embed/reference.md#write-actions).
* `userAttributes` -- applies row- and column-level filters to catalog previews and Explore queries, identical to other embed types.
* `user.email` / `user.externalId` -- surfaced in audit and analytics for the embedded viewer.

## Controlling access

Metrics catalog embeds honor the same access controls as other embed surfaces:

* The catalog only shows metrics from the project named in `content.projectUuid`.
* [User attributes](https://docs.meetsilicon.com/workspace-admin/user-attributes.md) applied to the JWT hide tables, dimensions, and [metrics](https://docs.meetsilicon.com/workspace-admin/user-attributes.md#metric-access-control) whose `required_attributes` rules the embedded viewer does not satisfy, both in the catalog listing and in any Explore session launched from it.
* Metric previews and Explore queries run with the write actor's permissions (when `writeActions` is set) plus any `userAttributes` filters, so embedded viewers only see rows and columns they are entitled to.
* Metric and field SQL is hidden unless the write actor has the `view:EmbedCompiledSql` scope; see [Compiled SQL](https://docs.meetsilicon.com/embed/reference.md#compiled-sql).
* When `canExplore` isn't `true` and the write actor's role doesn't grant `view:EmbedExplore`, the catalog is read-only -- the **Explore from here** action is hidden and Explore routes reject the token.
* Metrics catalog tokens are rejected by dashboard, chart, AI agent, and data app routes, and vice versa.

## Example: read-only metrics catalog

To publish a browse-only catalog without Explore or chart saving, mint a token with just `type` and `projectUuid`:

```javascript theme={null}
const token = jwt.sign({
  content: {
    type: 'metricsCatalog',
    projectUuid: 'your-project-uuid',
  },
  userAttributes: {
    tenant_id: 'tenant-abc',
  },
}, process.env.SILICON_EMBED_SECRET, { expiresIn: '1h' });
```

Embedded users can search and preview metrics, but the **Explore from here** action is hidden and Explore routes reject the token.


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