APIContext CLI
The APIContext CLI (apimetrics) lets you manage API monitors, projects, workflows, schedules, and more without opening a browser.
The command set is generated at runtime from the APIContext OpenAPI description, so it varies by endpoint, API-description version, and account tier. A small set of built-in commands is always present. See Generated commands for the full explanation and how to discover what is available to you.
To install the CLI, sign in, select a project, and run your first command, follow Install and set up the CLI.
Configuration and endpoints
The CLI stores its state in a per-user config directory provided by the OS:
| Platform | Default config dir |
|---|---|
| macOS | ~/Library/Application Support/apimetrics |
| Linux | ~/.config/apimetrics |
Override it with the APIMETRICS_CONFIG_DIR environment variable. The active project is recorded in state.json inside that directory. A separate cache directory holds the cached OpenAPI description and tokens; override it with APIMETRICS_CACHE_DIR.
The endpoint the CLI talks to (and where it discovers the OpenAPI description) is compiled into the binary. You can override the server for a single invocation with the global -s/--rsh-server flag.
Built-in commands
These commands are always available, regardless of the loaded API description:
| Command | What it does |
|---|---|
apimetrics login / logout | Authenticate / clear credentials. See Authentication |
apimetrics completion <shell> | Generate a shell completion script (see Shell completion) |
apimetrics project select / show | Manage the active project. See Project |
apimetrics bulk … | Client-side bulk sync of resources. See Bulk |
apimetrics skills install / onboard | Set up AI coding agents with APIContext workflows. See Skills & onboard |
Output and global flags
Every command accepts the --rsh-* global flags. The most important one to know:
# Get machine-readable JSON — note it is -o json, NOT --json
apimetrics list-monitors -o json
Command reference
- CLI Command Reference: built-in command groups and global flags
- Generated commands: how runtime OpenAPI commands work and how to discover them
What's next?
- Configuration as code: define monitoring in YAML/JSON, version-control in Git, deploy through CI/CD
- Monitor your first API: end-to-end UI tutorial
- API Reference: full REST API reference