pm is the PushMetrics command-line tool. It talks to the same REST API the web app uses, with your permissions: it sees the reports, databases and users you can see in the app, in one workspace, and nothing else. Use it to run and debug reports from a shell, keep report definitions in git, feed a CI pipeline, or give an AI coding agent a safe, scriptable handle on your workspace.

This guide covers everything pm does. If you only want the raw HTTP API, see the Reports API and Run History API pages.

Install

pm is published on PyPI as pushmetrics-cli. It needs Python 3.9 or newer and runs on macOS, Linux and Windows. The recommended way to install it is pipx, which gives pm its own environment and puts it on your PATH:

pipx install pushmetrics-cli
pm --version

Already installed? Upgrade with pipx upgrade pushmetrics-cli.

With uv:

uv tool install pushmetrics-cli

Already installed? Upgrade with uv tool upgrade pushmetrics-cli.

Or with plain pip:

pip install --user pushmetrics-cli

Already installed? Upgrade with pip install --user --upgrade pushmetrics-cli.

What changed in each version: pm CLI changelog.

Python from Homebrew, and from some Linux distributions, refuses pip install --user with an externally-managed-environment error; use pipx or uv there. After a pip install --user, pip tells you if the directory it put pm in is not on your PATH.

pm needs an active PushMetrics subscription for your workspace's organization. Without one, PushMetrics refuses your personal access token: pm cannot log in, its commands stop working when the current session expires or sooner (within an hour at most), and no new tokens can be created.

Create a personal access token

pm logs in with a personal access token. In the app, open Settings and pick CLI & API (or go to /a/tokens). Click New token, give it a name, choose its access, and optionally an expiry date. Full access is the default; see Read-only tokens for the other choice.

The New access token dialog on the CLI & API settings page

Copy the pmpat_... value from the confirmation dialog. It is shown once.

The one-time token reveal after creation

A token is bound to the workspace that was active when you created it. Everything pm does with it happens in that workspace. To work in two workspaces, create one token in each (see Working in several workspaces).

Log in

pm login --token

pm asks for the token in a hidden prompt, checks it with PushMetrics, and stores it in your operating system's credential store. Then check who you are:

pm whoami

pm whoami prints your email, your name, the workspace the token is bound to, the token's access (token_scope), the profile, and the PushMetrics address it talks to.

Without storing anything. Put the token in the PM_API_TOKEN environment variable instead and skip pm login. Every pm command picks it up, and it wins over a stored token. This is the right choice for CI and other automation.

From a secrets manager. pm login --token also reads the token from stdin when it is piped, so it never appears on your screen, in your shell history or in a file. For example, with the 1Password CLI:

op read op://private/pushmetrics/token | pm login --token

pm logs in with personal access tokens only. pm login without --token answers: Browser login is not set up for profile 'default'. Use a personal access token instead: create one at https://pushmetrics.io/a/tokens, then run `pm login --token`.

How commands are organized

pm --help lists everything. Commands are grouped by what they manage, always as pm <group> <action>:

Group What it manages
login, logout, whoami, token, config Your login, tokens and profiles
report, run Reports, and their runs, results and logs
sql, chart, email, slack, sftp, explore, metrics-view, tableau, slides The blocks a report is made of, one group per block type
block Blocks of any type at once
database Databases, their schemas and tables
folder, favorite, saved-block, recipient, webhook, integration Things around reports
workspace, organization, user, role Your workspace, organization, people and roles

Most groups have list and get; many have create, update and delete. pm <group> --help lists a group's actions, and pm <group> <action> --help lists the options of one action. pm help <group> shows a compact page with examples.

Identifiers: wherever a command asks for a UID, use the identifier from the object's URL in the app or from pm <group> list. A few commands ask for a numeric ID instead; their help says where to find it.

Reports and runs

pm report list                         # every report in the workspace
pm report list --name weekly           # name contains "weekly" (case-insensitive)
pm report get <report-uid>             # key fields; --json for the full record
pm report runs <report-uid>            # the runs of one report

Run a report now. pm report run starts the run and prints the new run's uid straight away; the run itself happens in the background. The uid is the only thing on stdout (a reminder of the next command goes to stderr), so a script can capture it:

run=$(pm report run <report-uid>)
pm run get "$run"                      # status and timing
pm run results "$run"                  # what each block produced

Preview without notifying anyone. --send-to-me sends the report's email blocks to you instead of their recipients and skips every other destination (Slack, webhooks, SFTP, cloud storage). Add --email to preview as one of your saved recipients:

pm report run <report-uid> --send-to-me
pm report run <report-uid> --send-to-me --email anna@example.com

Find out why a run failed. pm run list filters combine, and pm run logs takes a run uid:

pm run list --report <report-uid> --last-days 2 --status failed
pm run logs <run-uid> --level ERROR

pm run list shows the 25 most recent runs by default; --limit raises that up to 5000.

Keep report definitions in git. pm report yaml exports a report's full configuration, and pm report apply writes it back:

pm report yaml <report-uid> > weekly-kpis.yaml
pm report apply weekly-kpis.yaml --uid <report-uid> --dry-run   # show the diff, save nothing
pm report apply weekly-kpis.yaml --uid <report-uid>             # replace the report
pm report apply weekly-kpis.yaml                                # create a new report

--no-prune keeps blocks that are in the report but not in the file; by default they are removed. --allow-create-folder creates the folder named in the file if it does not exist.

Schedules

A schedule runs one report on a recurring rule, like the schedules you set up for a report in the app. (The API calls a schedule a workflow.)

pm schedule list                                  # every schedule in the workspace
pm schedule list --report <report-uid>            # the schedules of one report
pm schedule get <schedule-uid>
pm schedule create --report <report-uid> --rrule 'DTSTART;TZID=Europe/Berlin:20261116T080000 RRULE:FREQ=WEEKLY;BYDAY=MO'
pm schedule update <schedule-uid> --rrule 'DTSTART;TZID=Europe/Berlin:20261116T090000 RRULE:FREQ=WEEKLY;BYDAY=MO'
pm schedule pause <schedule-uid>
pm schedule resume <schedule-uid>
pm schedule run <schedule-uid>

pm schedule list prints one row per schedule:

UID   NAME                   REPORT        STATUS  RRULE                                                                   NEXT_RUN                   LAST_RUN
----  ---------------------  ------------  ------  ----------------------------------------------------------------------  -------------------------  -------------------------
sch1  Weekly sales, Mondays  Weekly sales  active  DTSTART;TZID=Europe/Berlin:20261116T080000; RRULE:FREQ=WEEKLY;BYDAY=MO  2026-11-16T07:00:00+00:00  2026-11-09T07:00:02+00:00

STATUS is active or paused. pm schedule get shows the same fields for one schedule, and --json prints the full record. An unknown --report uid fails with a hint to run pm report list.

The rule. --rrule takes a start (DTSTART) and then a rule (RRULE), the format the app's scheduler stores. The start sets the first date and the time of day: DTSTART;TZID=Europe/Berlin:20261116T080000 is 08:00 Berlin time, and DTSTART:20261116T080000Z is 08:00 UTC. Separate the two parts with a space or a line break. pm checks the rule before it sends anything, and stops with exit code 2 when the start is missing:

Error: --rrule needs a start time (DTSTART) before the rule, e.g. 'DTSTART;TZID=Europe/Berlin:20261116T080000 RRULE:FREQ=WEEKLY;BYDAY=MO'.

or when the two parts are not separated by a space or a line break:

Error: --rrule must be a start (DTSTART) then a rule (RRULE), separated by a space, e.g. 'DTSTART;TZID=Europe/Berlin:20261116T080000 RRULE:FREQ=WEEKLY;BYDAY=MO'.

Create and update. pm schedule create needs --report and --rrule; --name is optional. It prints the new schedule's uid on stdout and a line on stderr, such as Created schedule sch9 for report 'Weekly sales'. Next run: 2026-11-16T07:00:00+00:00. If the rule has no future run, the schedule is created paused: Created schedule sch9, but it is paused: the rule has no future run. Fix it with pm schedule update sch9 --rrule ... pm schedule update changes the rule only, so it needs --rrule; without it, pm fails with a usage error, Error: Nothing to update: pass --rrule., and exit code 2.

Pause and resume.

Paused schedule 'Weekly sales, Mondays' (sch1). Resume it with pm schedule resume sch1.
Resumed schedule 'Weekly sales, Mondays' (sch1). Next run: 2026-11-16T07:00:00+00:00.

Pausing a paused schedule, or resuming an active one, changes nothing and says so (... is already paused., ... is already active.). A schedule whose rule has no future run cannot be resumed: Not resumed: the rule of schedule sch2 for report 'Daily KPIs' has no future run. Fix it with pm schedule update sch2 --rrule ...

Run now. pm schedule run runs the schedule's report at once and delivers it to all its destinations, like the scheduled run would. To preview a report instead, use pm report run <report-uid> --send-to-me. In a terminal, pm asks first: Run schedule 'Weekly sales, Mondays' (sch1) now? It delivers to all its destinations. [y/N]. Without a terminal, only --yes (or -y) lets it run; otherwise pm sends nothing and stops with:

Error: Not run: pm schedule run delivers to real destinations and needs --yes when stdin is not a terminal. To preview, run pm report run <report uid> --send-to-me.

pm schedule run prints nothing on stdout. On stderr it says Started schedule 'Weekly sales, Mondays' (sch1). Follow its runs with: pm run list --report rpt1, and the run then appears in that list. With --json it prints the schedule's record. Running a schedule needs edit permission on its report; without it, the run fails with failed: 403 You don't have edit permission on this report.

Blocks

A report is a sequence of blocks: SQL queries, charts, emails, Slack messages, and so on. Each block type has its own group with list, get and create. Most also have run (sql, chart, tableau, slides) or send (email, slack, sftp) to execute the block, and results to read what it produced. chart, explore and metrics-view also have update, and a metrics view is read with query. pm <group> --help lists each group's actions.

pm sql list --name revenue
pm sql run <block-uid>                 # run a saved SQL block
pm sql results <block-uid> --last      # its most recent result
pm chart list
pm explore get <block-uid>
pm email list
pm slack list
pm sftp list
pm block list --type sql --limit 20    # any block type, filtered

pm email send, pm slack send and pm sftp send deliver for real, to the block's real recipients. Use pm report run --send-to-me to preview a whole report instead.

Metrics views are queried by measures and dimensions instead of SQL:

pm metrics-view schema <view-uid>      # what the view can be queried by
pm metrics-view query <view-uid> --measure revenue --dimension country --time-range last_30d --time-grain month

Tableau views are found through the Tableau integration:

pm integration list
pm tableau search --integration <integration-uid> --keyword sales

Google Slides blocks can be exported once they have run:

pm slides export <block-uid> --filename q4-review.pdf

create and update on block groups read a JSON body on stdin (--stdin); pm help <group> shows the body's shape with an example.

Databases

pm database list
pm database schemas <database>
pm database tables <database> public
pm database describe <database> public orders
pm database search <database> order

<database> is the database's uid or its name. These commands read metadata only; to run a query, use a SQL block.

People, workspace and the rest

pm workspace list                      # workspaces you belong to
pm workspace current                   # the one this token works in
pm organization current
pm user list
pm role list
pm recipient list --name finance
pm folder list
pm favorite list
pm saved-block list
pm webhook list

Write actions such as pm user create, pm folder create or pm webhook create exist too, with the same permissions as in the app; --help on each lists its options. Commands that delete something ask for confirmation; --yes skips the prompt, and is required when pm is not running in a terminal.

Email deliverability

When an email bounces or someone marks it as spam, the email provider blocks the address and drops every later email to it. pm deliverability shows which addresses your workspace sends to are blocked, and lets an admin unblock one. It works like the Email deliverability card in Account Settings.

pm deliverability list                         # blocked addresses this workspace sends to
pm deliverability events alice@example.com     # one address's history
pm deliverability unblock alice@example.com    # admins only; asks first

pm deliverability list prints one row per blocked address:

EMAIL              STATUS   REASON          BLOCKED_SINCE              USED_AS          REPORTS
-----------------  -------  --------------  -------------------------  ---------------  -------------------
alice@example.com  blocked  Bounced         2026-11-09T08:14:03+00:00  recipient, user  Weekly sales, Churn
bob@example.com    blocked  Marked as spam  2026-11-10T17:02:44+00:00  email block      Daily KPIs

REASON is Bounced or Marked as spam. USED_AS says whether the address is a recipient, a user, used in an email block, or several of these, and REPORTS names the reports that send to it. --json prints the full rows, and [] when nothing is blocked. If email deliverability is not configured on the PushMetrics deployment you use, list fails with Error: Email deliverability is not configured on this deployment. and exit code 1, and prints nothing on stdout, also with --json or --quiet.

pm deliverability events <email> shows one address's bounces, spam complaints, dropped emails and unblocks, oldest first, up to the latest 20:

WHEN                       EVENT                            DETAIL
-------------------------  -------------------------------  ----------------------------
2026-11-09T08:14:03+00:00  Bounced                          smtp; 550 5.1.1 user unknown
2026-11-09T08:20:00+00:00  Email dropped (address blocked)
2026-11-10T09:00:00+00:00  Unblocked by an admin

pm deliverability unblock <email> asks Unblock alice@example.com? [y/N] and, after y, answers Unblocked alice@example.com. The next email to it will be sent. If the address bounces again, or someone marks a message as spam, the email provider blocks it again. In a script or CI job, add --yes (or -y). Without a terminal and without --yes, pm sends nothing and stops with Not unblocked: pm deliverability unblock needs --yes when stdin is not a terminal.

What can go wrong:

  • Not an admin. Unblocking needs an admin role in the workspace; listing does not. API POST https://pushmetrics.io/api/v1/recipient/deliverability/unblock failed: 403 Forbidden is followed by Hint: Unblocking an address needs an admin role in this workspace.
  • An address your workspace does not send to. events and unblock only accept an address that is one of the workspace's recipients, users or email blocks. Any other answers failed: 404 Not found with Hint: That address is not one this workspace sends to (a recipient, user or email block). `pm deliverability list` shows the blocked ones.
  • Not configured. On a deployment without email deliverability, unblock fails with failed: 503 Email deliverability is not configured on this deployment. Retrying does not help.

Message usage

A message is one successful delivery: an email, a Slack post, a file upload and so on. Each plan includes a number of messages per billing period. pm usage forecast shows where this period is heading, and ways to save. It needs pm 0.4.0 or later.

pm usage forecast                                            # this period's forecast
pm usage forecast --pause <report-uid> --remove-blocked      # what if: try changes, nothing is changed
pm usage forecast --json

pm usage forecast prints the period, the included messages, the messages used so far and the forecast for the whole period:

Period: 2026-11-10 to 2026-12-10
Included: 10,000   Used so far: 6,240   Forecast: 10,520 (over by 520)
  from schedules: 2,112 more; everything else at this period's pace: 2,168 more
Ways to save:
  -306  messages that would go only to 2 blocked addresses (--remove-blocked)
  -324  Vendor Alerts (a1b2c3d4e5): Half as often

Scheduled reports continue from their active schedules: their runs left, times the messages each run sent this period. Everything else continues at this period's pace. Every number comes from PushMetrics; pm only formats it. Ways to save lists up to three schedule changes that would save the most, largest first: the saving, then the report and its uid, then the change. Once the forecast reaches 90% of the included messages, it also lists the messages that would go only to blocked addresses. With nothing to suggest, the forecast ends after the first three lines, for example Forecast: 6,100 (3,900 to spare).

To see what a change would do before you make it, add one or more of these. Each report takes one change, and nothing is changed:

Option What if
--pause <report-uid> The report's schedules were paused.
--weekdays-only <report-uid> It ran Monday to Friday only.
--half-as-often <report-uid> It ran half as often.
--schedule <report-uid>=<RRULE> Its schedules were replaced by this rule. Its time of day is kept. At most 5 per command.
--remove-blocked Blocked addresses were removed from reports (see Email deliverability).
What if: 9,566 (saves 954), within the included messages
  -648  Vendor Alerts: Paused (216 -> 0 runs left)
  -306  blocked addresses removed

These lines follow the forecast. To make the change, use pm schedule pause, pm schedule update or the report's schedule in the app. --json prints PushMetrics's answer as it is, including each report's uid, runs left and messages per run.

What can go wrong:

  • No subscription. Without an active subscription there is no allowance to forecast against: Error: This workspace has no included-message allowance (no active subscription), so there is nothing to forecast against., exit code 1.
  • A change PushMetrics cannot work out. pm prints PushMetrics's reason on its own, with exit code 1, for example Error: A what-if may try at most 5 custom schedules at once. or Error: The schedule for report a1b2c3d4e5 runs every second; the scheduler runs at most once a minute.
  • A malformed --schedule. pm stops with exit code 2 before sending anything: expected REPORT_UID=RRULE.
  • An older PushMetrics server. A server without the usage forecast answers failed: 404 Not Found, followed by Hint: This PushMetrics server does not have the usage forecast yet.

Output: tables, JSON and filters

Without options, pm prints a short table or a key: value listing meant for reading. --json prints the full API objects instead, and works before or after the action:

pm report list --json
pm --json run get <run-uid>

On list commands, --name keeps rows whose name contains the text, case-insensitive; on pm user list it also matches email, first and last name, and on block lists the display name. --limit caps the number of rows. Together with jq:

# uid and name of every report
pm report list --json | jq -r '.[] | [.uid, .name] | @tsv'

# every report's YAML in its own file
for uid in $(pm report list --json | jq -r '.[].uid'); do
  pm report yaml "$uid" > "$uid.yaml"
done

Data goes to stdout; messages and errors go to stderr, so piping is safe. --quiet silences the informational messages (errors still print). pm exits with 0 on success, 1 when a command fails, 2 when the command line itself is wrong, and 141 when the command reading its output stops early, as head does.

Tokens

pm token list                          # your tokens in this workspace: id, name, prefix, scope, created, last used, expiry
pm token create ci-nightly --expires-on 2027-01-31
pm token revoke <token-id>             # the numeric ID from pm token list

pm token create prints the new token on stdout, once, and its reminders on stderr, so you can hand it to another profile without it touching your screen or a file:

pm config set ci api_url https://pushmetrics.io
pm token create ci-nightly | pm --profile ci login --token

The LAST_USED column is approximate: it is updated when a token is exchanged for a session, not on every request.

Read-only tokens

Every token has one of two kinds of access, chosen when you create it: Full access or Read-only. pm and the API call them full and read.

  • Full access can do anything you can do in this workspace, including deleting reports.
  • Read-only can read reports, runs and settings, and query metrics views (pm metrics-view query). It cannot run SQL, run reports, or change or delete anything, and it cannot create or revoke tokens.

The New token dialog and pm token create make Full access tokens unless you choose otherwise. The token dialog on the app's Connect an AI agent page starts at Read-only; choose Full access there when you want the agent to run SQL or make changes.

pm token create agent-readonly --scope read --expires-on 2027-01-31

For a read-only token, pm token create adds one line to its reminders on stderr: This token is read-only: it can read and query metrics views; SQL, runs and changes are refused. pm token list shows each token's access in its SCOPE column, full or read. pm whoami shows the access of the session you are using as token_scope: full, read or unknown. unknown means the server is older than read-only tokens.

Profiles and configuration

A profile is a named set of settings: which PushMetrics address pm talks to, and which stored token it uses. The built-in default profile talks to https://pushmetrics.io and is used unless you pass --profile <name> or set PM_PROFILE.

pm config list                         # every profile; * marks the active one

pm config list also shows which environment variables are overriding the profiles right now, which helps when a script behaves differently from your terminal.

Environment variable Effect
PM_API_TOKEN Use this personal access token. Wins over a stored token.
PM_PROFILE Use this profile when no --profile is given.
PM_API_URL Talk to this address instead of the profile's. Same as --api-url on one command.
PM_CONFIG_HOME Where pm keeps its configuration. Default: ~/.pm.
PM_CLIENT Names the tool that runs pm, such as ci, claude-code or cursor. pm sends it with each request as client=<name>, or client=cli when it is not set. It is not a secret and does not change what the token can do.

pm lowercases the PM_CLIENT value and turns anything other than letters, digits, ., _ and - into -. When that changes the value, pm config list shows what is sent, for example PM_CLIENT=GitHub Actions (sent as client=github-actions).

Profiles live in ~/.pm/config.toml.

Working in several workspaces

A token works in one workspace, so working in two means two tokens and two profiles. Create the token in the other workspace in the app, then add a profile for it:

pm config set acme api_url https://pushmetrics.io
pm --profile acme login --token
pm --profile acme report list

pm workspace switch is for browser login only. Do not use it with a token: the token decides the workspace.

Logging out

pm logout

This forgets the token stored for the active profile, together with the short-lived session pm keeps next to it. It does not revoke the token: do that with pm token revoke or on the CLI & API page.

Using pm in CI

Store the token as a secret in your CI system and expose it as PM_API_TOKEN; no pm login is needed. For example, in GitHub Actions:

- name: Export report definitions
  env:
    PM_API_TOKEN: ${{ secrets.PUSHMETRICS_TOKEN }}
    PM_CLIENT: ci
  run: |
    for uid in $(pm report list --json | jq -r '.[].uid'); do
      pm report yaml "$uid" > "reports/$uid.yaml"
    done

Give CI its own token, named after the pipeline and with an expiry, so you can revoke it without touching anyone's personal token. PM_CLIENT: ci makes pm declare that its requests come from CI. pm exits non-zero on any failure, so the step fails when a command fails.

Each pm process exchanges its token for a short-lived session and reuses it for a few minutes. Too many logins from one network address within a minute are refused with: Too many login attempts from this network address (10 per minute). Wait a minute and run pm login --token again.

Using pm from an AI agent

pm works well as a tool for an AI coding agent such as Claude Code: every action is a plain command, --json gives structured output, and pm help <group> prints a compact page with examples that fits in an agent's context.

pm help                                # the map of every group
pm help report                         # one group, with examples

Before handing pm to an agent:

  • Give it its own token, created for the purpose, with an expiry. Make it read-only unless the agent should run SQL or make changes. With a full-access token the agent can do everything that token's user can do in that workspace, including deleting reports and creating more tokens, so pick the user and workspace accordingly.
  • Pass the token as PM_API_TOKEN in the agent's environment rather than logging in on your account. PM_API_TOKEN always takes priority over a token stored with pm login, but if it is not set, the agent's pm uses your own stored login on that computer. Have the agent run pm whoami first to confirm whose token it is using.
  • Name the agent in PM_CLIENT: claude-code, cursor, or agent for any other. PM_CLIENT names the tool that runs pm. It is not a secret and does not change what the token can do.
  • Never paste the token into the conversation or into a file the agent can commit.
  • Ask for --json so the agent reads structured output, and --quiet if its tool output should carry data only.
  • Revoke the token on the CLI & API page when the work is done.

For Claude Code, in the shell that starts the agent:

# paste the token, press Enter (nothing is shown)
read -rs PM_API_TOKEN && export PM_API_TOKEN
export PM_CLIENT=claude-code
pm whoami

Then start the agent from that same shell.

Usage mistakes in block commands (pm sql, pm chart and the other block groups), such as a missing uid or a malformed body, are reported on stderr as one JSON line with a message and often a help or example field, so an agent can correct itself. API errors are an Error: line followed by a Hint: line, like every other command.

When AI agents are enabled for your workspace, the app's Connect an AI agent page (from Settings > CLI & API) also gives you instructions to paste into the agent's instructions file (CLAUDE.md for Claude Code, .cursor/rules/pushmetrics.mdc for Cursor, AGENTS.md for other agents). Cursor's version adds a short header; the rest reads:

## PushMetrics
Use the `pm` CLI for anything about PushMetrics reports, runs, databases and metrics.
- Run `pm whoami` first. Stop and ask me if the workspace is not the one I named.
- Find commands with `pm help` and `pm help <topic>`; do not guess flags.
- Add `--json` to list, get, run and query commands and read the JSON.
- Ask me before any delete, update, apply, run, pause or resume, and before creating a schedule.
- If pm says the token is read-only, stop and tell me; do not look for another token.
- Never print, log or store the token in PM_API_TOKEN.

pm agent setup writes those same instructions into the file your agent reads, so you do not have to paste them yourself:

pm agent setup --target claude          # or codex, cursor, gemini, copilot, other
pm agent setup --target claude --dry-run   # show what would change; write nothing
pm agent status                         # which agent files have current instructions

Without --target, it picks the agent from the files already in the directory (--path, the current directory by default). It writes the block between <!-- pushmetrics:start --> and <!-- pushmetrics:end -->, and running it again replaces only that block and leaves the rest of the file as it is. It never writes the token: under "For you to run, not the agent" it prints the read -rs PM_API_TOKEN && export PM_API_TOKEN and export PM_CLIENT=... lines to run in the shell that starts the agent, then checks the token with pm whoami if one is set. pm agent status makes no network call.

pm help --json prints every command and option as JSON, so an AI agent or a script can read what pm accepts.

The Connect an AI agent page also offers a Let the agent set itself up prompt to paste into the agent's chat: the agent installs or upgrades pm, runs pm agent setup and pm whoami, and stops and tells you if PM_API_TOKEN is not set or pm whoami fails, instead of asking you for the token.

The PushMetrics agent skill gives an agent the same rules plus recipes for finding out why a report failed, showing a report's SQL, previewing a report to yourself and changing a schedule; install it with npx skills add https://pushmetrics.io.

Troubleshooting

Every error says what failed and what to do next. The ones you are most likely to meet:

Not logged in. Run pm login --token with a personal access token, or set PM_API_TOKEN. No token is stored for the active profile and PM_API_TOKEN is not set. Tokens are stored per profile, so check pm config list if you logged in under a different one.

That does not look like a personal access token (expected pmpat_ followed by 40-64 letters, digits, - or _, on one line)… The value pasted or piped into pm login --token, or set in PM_API_TOKEN, is not a token. Copy it again from where you saved it; spaces or line breaks inside it are rejected.

Personal access token rejected (invalid, expired, or revoked). The token is well-formed but the server pm checked does not accept it. The next line names that server and profile: Checked against https://pushmetrics.io (profile 'default'). If the token was made on another PushMetrics server, use that server's profile: pm --profile <name> login --token, or set PM_PROFILE. Otherwise create a new token on the CLI & API page and log in again.

This workspace can only be reached from approved network addresses… The workspace has an IP allowlist and this computer's address is not on it. The token is fine: connect through your organization's network or VPN, or ask a workspace admin to add the address. If you signed in with pm login (in the browser) instead of a token, the same sentence comes after an API ... failed: 403 line.

Too many login attempts from this network address (10 per minute). Wait a minute. If it happens in a loop or in CI, check that the token is valid and that the job does not log in again for every command.

Could not reach https://... (ConnectionError). Check your network and the API URL… pm cannot connect to the address it is configured for. pm config list shows the address and any PM_API_URL override.

Hint: Check the API URL: `pm config list` shows the one in use. pm whoami, pm login or the token exchange got 404 Not Found, so pm is talking to the wrong address: a typo in the API URL or in PM_API_URL, a missing path, or a proxy in between. pm config list shows the address in use and any PM_API_URL override.

Refusing to send a bearer credential over plain http to ... The configured address starts with http://. pm only sends tokens over https://, except to localhost.

Unknown profile: 'acme'. Known profiles: agent, default, local… The profile named by --profile or PM_PROFILE does not exist yet. The message ends with the pm config set command that creates it; see also Working in several workspaces.

Profile 'acme' has no api_url… The profile exists but has no address. Run the pm config set command the message names, or set PM_API_URL.

PM_API_URL is not a plain server address… (or the same for --api-url, a profile's api_url, or pm config set). pm accepts only http(s)://host[:port][/path], with no user name, password, query or fragment. Fix the value the message names; for a saved profile, run the pm config set command it shows.

An API ... failed: 403 line that says the token is read-only.

Error: API POST <url> failed: 403 This token is read-only and cannot do this. Only its owner can create a token with full access (Settings > CLI & API).
Hint: If you are an AI agent, this token is read-only on purpose: stop and tell the person you work for. Do not look for another token.

The token is read-only and the command needs full access: it runs SQL or a report, changes or deletes something, or creates or revokes a token. With --json, both lines still go to stderr and stdout stays empty. Only the token's owner can create a token with full access, on the CLI & API page.

The server did not confirm a read-only token, so pm revoked the token it created (id <id>). This server does not support read-only tokens yet. You asked pm token create --scope read for a read-only token, and the server does not support them yet: it made a full-access token instead. pm revoked that token at once, printed no token, and exits with status 1. If the revoke fails too, the message says so and names the pm token revoke command to run.

An API ... failed: 403 line followed by Hint: You do not have permission for this in the active workspace. Your user cannot do this in the token's workspace, the same as in the app. pm whoami shows which user and workspace the token is for.

An API ... failed: 404 line followed by Hint: Nothing with that id is visible in the active workspace. The uid is wrong, or the object belongs to a different workspace than the token's. Where the group has a list command, the hint names it, for example Hint: Nothing with that id is visible in the active workspace. `pm report list` shows what exists.

Hint: PushMetrics returned a server error. Retry in a minute… pm already retries reads on temporary server errors. If it keeps failing, email support@pushmetrics.io with the command and the time.

Anything else. Run the command again with -v: pm prints each request, the response status and its timing to stderr, and the response body on errors. Tokens are never printed; check the output for your own data before sharing it.

Security notes

  • Where the token lives. pm login --token stores the token in your operating system's credential store: Keychain on macOS, Credential Manager on Windows, Secret Service on Linux. Where none is available, it falls back to ~/.pm/tokens.json, readable only by you (file mode 0600). The short-lived session pm derives from the token is kept the same way.
  • Off the command line. pm never takes a token as a command-line argument, so it does not end up in shell history or process lists. Use the prompt, a pipe, or PM_API_TOKEN.
  • Only over https. pm refuses to send a token to an http:// address, except to your own computer (localhost).
  • Never printed. Tokens do not appear in -v output or in error messages.
  • One workspace, your permissions. A token can only act in its workspace, with the permissions of the user who created it. Anyone holding a full-access token can do what that user can do there, including creating more tokens; a read-only token can only read and query metrics views.
  • Revoking. pm logout only removes the token from this computer. To make a token stop working everywhere, revoke it with pm token revoke or on the CLI & API page. Revoke a token you think was exposed, and give every script, pipeline and agent its own token so you can revoke one without breaking the others.
  • Digest API — personal access tokens with curl or any HTTP client, and run health as JSON.
  • Run History API — the data behind pm run list, for raw HTTP.
  • Reports API — the data behind pm report list and pm report yaml.