curl --request POST \
--url https://api.usedatabrain.com/api/v2/workspace \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"name": "Sales Analytics",
"connectionType": "DATASOURCE",
"datasourceName": "postgres-main"
}'
{
"data": {
"name": "Sales Analytics"
},
"error": null
}
curl --request POST \
--url https://api.usedatabrain.com/api/v2/workspace \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"name": "Sales Analytics",
"connectionType": "DATASOURCE",
"datasourceName": "postgres-main"
}'
{
"data": {
"name": "Sales Analytics"
},
"error": null
}
Create a new workspace with datasource, datamart, multi-datasource, or multi-datamart configuration to organize your analytics environment.
curl --request POST \
--url https://api.usedatabrain.com/api/v2/workspace \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"name": "Sales Analytics",
"connectionType": "DATASOURCE",
"datasourceName": "postgres-main"
}'
{
"data": {
"name": "Sales Analytics"
},
"error": null
}
curl --request POST \
--url https://api.usedatabrain.com/api/v2/workspace \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"name": "Sales Analytics",
"connectionType": "DATASOURCE",
"datasourceName": "postgres-main"
}'
{
"data": {
"name": "Sales Analytics"
},
"error": null
}
connectionType that matches how this workspace will use data. For DATASOURCE or DATAMART, the corresponding datasourceName or datamartName must already exist in your organization. For MULTI_DATASOURCE or MULTI_DATAMART, those name fields are not required in the request body (see connectionType below).Authorization: Bearer dbn_live_abc123...
application/json for all requests.Content-Type: application/json
Show Naming guidelines
DATASOURCE, DATAMART, MULTI_DATASOURCE, or MULTI_DATAMART.Show Connection type details
datasourceName is not required for this type)datamartName is not required for this type; it is required only when connectionType is DATAMART)connectionType is DATASOURCE.Show Finding datasource names
connectionType is DATAMART.Show Finding datamart names
false when omitted.false when omitted.technicalAndInsightSummary, forecastAndTrendAnalysis, comparativeAndAnomalyDetection, custom.Required when isEnableMetricSummary is true.summaryType is custom.Show data properties
| Status Code | Description |
|---|---|
200 | OK - Workspace created successfully |
400 | Bad Request - Invalid request parameters |
401 | Unauthorized - Invalid or missing API key |
500 | Internal Server Error - Server error occurred |
| Error Code | HTTP Status | Description |
|---|---|---|
INVALID_REQUEST_BODY | 400 | Missing or invalid parameters |
WORKSPACE_NAME_ALREADY_EXISTS | 400 | Workspace name already exists |
INVALID_DATASOURCE_NAME | 400 | Datasource not found |
INVALID_DATAMART_NAME | 400 | Datamart not found |
INVALID_LLM_NAME | 400 | Invalid LLM name provided |
INVALID_AI_COPILOT_LLMS | 400 | Invalid AI Copilot LLM list |
INVALID_THEME_NAME | 400 | Invalid theme name provided |
INVALID_DATA_APP_API_KEY | 401 | Invalid API key |
INTERNAL_SERVER_ERROR | 500 | Server error |
Verify prerequisites
Choose your connection type
name and connectionType in the minimal body)Create your workspace
curl --request POST \
--url https://api.usedatabrain.com/api/v2/workspace \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"name": "My Analytics Workspace",
"connectionType": "DATASOURCE",
"datasourceName": "postgres-main"
}'