The Generate Session API is available on Premium and Enterprise plans.
Authentication
The Generate Session API requires your Cube Cloud API key for authentication. If the API key is scoped to specific deployments, thedeploymentId in the request body must be within the key’s scope; otherwise the request is rejected with 403 Forbidden. Unscoped keys can mint sessions for any deployment.
Endpoint
Request Headers
Request Body
When using
internalId, the user must already exist in Cube Cloud. You cannot specify groups, userAttributes, groupDefinitions, userAttributeDefinitions, securityContext, or userProfile with internalId — the internal user’s existing permissions are used instead.User profile
userProfile lets you attach a human-readable display name and avatar to an external user so they render with a recognizable identity inside embedded surfaces (workbook owners, dashboard headers, etc.) instead of the raw externalId.
Behavior:
- Both fields are persisted on the external user (keyed by
externalId). - Sending
userProfileon subsequentgenerate-sessioncalls overwrites the previously-saved values. - Omitting
userProfile(or omitting a property inside it) preserves whatever was saved before.
Picture format
Thepicture URL must be reachable by the end-user’s browser — it’s loaded directly via an <img> tag in the embedded UI, not proxied through Cube Cloud. The server validates only that the value is a syntactically valid http(s):// URL; it does not download or sniff the content.
Use a URL that returns one of the common web image formats: PNG, JPEG, GIF, WebP, or SVG. Other content types (videos, PDFs, HTML pages) will fail to render and the avatar will fall back to the user’s initials.
Practical guidance:
- Prefer HTTPS URLs — mixed-content rules will block
http://images on HTTPS embed pages. - Keep the image under ~1 MB and ideally square (e.g. 96×96 or 256×256). Avatars are displayed in small containers, so anything larger is wasted bandwidth.
- The URL must be publicly reachable — signed URLs that expire or assets behind auth headers will not load.
- If the URL fails to load for any reason (404, wrong content type, CORS, network error), the UI gracefully falls back to an initials avatar derived from
displayName. No error is returned to the caller.
User attributes
userAttributes is an array of { name, value } pairs that drive row-level security in queries.
Attribute definition lookup:
- Read-only mode (
creatorModeomitted orfalse): names are resolved against the tenant-wide attribute catalog (managed in Settings → User Attributes or via the admin GraphQL API). Any name not present there fails withUser attributes not found. - Creator mode (
creatorMode: true): names are resolved against the embed tenant’s scoped catalog (embed_user_attributes). UseuserAttributeDefinitionsin the same request to upsert definitions on the fly — see Creator mode bootstrap.
- Duplicate
nameentries are rejected with400 Bad Request. - Values are persisted per user. Subsequent calls with the same
externalIdoverwrite previous values for the supplied names.
Groups
groups is an array of group names (not IDs) that the user should belong to. Group definitions must already exist (or be created in the same request via groupDefinitions in creator mode).
Group definition lookup:
- Read-only mode: names are resolved against tenant-wide groups (managed in Settings → Groups or via the admin GraphQL API). The membership row references the global group.
- Creator mode: names are resolved against the embed tenant’s scoped groups (
embed_user_groups). UsegroupDefinitionsin the same request to upsert them.
groups cannot be resolved, the request fails with Groups with names <missing> not found.
Creator mode: bootstrapping groups and user attributes
In API-first integrations you often want to mint an embed session and define the groups/attributes it references in a single call, without first making a round trip to the admin UI. ThegroupDefinitions and userAttributeDefinitions fields do that — they idempotently upsert definitions in the embed tenant’s scoped tables and are validated before groups and userAttributes are applied.
Both fields:
- Require
creatorMode: true. - Require an
embedTenantName(definitions are only meaningful inside an embed tenant). - Require the
useCreatorModetenant flag — contact support to enable. - Land in the embed-tenant scope only — they never modify tenant-wide groups or attributes.
- Are idempotent: running the same request twice produces the same end state.
groupDefinitions
Duplicate
name entries within the same request are rejected.
userAttributeDefinitions
type is immutable. If a definition with the supplied name already exists with a different type, the request fails with cannot change type and nothing is upserted. This protects every value already stored against that attribute from silently becoming invalid. To change the type, delete the attribute via the embed-tenant admin API and recreate it.
Duplicate name entries within the same request are rejected.
Bootstrap example
Define a group and an attribute, assign the user to both, and mint a session — all in one call:Embed-tenant admin API
To list or delete the groups and attributes that have been bootstrapped into an embed tenant, use the admin endpoints scoped to that tenant:Api-Key authentication as Generate Session and require admin access. List endpoints return cursor-paginated results (?first=, ?after=).
Response
The API returns a session object:
Use the
sessionId directly in your embed URL to authenticate and load content securely.