# Baremetrics

> Read subscription and revenue metrics from Baremetrics - sources, MRR/ARR, customers, subscriptions, and plans.

Lets an agent read your subscription analytics from Baremetrics: list the data sources connected to your account, pull the headline revenue metrics (MRR, ARR, active customers) over time, and browse customers, subscriptions, and plans. Most calls take a `source_id` from `baremetrics_sources_list`.

## What it can do

| Method | What it does |
| --- | --- |
| `baremetrics_sources_list` | List data sources - returns the source ids every other call needs. |
| `baremetrics_account` | Get the current Baremetrics account. |
| `baremetrics_metrics` | Get the metrics summary for a source (MRR, ARR, etc.) over an optional date window. |
| `baremetrics_customers_list` | List customers for a source, with optional search and pagination. |
| `baremetrics_customer_get` | Get one customer by oid. |
| `baremetrics_subscriptions_list` | List subscriptions for a source. |
| `baremetrics_plans_list` | List plans for a source. |
| `baremetrics_request` | Generic passthrough to any Baremetrics endpoint for full API coverage. |

## How to get credentials

1. Sign in to [app.baremetrics.com](https://app.baremetrics.com).
2. Open **Settings → API** ([app.baremetrics.com/settings/api](https://app.baremetrics.com/settings/api)).
3. Create or copy an API token. Baremetrics offers a separate **Sandbox** token for testing against demo data - use it first if you do not want to hit live numbers.
4. Paste the token into FlyMyAI. If you used a Sandbox token, set `BAREMETRICS_ENV` to `sandbox`.

## Fields to fill in FlyMyAI

| FlyMyAI field | Where it comes from |
| --- | --- |
| `BAREMETRICS_API_TOKEN` | Baremetrics → Settings → API |
| `BAREMETRICS_ENV` | Optional - `live` (default) or `sandbox`, matching the token you pasted |

## Troubleshooting

- **`401 Unauthorized`** - the token is wrong or revoked. Re-copy it from Settings → API.
- **Live token returns no data, or numbers look like demo data** - you may be mixing live and sandbox. A sandbox token only works against the sandbox host; set `BAREMETRICS_ENV=sandbox` to match it, or use a live token with the default `live`.
- **`404 Not Found` on a metrics/customers call** - the `source_id` is wrong. Call `baremetrics_sources_list` first and use one of the returned ids.

## Links

- [Baremetrics API reference](https://developers.baremetrics.com/)
- [API settings](https://app.baremetrics.com/settings/api)
