Data Retrieval
Fetch metric data by data app
Execute queries on metrics within your embedded dashboards and retrieve the resulting data.
POST
Query specific metrics from your embedded dashboards to retrieve data programmatically. This endpoint allows you to fetch metric data with optional filtering and is essential for building custom analytics interfaces or exporting data from your embedded dashboards.
Use this endpoint for all new integrations. This is the recommended endpoint format.
This endpoint requires an embed ID, metric ID, and client ID. The metric must be associated with the specified embed configuration for the query to succeed.
Endpoint Formats
- New Endpoint (Recommended)
- Legacy Endpoint (Deprecated Soon)
Authentication
All API requests must include your API key in the Authorization header. Get your API token when creating a data app - see our data app creation guide for details. Finding your API token: For detailed instructions, see the API Token guide.Headers
Request Body
The tenant the query runs for: the same tenant identity you send as
clientId in the guest token (a tenant column value, a schema or database name, a datasource tenant name, or "None"). It is not the ID of a person.Dashboard-level filters to apply to the metric query. These filters affect the entire dashboard context.
Metric-specific filters to apply to the query. Used for row-level security and additional filtering.
Optional string. Use when the dashboard’s workspace is configured for multiple datasources (
MULTI_DATASOURCE): pass the datasource name (as in Data Studio / your integration credentials) so the query runs against that datasource. If the name does not resolve, the API returns DATASOURCE_NAME_ERROR (400).Optional string. Use the exact JSON property name
dataMartName (camelCase with a capital M in Mart).When the dashboard’s workspace is configured for multiple datamarts (MULTI_DATAMART), pass the datamart name so the query resolves that datamart’s linked datasource. Names follow the same rules as in the List Datamarts API. If the name does not resolve, the API returns DATAMART_NAME_ERROR (400).Response
Array of objects containing the query results. Each object represents a row of data with column names as keys.
Example
Examples
Error Codes
Metric not found - The specified metric ID doesn’t exist or isn’t associated with the embed configuration
Invalid datasource name - The specified datasource name could not be resolved for a multi-datasource workspace
Invalid datamart name - The specified
dataMartName could not be resolved for a multi-datamart workspaceHTTP Status Code Summary
Possible Errors
Filtering Guide
Dashboard Filters
Dashboard filters apply to the entire dashboard context and affect all metrics. Common use cases include:- Date range filtering: Limit data to specific time periods
- Category filtering: Filter by region, department, product line, etc.
- Global parameters: Set values that affect multiple metrics
Example
Metric Filters
Metric filters apply specifically to the metric being queried and can be used for:- Row-level security (RLS): Restrict data based on client permissions
- Additional filtering: Apply metric-specific conditions
- Client isolation: Ensure multi-tenant data separation
Example
Use Cases
Export Dashboard Data
Real-time Data Refresh
Multi-Tenant Data Access
Best Practices
- Cache responses - Cache query results when appropriate to reduce API calls and improve performance
- Use filters efficiently - Apply filters at the query level rather than filtering data client-side
- Handle pagination - For large datasets, implement pagination or limit results
- Error handling - Implement robust error handling and retry logic
- Rate limiting - Respect rate limits and implement exponential backoff
- Security - Never expose API keys in client-side code; proxy requests through your backend
Performance Tips
- Minimize filter complexity - Complex filters can slow down queries
- Request only needed columns - If possible, select only required columns
- Use date ranges - Limit queries to specific time periods
- Cache when possible - Cache frequently accessed data
- Batch requests - When querying multiple metrics, consider batching requests
Quick Start Guide
1
Get embed and metric IDs
First, get your embed ID and metric ID from your DataBrain dashboard or via the List APIs:
2
Fetch available metrics
Use the Fetch Metrics by Embed endpoint to get a list of available metrics:
3
Make your first query
Query a metric with minimal parameters:
4
Add filters for specific data
Include filters to narrow down your results:
5
Process the results
Use the returned data in your application:
Next Steps
Fetch Metrics by Embed
Get a list of available metrics before querying
Fetch Dashboards by Data App
Retrieve available dashboards in your data app
Embed a Pre-built Dashboard/Metric
Set up embed configurations for your data app
Guest Token API
Generate secure tokens for embedded access

