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.
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.
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.
- 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
- 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
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.
- 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
- 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?
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)
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)
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)
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 csvto 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 csvneeds 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_URLto 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)
# 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>{
"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).
# 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.csvThe 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.
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.
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.
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
_centsfields — 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
| Concept | Grain | Key columns |
|---|---|---|
customers | one row per customer | id, external_id, created_at, currency |
subscriptions | one row per subscription | id, customer_id, plan_id, status, started_at, terminated_at |
billable_metrics | one row per metric | id, code, name, aggregation_type |
events | one row per usage event | transaction_id, external_subscription_id, code, properties, timestamp |
invoices | one row per invoice | id, customer_id, total_amount_cents, status, payment_status, issuing_date |
fees | one row per fee | id, invoice_id, charge_id, fee_type, amount_cents |
wallets | one row per wallet | id, customer_id, balance_cents, status |
Modeling advice
- Build a
modeled_lago_mrrtable 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?
| Metric | Definition | Notes |
|---|---|---|
| Usage revenue | Rated metered consumption (charge fees). | By billable metric. |
| MRR | Recurring subscription fees, normalized monthly. | Exclude usage charges. |
| Invoiced revenue | Total billed in a period. | Recognize per your accounting policy. |
| Overage revenue | Usage beyond included allowance. | Signals upsell opportunity. |
| Wallet balance | Outstanding prepaid credits. | Track consumption/burn rate. |
| Churn rate | Terminated ÷ 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.
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;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);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;