Install and set up the CLI
Install the APIContext CLI (apimetrics), sign in, select a project, and run your first command. The command reference stays on the CLI overview.
Prerequisites
- An APIContext account to sign in with.
Installation
Install the CLI with your platform's package manager, or download a release binary from GitHub.
macOS (Homebrew)
brew install apimetrics/tap/apimetrics
Windows (winget)
winget install APIContext.APImetricsCLI
Linux and manual installation
Binaries are published as GitHub release assets on the APImetrics CLI releases page. This works on every platform, including macOS and Windows.
-
Download the archive matching your OS and architecture:
- macOS:
apimetrics-<version>-darwin-amd64.tar.gzorapimetrics-<version>-darwin-arm64.tar.gz - Linux:
apimetrics-<version>-linux-amd64.tar.gzorapimetrics-<version>-linux-arm64.tar.gz - Windows:
apimetrics-<version>-windows-amd64.zip
<version>has no leadingv. For release v0.0.2 the files are namedapimetrics-0.0.2-linux-amd64.tar.gz, and so on. - macOS:
-
Verify the download against the published
checksums.txt. -
Extract the archive and move the
apimetricsbinary somewhere on yourPATH.
# Example (Linux amd64) - adjust the version and architecture to the release you downloaded
sha256sum --check --ignore-missing checksums.txt
tar -xzf apimetrics-0.0.2-linux-amd64.tar.gz
sudo mv apimetrics /usr/local/bin/apimetrics
apimetrics --version
--version reports the CLI version, the OpenAPI spec version, and when the spec was last checked.
Authentication
Authentication uses OAuth 2.0. You do not set an API key in an environment variable, and there is no api configure command: sign in with login instead.
apimetrics login
- The default interactive
loginuses the OAuth 2.0 authorization-code flow with PKCE (code_challenge_method=S256). It opens your browser to sign in. - For CI and other headless environments, authenticate with a service account using
--service-account <file>: no browser is needed. - Most commands auto-trigger login when they need credentials, so running
loginexplicitly is rarely required. apimetrics logoutclears cached credentials and the active project.
See Authentication for OAuth details and named profiles (-p/--rsh-profile).
Selecting a project
Most commands operate on an active project. Set it once and it is remembered:
# Choose interactively from the projects you can access
apimetrics project select
# Or set it directly by ID (no prompt)
apimetrics project select prj_abc123
# Show the active project
apimetrics project show
In CI, where there is no prompt, pass --project-id (or set APIMETRICS_PROJECT_ID) instead. See Project for details.
Creating a project
You can create a new project directly from the CLI using a generated command. To create a personal project owned by you, use create-account-project:
apimetrics create-account-project name: "My New Project"
A personal project is not added to any organization, even if you belong to one. Organization admins can create projects in an organization. Find the organization ID, then pass it to create-project-in-org:
apimetrics list-account-projects -f 'body.organizations.*.{id, name}'
apimetrics create-project-in-org <org-id> name: "My New Project"
After creating it, select it as the active project:
apimetrics project select
See Create a new project for all the ways to create projects, including from the web UI.
First monitor via the CLI
# 1. Authenticate (or let the next command trigger it for you)
apimetrics login
# 2. Select (or create) the project to work in
apimetrics project select
# 3. List your monitors (a generated command from the loaded API description)
apimetrics list-monitors -o json
# 4. Discover any other command and its flags
apimetrics --help
apimetrics list-monitors --help
Next steps
- Generated commands: how the CLI turns the OpenAPI description into commands, and how to discover them.
- CLI overview: configuration, endpoints, built-in commands, and global flags.
- CLI command reference: built-in command groups and global flags.
- Monitor your first API: end-to-end UI tutorial.