get_embedded_url endpoint with different parameters.
Data App Embeds
Data apps are standalone React applications that run inside an iframe. They support tenant-scoped filtering, where each embedded user only sees their own data.Obtain Your API Key
Get your API key from the menu in the Definite web application. See here for more.
Build and Publish the Data App
Build the data app using the Definite data-apps skill. The build produces two artifacts:
index.html(full manifest, for internal development)index.embedded.html(stripped manifest, for embedded use)
apps/my-app/dist/).Generate an Embed URL
Call the endpoint to generate a signed embed URL:Endpoint:
POST https://api.definite.app/v1/get_embedded_urlParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
embed_type | string | Yes | Must be "data_app" |
user_identifier | string | Yes | A unique identifier for the visiting user (e.g. tenant ID) |
drive_file | string | Yes | Path to the .embedded.html artifact in your team’s Drive |
required_filters | array | No | Filters applied server-side to all queries. Uses Cube filter syntax: [{"member": "...", "operator": "equals", "values": ["..."]}] |
expires_in | integer | No | Token lifetime in seconds. Default: 86,400 (24 hours). Max: 2,592,000 (30 days). Min: 60. |
allowed_hosts | array | No | Hostnames allowed to iframe the app (sets frame-ancestors CSP). Default: ["*"] (any host). |
Response
Example
Required Filters and Tenant Isolation
Data apps enforce tenant isolation throughrequired_filters. Here’s how it works:
- The app’s
app.jsonmanifest declaresrequiredFilterson each resource, mapping a filter member name to a SQL column:
-
The SQL must include a
{{ required_filters }}marker where the filter predicate should be injected. -
When you call
get_embedded_urlwithrequired_filters: [{"member": "customerId", "operator": "equals", "values": ["A"]}], the server substitutes the marker with a parameterized predicate:(customer_id = $1)with bind var$1 = 'A'. - Filter values are always passed as bind variables, never string-concatenated, so tenant identifiers cannot break out via SQL injection.
-
For non-embedded users (team members testing via session/API key), the marker is replaced with
(TRUE), returning all data.
Important Notes
- Token expiry: Tokens are stateless HMAC-signed payloads. When a token expires, mint a new one via
get_embedded_url. There is no refresh endpoint. - Emergency revocation: Rotating the signing key invalidates all outstanding tokens at once.
- Drive file pinning: The token is pinned to the
drive_filespecified at mint time. A token minted for one app cannot be used to query a different app. - SQL is never sent to the browser. The
.embedded.htmlartifact has SQL and Cube query declarations stripped at build time. The browser only sees{"type": "sql", "embedded": true}. All query execution happens server-side viaPOST /v4/data-apps/query. - Cache headers: The embed HTML response sets
Cache-Control: private, no-storeandReferrer-Policy: no-referrerto prevent token leakage. - Filter options are tenant-scoped. If you build dropdown filters from
SELECT DISTINCTqueries on the client-side DuckDB dataset, the options will only include values that exist in that tenant’s data.
Doc Embeds
Docs (YAML dashboards) can be embedded in iframes using a Supabase magic link flow.Obtain Your API Key
Get your API key from the menu in the Definite web application. See here for more.
Generate an Embedded UI Link
Call the endpoint to generate an embedded UI link:Endpoint:
POST https://api.definite.app/v1/get_embedded_urlParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
embed_type | string | Yes | Must be "doc" |
user_identifier | string | Yes | A user identifier for the visiting user |
doc_id | string | Yes | The UUID of the doc to share (found in the URL after /docs/) |
required_filters | array | No | Cube filters applied to all of the user’s queries |
redirect_query_params | string | No | Additional query params to append to redirect URL |
Example
Important Notes
- User Identifier: The
user_identifierdefines a user in your team with limited access. This user cannot view other users’ content, edit integrations or cube models, or execute SQL blocks. - Multiple Calls: You can call
get_embedded_urlmultiple times with different docs. The user will have a copy of each. - Content Updates: If you update the source doc, all downstream users will receive an updated copy on the next
get_embedded_urlquery or page refresh.

