curl --request POST \
--url https://api.usedatabrain.com/api/v2/datasource \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"datasourceType": "postgres",
"credentials": {
"name": "production-postgres",
"host": "db.example.com",
"port": 5432,
"username": "dbuser",
"password": "securepassword",
"database": "analytics",
"schema": "public"
}
}'
{
"name": "production-postgres"
}
curl --request POST \
--url https://api.usedatabrain.com/api/v2/datasource \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"datasourceType": "postgres",
"credentials": {
"name": "production-postgres",
"host": "db.example.com",
"port": 5432,
"username": "dbuser",
"password": "securepassword",
"database": "analytics",
"schema": "public"
}
}'
{
"name": "production-postgres"
}
Create a new datasource connection to your data infrastructure. Supports multiple database types and cloud services.
curl --request POST \
--url https://api.usedatabrain.com/api/v2/datasource \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"datasourceType": "postgres",
"credentials": {
"name": "production-postgres",
"host": "db.example.com",
"port": 5432,
"username": "dbuser",
"password": "securepassword",
"database": "analytics",
"schema": "public"
}
}'
{
"name": "production-postgres"
}
curl --request POST \
--url https://api.usedatabrain.com/api/v2/datasource \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"datasourceType": "postgres",
"credentials": {
"name": "production-postgres",
"host": "db.example.com",
"port": 5432,
"username": "dbuser",
"password": "securepassword",
"database": "analytics",
"schema": "public"
}
}'
{
"name": "production-postgres"
}
POST https://api.usedatabrain.com/api/v2/datasource
POST <SELF_HOSTED_URL>/api/v2/datasource
Authorization: Bearer dbn_live_abc123...
application/json for all requests.Content-Type: application/json
snowflake - Snowflake data warehousepostgres - PostgreSQL databaseredshift - Amazon Redshiftcockroachdb - CockroachDBmysql - MySQL databasemongodb - MongoDB databaseclickhouse - ClickHouse databasesinglestore - SingleStore databasebigquery - Google BigQuerydatabricks - Databrickselasticsearch - Elasticsearchopensearch - OpenSearchmssql - Microsoft SQL Serverawss3 - Amazon S3csv - CSV filesfirebolt - Fireboltathena - Amazon Athenatrino - TrinoShow Datasource type details
name field.Show Common credential fields
name (string, required) - Unique name for the datasource within your organizationShow Naming guidelines
Show Tenancy configuration details
TABLE or DATABASE.TABLE: Client mapping is stored in a specific table (most common)DATABASE: Each client has a separate database instancetenancySettings is provided. If tenancySettings is omitted, this field is not needed.NUMBER or STRING.Required when tenancyLevel is TABLE.tenancyLevel is TABLE.tenancyLevel is TABLE.tenancyLevel is TABLE.tenancyLevel is TABLE.datasourceType. Below are examples for common datasource types:
datasourceType.Snowflake
your-account.snowflakecomputing.com)"username/password" or "Key-pair authentication""username/password")"Key-pair authentication")Postgres / Redshift
"enable" or "disable" (optional)"enable")"enable")"enable")"enable")CockroachDB
"enable" or "disable" (optional)"enable")"enable")"enable")"enable")BigQuery
"US", "EU")MySQL / MongoDB / ClickHouse
MSSQL
server not host for MSSQL.user not username for MSSQL.SingleStore
Databricks
Elasticsearch
"elastic-cloud", "open-cloud", or "self-managed""elastic-cloud" or "open-cloud")"self-managed")disableAuth is true)disableAuth is true)false). Only valid when server_type is "self-managed".OpenSearch
"elastic-cloud", "open-cloud", or "self-managed""elastic-cloud" or "open-cloud")"self-managed")disableAuth is true)disableAuth is true)false). Only valid when server_type is "self-managed".Firebolt
Athena
Trino
"enable" or "disable" (optional)"enable")"enable")"enable")"enable")CSV
AWS S3
"us-east-1")"File" or "Folder" (optional)| Error Code | HTTP Status | Description |
|---|---|---|
INVALID_REQUEST_BODY | 400 | Missing required fields or invalid credential structure |
DATASOURCE_NAME_ERROR | 400 | Datasource name already exists |
CREDENTIAL_TEST_FAILED | 400 | Connection test failed |
AUTHENTICATION_ERROR | 401 | Invalid or missing service token |
SCHEMA_CACHE_FAILED | 500 | Schema caching failed |
CREATE_DATASOURCE_FAILED | 500 | Internal error during datasource creation |
INTERNAL_SERVER_ERROR | 500 | Server error occurred |