> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/integrations/catalog/metabase.md).

# Metabase

Query, save, and export Metabase analytics.

### Connectors

Choose the connector that matches your authentication method. The options below use the names shown in StackAI.

| Connector | Authentication |
| --------- | -------------- |
| Metabase  | API Key        |

#### Metabase

Connect to Metabase with an API key.

**Set up in Metabase**

1. Prepare the Metabase account or service that the workflow will access. Grant access to the required resources and operations.
2. **API Key:** Create an API key in Metabase and grant its group access only to the content and databases this workflow needs.

**Set up in StackAI**

1. Open **Settings → Connections**, add a connection, and select **Metabase**.
2. Enter the credentials and connection details in the fields below.
3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

**Connection fields**

| StackAI field         | Required | What to enter                                                                                                                                                                                             |
| --------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Metabase Instance URL | Yes      | The HTTPS origin of your Metabase instance, without a path.                                                                                                                                               |
| API Key               | Yes      | Create an API key in Metabase and grant its group access only to the content and databases this workflow needs. [Provider instructions](https://www.metabase.com/docs/latest/people-and-groups/api-keys). |

#### Verify the connection

Check that the connection is healthy. Then run a read operation against a resource the connected account can access. A successful connection check confirms authentication; it does not guarantee permission for every action.

If access is denied, check the credential or OAuth permissions, the selected account or environment, and access to the specific resource. Update expired credentials or reconnect after permissions change.

### Use an action

1. Add the required **Metabase** action to the workflow.
2. Select a connection when the action requests one.
3. Complete the required fields. Use the reference picker when a value comes from another workflow step.
4. Run the workflow and inspect the action’s output. Check the result before using it in a later step.

### Actions

#### Search Metabase Content

Find accessible questions, dashboards, collections, databases, tables, models, and metrics by name.

**Inputs**

| Field         | Type            | Required | Description                                                                                                                           |
| ------------- | --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| Search        | string          | No       | Words to match in Metabase content names and metadata.                                                                                |
| Content Type  | select (string) | No       | Type of Metabase content to return. Available values: Question, Dashboard, Collection, Database, Table, Model, Metric. Default: card. |
| Archived Only | boolean         | No       | Search archived content instead of active content. Default: false.                                                                    |

**Outputs**

| Field            | Type          | Description                                      |
| ---------------- | ------------- | ------------------------------------------------ |
| Matching Content | object\_array | Accessible Metabase content matching the search. |

#### List Queryable Databases

List Metabase databases that the connected API key can query.

**Inputs**

| Field                            | Type    | Required | Description                                                             |
| -------------------------------- | ------- | -------- | ----------------------------------------------------------------------- |
| Include Saved Questions Database | boolean | No       | Include Metabase's virtual database of saved questions. Default: false. |

**Outputs**

| Field     | Type          | Description                                            |
| --------- | ------------- | ------------------------------------------------------ |
| Databases | object\_array | Databases available for querying with this connection. |

#### Run Card Query

Run a saved Metabase question and return its structured results.

**Inputs**

| Field                 | Type            | Required | Description                                                                                                |
| --------------------- | --------------- | -------- | ---------------------------------------------------------------------------------------------------------- |
| Saved Question        | select (string) | Yes      | Saved question to run. Options load from the selected connection.                                          |
| Question Parameters   | textarea        | No       | Optional values for filters defined by the saved question.                                                 |
| Ignore Cached Results | boolean         | No       | Force Metabase to execute the question instead of using cached results. Default: false.                    |
| Dashboard Context     | select (string) | No       | Optional dashboard whose filters should apply to this question. Options load from the selected connection. |

**Outputs**

| Field     | Type          | Description                                 |
| --------- | ------------- | ------------------------------------------- |
| Status    | string        | Metabase query completion status.           |
| Row Count | integer       | Number of result rows returned by Metabase. |
| Columns   | object\_array | Column metadata for the result set.         |
| Rows      | array         | Rows returned by the saved question.        |

#### Run Dataset Query

Run an ad-hoc native SQL or complete MBQL query and return structured results.

**Inputs**

| Field           | Type            | Required | Description                                                                                               |
| --------------- | --------------- | -------- | --------------------------------------------------------------------------------------------------------- |
| Query Type      | select (string) | Yes      | Whether to run SQL or an existing MBQL query object. Available values: Native SQL, MBQL. Default: native. |
| Database        | select (string) | No       | Database against which native SQL will run. Options load from the selected connection.                    |
| SQL Query       | textarea        | No       | Read-only SQL to execute in native mode.                                                                  |
| MBQL Query JSON | textarea        | No       | Complete dataset query object supplied by Metabase for MBQL mode.                                         |

**Outputs**

| Field     | Type          | Description                                 |
| --------- | ------------- | ------------------------------------------- |
| Status    | string        | Metabase query completion status.           |
| Row Count | integer       | Number of result rows returned by Metabase. |
| Columns   | object\_array | Column metadata for the result set.         |
| Rows      | array         | Rows returned by the dataset query.         |

#### Get Dashboard

Get a Metabase dashboard's structure, tabs, filters, and cards.

**Inputs**

| Field     | Type            | Required | Description                                                       |
| --------- | --------------- | -------- | ----------------------------------------------------------------- |
| Dashboard | select (string) | Yes      | Dashboard to retrieve. Options load from the selected connection. |

**Outputs**

| Field     | Type   | Description                                |
| --------- | ------ | ------------------------------------------ |
| Dashboard | object | Dashboard definition returned by Metabase. |

#### Create Card

Create a saved Metabase question from native SQL or a complete MBQL query.

**Inputs**

| Field                  | Type            | Required | Description                                                                                                                |
| ---------------------- | --------------- | -------- | -------------------------------------------------------------------------------------------------------------------------- |
| Question Name          | string          | Yes      | Name shown for the saved question in Metabase.                                                                             |
| Description            | textarea        | No       | Optional explanation of what the question measures.                                                                        |
| Query Type             | select (string) | Yes      | Whether the saved question uses SQL or an existing MBQL query object. Available values: Native SQL, MBQL. Default: native. |
| Database               | select (string) | No       | Database against which native SQL will run. Options load from the selected connection.                                     |
| SQL Query              | textarea        | No       | Read-only SQL saved in the question for native mode.                                                                       |
| MBQL Query JSON        | textarea        | No       | Complete dataset query object supplied by Metabase for MBQL mode.                                                          |
| Visualization Type     | string          | No       | Metabase visualization identifier for the new question. Default: table.                                                    |
| Destination Collection | select (string) | No       | Optional collection in which to save the question. Options load from the selected connection.                              |
| Visualization Settings | textarea        | No       | Optional Metabase settings for the selected visualization. Default: {}.                                                    |

**Outputs**

| Field            | Type   | Description                         |
| ---------------- | ------ | ----------------------------------- |
| Created Question | object | Saved question created by Metabase. |

#### Export Query Results

Export a saved Metabase question's results as a CSV or XLSX file.

**Inputs**

| Field               | Type            | Required | Description                                                                                 |
| ------------------- | --------------- | -------- | ------------------------------------------------------------------------------------------- |
| Saved Question      | select (string) | Yes      | Saved question whose results should be exported. Options load from the selected connection. |
| File Format         | select (string) | Yes      | File format for the exported results. Available values: CSV, XLSX. Default: csv.            |
| Question Parameters | textarea        | No       | Optional values for filters defined by the saved question.                                  |
| Format Values       | boolean         | No       | Apply Metabase display formatting to exported values. Default: false.                       |
| Pivot Results       | boolean         | No       | Export pivoted results when the saved question supports them. Default: false.               |
| Include CSV BOM     | boolean         | No       | Include a UTF-8 byte-order mark for CSV compatibility. Default: false.                      |

**Outputs**

| Field         | Type         | Description                                    |
| ------------- | ------------ | ---------------------------------------------- |
| Exported File | binary\_file | CSV or XLSX file containing the query results. |

### Important behavior

Actions that create, update, send, or delete data can change the connected service. Review their inputs before running them. A retry can repeat an operation; consider this when configuring retries for actions that change data.

The catalog lists the fields and capabilities available in the supplied provider definition. Availability can also depend on your deployment and organization’s Feature Access settings.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/integrations/catalog/metabase.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
