Skip to main content
~/tools/metabase-cli
$ inspect Metabase CLI
repo: https://github.com/rohanraarora/metabase-cli
language: TypeScript
status: indexed
$ cat ./metabase-cli.md

Metabase CLI

Headless CLI and Node.js library for interacting with Metabase (https://www.metabase.com) instances. Manage profiles, run queries, CRUD questions, dashboards, collections, snippets, alerts, segments, timelines, and more — all from the terminal.

4 stars 2 forks TypeScript MIT License
rohanraarora 441 May 20, 2026
Login with GitHub to like and favorite this CLI tool
$ git release --latest

Latest Releases

All releases

Added
  • notification update --card <id> — reassign a notification's card. (#24)

Fixed
  • Integer CLI options are now parsed in base 10 via a shared parseIntArg helper. Previously a numeric option default became the parseInt radix, so dashboard add-card --width 12 --height 8 either applied the wrong card size or failed with 400 Bad Request. All integer options now reject non-integer input with a clear error. (#23)
  • alert update, alert delete, and notification update now work on Metabase v0.59+: the CLI reads the current notification, merges the change, and PUTs the full object back with all nested ids preserved. The old partial-body PUT either 400'd or silently corrupted the alert into a card-less orphan. (#24)
  • alert update --schedule no longer wipes the existing Slack/email handler. (#24)
  • alert delete archives in place via active:false (v0.59+ has no DELETE route); corrupt null-payload orphans fail with a clear message instead of a cryptic 500. (#24)

Security
  • Dev-only advisories resolved: esbuild → 0.28.1 (GHSA-g7r4-m6w7-qqqr) and js-yaml (GHSA-h67p-54hq-rp68). npm audit reports 0 vulnerabilities. No runtime dependencies changed.

Full changelog: https://github.com/rohanraarora/metabase-cli/compare/v0.7.0...v0.8.0

Adds first-class support for two Metabase v0.59+ workflows and clears all open dependency advisories.
Added
  • question update --db <id> — move a saved card to a different database. Updates both the top-level databaseid and datasetquery.database so they never drift.
  • --slack-channel <name> on alert create / notification create — post to a Slack channel by name (emits a notification-recipient/raw-value recipient, the only shape v0.59+ accepts for channel-name targets).
  • --schedule <cron> (Quartz/Spring), plus legacy --schedule-type / --schedule-hour, on alert create / alert update — schedules now attach to top-level subscriptions[] as notification-subscription/cron.
  • notification create: --condition, --send-once, --disable-links flags for the full v0.59+ payload.

Fixed
  • --channel-type slack no longer fails with 400 ... unknown error, received: :slack — the channel type is canonicalized to channel/slack / channel/email. Both bare and prefixed forms are accepted.
  • notification create --schedule no longer attaches the cron to handlers[].schedule (silently ignored); it's mounted at the notification level.
  • AlertApi translates alertcondition + alertabovegoal → sendcondition and alertfirstonly → send_once; legacy field names still accepted.
  • alert create canonicalizes --channel-type before the Slack-recipient guard (prefixed form was bypassing validation).
  • alert update --above-goal without --condition now implies a goal condition instead of downgrading to has_result.

Security
  • Cleared all npm audit advisories (dev deps): brace-expansion (ReDoS), postcss (XSS), and vitest 3 → 4.1.8 (critical UI-server arbitrary file read/exec). npm audit now reports 0 vulnerabilities. No runtime dependencies changed.

Full Changelog: https://github.com/rohanraarora/metabase-cli/compare/v0.6.1...v0.7.0

Added
  • Global --verbose flag (and METABASECLIVERBOSE=1 env var) to print full API error response bodies. Useful for debugging; off by default.

Changed
  • API errors are now one-line human-readable messages instead of the full server response. Previously a single 500 dumped 5–20 KB of Clojure stacktrace into stdout; now it prints just the top-level message / error / cause field (e.g. 500 Server Error: Invalid parameter: Card 24,009 does not have a template tag named "since_date".). Use --verbose to see the original body. Applies to both HTTP errors and in-band query-execution failures.

Fixed
  • question update no longer corrupts v0.59+ cards when template tags are involved. The previous code wrapped stages[0].native as an object with nested template-tags; Metabase saved the payload but the query processor could not substitute parameters, leaving cards unrunnable ("Card does not have a template tag named X"). Updates now emit native as a string with template-tags at the stage level, matching native-UI-authored cards. Cards previously corrupted by this bug are healed on their next update.

Full changelog: https://github.com/rohanraarora/metabase-cli/compare/v0.6.0...v0.6.1

What's Changed
Added
  • metabase-cli doctor — runs 8 diagnostic checks against your Metabase instance (connectivity, version detection, API compatibility)
  • --template-tags and --template-tags-file flags on question update (previously only available on create)

Fixed
  • question update --sql no longer corrupts questions on Metabase v0.59+ — now detects the stages format vs legacy native format
  • Migrated alert commands from deprecated /api/alert to /api/notification endpoints (backward-compatible CLI interface)
  • segment delete now uses PUT with archived: true instead of deprecated DELETE endpoint
  • dashboard list falls back to search API if /api/dashboard returns 404 (endpoint deprecated in recent Metabase versions)
  • Security: updated transitive deps vite (7.3.1 → 7.3.2) and picomatch (4.0.3 → 4.0.4), fixing 4 Dependabot alerts

Changed
  • DatasetQuery type now includes optional stages property for Metabase v0.59+ compatibility
  • Alert delete now archives (soft delete) instead of hard delete, matching notification API behavior

Full Changelog: https://github.com/rohanraarora/metabase-cli/compare/v0.5.0...v0.6.0

What's New
  • Environment variable authentication: Set METABASECLIAUTHKEY and METABASECLI_DOMAIN to use the CLI without running profile add — useful for CI/CD pipelines, Docker containers, and quick one-off usage
  • Warning when only one of the two env vars is set
  • --profile flag still takes precedence over env vars

See [CHANGELOG](https://github.com/rohanraarora/metabase-cli/blob/main/CHANGELOG.md) for full details.
``bashnpm install -g [email protected]``

Installation

npm install -g metabase-cli
$ tail ./comments.log

Comments (0)

Login with GitHub to post a comment
No comments yet. Be the first to comment!