# Metabase

> Run Metabase questions and SQL and use the rows in a workflow: send a report, copy results to a sheet, find questions and dashboards. Start a workflow when a question has a new row.

App · 9 actions. Web page: https://docs.lodol.com/docs/integrations/metabase

## Actions

### Create question from SQL

Save SQL as a question in Metabase, shown as a table. Each {{name}} in the SQL becomes a filter.

**Inputs**

- Name (`name`, text, required): What to call the question, such as Orders this week.
- Database (`database`, text, required): The database. Pick one, or type its name.
- SQL (`sql`, text, required): The SQL to run, written for that database, such as SELECT * FROM orders.
- Collection (`collection`, text): Where to save it. Leave blank for Our analytics.
- Description (`description`, text): What the question shows, for the people who find it.

**Outputs**

- `collection` (text): The collection it's saved in
- `collection_id` (text): That collection's number; blank for Our analytics
- `columns` (list): The columns it returns, from its last run
- `created_at` (text): When it was made (ISO 8601)
- `created_by` (text): Who made it
- `database_id` (number): The number of the database it reads
- `description` (text): Its description
- `display` (text): How Metabase shows it, such as table, bar or line
- `filters` (list): Its filters
- `id` (number): The question's number
- `link` (text): A link to it in Metabase
- `name` (text): Its name
- `query_type` (text): sql, or query builder
- `sql` (text): Its SQL, for a SQL question
- `type` (text): question, model or metric
- `updated_at` (text): When it last changed (ISO 8601)

**Example output**

```json
{
  "collection": "Sales",
  "collection_id": "3",
  "columns": [
    {
      "display_name": "ID",
      "name": "ID"
    },
    {
      "display_name": "Total",
      "name": "TOTAL"
    }
  ],
  "created_at": "2026-10-20T09:00:00Z",
  "created_by": "Ada Lovelace",
  "database_id": 2,
  "description": "Every order placed since Monday",
  "display": "table",
  "filters": [
    {
      "name": "State",
      "slug": "state",
      "type": "category"
    }
  ],
  "id": 12,
  "link": "https://metabase.example.com/question/12",
  "name": "Orders this week",
  "query_type": "sql",
  "sql": "SELECT id, total, created_at FROM orders WHERE state = {{state}}",
  "type": "question",
  "updated_at": "2026-10-28T09:00:00Z"
}
```

### Delete question

Move a saved question to Metabase's trash, where it can be restored.

**Inputs**

- Question (`question`, text, required): The saved question. Pick one, or give its number or link.

**Outputs**

- `deleted` (true/false): True once it's in the trash
- `id` (number): The question's number
- `name` (text): Its name

**Example output**

```json
{
  "deleted": true,
  "id": 12,
  "name": "Orders this week"
}
```

### Get dashboard

Get a dashboard's details and the questions on it, to run each of them.

**Inputs**

- Dashboard (`dashboard`, text, required): The dashboard. Pick one, or give its number or link.

**Outputs**

- `collection` (text): The collection it's saved in
- `collection_id` (text): That collection's number; blank for Our analytics
- `created_at` (text): When it was made (ISO 8601)
- `description` (text): Its description
- `filters` (list): Its filters
- `id` (number): The dashboard's number
- `link` (text): A link to the dashboard in Metabase
- `name` (text): Its name
- `question_count` (number): How many questions are on it
- `questions` (list): The questions on it
- `tabs` (list): Its tabs, by name
- `updated_at` (text): When it last changed (ISO 8601)

**Example output**

```json
{
  "collection": "Sales",
  "collection_id": "3",
  "created_at": "2026-10-20T09:00:00Z",
  "description": "Orders, revenue and refunds by week",
  "filters": [
    {
      "name": "Date",
      "slug": "date",
      "type": "date/all-options"
    }
  ],
  "id": 4,
  "link": "https://metabase.example.com/dashboard/4",
  "name": "Weekly sales",
  "question_count": 1,
  "questions": [
    {
      "display": "table",
      "link": "https://metabase.example.com/question/12",
      "name": "Orders this week",
      "question_id": 12,
      "tab": ""
    }
  ],
  "tabs": [],
  "updated_at": "2026-10-28T09:00:00Z"
}
```

### Get question

Get a saved question's details: its SQL, its filters and the columns it returns.

**Inputs**

- Question (`question`, text, required): The saved question. Pick one, or give its number or link.

**Outputs**

- `collection` (text): The collection it's saved in
- `collection_id` (text): That collection's number; blank for Our analytics
- `columns` (list): The columns it returns, from its last run
- `created_at` (text): When it was made (ISO 8601)
- `created_by` (text): Who made it
- `database_id` (number): The number of the database it reads
- `description` (text): Its description
- `display` (text): How Metabase shows it, such as table, bar or line
- `filters` (list): Its filters
- `id` (number): The question's number
- `link` (text): A link to it in Metabase
- `name` (text): Its name
- `query_type` (text): sql, or query builder
- `sql` (text): Its SQL, for a SQL question
- `type` (text): question, model or metric
- `updated_at` (text): When it last changed (ISO 8601)

**Example output**

```json
{
  "collection": "Sales",
  "collection_id": "3",
  "columns": [
    {
      "display_name": "ID",
      "name": "ID"
    },
    {
      "display_name": "Total",
      "name": "TOTAL"
    }
  ],
  "created_at": "2026-10-20T09:00:00Z",
  "created_by": "Ada Lovelace",
  "database_id": 2,
  "description": "Every order placed since Monday",
  "display": "table",
  "filters": [
    {
      "name": "State",
      "slug": "state",
      "type": "category"
    }
  ],
  "id": 12,
  "link": "https://metabase.example.com/question/12",
  "name": "Orders this week",
  "query_type": "sql",
  "sql": "SELECT id, total, created_at FROM orders WHERE state = {{state}}",
  "type": "question",
  "updated_at": "2026-10-28T09:00:00Z"
}
```

### List databases

List the databases connected to Metabase that the API key can use.

**Inputs**: None.

**Outputs**

- `count` (number): How many
- `databases` (list): The databases

**Example output**

```json
{
  "count": 1,
  "databases": [
    {
      "engine": "postgres",
      "id": 2,
      "is_sample": false,
      "name": "Shop database"
    }
  ]
}
```

### Run question

Run a saved question and get its rows, to send as a report or copy to a sheet.

**Inputs**

- Question (`question`, text, required): The saved question. Pick one, or give its number or link.
- Filters (`filters`, object): Values for the question's filters, such as a date or a state. Leave a filter blank to use its default.
- Row limit (`limit`, number): The most rows to return, up to 2000. Defaults to 100. From 1 to 2000.

**Outputs**

- `columns` (list): The columns, in order
- `has_more` (true/false): True when the results had more rows than returned
- `link` (text): A link to the question in Metabase
- `question_id` (number): The question's number
- `question_name` (text): Its name
- `row_count` (number): How many rows are returned
- `rows` (list): The rows, each an object keyed by column name

**Example output**

```json
{
  "columns": [
    {
      "display_name": "ID",
      "name": "ID",
      "type": "BigInteger"
    },
    {
      "display_name": "Total",
      "name": "TOTAL",
      "type": "Float"
    },
    {
      "display_name": "Created At",
      "name": "CREATED_AT",
      "type": "DateTime"
    }
  ],
  "has_more": false,
  "link": "https://metabase.example.com/question/12",
  "question_id": 12,
  "question_name": "Orders this week",
  "row_count": 2,
  "rows": [
    {
      "CREATED_AT": "2026-10-28T09:14:00Z",
      "ID": 448,
      "TOTAL": 39.72
    },
    {
      "CREATED_AT": "2026-10-28T11:02:00Z",
      "ID": 449,
      "TOTAL": 117.03
    }
  ]
}
```

### Run SQL query

Run SQL on a database connected to Metabase and get the rows. The SQL runs with Metabase's access to that database, so it can change data too.

**Inputs**

- Database (`database`, text, required): The database. Pick one, or type its name.
- SQL (`sql`, text, required): The SQL to run, written for that database, such as SELECT * FROM orders.
- Row limit (`limit`, number): The most rows to return, up to 2000. Defaults to 100. From 1 to 2000.

**Outputs**

- `columns` (list): The columns, in order
- `database_id` (number): The database's number
- `has_more` (true/false): True when the results had more rows than returned
- `row_count` (number): How many rows are returned
- `rows` (list): The rows, each an object keyed by column name

**Example output**

```json
{
  "columns": [
    {
      "display_name": "ID",
      "name": "ID",
      "type": "BigInteger"
    },
    {
      "display_name": "Total",
      "name": "TOTAL",
      "type": "Float"
    },
    {
      "display_name": "Created At",
      "name": "CREATED_AT",
      "type": "DateTime"
    }
  ],
  "database_id": 2,
  "has_more": false,
  "row_count": 2,
  "rows": [
    {
      "CREATED_AT": "2026-10-28T09:14:00Z",
      "ID": 448,
      "TOTAL": 39.72
    },
    {
      "CREATED_AT": "2026-10-28T11:02:00Z",
      "ID": 449,
      "TOTAL": 117.03
    }
  ]
}
```

### Search dashboards

Find dashboards by words in their names, or in one collection.

**Inputs**

- Words (`query`, text): Words in the dashboards' names or descriptions. Leave blank to list them all.
- Collection (`collection`, text): Only dashboards saved straight in this collection. Leave blank to look everywhere.
- How many (`limit`, number): The most to list, up to 200. Defaults to 25. From 1 to 200.

**Outputs**

- `count` (number): How many are listed
- `dashboards` (list): The dashboards found
- `total` (number): How many match in all

**Example output**

```json
{
  "count": 1,
  "dashboards": [
    {
      "collection": "Sales",
      "collection_id": "3",
      "description": "Orders, revenue and refunds by week",
      "id": 4,
      "link": "https://metabase.example.com/dashboard/4",
      "name": "Weekly sales",
      "updated_at": "2026-10-28T09:00:00Z"
    }
  ],
  "total": 1
}
```

### Search questions

Find saved questions, models and metrics by words in their names, or in one collection.

**Inputs**

- Words (`query`, text): Words in the questions' names or descriptions. Leave blank to list them all.
- Collection (`collection`, text): Only questions saved straight in this collection. Leave blank to look everywhere.
- How many (`limit`, number): The most to list, up to 200. Defaults to 25. From 1 to 200.

**Outputs**

- `count` (number): How many are listed
- `questions` (list): The questions found
- `total` (number): How many match in all

**Example output**

```json
{
  "count": 1,
  "questions": [
    {
      "collection": "Sales",
      "collection_id": "3",
      "database_id": 2,
      "description": "Every order placed since Monday",
      "display": "table",
      "id": 12,
      "link": "https://metabase.example.com/question/12",
      "name": "Orders this week",
      "type": "question",
      "updated_at": "2026-10-28T09:00:00Z"
    }
  ],
  "total": 1
}
```
