Full App Embed > Generate Token API
Create a full app embed token from your backend
Call this API from your backend each time a signed-in user opens the page with the embed. It returns a token you pass to the frontend snippet.
The embed builder generates this request for you with your API key, secret and settings filled in.
Endpoint
POST https://api.draxlr.com/api/full-app-embed/generate-embed-token
Content-Type: application/json
Server-side only:
The request includes your API secret. Never call this API from the browser.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | Your organization's embed API key |
apiSecret | string | Yes | Your organization's embed API secret |
databaseId | string | Yes | The database to embed. The embed builder fills this in |
userIdentifier | string or number | Yes | Your ID for the signed-in user. Each ID gets its own workspace with saved queries, folders and dashboards |
dashboardGroupIds | string[] | No | IDs of the dashboards to show under Shared Dashboards. Default: none |
allowCreateQuery | boolean | No | Let the user save queries. Default: true |
allowCreateDashboard | boolean | No | Let the user create their own dashboards. Default: true |
browseDataModules | string[] | No | Tools to offer: any of "ai", "sql", "visual". Default: all three |
rlsGroup | string | No | Name of a row-level security group. See Row-level Security |
attributes | object | No | Attribute values for the RLS group's rules, such as { "accountId": 42 } |
configuration | object | No | Appearance and export options, below |
configuration
| Field | Type | Description |
|---|---|---|
backgroundColor | string | Page background color, such as "#ffffff". Also decides the light or dark theme |
cardBackgroundColor | string | Background color of dashboard cards |
primaryColor | string | Brand color as a hex code (#RGB or #RRGGBB). Replaces Draxlr's green in buttons and highlights |
showExport | boolean | Downloads from individual elements and the query editor. On unless set to false |
showExportPdf | boolean | Dashboard PDF export. Off unless set to true |
showExportExcel | boolean | Dashboard Excel export. Off unless set to true |
attributes values
| Value | Example |
|---|---|
| Number | 42 |
| Text | "acme" |
| Boolean | true |
| List of numbers | [1, 2, 3] |
| List of text | ["EU", "US"] |
Example
curl -X POST https://api.draxlr.com/api/full-app-embed/generate-embed-token \
-H "Content-Type: application/json" \
-d '{
"apiKey": "YOUR_API_KEY",
"apiSecret": "YOUR_API_SECRET",
"databaseId": "665f1c2a9b1e4a0012ab34cd",
"userIdentifier": "user_1234",
"dashboardGroupIds": ["6690aa11bc2e4a0012cd77ee"],
"allowCreateQuery": true,
"allowCreateDashboard": true,
"browseDataModules": ["ai", "sql", "visual"],
"rlsGroup": "Customers",
"attributes": { "accountId": 42 },
"configuration": {
"backgroundColor": "#ffffff",
"primaryColor": "#6d28d9",
"showExport": true,
"showExportPdf": true,
"showExportExcel": true
}
}'
Response
{
"success": true,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Pass token to the frontend snippet as data-token. Tokens are valid for 24 hours.
The first time a userIdentifier is used, Draxlr creates that user's workspace with a Default folder and, if allowCreateDashboard is on, an empty dashboard called First Dashboard.
Errors
Errors are returned with success: false and an error message.
| Error | Cause |
|---|---|
apiKey and apiSecret are required. | One of them is missing |
API authentication failed | The key or secret is wrong |
Your plan does not support Full App Embedding, please upgrade to use this feature. | Your plan doesn't include Full App Embedding |
databaseId is required. | databaseId is missing |
Invalid database. | The database doesn't exist in your organization |
userIdentifier is required. | userIdentifier is missing or empty |
One or more dashboard groups are invalid. | A dashboard in dashboardGroupIds doesn't exist in your organization |
allowCreateQuery and allowCreateDashboard must be booleans. | One of them isn't true or false |
browseDataModules must be an array containing any of: ai, sql, visual. | An unknown tool was passed |
configuration.primaryColor must be a hex color, for example #00d09f. | primaryColor isn't a hex color |
rlsGroup must be the name of a row-level security group. | rlsGroup is empty or not text |
Your plan does not support row-level security. | rlsGroup was passed, but your plan doesn't include RLS |
Invalid rlsGroup. No row-level security group named "…" exists. | No RLS group has that name |
attributes must be an object of key-value pairs. | attributes isn't an object |
attributes.<key> must be a string, number, boolean, or a non-empty array of strings or numbers. | An attribute value has an unsupported type |