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

ParameterTypeRequiredDescription
apiKeystringYesYour organization's embed API key
apiSecretstringYesYour organization's embed API secret
databaseIdstringYesThe database to embed. The embed builder fills this in
userIdentifierstring or numberYesYour ID for the signed-in user. Each ID gets its own workspace with saved queries, folders and dashboards
dashboardGroupIdsstring[]NoIDs of the dashboards to show under Shared Dashboards. Default: none
allowCreateQuerybooleanNoLet the user save queries. Default: true
allowCreateDashboardbooleanNoLet the user create their own dashboards. Default: true
browseDataModulesstring[]NoTools to offer: any of "ai", "sql", "visual". Default: all three
rlsGroupstringNoName of a row-level security group. See Row-level Security
attributesobjectNoAttribute values for the RLS group's rules, such as { "accountId": 42 }
configurationobjectNoAppearance and export options, below

configuration

FieldTypeDescription
backgroundColorstringPage background color, such as "#ffffff". Also decides the light or dark theme
cardBackgroundColorstringBackground color of dashboard cards
primaryColorstringBrand color as a hex code (#RGB or #RRGGBB). Replaces Draxlr's green in buttons and highlights
showExportbooleanDownloads from individual elements and the query editor. On unless set to false
showExportPdfbooleanDashboard PDF export. Off unless set to true
showExportExcelbooleanDashboard Excel export. Off unless set to true

attributes values

ValueExample
Number42
Text"acme"
Booleantrue
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.

ErrorCause
apiKey and apiSecret are required.One of them is missing
API authentication failedThe 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