Skip to main content
This page is the guide. For the field-by-field API reference of this endpoint, see the canonical Guest Token API reference — if the two ever disagree, the API reference wins.
To obtain a guest token from DataBrain, utilize our REST API from your backend system. Each request will generate a unique guest token, ensuring security and flexibility. Once you acquire the guest token, you can seamlessly pass it to your frontend application, where it can be integrated with the web component.
Create API key from Databrain's dashboard that should be passed in the headers in these requests.
Guest tokens are designed for frontend embedding. Never expose your API key in frontend code — always generate tokens from your backend.

Quick start (simple use case):

When you need a guest token that you want to use across dashboards and metrics, all you have to do is pass clientId, dataAppName. If expiryTime is not passed, the token will not expire.

Cloud Databrain Endpoint:

Self-hosted Databrain Endpoint:

Generating GUEST TOKEN for your Dashboard/Metric Component.

Headers

Request Body

The request body is validated strictly — any field not listed above is rejected with INVALID_REQUEST_BODY. In particular, dataAppId, tenant_id, client_id, and permissions.dashboards are not valid fields. Use clientId and dataAppName exactly as spelled here.
Guest tokens are free. There is no charge, metering, or purchase involved in generating them — mint as many as you need from your backend.

Request Body Examples:

Simple Request Body:

Request Body with App Level Metric Filter:

App filter
A metric level filter designed specifically for controlling access to individual metrics. Unlike general RLS settings, it restricts access without requiring end user input or control.

Request.json

Dashboard App Filters:

Request Body with Dashboard filters:

In the above code snippet, "name", "country", "timePeriod", and "price" are Dashboard App filters.
When you disable the isShowOnUrl, the filter will not be visible to end users as search params on URL.

Datasource [Multi Datasource connection]:

datasourceName is available in app data studio tab.

Hide Dashboard Filters:

To hide dashboard filters in an embedded dashboard:

Allowed Embeds (optional)

To restrict which dashboards a guest token can load, pass an allowlist of IDs in params.allowedEmbeds. When set, the token can only load an embed whose ID (the value you pass to the component’s dashboard-id/dashboardId attribute — an embed ID or dashboard ID both work) is included in the list. Loading any other ID fails with UNAUTHORIZED.

Dashboard Permissions

To enable or disable few dashboard permissions from backend:

User Identifier for Private & Publish Metrics

Use userIdentifier inside the params object to uniquely identify the end-user in your embedded dashboard.
This enables features such as creating private metrics and publishing metrics directly from the embed view.
Note: userIdentifier should be a unique string representing the logged-in user in your system. When set, any metrics created by this identifier can be managed (private or published) within the embedded environment. isAllowPrivateMetricsByDefault should be enabled while creating the dashboard.

Timezone

Use timezone inside the params object to specify an IANA timezone string for timezone-aware queries and date/time formatting. When provided, SQL queries will be executed with this timezone setting, ensuring consistent date/time handling across different timezones. Supported Datasources: Clickhouse, Trino, Redshift, CockroachDB, Postgres, MSSQL Common timezone values: "UTC", "America/New_York", "America/Los_Angeles", "Europe/London", "Asia/Kolkata", "Australia/Sydney"

Code Examples

HTTP Status Codes

Rate Limiting: API requests are limited to prevent abuse. Implement exponential backoff for rate limited requests (429 status).

Error Codes:

At embed runtime (after minting), the distinct errors are INVALID_TOKEN (token not found in this deployment), TOKEN_EXPIRED, UNAUTHORIZED_ORIGIN, UNAUTHORIZED, and INVALID_ID — see the Error Codes Reference.