Lago × Metabase

How to build Lago billing dashboards in Metabase

Lago is an open-source metering and usage-based billing platform — events, billable metrics, plans, invoices, and prepaid wallets. Metabase is where you turn that into shared dashboards for usage revenue, MRR, and invoicing. This guide covers two complementary paths: a lightweight MCP + CLI route that pulls live data with the Lago agent toolkit and loads a CSV into Metabase with the Metabase CLI for quick analysis, and a durable pipeline route that syncs Lago into a database so you can build usage-revenue, MRR, and invoicing dashboards anyone can read.

Heads up: Metabase connects to databases and warehouses — it does not ship a native Lago connector. For dashboards that need history and reliability, you'll sync Lago (via its API and webhooks) into a database first — or, if you self-host, query its Postgres via a read replica.

How do you connect Lago to Metabase?

Most teams combine both routes: use the Lago agent toolkit and Metabase CLI route to pull live data and stand up a quick analysis, and the pipeline route for the usage-revenue dashboards finance depends on.

1 · MCP + CLI route (AI-assisted)

Live data in, quick analysis out

Run Lago's agent toolkit as a local MCP server (to look up live customers, subscriptions, and usage) and pair it with the Metabase CLI, whose upload command loads a CSV into Metabase as a ready-to-query table and model.

Best for
  • Quick lookups like "which customers spiked usage this week?"
  • Loading a Lago CSV export into Metabase in seconds
  • Spot-checks and one-off analyses without a warehouse
Trade-offs
  • Great for exploration, not governed revenue reporting
  • Use a read-only Lago API key so analysis can't trigger writes
  • CSV uploads are snapshots — refresh or move to the pipeline for history
2 · Pipeline route (warehouse-backed)

Durable dashboards with history

Sync Lago via its API and webhooks — or query its Postgres directly if you self-host — into a database, then point Metabase at it.

Best for
  • Usage-revenue, MRR, and invoiced-revenue dashboards finance relies on
  • Metered-event and billable-metric trends over time
  • Joining billing data with product usage and CRM data
Trade-offs
  • Requires a destination database and a sync to maintain
  • Usage-based revenue needs documented rating logic
  • Reconcile against Lago before anyone trusts the numbers

What can you analyze from Lago data in Metabase?

  • Usage revenue — metered consumption by billable metric
  • Recurring MRR — subscription plan charges over time
  • Invoices and fees — invoiced revenue by fee type
  • Wallets and credits — prepaid balance and consumption
  • Overage — usage beyond included allowances
  • Coupons and credits — discounts and their revenue impact

Which Lago dashboards should you build in Metabase?

For: Finance, product

Usage & billable metrics

What drives usage-based revenue.

  • Metered usage by billable metric over time (line)
  • Usage revenue by metric (bar)
  • Customers by usage tier (table)
  • Overage vs. included usage (stacked bar)
For: Finance, RevOps

Recurring & total revenue

Recurring plan charges plus usage on top.

  • MRR from recurring plan charges (number + trend)
  • Recurring vs. usage revenue split (stacked bar)
  • Net new MRR per month (bar)
  • Revenue by plan (bar)
For: Finance, ops

Invoices & fees

Billed amounts and their composition.

  • Invoiced revenue by month (bar)
  • Fees by type: subscription, charge, add-on (stacked bar)
  • Invoice status and AR (table)
  • Credits and coupons applied (table)
For: Finance, product

Wallets & prepaid credits

Prepaid balance and how fast it burns.

  • Wallet balances outstanding (number)
  • Credit top-ups vs. consumption (dual line)
  • Burn rate by customer (table)
  • Customers near zero balance (table)

How do you use the Lago MCP server with the Metabase CLI?

Pair Lago's agent toolkit (a local MCP server) with the Metabase CLI for fast, hands-on analysis. Lago's toolkit runs locally with your API key and looks up live customers, subscriptions, and usage; the Metabase CLI's upload command loads a CSV into Metabase and creates a ready-to-query table and model. For analysis, scope the Lago API key to read-only.

Example workflow

  • Ask the Lago MCP which customers spiked usage this week, or pull a customer's plan, wallet balance, and invoices.
  • Export the customers, subscriptions, invoices, and fees you want to keep as CSVs.
  • Run mb upload csv to load them into Metabase as tables and models, then build questions and dashboards on top.

Be honest about the limits

  • Lago's toolkit is a local MCP server great for live lookups — not for scheduled or audited revenue reporting.
  • A CSV upload is a point-in-time snapshot; usage trends and MRR movement still need a database sync, or refresh with mb upload replace.
  • Scope the Lago API key to read-only so analysis can't trigger writes.
  • mb upload csv needs an uploads database configured under Admin → Settings → Uploads.

How do you set up the Lago MCP server and the Metabase CLI?

Lago MCPofficial · local

Source
getlago/lago-agent-toolkit (GitHub)
Transport
Local (build/run per the repo)
Auth
LAGO_API_KEY
Self-hosted
Set LAGO_API_URL to your instance

Metabase CLIofficial

Install
npm install -g @metabase/cli
Auth
mb auth login (browser OAuth on v62+, or an API key)
Load data
mb upload csv --file data.csv
Requires
An uploads database (Admin → Settings → Uploads)
ClaudeClaude Code CLI (template — see the repo for the run command)
# Lago (local agent toolkit — build/run per the repo README)
claude mcp add lago \
  --env LAGO_API_KEY=<YOUR_LAGO_API_KEY> \
  --env LAGO_API_URL=https://api.getlago.com \
  -- <command-from-lago-agent-toolkit-readme>
Cursor~/.cursor/mcp.json (template — see the repo for the run command)
{
  "mcpServers": {
    "lago": {
      "command": "<command-from-lago-agent-toolkit-readme>",
      "env": {
        "LAGO_API_KEY": "<YOUR_LAGO_API_KEY>",
        "LAGO_API_URL": "https://api.getlago.com"
      }
    }
  }
}

Lago's MCP is distributed as the getlago/lago-agent-toolkit repo — follow its README for the exact run command, then set LAGO_API_KEY (and LAGO_API_URL if self-hosting).

TerminalLoad a Lago CSV with the Metabase CLI
# Install the Metabase CLI
npm install -g @metabase/cli

# Log in (opens your browser; requires Metabase v62+)
mb auth login --url https://your-metabase.example.com

# Load a Lago CSV export — creates a table AND a model
mb upload csv --file lago-invoices.csv --collection root

# Refresh that same table later from a new export
mb upload replace <table-id> --file lago-invoices.csv

The Metabase CLI stores its credentials securely after mb auth login. Use a read-only Lago API key for the toolkit so analysis can't trigger writes.

Verify before shipping: confirm an uploads database is enabled under Admin → Settings → Uploads (Metabase docs) and the current Lago toolkit setup in the lago-agent-toolkit repo. Scope the Lago API key to read-only for analysis work.

Can you generate a Lago dashboard with AI?

Yes. Use the prompt below with any assistant that can run the Lago MCP server and the Metabase CLI. It works end to end: if Lago tables already exist in Metabase it analyzes those; otherwise it pulls the data over the Lago MCP, loads it with mb upload csv, then builds the dashboard — separating usage from MRR and skipping cards it has no data for.

Prompt for creating a Lago Billing Overview dashboard
Create a polished Metabase dashboard for Lago usage-based billing analytics.
Work end to end: get the data into Metabase if it isn't there yet, then build.

Goal: Help finance and product leaders understand usage-based revenue, recurring
MRR, invoices, and prepaid credit (wallet) consumption from Lago data.

Step 1 — Find or load the data:
- First, check what already exists in Metabase (search for Lago tables and
  models). If durable Lago data is already present — synced from a database or
  uploaded earlier — use it and skip to Step 2.
- If nothing is there, pull it with Lago's agent-toolkit MCP server using a
  read-only API key: customers, subscriptions, plans, billable metrics, events,
  invoices, fees, and wallets. Write each result to a CSV, then load it with the
  Metabase CLI — run "mb upload csv --file <export>.csv" so each upload creates a
  table and a ready-to-query model. Use "mb upload replace <table-id> --file
  <export>.csv" to refresh an existing table instead of creating duplicates.

Step 2 — Inspect before querying:
Do not assume exact table names. Map the available raw tables into these
analytical concepts where possible: Customers, Subscriptions, Plans, Billable
metrics, Events (usage), Invoices, Fees, Wallets/Credits, and Coupons. Inspect
the actual tables and column names first.

Important:
- Build on whatever data is present; don't claim Metabase connects natively to
  Lago — it reads a database or CLI-uploaded tables.
- Separate recurring subscription revenue (MRR) from usage-based (metered)
  revenue; document the rating logic.
- Report usage against included allowances so overage is visible.
- Track wallet (prepaid credit) balances and consumption separately.
- Report in a single reporting currency.
- Only build a card if its underlying column/metric exists in the data.
- A single CSV is a point-in-time snapshot: usage trends and MRR movement need
  history, so build trend cards only if a database sync or multiple uploads
  provide it.

Dashboard title: Lago Billing Overview

Sections:
1. Executive summary (KPI cards): MRR; Usage revenue this month; Invoiced
   revenue; Outstanding wallet balance; Net new MRR; Overage revenue.
2. Usage & billable metrics: Usage by metric over time; Usage revenue by metric;
   Overage vs. included.
3. Recurring & total revenue: MRR from recurring charges; Recurring vs. usage
   split; Revenue by plan.
4. Invoices & fees: Invoiced revenue; Fees by type; AR.
5. Wallets & credits: Wallet balances; Top-ups vs. consumption; Burn rate.

Filters: Plan, Billable metric, Customer, Currency, Date range.

Reuse the models Metabase auto-created from uploaded CSVs, or (for a database)
create reusable models: modeled_lago_usage, modeled_lago_invoices,
modeled_lago_wallets, and modeled_lago_mrr (a monthly recurring-MRR model).

Output: Build the dashboard if you have permission; otherwise provide the exact
questions, SQL, model definitions, and layout. Include caveats for any metric
that cannot be calculated from the available data. Reconcile totals against
Lago. Keep it practical, dense, and executive-readable. Avoid vanity metrics.

How do you build the Lago → Metabase pipeline?

For dashboards that need history and reliability, land Lago data in a database first, then connect Metabase to that database.

No paid tool required. A fully free stack: a small dlt or hand-written script (extract) → a free Postgres database like Neon or Supabase (load) → a scheduler such as GitHub Actions cron (host) → Metabase (visualize). For hosting and scheduling details, see our data pipeline guide.

Connector options

  • dlt (free, code) — wrap the Lago API in a small Python pipeline for incremental, no-vendor loads. The lightest path to a maintainable sync.
  • Lago API (free, raw) — paginate customers, subscriptions, invoices, fees, and wallets into your own pipeline.
  • Webhooks (events) — stream invoice and subscription events into a table for near-real-time dashboards.
  • Postgres read replica (self-hosted) — if you run Lago yourself, point Metabase at a read replica of its database.

Notes

  • Land raw tables first, then build clean models on top.
  • Amounts are in _cents fields — divide in a model layer.
  • Keep usage (charge) fees separate from subscription fees.
  • Model wallet balances and transactions separately from invoiced revenue.

How should you model Lago data in Metabase?

Core tables

ConceptGrainKey columns
customersone row per customerid, external_id, created_at, currency
subscriptionsone row per subscriptionid, customer_id, plan_id, status, started_at, terminated_at
billable_metricsone row per metricid, code, name, aggregation_type
eventsone row per usage eventtransaction_id, external_subscription_id, code, properties, timestamp
invoicesone row per invoiceid, customer_id, total_amount_cents, status, payment_status, issuing_date
feesone row per feeid, invoice_id, charge_id, fee_type, amount_cents
walletsone row per walletid, customer_id, balance_cents, status

Modeling advice

  • Build a modeled_lago_mrr table from recurring subscription fees, excluding usage charges.
  • Keep usage rating in one model so overage and included allowances are auditable.
  • Aggregate raw events to the billable-metric grain for usage analysis.
  • Model wallets and wallet transactions separately from invoices.
  • Reconcile modeled revenue against Lago before trusting the numbers.

Which Lago metrics should you track in Metabase?

MetricDefinitionNotes
Usage revenueRated metered consumption (charge fees).By billable metric.
MRRRecurring subscription fees, normalized monthly.Exclude usage charges.
Invoiced revenueTotal billed in a period.Recognize per your accounting policy.
Overage revenueUsage beyond included allowance.Signals upsell opportunity.
Wallet balanceOutstanding prepaid credits.Track consumption/burn rate.
Churn rateTerminated ÷ active subscriptions.Split voluntary vs. failed payment.

What SQL powers Lago dashboards in Metabase?

These assume the modeled tables above (PostgreSQL dialect, amounts in cents). Adjust identifiers to match your schema.

Usage revenue by billable metricPostgreSQL

Rated metered consumption, grouped by metric.

-- Metered usage revenue by billable metric
SELECT
  date_trunc('month', f.created_at) AS month,
  bm.name                           AS billable_metric,
  ROUND(SUM(f.amount_cents) / 100.0, 2) AS usage_revenue
FROM fees f
JOIN charges c          ON c.id = f.charge_id
JOIN billable_metrics bm ON bm.id = c.billable_metric_id
WHERE f.fee_type = 'charge'
GROUP BY 1, bm.name
ORDER BY 1, usage_revenue DESC;
Recurring MRR and ARRPostgreSQL

From subscription fees, excluding usage charges.

-- Recurring MRR from subscription fees (excludes usage charges)
SELECT
  ROUND(SUM(mrr), 2)       AS mrr,
  ROUND(SUM(mrr) * 12, 2)  AS arr,
  COUNT(*)                 AS active_subscriptions
FROM modeled_lago_mrr
WHERE month = date_trunc('month', CURRENT_DATE);
Wallet balances and consumptionPostgreSQL

Prepaid credit outstanding and how much has been used.

-- Prepaid credit balance and consumption
SELECT
  w.customer_id,
  ROUND(w.balance_cents / 100.0, 2)                       AS balance,
  ROUND(SUM(wt.credit_amount) FILTER (
    WHERE wt.transaction_type = 'outbound') / 100.0, 2)   AS consumed_credits
FROM wallets w
LEFT JOIN wallet_transactions wt ON wt.wallet_id = w.id
WHERE w.status = 'active'
GROUP BY w.customer_id, w.balance_cents
ORDER BY balance ASC;

What are common mistakes when analyzing Lago in Metabase?

Treating a live MCP lookup or a one-off CSV as governed revenue reporting.→ Use the Lago MCP and CSV uploads for lookups and triage; build warehouse-backed Metabase dashboards for anything finance depends on.
Folding usage charges into MRR.→ MRR is recurring subscription revenue — keep metered charge fees in a separate usage-revenue line.
Analyzing raw events without aggregating.→ Roll events up to the billable-metric grain, or usage numbers are noise.
Mixing wallet balances into revenue.→ Prepaid credits are a liability until consumed — model wallets separately from invoiced revenue.
Never reconciling with Lago.→ Sanity-check modeled usage and invoiced revenue against Lago's own reports before trusting them.

Related analytics

Related metrics

Related integrations

FAQ

Does Metabase connect natively to Lago?
No. Metabase reads SQL databases and warehouses. Sync Lago into a database first (its API and webhooks) — or, if you self-host Lago, point Metabase at a read replica of its Postgres.
How do I quickly analyze Lago data without a warehouse?
Pull the objects you need with Lago's agent-toolkit MCP server (use a read-only API key), export them to CSV, and run `mb upload csv --file data.csv` with the Metabase CLI. It creates a table and a model you can build questions on right away. You'll need an uploads database enabled under Admin → Settings → Uploads. Refresh later with `mb upload replace`, or move to the pipeline route when you need history.
Is there a hosted Lago MCP URL I can paste?
No. Lago ships an official agent toolkit (getlago/lago-agent-toolkit) that runs as a local MCP server with your LAGO_API_KEY. There's no hosted paste-a-URL endpoint — build and run it per the repo.
How do I separate usage revenue from MRR?
Lago fees carry a fee_type. Treat subscription fees as recurring MRR and charge fees as usage revenue, and keep the rating logic in one modeled layer so the two never blur.