<!-- BusyBot node reference — https://busybot.net/tools/metabase/ -->

> Node: Metabase (`metabase`) · Action (binary) · v1
> Category: Analytics · Credentials: Metabase API (`metabaseApi`)
> Updated: 2026-08-16

# Metabase

> Query and export Metabase question results as CSV, XLSX, or JSON

## Overview

The Metabase tool interacts with the Metabase REST API to manage questions (cards), alerts, databases, and metrics. It supports exporting question results as CSV, XLSX (binary download), or JSON. Authentication uses session tokens obtained via POST /api/session with username and password credentials. Binary output is produced when exporting question results in CSV or XLSX format.

**Category:** Analytics  
**Tool Name:** `metabase`  
**Version:** 1

**Appearance:** Icon: `lucide-BarChart` | Color: `#509EE3`

## Node Type

**Action (Binary)** — handles file/binary data operations

## Input / Output

| Direction | Port(s) |
|-----------|--------|
| Input | `Input` |
| Output | `Output`, `Error` |

## Credentials

This tool requires **Metabase API** credentials.
See the [Credentials Guide](https://busybot.net/credentials/metabase-api/) for setup instructions.

### Resources

| Resource | Value |
|----------|-------|
| Alert | `alerts` |
| Database | `databases` |
| Metric | `metrics` |
| Question | `questions` |

### Operations

Each resource has its own Operation list, and several resources reuse the same operation values (`get`, `getAll`). Pick the resource first, then the operation.

| Resource | Operation | Value | Description |
|----------|-----------|-------|-------------|
| Question | Get | `get` | Get a specific question |
| Question | Get Many | `getAll` | Get many questions |
| Question | Result Data | `resultData` | Export question results as CSV, XLSX, or JSON |
| Alert | Get | `get` | Get a specific alert |
| Alert | Get Many | `getAll` | Get many alerts |
| Database | Add | `add` | Add a new database datasource |
| Database | Get Many | `getAll` | Get many databases |
| Database | Get Fields | `getFields` | Get fields from a database |
| Metric | Get | `get` | Get a specific metric |
| Metric | Get Many | `getAll` | Get many metrics |

### Parameters

Metabase IDs are the numbers in the object's URL — a question at `/question/42` has Question ID `42`. The identifier and database-connection fields accept expressions, so you can feed them from an upstream item.

#### Question: Get

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Question ID | `string` | Yes | — | The ID of the question (card) in Metabase. Accepts expressions such as {{ $json.questionId }}. |

#### Question: Get Many

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Return All | `boolean` | No | `false` | Whether to return all results. Metabase getAll endpoints return all results in a single request, so this controls whether to apply a limit. |
| Limit | `number` | No | `50` | Maximum number of results to return. _(shown when Return All is `false`)_ |

#### Question: Result Data

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Question ID | `string` | Yes | — | The ID of the question (card) in Metabase. Accepts expressions such as {{ $json.questionId }}. |
| Format | `options` | Yes | `csv` | The export format for question results. CSV and XLSX produce binary output; JSON produces parsed row items. |
| | | | | Options: `csv`, `json`, `xlsx` |
| Binary Property | `string` | No | `data` | Name of the binary property to store the exported file under. Names are case-sensitive — see the upstream node's Binary Data panel for the exact names to use. _(shown when Format is `csv`, `xlsx`)_ |

#### Alert: Get

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Alert ID | `string` | Yes | — | The ID of the alert. Accepts expressions such as {{ $json.alertId }}. |

#### Alert: Get Many

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Return All | `boolean` | No | `false` | Whether to return all results. Metabase getAll endpoints return all results in a single request, so this controls whether to apply a limit. |
| Limit | `number` | No | `50` | Maximum number of results to return. _(shown when Return All is `false`)_ |

#### Database: Add

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Engine | `options` | Yes | `postgres` | The database engine type. |
| | | | | Options: `h2`, `mongo`, `mysql`, `postgres`, `redshift`, `sqlite` |
| Name | `string` | Yes | — | Display name for the database in Metabase. Accepts expressions. |
| Host | `string` | Yes | — | Database host address. _(shown when Engine is `postgres`, `redshift`, `mysql`, `mongo`)_ |
| Port | `number` | Yes | `5432` | Database port number. _(shown when Engine is `postgres`, `redshift`, `mysql`, `mongo`)_ |
| User | `string` | Yes | — | Database username. _(shown when Engine is `postgres`, `redshift`, `mysql`, `mongo`)_ |
| Password | `string` | Yes | — | Database password. _(shown when Engine is `postgres`, `redshift`, `mysql`, `mongo`)_ |
| Database Name | `string` | No | — | Name of the database to connect to. _(shown when Engine is `postgres`, `redshift`, `mysql`, `mongo`)_ |
| File Path | `string` | Yes | — | File path to the H2 or SQLite database file. _(shown when Engine is `h2`, `sqlite`)_ |
| Full Sync | `boolean` | Yes | `true` | Whether to enable full sync for the database. |

#### Database: Get Many

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Simplify | `boolean` | No | `true` | Whether to return a simplified version of the response instead of the raw data. |
| Return All | `boolean` | No | `false` | Whether to return all results. Metabase getAll endpoints return all results in a single request, so this controls whether to apply a limit. |
| Limit | `number` | No | `50` | Maximum number of results to return. _(shown when Return All is `false`)_ |

#### Database: Get Fields

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Database ID | `string` | Yes | — | The ID of the database. Accepts expressions such as {{ $json.databaseId }}. |

#### Metric: Get

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Metric ID | `string` | Yes | — | The ID of the metric. Accepts expressions such as {{ $json.metricId }}. |

#### Metric: Get Many

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Return All | `boolean` | No | `false` | Whether to return all results. Metabase getAll endpoints return all results in a single request, so this controls whether to apply a limit. |
| Limit | `number` | No | `50` | Maximum number of results to return. _(shown when Return All is `false`)_ |

#### All Operations

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Max Concurrency | `number` | No | `10` | Maximum number of items to process concurrently. |

## Output Data

What lands on the output item depends on the operation — some operations **merge** the Metabase response onto the input item's JSON, while the list operations **replace** it with one record per output item. Binary data on the input item is always forwarded.

| Operations | Output |
|------------|--------|
| Question Get, Alert Get, Metric Get, Database Add | The Metabase object is **merged onto the input item JSON** at the top level, so the item keeps its upstream fields and gains the returned ones (`{{ $json.id }}`, `{{ $json.name }}`). A response field with the same name as an existing item field overwrites it. One output item per input item. |
| Question Get Many, Alert Get Many, Database Get Many, Metric Get Many, Database Get Fields | **One output item per record**, and each item's JSON is **replaced** by that record — upstream fields are not carried over. A response with no records produces a single output item carrying the input JSON unchanged. |
| Question Result Data, Format `json` | **One output item per result row**, each item's JSON **replaced** by the row. A question that returns no rows produces one item carrying the input JSON plus `_empty: true`. |
| Question Result Data, Format `csv` / `xlsx` | One output item whose JSON is **replaced** by the download summary below, with the file attached as binary under the Binary Property name. Any binary already on the input item is kept alongside it. |

A CSV or XLSX export produces this JSON:

```json
{
  "questionId": "42",
  "format": "xlsx",
  "fileName": "question_42.xlsx",
  "fileSize": 20481
}
```

- `fileName` is always `question_{Question ID}.{csv|xlsx}`, and `fileSize` is the byte length of the downloaded file.
- The attached file carries the matching MIME type — `text/csv` for CSV, the Excel spreadsheet type for XLSX — so a downstream upload or email node can send it as-is.

With Simplify on, **Database: Get Many** flattens each database's connection `details` into top-level fields instead of leaving them nested. Turn it off to get the raw Metabase object.

**Database: Get Fields** does not show the Return All and Limit fields, so it uses their defaults and returns at most 50 fields per database.

## Usage Examples

- Export Metabase question results as XLSX file
- Get all questions from Metabase
- Download question data as CSV
- Add a PostgreSQL database to Metabase
- Get all alerts from Metabase

## Example Configuration

Fetch a single question's definition:

```json
{
  "type": "metabase",
  "parameters": {
    "resource": "questions",
    "operation": "get",
    "questionId": "123"
  }
}
```

Run a question and get its rows as workflow items:

```json
{
  "type": "metabase",
  "parameters": {
    "resource": "questions",
    "operation": "resultData",
    "questionId": "{{ $json.questionId }}",
    "format": "json"
  }
}
```

Download a question's results as an Excel file for a downstream email or upload node:

```json
{
  "type": "metabase",
  "parameters": {
    "resource": "questions",
    "operation": "resultData",
    "questionId": "123",
    "format": "xlsx",
    "binaryPropertyName": "excelReport"
  }
}
```

List the first 50 questions on the instance:

```json
{
  "type": "metabase",
  "parameters": {
    "resource": "questions",
    "operation": "getAll",
    "returnAll": false,
    "limit": 50
  }
}
```

Fetch every alert without a cap:

```json
{
  "type": "metabase",
  "parameters": {
    "resource": "alerts",
    "operation": "getAll",
    "returnAll": true
  }
}
```

Look up one alert by ID:

```json
{
  "type": "metabase",
  "parameters": {
    "resource": "alerts",
    "operation": "get",
    "alertId": "456"
  }
}
```

Register a PostgreSQL datasource and let Metabase sync its schema:

```json
{
  "type": "metabase",
  "parameters": {
    "resource": "databases",
    "operation": "add",
    "engine": "postgres",
    "name": "Production DB",
    "host": "db.example.com",
    "port": 5432,
    "dbUser": "metabase_user",
    "dbPassword": "secure_password",
    "dbName": "analytics",
    "fullSync": true
  }
}
```

Register a file-backed SQLite datasource instead:

```json
{
  "type": "metabase",
  "parameters": {
    "resource": "databases",
    "operation": "add",
    "engine": "sqlite",
    "name": "Local Analytics",
    "filePath": "file:/data/analytics.db",
    "fullSync": false
  }
}
```

List databases with their connection details flattened:

```json
{
  "type": "metabase",
  "parameters": {
    "resource": "databases",
    "operation": "getAll",
    "simple": true,
    "returnAll": true
  }
}
```

Explore a database's schema, one item per field:

```json
{
  "type": "metabase",
  "parameters": {
    "resource": "databases",
    "operation": "getFields",
    "databaseId": "789"
  }
}
```

Fetch a single metric definition:

```json
{
  "type": "metabase",
  "parameters": {
    "resource": "metrics",
    "operation": "get",
    "metricId": "101"
  }
}
```

### Error Handling

| Mode | Behavior |
|------|----------|
| **stop** | Halts workflow on first error |
| **continue** | Skips failed items, passes successful ones through |
| **errorPort** | Routes failed items to Error output port |

## Tips

Query Metabase questions, export results as CSV/XLSX/JSON, and manage alerts, databases, and metrics.