Datamart APIs
Create Datamart
Create a new datamart to organize and manage your data sources with custom table and column configurations.
POST
Create datamarts to organize your data sources into logical business units. Datamarts provide structured access to your datasource tables and columns with optional schema support.
Use this endpoint for all new integrations. This is the recommended endpoint format.
Datamarts help organize data sources by defining which tables and columns are accessible. Tenancy settings are optional and can be omitted if multi-tenant data isolation is handled at the application level. Ensure your datasource exists before creating a datamart.
Endpoint Formats
- New Endpoint (Recommended)
- Legacy Endpoint (Deprecated Soon)
Authentication
This endpoint requires a service token in the Authorization header. Service tokens differ from data app API keys and provide organization-level permissions.- 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.
string
required
Must be set to
application/json for all requests.Request Body
string
required
Name of the datamart to create. Must be unique within your organization — the API will reject the request with an error if a datamart with the same name already exists.
string
required
The datasource to which this datamart belongs. Must match an existing datasource in your organization.
array
required
Array of tables with columns to include in the datamart. Must be non-empty.
string
required
Table name from your datasource.
string
Optional schema name (required only for schema-based datasources like PostgreSQL, SQL Server).
string
Optional column name in this table that identifies the client/tenant. This column is used for multi-tenant data isolation at the table level. Must exist in the table schema.
boolean
Optional flag to hide the table from the datamart interface.
string
Optional label for the table to provide a human-readable display name. When provided, this label can be used in the UI instead of the technical table name for better readability.
string
Optional wildcard index pattern for OpenSearch tables. When set, this value is used as the table name in queries, enabling you to query multiple OpenSearch indices that match a pattern.
array
required
List of column objects for this table. Must be non-empty.
string
required
Column name from the table.
string
Optional alias for the column to display a different name.
string
Optional label for the column for better readability.
boolean
Optional flag to hide the column from the datamart interface.
boolean
Optional flag to mark this as a custom/calculated column. When
true, the sql field is required to define the column’s SQL expression.string
SQL expression that defines the calculated value for a custom column. Required when
isCustomColumn is true. The expression can reference other columns from the same table.boolean
Optional flag to indicate if this column should be treated as an aggregate column. When
true, the column is marked as AGGREGATE drop type for metric calculations.boolean
Optional flag to enable timezone conversion for this column. When
true, the column’s datetime values are converted using the timezone passed as params.timezone in the guest token at query execution time.This field has no effect unless
params.timezone is set in the guest token. See Timezone Handling in Guest Token for the full setup guide.string | null
Optional default sort direction for the column. Supported values are
ASC and DESC. The value is propagated to data-app embed access settings and used as the initial sort direction when this column is selected during metric creation.Pass an empty string ("") or null, or omit this field, to leave the column without a default sort. Values are case-sensitive; lowercase values such as "asc" fail validation.object
Multi-tenant configuration for the datamart. Defines how data is isolated between different tenants/clients. Optional - if not provided, the datamart will be created without explicit tenancy settings.
string
The level at which tenant isolation occurs. Must be one of:
TABLE, DATABASE, or MULTI_DATABASE.TABLE: Client mapping is stored in a specific table (most common)DATABASE: Each client has a separate database instanceMULTI_DATABASE: Tenancy spans multiple databases with optional default routing viaprimaryDatabase
tenancySettings is provided. If tenancySettings is omitted, this field is not needed.string
Data type of the client identifier column. Must be either
NUMBER or STRING.Required when tenancyLevel is TABLE.string | null
Optional primary database name used for
DATABASE and MULTI_DATABASE tenancy levels. Set to null when you do not want a default database.Note: The API accepts this field for all tenancy levels. It is primarily used by DATABASE and MULTI_DATABASE.string
Schema name where the client mapping table is located.Required when
tenancyLevel is TABLE.string
Name of the table that contains client mapping information.Required when
tenancyLevel is TABLE.string
Column name in the mapping table that stores the client identifier.Required when
tenancyLevel is TABLE.string
Primary key column of the client mapping table.Required when
tenancyLevel is TABLE.array
Optional array of table relationships to define how tables in the datamart are connected. Relationships enable joins between tables for more complex queries.
string
required
Name of the parent table in the relationship.
string
required
Column name in the parent table that participates in the relationship.
string
required
Name of the child table in the relationship.
string
required
Column name in the child table that participates in the relationship.
string
required
A descriptive name for the relationship (e.g., “orders_to_customers”).
string
The cardinality of the relationship. Must be one of:
ManyToMany, ManyToOne, OneToMany, OneToOne.Optional: Can be omitted or set to null if not specified.string
The type of SQL join to use. Must be one of:
INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN.Optional: Can be omitted or set to null if not specified.Response
string
The name of the created datamart (same as the input name).
null | object
Error object if the request failed, otherwise
null for successful requests.Examples
Errors
Quick Start Guide
1
Verify your datasource
Ensure your datasource exists and is properly configured. You’ll need the exact datasource name as it appears in your DataBrain workspace.
2
Prepare your table structure
Identify the tables and columns you want to include in your datamart:
3
Create your datamart
Make the API call to create your datamart:
4
Use your datamart
Reference your new datamart in embed configurations:
Next Steps
List Datamarts
View all datamarts in your organization
Delete Datamart
Remove datamarts you no longer need
Embed a Pre-built Dashboard/Metric
Use your datamart in embed configurations
Getting Started
Learn how to get started with DataBrain embedding

