The Dataset API allows you to execute ad-hoc queries and retrieve data. This is the primary endpoint for running queries programmatically. The API includes 8 endpoints.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/metabase/metabase/llms.txt
Use this file to discover all available pages before exploring further.
Execute query
Execute an ad-hoc query and retrieve results.Request body
Database ID to query (optional for saved question queries)
Query type: “query” (MBQL) or “native” (SQL)
MBQL query objectExample MBQL query:
Native SQL query (when type is “native”)Example:
Parameter values for template tags
Query constraints like max results
Response
Query results
rows- Array of result rowscols- Array of column metadatarows_truncated- Number of rows truncated (if limited)
Database that was queried
Query status: “completed”, “failed”, etc.
Number of rows returned
Query execution time in milliseconds
The query that was executed
This endpoint does not use query caching. Results are always fresh from the database.
Export query results
Execute a query and download results in a specific format.Parameters
Export format: csv, xlsx, or json
Request body
Query object with database, type, and query/native fields
Visualization settings (can be empty object)
Apply cell formatting to values (default: false)
Pivot the results (default: false)
Response
Returns file data with appropriate content-type:- CSV:
text/csv - XLSX:
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - JSON:
application/json
Get query metadata
Get metadata needed to construct a query.Request body
Database ID to get metadata for
Response
Returns database metadata including tables, fields, and foreign key relationships needed for building queries.Convert to native query
Convert an MBQL query to native SQL.Request body
Database ID (minimum: 1)
Query type (“query”)
MBQL query to convert
Format the SQL with indentation (default: true)
Response
Native SQL query
Get parameter values
Get possible values for a query parameter.Request body
Parameter definition with id, type, and target
Field IDs to get values from
Response
Returns an array of possible parameter values.Search parameter values
Search for parameter values matching a query string.Parameters
Search query (minimum: 1 character)
Request body
Parameter definition
Field IDs to search
Get parameter remapping
Get remapped values for a parameter.Request body
Parameter definition
Value to get remapping for
Field IDs
Generate pivot table
Generate a pivoted dataset for a query.Request body
Database ID (minimum: 1)
Query type
Query with breakout fields for pivoting