Workspace APIs
Create a workspace
Make a workspace on a datasource or datamart, ready for dashboards and metrics.
curl --request POST https://api.usedatabrain.com/api/v2/workspace \ --header "Authorization: Bearer $DATABRAIN_SERVICE_TOKEN" \ --header "Content-Type: application/json" \ --data '{ "name": "Customer analytics", "connectionType": "DATAMART", "datamartName": "Sales" }'Auth
A service token. See Authentication.
ApiTokenAuthorizationBearer <token>A service token or a data app API token.
Body
Unknown fields are refused. Names are matched exactly, with capital letters.
Up to 100 characters, unique in your organization. You cannot rename it with the API.
DATASOURCE, DATAMART, MULTI_DATASOURCE or MULTI_DATAMART
Required for DATASOURCE. The datasource name. Ignored for other types.
Required for DATAMART. The datamart name. Ignored for other types.
Name of an LLM in Settings > LLMs.
Names of the LLMs for the AI copilot.
Suggest metrics. Default false
AI summaries on metrics. Default false
Required with isEnableMetricSummary. technicalAndInsightSummary, forecastAndTrendAnalysis, comparativeAndAnomalyDetection or custom
Name of a theme in Settings > UI Theming.
MULTI_DATASOURCE and MULTI_DATAMART workspaces have no fixed connection. Each guest token picks one with datasourceName or datamartName.
Response
{ "data": { "name": "Customer analytics" } }Errors
| Status | error.code | Why |
|---|---|---|
| 400 | INVALID_REQUEST_BODY | A field is missing, unknown or wrong |
| 400 | WORKSPACE_NAME_ALREADY_EXISTS | The name is taken |
| 400 | WORKSPACE_NAME_TOO_LONG | The name is over 100 characters |
| 400 | INVALID_DATASOURCE_NAME | No datasource has this name |
| 400 | INVALID_DATAMART_NAME | No datamart has this name |
| 400 | INVALID_LLM_NAME | No LLM has this name |
| 400 | INVALID_AI_COPILOT_LLMS | One of the aiCopilotLlms names is unknown |
| 400 | INVALID_THEME_NAME | No theme has this name. The workspace was still created: set the theme with update |
| 409 | limit_reached | Your plan's workspace limit is used. The body has limit, used, max, currentPlan and requiredPlan |
For errors that every endpoint returns, see Authentication.
Next, create a data app.
curl -X POST 'https://api.usedatabrain.com/api/v2/workspace' \ -H 'Content-Type: application/json' \ -d '{ "name": "Customer analytics", "connectionType": "DATAMART", "datamartName": "Sales"}'{ "data": { "name": "Customer analytics" }}