Metabase Custom icon

Metabase Custom

Use the Metabase API

Actions4

Question → Save Card

AI-generated

Overview

The node integrates with the Metabase API to save a "card" (a saved question or query visualization) within a specified collection in Metabase. This operation is useful for automating the creation or updating of dashboard cards programmatically, enabling users to manage their Metabase questions and visualizations directly from n8n workflows.

Typical use cases include:

  • Automatically saving or updating SQL queries as cards after data processing steps.
  • Managing collections of questions/cards dynamically based on external triggers.
  • Setting visualization parameters and metadata for consistent reporting.

Properties

Name Meaning
Database ID Numeric identifier of the database where the query will run.
Query The SQL query string that defines the data retrieval logic for the card.
Name The display name of the card/question being saved.
Description A textual description explaining the purpose or content of the card.
Collection ID Identifier of the collection in Metabase where the card will be saved.
Template Tags Tags used for templating or categorizing the card.
Visualization Settings JSON string defining how the results should be visualized (e.g., chart type, axes).
Display Configuration string controlling the display options of the card.
Parameters JSON string specifying parameters used in the query for dynamic filtering or input.
Parameter Mappings JSON string mapping parameter names to values or expressions.
Cache TTL Time-to-live setting for caching the query results, controlling performance and freshness.
Collection Position String indicating the position/order of the card within its collection.
Result Metadata Additional metadata about the query results, possibly including formatting or schema info.

Output

The node outputs the full response from the Metabase API after attempting to save the card. The json output field contains details about the saved card, such as its ID, name, query, visualization settings, and other metadata returned by Metabase.

If the operation succeeds, the output confirms the card's creation or update status. If it fails, error information is included in the response.

No binary data output is expected from this node.

Dependencies

  • Requires an active connection to a Metabase instance via an API key or token credential configured in n8n.
  • The node depends on the Metabase API endpoint URL provided in credentials.
  • Proper permissions in Metabase are necessary to create or update cards and collections.

Troubleshooting

  • Common issues:

    • Invalid or missing API credentials leading to authentication errors.
    • Incorrect database or collection IDs causing resource not found errors.
    • Malformed SQL queries resulting in query validation failures.
    • Improperly formatted JSON strings in properties like visualization settings or parameters causing parsing errors.
  • Error messages:

    • Authentication errors typically indicate invalid or expired API tokens; verify and update credentials.
    • 404 errors suggest incorrect database or collection identifiers; confirm these IDs exist in Metabase.
    • Validation errors on the query or visualization settings require checking the syntax and format against Metabase API documentation.
    • JSON parse errors mean the input strings for parameters or settings are not valid JSON; validate them before running.

Links and References

Discussion