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"
}'
curl --request POST \
--url https://api.usedatabrain.com/api/v2/workspace \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"name": "Customer Insights",
"connectionType": "DATAMART",
"datamartName": "customer-data-mart"
}'
curl --request POST \
--url https://api.usedatabrain.com/api/v2/workspace \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"name": "Cross-Platform Analytics",
"connectionType": "MULTI_DATASOURCE"
}'
curl --request POST \
--url https://api.usedatabrain.com/api/v2/workspace \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"name": "Multi-Datamart Analytics",
"connectionType": "MULTI_DATAMART"
}'
curl --request POST \
--url https://api.usedatabrain.com/api/v2/workspace \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"name": "Executive AI Workspace",
"connectionType": "DATAMART",
"datamartName": "finance-datamart",
"llmName": "gpt-4o",
"aiCopilotLlms": ["gpt-4o", "gpt-4.1-mini"],
"isEnableMetricSuggestions": true,
"isEnableMetricSummary": true,
"summaryType": "custom",
"customSummaryPrompt": "Summarize KPIs with variance drivers and weekly action items.",
"themeName": "Executive Theme"
}'
const response = await fetch('https://api.usedatabrain.com/api/v2/workspace', {
method: 'POST',
headers: {
'Authorization': 'Bearer dbn_live_abc123...',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Sales Analytics',
connectionType: 'DATASOURCE',
datasourceName: 'postgres-main'
})
});
const result = await response.json();
console.log(result);
import requests
response = requests.post(
'https://api.usedatabrain.com/api/v2/workspace',
headers={
'Authorization': 'Bearer dbn_live_abc123...',
'Content-Type': 'application/json'
},
json={
'name': 'Sales Analytics',
'connectionType': 'DATASOURCE',
'datasourceName': 'postgres-main'
}
)
result = response.json()
print(result)
require 'net/http'
require 'json'
uri = URI('https://api.usedatabrain.com/api/v2/workspace')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer dbn_live_abc123...'
request['Content-Type'] = 'application/json'
request.body = {
name: 'Sales Analytics',
connectionType: 'DATASOURCE',
datasourceName: 'postgres-main'
}.to_json
response = http.request(request)
result = JSON.parse(response.body)
puts result
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class CreateWorkspace {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String requestBody = """
{
"name": "Sales Analytics",
"connectionType": "DATASOURCE",
"datasourceName": "postgres-main"
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.usedatabrain.com/api/v2/workspace"))
.header("Authorization", "Bearer dbn_live_abc123...")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
type WorkspaceRequest struct {
Name string `json:"name"`
ConnectionType string `json:"connectionType"`
DatasourceName string `json:"datasourceName,omitempty"`
DatamartName string `json:"datamartName,omitempty"`
}
func main() {
reqData := WorkspaceRequest{
Name: "Sales Analytics",
ConnectionType: "DATASOURCE",
DatasourceName: "postgres-main",
}
jsonData, _ := json.Marshal(reqData)
req, _ := http.NewRequest("POST",
"https://api.usedatabrain.com/api/v2/workspace",
bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer dbn_live_abc123...")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
fmt.Println("Workspace created successfully")
}
<?php
$url = 'https://api.usedatabrain.com/api/v2/workspace';
$data = [
'name' => 'Sales Analytics',
'connectionType' => 'DATASOURCE',
'datasourceName' => 'postgres-main'
];
$options = [
'http' => [
'header' => [
'Authorization: Bearer dbn_live_abc123...',
'Content-Type: application/json'
],
'method' => 'POST',
'content' => json_encode($data)
]
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
$result = json_decode($response, true);
echo "Workspace: " . $result['data']['name'];
?>
{
"data": {
"name": "Sales Analytics"
},
"error": null
}
{
"error": {
"code": "WORKSPACE_NAME_ALREADY_EXISTS",
"message": "Workspace with the same name already exists"
}
}
{
"error": {
"code": "INVALID_DATASOURCE_NAME",
"message": "Invalid datasource name provided"
}
}
{
"error": {
"code": "INVALID_DATAMART_NAME",
"message": "Invalid datamart name provided"
}
}
{
"error": {
"code": "INVALID_REQUEST_BODY",
"message": "\"connectionType\" is required"
}
}
{
"error": {
"code": "INVALID_DATA_APP_API_KEY",
"message": "invalid or expired API KEY, data app not found"
}
}
{
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal Server Error"
}
}
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"
}'
curl --request POST \
--url https://api.usedatabrain.com/api/v2/workspace \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"name": "Customer Insights",
"connectionType": "DATAMART",
"datamartName": "customer-data-mart"
}'
curl --request POST \
--url https://api.usedatabrain.com/api/v2/workspace \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"name": "Cross-Platform Analytics",
"connectionType": "MULTI_DATASOURCE"
}'
curl --request POST \
--url https://api.usedatabrain.com/api/v2/workspace \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"name": "Multi-Datamart Analytics",
"connectionType": "MULTI_DATAMART"
}'
curl --request POST \
--url https://api.usedatabrain.com/api/v2/workspace \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"name": "Executive AI Workspace",
"connectionType": "DATAMART",
"datamartName": "finance-datamart",
"llmName": "gpt-4o",
"aiCopilotLlms": ["gpt-4o", "gpt-4.1-mini"],
"isEnableMetricSuggestions": true,
"isEnableMetricSummary": true,
"summaryType": "custom",
"customSummaryPrompt": "Summarize KPIs with variance drivers and weekly action items.",
"themeName": "Executive Theme"
}'
const response = await fetch('https://api.usedatabrain.com/api/v2/workspace', {
method: 'POST',
headers: {
'Authorization': 'Bearer dbn_live_abc123...',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Sales Analytics',
connectionType: 'DATASOURCE',
datasourceName: 'postgres-main'
})
});
const result = await response.json();
console.log(result);
import requests
response = requests.post(
'https://api.usedatabrain.com/api/v2/workspace',
headers={
'Authorization': 'Bearer dbn_live_abc123...',
'Content-Type': 'application/json'
},
json={
'name': 'Sales Analytics',
'connectionType': 'DATASOURCE',
'datasourceName': 'postgres-main'
}
)
result = response.json()
print(result)
require 'net/http'
require 'json'
uri = URI('https://api.usedatabrain.com/api/v2/workspace')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer dbn_live_abc123...'
request['Content-Type'] = 'application/json'
request.body = {
name: 'Sales Analytics',
connectionType: 'DATASOURCE',
datasourceName: 'postgres-main'
}.to_json
response = http.request(request)
result = JSON.parse(response.body)
puts result
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class CreateWorkspace {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String requestBody = """
{
"name": "Sales Analytics",
"connectionType": "DATASOURCE",
"datasourceName": "postgres-main"
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.usedatabrain.com/api/v2/workspace"))
.header("Authorization", "Bearer dbn_live_abc123...")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
type WorkspaceRequest struct {
Name string `json:"name"`
ConnectionType string `json:"connectionType"`
DatasourceName string `json:"datasourceName,omitempty"`
DatamartName string `json:"datamartName,omitempty"`
}
func main() {
reqData := WorkspaceRequest{
Name: "Sales Analytics",
ConnectionType: "DATASOURCE",
DatasourceName: "postgres-main",
}
jsonData, _ := json.Marshal(reqData)
req, _ := http.NewRequest("POST",
"https://api.usedatabrain.com/api/v2/workspace",
bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer dbn_live_abc123...")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
fmt.Println("Workspace created successfully")
}
<?php
$url = 'https://api.usedatabrain.com/api/v2/workspace';
$data = [
'name' => 'Sales Analytics',
'connectionType' => 'DATASOURCE',
'datasourceName' => 'postgres-main'
];
$options = [
'http' => [
'header' => [
'Authorization: Bearer dbn_live_abc123...',
'Content-Type: application/json'
],
'method' => 'POST',
'content' => json_encode($data)
]
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
$result = json_decode($response, true);
echo "Workspace: " . $result['data']['name'];
?>
{
"data": {
"name": "Sales Analytics"
},
"error": null
}
{
"error": {
"code": "WORKSPACE_NAME_ALREADY_EXISTS",
"message": "Workspace with the same name already exists"
}
}
{
"error": {
"code": "INVALID_DATASOURCE_NAME",
"message": "Invalid datasource name provided"
}
}
{
"error": {
"code": "INVALID_DATAMART_NAME",
"message": "Invalid datamart name provided"
}
}
{
"error": {
"code": "INVALID_REQUEST_BODY",
"message": "\"connectionType\" is required"
}
}
{
"error": {
"code": "INVALID_DATA_APP_API_KEY",
"message": "invalid or expired API KEY, data app not found"
}
}
{
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal Server Error"
}
}
Workspace APIs
Create Workspace
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"
}'
curl --request POST \
--url https://api.usedatabrain.com/api/v2/workspace \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"name": "Customer Insights",
"connectionType": "DATAMART",
"datamartName": "customer-data-mart"
}'
curl --request POST \
--url https://api.usedatabrain.com/api/v2/workspace \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"name": "Cross-Platform Analytics",
"connectionType": "MULTI_DATASOURCE"
}'
curl --request POST \
--url https://api.usedatabrain.com/api/v2/workspace \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"name": "Multi-Datamart Analytics",
"connectionType": "MULTI_DATAMART"
}'
curl --request POST \
--url https://api.usedatabrain.com/api/v2/workspace \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"name": "Executive AI Workspace",
"connectionType": "DATAMART",
"datamartName": "finance-datamart",
"llmName": "gpt-4o",
"aiCopilotLlms": ["gpt-4o", "gpt-4.1-mini"],
"isEnableMetricSuggestions": true,
"isEnableMetricSummary": true,
"summaryType": "custom",
"customSummaryPrompt": "Summarize KPIs with variance drivers and weekly action items.",
"themeName": "Executive Theme"
}'
const response = await fetch('https://api.usedatabrain.com/api/v2/workspace', {
method: 'POST',
headers: {
'Authorization': 'Bearer dbn_live_abc123...',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Sales Analytics',
connectionType: 'DATASOURCE',
datasourceName: 'postgres-main'
})
});
const result = await response.json();
console.log(result);
import requests
response = requests.post(
'https://api.usedatabrain.com/api/v2/workspace',
headers={
'Authorization': 'Bearer dbn_live_abc123...',
'Content-Type': 'application/json'
},
json={
'name': 'Sales Analytics',
'connectionType': 'DATASOURCE',
'datasourceName': 'postgres-main'
}
)
result = response.json()
print(result)
require 'net/http'
require 'json'
uri = URI('https://api.usedatabrain.com/api/v2/workspace')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer dbn_live_abc123...'
request['Content-Type'] = 'application/json'
request.body = {
name: 'Sales Analytics',
connectionType: 'DATASOURCE',
datasourceName: 'postgres-main'
}.to_json
response = http.request(request)
result = JSON.parse(response.body)
puts result
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class CreateWorkspace {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String requestBody = """
{
"name": "Sales Analytics",
"connectionType": "DATASOURCE",
"datasourceName": "postgres-main"
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.usedatabrain.com/api/v2/workspace"))
.header("Authorization", "Bearer dbn_live_abc123...")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
type WorkspaceRequest struct {
Name string `json:"name"`
ConnectionType string `json:"connectionType"`
DatasourceName string `json:"datasourceName,omitempty"`
DatamartName string `json:"datamartName,omitempty"`
}
func main() {
reqData := WorkspaceRequest{
Name: "Sales Analytics",
ConnectionType: "DATASOURCE",
DatasourceName: "postgres-main",
}
jsonData, _ := json.Marshal(reqData)
req, _ := http.NewRequest("POST",
"https://api.usedatabrain.com/api/v2/workspace",
bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer dbn_live_abc123...")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
fmt.Println("Workspace created successfully")
}
<?php
$url = 'https://api.usedatabrain.com/api/v2/workspace';
$data = [
'name' => 'Sales Analytics',
'connectionType' => 'DATASOURCE',
'datasourceName' => 'postgres-main'
];
$options = [
'http' => [
'header' => [
'Authorization: Bearer dbn_live_abc123...',
'Content-Type: application/json'
],
'method' => 'POST',
'content' => json_encode($data)
]
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
$result = json_decode($response, true);
echo "Workspace: " . $result['data']['name'];
?>
{
"data": {
"name": "Sales Analytics"
},
"error": null
}
{
"error": {
"code": "WORKSPACE_NAME_ALREADY_EXISTS",
"message": "Workspace with the same name already exists"
}
}
{
"error": {
"code": "INVALID_DATASOURCE_NAME",
"message": "Invalid datasource name provided"
}
}
{
"error": {
"code": "INVALID_DATAMART_NAME",
"message": "Invalid datamart name provided"
}
}
{
"error": {
"code": "INVALID_REQUEST_BODY",
"message": "\"connectionType\" is required"
}
}
{
"error": {
"code": "INVALID_DATA_APP_API_KEY",
"message": "invalid or expired API KEY, data app not found"
}
}
{
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal Server Error"
}
}
POST
/
api
/
v2
/
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": "Sales Analytics",
"connectionType": "DATASOURCE",
"datasourceName": "postgres-main"
}'
curl --request POST \
--url https://api.usedatabrain.com/api/v2/workspace \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"name": "Customer Insights",
"connectionType": "DATAMART",
"datamartName": "customer-data-mart"
}'
curl --request POST \
--url https://api.usedatabrain.com/api/v2/workspace \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"name": "Cross-Platform Analytics",
"connectionType": "MULTI_DATASOURCE"
}'
curl --request POST \
--url https://api.usedatabrain.com/api/v2/workspace \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"name": "Multi-Datamart Analytics",
"connectionType": "MULTI_DATAMART"
}'
curl --request POST \
--url https://api.usedatabrain.com/api/v2/workspace \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"name": "Executive AI Workspace",
"connectionType": "DATAMART",
"datamartName": "finance-datamart",
"llmName": "gpt-4o",
"aiCopilotLlms": ["gpt-4o", "gpt-4.1-mini"],
"isEnableMetricSuggestions": true,
"isEnableMetricSummary": true,
"summaryType": "custom",
"customSummaryPrompt": "Summarize KPIs with variance drivers and weekly action items.",
"themeName": "Executive Theme"
}'
const response = await fetch('https://api.usedatabrain.com/api/v2/workspace', {
method: 'POST',
headers: {
'Authorization': 'Bearer dbn_live_abc123...',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Sales Analytics',
connectionType: 'DATASOURCE',
datasourceName: 'postgres-main'
})
});
const result = await response.json();
console.log(result);
import requests
response = requests.post(
'https://api.usedatabrain.com/api/v2/workspace',
headers={
'Authorization': 'Bearer dbn_live_abc123...',
'Content-Type': 'application/json'
},
json={
'name': 'Sales Analytics',
'connectionType': 'DATASOURCE',
'datasourceName': 'postgres-main'
}
)
result = response.json()
print(result)
require 'net/http'
require 'json'
uri = URI('https://api.usedatabrain.com/api/v2/workspace')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer dbn_live_abc123...'
request['Content-Type'] = 'application/json'
request.body = {
name: 'Sales Analytics',
connectionType: 'DATASOURCE',
datasourceName: 'postgres-main'
}.to_json
response = http.request(request)
result = JSON.parse(response.body)
puts result
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class CreateWorkspace {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String requestBody = """
{
"name": "Sales Analytics",
"connectionType": "DATASOURCE",
"datasourceName": "postgres-main"
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.usedatabrain.com/api/v2/workspace"))
.header("Authorization", "Bearer dbn_live_abc123...")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
type WorkspaceRequest struct {
Name string `json:"name"`
ConnectionType string `json:"connectionType"`
DatasourceName string `json:"datasourceName,omitempty"`
DatamartName string `json:"datamartName,omitempty"`
}
func main() {
reqData := WorkspaceRequest{
Name: "Sales Analytics",
ConnectionType: "DATASOURCE",
DatasourceName: "postgres-main",
}
jsonData, _ := json.Marshal(reqData)
req, _ := http.NewRequest("POST",
"https://api.usedatabrain.com/api/v2/workspace",
bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer dbn_live_abc123...")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
fmt.Println("Workspace created successfully")
}
<?php
$url = 'https://api.usedatabrain.com/api/v2/workspace';
$data = [
'name' => 'Sales Analytics',
'connectionType' => 'DATASOURCE',
'datasourceName' => 'postgres-main'
];
$options = [
'http' => [
'header' => [
'Authorization: Bearer dbn_live_abc123...',
'Content-Type: application/json'
],
'method' => 'POST',
'content' => json_encode($data)
]
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
$result = json_decode($response, true);
echo "Workspace: " . $result['data']['name'];
?>
{
"data": {
"name": "Sales Analytics"
},
"error": null
}
{
"error": {
"code": "WORKSPACE_NAME_ALREADY_EXISTS",
"message": "Workspace with the same name already exists"
}
}
{
"error": {
"code": "INVALID_DATASOURCE_NAME",
"message": "Invalid datasource name provided"
}
}
{
"error": {
"code": "INVALID_DATAMART_NAME",
"message": "Invalid datamart name provided"
}
}
{
"error": {
"code": "INVALID_REQUEST_BODY",
"message": "\"connectionType\" is required"
}
}
{
"error": {
"code": "INVALID_DATA_APP_API_KEY",
"message": "invalid or expired API KEY, data app not found"
}
}
{
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal Server Error"
}
}
Create workspaces to organize your analytics environment by connecting datasources or datamarts. Workspaces serve as containers for dashboards and metrics, providing structured access to your data.
Choose a
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).Authentication
This endpoint requires a service token in the Authorization header. Service tokens differ from data app API keys and provide organization-level permissions. To access your service token:- In Settings page, navigate to the Service Tokens section.
- Click the “Generate Token” button to create a new service token if you don’t have one already.
Headers
string
required
Bearer token for API authentication. Use your service token.
Authorization: Bearer dbn_live_abc123...
string
required
Must be set to
application/json for all requests.Content-Type: application/json
Request Body
string
required
Name of the workspace to create. Must be unique within your organization.
Show Naming guidelines
Show Naming guidelines
- Use descriptive names (e.g., “sales-analytics”, “customer-insights”)
- Alphanumeric characters and spaces are supported
- Must be unique within your organization
- Cannot be changed after creation (use update API to modify connection)
string
required
Type of connection for the workspace. Must be one of:
DATASOURCE, DATAMART, MULTI_DATASOURCE, or MULTI_DATAMART.Show Connection type details
Show Connection type details
- DATASOURCE: Connect directly to a single datasource
- DATAMART: Connect to a pre-configured datamart
- MULTI_DATASOURCE: Allow connections to multiple datasources within this workspace (
datasourceNameis not required for this type) - MULTI_DATAMART: Allow multiple datamarts in this workspace (
datamartNameis not required for this type; it is required only whenconnectionTypeisDATAMART)
string
Name of the datasource to connect to this workspace.Required when
connectionType is DATASOURCE.Show Finding datasource names
Show Finding datasource names
- Check your datasources list in the DataBrain dashboard
- Use the exact name as stored in datasource credentials
- Names are case-sensitive
string
Name of the datamart to connect to this workspace.Required when
connectionType is DATAMART.Show Finding datamart names
Show Finding datamart names
- List available datamarts using the List Datamarts API
- Use the exact name as it appears in your datamart configuration
- Names are case-sensitive
string
Optional primary LLM name for workspace-level AI features. Must match an existing LLM configured in your organization.
array
Optional list of LLM names available for AI Copilot in this workspace. Every value must match an existing organization LLM name.
boolean
Optional flag to enable AI-powered metric suggestions in this workspace. Defaults to
false when omitted.boolean
Optional flag to enable AI-generated metric summaries in this workspace. Defaults to
false when omitted.string
Summary mode used when metric summaries are enabled. Must be one of:
technicalAndInsightSummary, forecastAndTrendAnalysis, comparativeAndAnomalyDetection, custom.Required when isEnableMetricSummary is true.string
Custom summary instruction prompt for AI-generated summaries.Required when
summaryType is custom.string
Optional workspace theme name. Must match an existing theme configured in your organization.
Response
object
Contains the created workspace information on success.
Show data properties
Show data properties
string
The name of the successfully created workspace.
null | object
Examples
HTTP Status Code Summary
| 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 |
Possible Errors
| 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 |
Quick Start Guide
1
Verify prerequisites
Before creating a workspace, ensure you have:
- A valid API token from your data app
- Either a datasource or datamart already configured
- The exact name of your datasource or datamart (case-sensitive)
2
Choose your connection type
Decide which connection type fits your use case:
- DATASOURCE: For connecting to a single data source
- DATAMART: For connecting to a pre-configured datamart with table/column configurations
- MULTI_DATASOURCE: For workspaces that need access to multiple datasources
- MULTI_DATAMART: For workspaces that support multiple datamarts (same API shape as multi-datasource: only
nameandconnectionTypein the minimal body)
Start with DATASOURCE for simple use cases. Use DATAMART when you need structured access with tenancy settings. For multi-datamart setup in the product UI, see Multi Datamart Workspace.
3
Create your workspace
Make the API call with your chosen configuration:
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"
}'
Successful response returns the workspace name. Save this for use in embed configurations.
4
Use your workspace
Reference your workspace in dashboards and metrics:
const embedConfig = {
workspaceName: 'My Analytics Workspace',
// ... other configuration
};
⌘I

