Skip to content
Back to skills

Data Metabase

ASecurity

Metabase REST API automation and troubleshooting: authenticate (API key preferred, session fallback), export/upsert questions (cards) and dashboards, standardize visualization_settings, and run/export results.

  • 666 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added February 8, 2026
toolspythonbashsqlrailsapidatabasedocumentation

Works with

  • api

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill data-metabase --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Data Metabase?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Data Metabase
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-data-metabase/badge)](https://www.skillsdirectory.com/skills/majiayu000-data-metabase)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: data-metabase
description: "Metabase REST API automation and troubleshooting: authenticate (API key preferred, session fallback), export/upsert questions (cards) and dashboards, standardize visualization_settings, and run/export results."
---

# Metabase

Automate Metabase via API: reports (cards), dashboards, and chart settings.

## Quick Start

### Inputs (env vars)

- `METABASE_URL` (e.g., `https://metabase.example.com`)
- Preferred: `METABASE_API_KEY`
- Fallback: `METABASE_USERNAME` + `METABASE_PASSWORD`

### Sanity checks

```bash
python3 frameworks/shared-skills/skills/data-metabase/scripts/metabase_api.py health
python3 frameworks/shared-skills/skills/data-metabase/scripts/metabase_api.py whoami
```

### Live API documentation

Your Metabase instance serves OpenAPI docs at `/api/docs` (e.g., `https://metabase.example.com/api/docs`). Use this to discover version-specific endpoints and request shapes.

## Workflow

1. Confirm API availability (`GET /api/util/health`).
2. Authenticate with an API key (preferred) or a short-lived session (fallback).
3. Discover IDs (prefer discovery over hardcoding across environments):
   - `collection_id` for where to save
   - `database` id for `dataset_query`
   - `source-table` / field ids if using MBQL
4. Create/update a card:
   - Prefer native SQL for stable automation.
   - Set `display` + `visualization_settings` explicitly.
5. Create/update a dashboard and add cards with consistent layout.
6. Validate by running/exporting results.

## Key Concepts

- UI "Question" == API `card`
- Chart configuration lives on the card as `display` + `visualization_settings`
- Most viz keys are easiest to manage by copying from an existing card JSON, then editing

## Guardrails

- Prefer Metabase "serialization" (Pro/Enterprise) for bulk, cross-environment migrations; use direct API for incremental upserts.
- Do not hardcode numeric IDs across environments when you can discover them or use serialization/entity IDs.
- Never commit `METABASE_API_KEY`, passwords, or session tokens.
- Prefer a dedicated, least-privileged automation account and collection.

## References (read only as needed)

| Topic                                 | File                                                           |
|---------------------------------------|----------------------------------------------------------------|
| Authentication (API key + fallback)   | [references/api-auth.md](references/api-auth.md)               |
| Reports (cards): create/edit patterns | [references/reports-cards.md](references/reports-cards.md)     |
| Dashboards and card placement         | [references/dashboards.md](references/dashboards.md)           |
| Charts and `visualization_settings`   | [references/charts-settings.md](references/charts-settings.md) |

## Scripts

`scripts/metabase_api.py` is a small, dependency-free helper to test auth and upsert cards.

Examples:

```bash
# Print authenticated user (tries API key, then session)
python3 frameworks/shared-skills/skills/data-metabase/scripts/metabase_api.py whoami

# Export an existing card JSON (use as a template for visualization_settings)
python3 frameworks/shared-skills/skills/data-metabase/scripts/metabase_api.py export-card --id 123 --out card.json

# Export an existing dashboard JSON (use as a template for layout)
python3 frameworks/shared-skills/skills/data-metabase/scripts/metabase_api.py export-dashboard --id 5 --out dashboard.json

# Create/update a card from a JSON spec (see references/reports-cards.md)
python3 frameworks/shared-skills/skills/data-metabase/scripts/metabase_api.py upsert-card --spec card-spec.json

# Create/update a dashboard from a JSON spec (base fields only)
python3 frameworks/shared-skills/skills/data-metabase/scripts/metabase_api.py upsert-dashboard --spec dashboard-spec.json
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.