curl --request POST \
--url https://api.usedatabrain.com/api/v2/guest-token/create \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"clientId": "user-456",
"dataAppName": "sales-dashboard"
}'
{
"token": "3affda8b-7bd4-4a88-9687-105a94cfffab"
}
curl --request POST \
--url https://api.usedatabrain.com/api/v2/guest-token/create \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"clientId": "user-456",
"dataAppName": "sales-dashboard"
}'
{
"token": "3affda8b-7bd4-4a88-9687-105a94cfffab"
}
Generate secure guest tokens for embedding DataBrain dashboards and metrics in your application.
curl --request POST \
--url https://api.usedatabrain.com/api/v2/guest-token/create \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"clientId": "user-456",
"dataAppName": "sales-dashboard"
}'
{
"token": "3affda8b-7bd4-4a88-9687-105a94cfffab"
}
curl --request POST \
--url https://api.usedatabrain.com/api/v2/guest-token/create \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"clientId": "user-456",
"dataAppName": "sales-dashboard"
}'
{
"token": "3affda8b-7bd4-4a88-9687-105a94cfffab"
}
clientId and dataAppName are required. All other parameters (params, permissions, expiryTime, datasourceName) are optional for advanced use cases.dashboardAppFilters, appFilters)params.allowedEmbeds)permissions object)userIdentifier)params.timezone)datasourceName)hideDashboardFilters, isShowOnUrl)expiryTime)Authorization: Bearer dbn_live_abc123...
application/json for all requests.Content-Type: application/json
Show Best practices
Show Example values
"sales-dashboard""marketing-metrics""customer-analytics"allowedEmbeds, the guest token will only allow access to those specific embeds (by their embedId). All other embeds will be inaccessible with this token.Show Example usage
{
"clientId": "user-456",
"dataAppName": "sales-dashboard",
"params": {
"allowedEmbeds": ["embed_abc123", "embed_def456"]
}
}
Metric App Filter
"paid_orders": true"amount": 500"country": "USA""countries": ["USA", "CANADA"]{ "sql": "SELECT...", "columnName": "name" }Show Example with multiple filter types
{
"metricId": "metric_123",
"values": {
"paid_orders": true,
"amount": 500,
"country": ["USA", "CANADA"],
"region": {
"sql": "SELECT \"name\" FROM \"public\".\"regions\" WHERE isActive=true",
"columnName": "name"
}
}
}
Dashboard AppFilters
"name": "Eric""country": ["USA", "CANADA"]"timePeriod": { "startDate": "2024-01-01", "endDate": "2024-03-23" }"price": { "min": 1000, "max": 5000 }{ "sql": "SELECT...", "columnName": "name" }Show Complete example with all filter types
{
"dashboardId": "dashboard_abc123",
"values": {
"name": "Eric",
"country": ["USA", "CANADA"],
"timePeriod": {
"startDate": "2024-01-01",
"endDate": "2024-03-23"
},
"price": { "min": 1000, "max": 5000 },
"region": {
"sql": "SELECT \"name\" FROM \"public\".\"countries\" WHERE isEnabled=true",
"columnName": "name"
}
},
"isShowOnUrl": false
}
false, filters are applied but not visible to end users in the URL.false to hide sensitive filter criteria from end users while still applying the filtering logic.Show Example usage
{
"clientId": "user-456",
"dataAppName": "sales-dashboard",
"params": {
"hideDashboardFilters": ["region_filter", "date_range", "status"]
}
}
isAllowPrivateMetricsByDefault setting must be enabled when creating the dashboard for this feature to work.Show Use case example
{
"clientId": "client-123",
"dataAppName": "analytics-app",
"params": {
"userIdentifier": "user_john_doe_789"
}
}
Show Common timezone values
"UTC" - Coordinated Universal Time"America/New_York" - Eastern Time (US)"America/Los_Angeles" - Pacific Time (US)"Europe/London" - Greenwich Mean Time / British Summer Time"Asia/Kolkata" - Indian Standard Time"Australia/Sydney" - Australian Eastern Time{
"clientId": "user-456",
"dataAppName": "sales-dashboard",
"params": {
"timezone": "America/New_York"
}
}
Permission Options
true, end users cannot create new metrics.Show Use case
true disables only the metric creation feature for end users in the embedded interface.false or remove it.Show Common values
3600000 - 1 hour (3600 * 1000 ms)86400000 - 24 hours604800000 - 7 daysShow Multi-datasource example
{
"clientId": "user-456",
"dataAppName": "analytics-app",
"datasourceName": "production_db_replica"
}
null for successful requests.| Status Code | Description |
|---|---|
200 | OK - Request succeeded |
400 | Bad Request - Invalid request parameters |
401 | Unauthorized - Invalid or missing API key |
403 | Forbidden - Access denied to resource |
404 | Not Found - Resource not found |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error - Server error occurred |
| Error Code | HTTP Status | Description |
|---|---|---|
AUTHENTICATION_ERROR | 401 | Invalid or missing API key |
INVALID_REQUEST_BODY | 400 | Missing or invalid parameters |
CLIENT_ID_ERROR | 400 | Invalid clientId format or value |
DATA_APP_ID_ERROR | 404 | Data app not found |
WORKSPACE_ID_ERROR | 404 | Workspace not found or inaccessible |
DASHBOARD_PARAM_ERROR | 400 | Invalid dashboard filter parameters |
APP_FILTER_PARAM_ERROR | 400 | Invalid app filter configuration |
RLS_SETTINGS_PARAM_ERROR | 400 | Invalid RLS settings |
RATE_LIMIT_EXCEEDED | 429 | Too many requests |
INTERNAL_SERVER_ERROR | 500 | Server error |
INVALID_PERMISSIONS | 403 | Invalid permission settings |
EXPIRED_TOKEN | 401 | Token has expired |