curl --request POST \
--url https://api.usedatabrain.com/api/v2/data-app/api-tokens \
--header 'Authorization: Bearer service_token_xyz...' \
--header 'Content-Type: application/json' \
--data '{
"dataAppName": "Customer Portal Analytics",
"name": "Production API Key"
}'
{
"key": "550e8400-e29b-41d4-a716-446655440000"
}
curl --request POST \
--url https://api.usedatabrain.com/api/v2/data-app/api-tokens \
--header 'Authorization: Bearer service_token_xyz...' \
--header 'Content-Type: application/json' \
--data '{
"dataAppName": "Customer Portal Analytics",
"name": "Production API Key"
}'
{
"key": "550e8400-e29b-41d4-a716-446655440000"
}
Generate a new API token for a specific Data App to enable embed operations.
curl --request POST \
--url https://api.usedatabrain.com/api/v2/data-app/api-tokens \
--header 'Authorization: Bearer service_token_xyz...' \
--header 'Content-Type: application/json' \
--data '{
"dataAppName": "Customer Portal Analytics",
"name": "Production API Key"
}'
{
"key": "550e8400-e29b-41d4-a716-446655440000"
}
curl --request POST \
--url https://api.usedatabrain.com/api/v2/data-app/api-tokens \
--header 'Authorization: Bearer service_token_xyz...' \
--header 'Content-Type: application/json' \
--data '{
"dataAppName": "Customer Portal Analytics",
"name": "Production API Key"
}'
{
"key": "550e8400-e29b-41d4-a716-446655440000"
}
POST https://api.usedatabrain.com/api/v2/data-app/api-tokens
POST https://api.usedatabrain.com/api/v2/dataApp/api-tokens
Authorization: Bearer service_token_xyz...
application/json for all requests.Content-Type: application/json
Show Finding Data App names
Show Naming recommendations
| Status Code | Description |
|---|---|
200 | OK - API token created successfully |
400 | Bad Request - Invalid request parameters |
500 | Internal Server Error - Server error occurred |
| Error Code | HTTP Status | Description |
|---|---|---|
INVALID_REQUEST_BODY | 400 | Missing or invalid dataAppName or name |
DATA_APP_NOT_FOUND | 400 | Data App with given name not found |
AUTHENTICATION_ERROR | 400 | Invalid or missing service token |
INTERNAL_SERVER_ERROR | 500 | Server error |
Get your service token
Verify the Data App exists
curl --request GET \
--url 'https://api.usedatabrain.com/api/v2/data-app' \
--header 'Authorization: Bearer service_token_xyz...'
Create the API token
curl --request POST \
--url https://api.usedatabrain.com/api/v2/data-app/api-tokens \
--header 'Authorization: Bearer service_token_xyz...' \
--header 'Content-Type: application/json' \
--data '{"dataAppName": "My Data App", "name": "Production Token"}'
Store the API key securely
// Store in environment variables
process.env.DATABRAIN_API_KEY = response.key;
// Or in a secrets manager
await secretsManager.setSecret('databrain-api-key', response.key);
Use the API key for embed operations
curl --request POST \
--url 'https://api.usedatabrain.com/api/v2/data-app/embeds' \
--header 'Authorization: Bearer 550e8400-e29b-41d4-a716-446655440000' \
--header 'Content-Type: application/json' \
--data '{...}'