CLI
The saasflow command-line client — OAuth or API key, profiles, JSON or table output.
saasflow is the official command-line client for the SaaSFlow public API. Same auth
modes as the API, same endpoints, with a few extras (search, batched data slices, profile
management).
Install
npm install -g saasflow
# yarn:
yarn global add saasflowVerify:
saasflow --versionAuthenticate
The default saasflow login opens your browser, walks you through OAuth (PKCE) at
app.saasflow.com, then stores the issued token in ~/.saasflow/config.json.
saasflow loginAfter login, the CLI prompts you to pick a default company.
By default the CLI requests read and write access plus the OpenID scopes for identity
and token refresh. Untick saasflow:write on the consent screen for a read-only
session, or pass --scopes to request a different set:
saasflow login --scopes "openid profile email offline_access saasflow:read"Non-interactive (API key)
saasflow login --api-key sf_...
# or read from stdin
echo "$SAASFLOW_KEY" | saasflow login --api-key -Use this in CI. Create the key at Settings → API keys (details).
Logout
saasflow logoutWipes the active profile's credentials.
Profiles
Switch between accounts or environments without re-authenticating:
saasflow login --profile work
saasflow login --profile staging --base-url https://staging-api.saasflow.com
# Use them
saasflow --profile work customers list
saasflow --profile staging companiesThe default profile is named default.
Global options
| Flag | Purpose |
|---|---|
-p, --profile <name> | Profile to use. Default: default. |
--base-url <url> | Override the API base URL. |
--api-key <key> | One-off API key for this call (or - for stdin). |
--company <id> | Override the default company for this call. |
-f, --format <auto|json|table> | Output format. Default auto. |
--json | Shortcut for --format json. |
--table | Shortcut for --format table. |
--columns <list> | Comma-separated columns for table mode. |
Built-in commands
saasflow login # Browser OAuth or --api-key
saasflow logout # Clear credentials
saasflow whoami # Show current profile and active company
saasflow search <query> # Free-text search across customers/vendors/accounts/transactions
saasflow data <slice> # Run a data slice (MRR, cash flow, P&L, ...)
saasflow data list # List supported slice types
saasflow data batch # Run multiple slices in one request (stdin or --from-json)
saasflow companies use [id] # Pick or change the default companyAuto-generated commands
The CLI generates one command per OpenAPI operation, so anything the
API exposes is reachable. The pattern is
saasflow <resource> <verb>:
saasflow companies list
saasflow companies get
saasflow customers list --limit 100
saasflow customers get --customer-id cust_...
saasflow accounts list
saasflow transactions list --account-id acc_... --limit 50
saasflow subscription_events list --subscription-id sub_...
saasflow products listFor the full list, run saasflow --help or saasflow <resource> --help.
Example
# Top 10 customers by MRR
saasflow data customerMrr --to today --json | jq '.[] | select(.mrr > 0)' | head -20
# Pipe an MRR snapshot into a CSV
saasflow data mrrData --from 2026-01-01 --to 2026-06-30 --json \
| jq -r '.[] | [.date, .mrr] | @csv'
# Search for a customer and inspect their subscription events
CUST=$(saasflow search "acme corp" --json | jq -r '.customers[0].id')
saasflow subscription_events list --customer-id "$CUST"List search
Free-text search across a company, grouped by entity type. Use it when you know a name but not an id: one call matches customers, vendors, and accounts on name, and transactions on counterparty or description. This backs the command palette, so each category returns at most 5 hits. Categories the caller has no read permission for come back empty rather than 403, which keeps the search box usable on partial-permission grants. When you need a full, filtered, paginated list of one entity type, use that resource's own endpoint.
MCP server
Expose SaaSFlow as tools to Claude, ChatGPT, and other Model Context Protocol clients.