POST
/
api
/
v2
/
guest-token
/
create
Token
curl --request POST \
  --url https://api.usedatabrain.com/api/v2/guest-token/create \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '{
  "dataAppName": "<string>",
  "clientId": "<string>",
  "params": {},
  "expiryTime": 123,
  "datasourceName": "<string>"
}'
// 200: OK
{
  "token": "..."
}

// 400: Bad Request
{
  "error": {
    "message": "invalid dashboard id",
    "code": "<ERROR_CODE>"
  }
}

// 401: Unauthorized
{
  "error": {
    "message": "API key is invalid or expired",
    "code": "AUTHENTICATION_ERR"
  }
}
To obtain a guest token from Databrain, utilize our REST API from your backend system. Each request will generate a unique guest token, ensuring security and flexibility. Once you acquire the guest token, you can seamlessly pass it to your frontend application, where it can be integrated with the web component.

Quick start (simple use case):

When you need a guest token that you want to use across dashboards and metrics. All you have to do is pass clientId, dataAppName. If expiryTime is not passed, the token will not expire.

Cloud Databrain:

POST https://api.usedatabrain.com/api/v2/guest-token/create

Self-hosted Databrain:

POST <SELF_HOSTED_URL>/api/v2/guest-token/create
Generating GUEST TOKEN for your Dashboard/Metric Component.

Headers

Authorization
string
required
Bearer API TOKEN

Request Body

dataAppName
string
required
clientId
string
required
params
object
expiryTime
number
datasourceName
string

Response

// 200: OK
{
  "token": "..."
}

// 400: Bad Request
{
  "error": {
    "message": "invalid dashboard id",
    "code": "<ERROR_CODE>"
  }
}

// 401: Unauthorized
{
  "error": {
    "message": "API key is invalid or expired",
    "code": "AUTHENTICATION_ERR"
  }
}

Error Codes:

  • 'AUTHENTICATION_ERROR'
  • 'INVALID_REQUEST_BODY'
  • 'CLIENT_ID_ERROR'
  • 'WORKSPACE_ID_ERROR'
  • 'DASHBOARD_PARAM_ERROR'
  • 'APP_FILTER_PARAM_ERROR'
  • 'RLS_SETTINGS_PARAM_ERROR'
  • 'INTERNAL_SERVER_ERROR'