Datasource APIs
Create Datasource
Create a new datasource connection to your data infrastructure. Supports multiple database types and cloud services.
POST
Create a new datasource connection to integrate your database or data warehouse with DataBrain. The API validates credentials, tests the connection, and automatically caches the schema for immediate use.
Before creating a datasource, ensure you have valid credentials for your database or data warehouse. The API will test the connection before creating the datasource. Supported datasource types include Snowflake, PostgreSQL, MySQL, BigQuery, Databricks, and many more.
Endpoint
Self-hosted Databrain Endpoint
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
Request Body
The type of datasource to create. Must be one of the supported datasource types.Supported types:
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- Trino
Connection credentials for the datasource. The structure varies by datasource type, but all types require a
name field.Unique name for the datasource. This name will be used to reference the datasource in other APIs and configurations.
Multi-tenant configuration for the datasource. Defines how data is isolated between different tenants/clients. Optional - if not provided, the datasource will be created without explicit tenancy settings.
The level at which tenant isolation occurs. Must be one of:
TABLE or DATABASE.TABLE: Client mapping is stored in a specific table (most common)DATABASE: Each client has a separate database instance
tenancySettings is provided. If tenancySettings is omitted, this field is not needed.Data type of the client identifier column. Must be either
NUMBER or STRING.Required when tenancyLevel is TABLE.Name of the table that contains client mapping information.Required when
tenancyLevel is TABLE.Column name in the mapping table that stores the client identifier.Required when
tenancyLevel is TABLE.Datasource-Specific Credentials
The credentials object structure depends on thedatasourceType. Below are examples for common datasource types:
Datasource-specific credential fields. The required fields depend on the
datasourceType.Snowflake
Snowflake
Postgres / Redshift
Postgres / Redshift
CockroachDB
CockroachDB
BigQuery
BigQuery
MySQL / MongoDB / ClickHouse
MySQL / MongoDB / ClickHouse
MSSQL
MSSQL
SingleStore
SingleStore
Databricks
Databricks
Elasticsearch
Elasticsearch
Disable authentication (optional, default
false). Only valid when server_type is "self-managed".OpenSearch
OpenSearch
Disable authentication (optional, default
false). Only valid when server_type is "self-managed".Firebolt
Firebolt
Athena
Athena
Trino
Trino
Response
Examples
Error Codes
Next Steps
List Datasources
View all datasources in your organization
Update Datasource
Update datasource credentials or configuration
Sync Datasource
Sync datasource schema after creation
Create Datamart
Create a datamart using your new datasource

