Skip to main content
The Apitally CLI makes API metrics and request log data accessible to coding agents such as Claude Code, Cursor, and Codex. An accompanying skill teaches agents how to use the CLI effectively, so they can answer questions that go beyond what the pre-built dashboards cover. While primarily designed for agents, the CLI works equally well directly in your terminal or as part of scripts and automations. The CLI is a single Rust binary with a bundled DuckDB engine and no runtime dependencies. It’s open-source and also published as an npm package, so you can run it with npx without prior installation.

GitHub repository

npm package

Capabilities

  • Retrieve API metrics with various aggregation options and filters
  • Retrieve request logs with filters and field selection, including headers and payloads
  • Fetch full details about specific API requests, including application logs and traces
  • Load data into a local DuckDB database and run arbitrary SQL queries against it
  • List apps, consumers, and endpoints in your team
All commands output newline-delimited JSON to stdout by default.
For example use cases, see the release announcement.

Agent skill

The skill bundles instructions and reference material that allow agents to use the CLI efficiently, without digging through documentation or --help text on every invocation. It includes guidance on key concepts, an investigation workflow, a full command reference, and the schemas of the DuckDB tables the CLI writes to. It follows the open Agent Skills standard and works with Claude Code, Cursor, Codex, and other compatible agents. The skill lives alongside the CLI in the GitHub repository.

Installation

For agents

Install the apitally-cli skill using the skills CLI:
npx skills add apitally/cli
Once installed, agents will pick up the skill automatically when you mention Apitally or ask it to investigate API metrics or request logs. Agents will invoke the CLI through npx, so it doesn’t need to be installed separately.

For humans

The CLI can be used via npx, no installation required:
npx @apitally/cli <command>
To use the apitally binary directly, install it with the standalone installer:
# macOS and Linux
curl -fsSL https://apitally.io/cli/install.sh | sh
# Windows
powershell -ExecutionPolicy Bypass -c "irm https://apitally.io/cli/install.ps1 | iex"
You can also download the binary for your platform from the latest release on GitHub.

Authentication

The CLI uses the Apitally API under the hood and therefore requires a team-scoped API key. Authenticate using a browser-based flow that creates and saves an API key to ~/.apitally/auth.json:
npx @apitally/cli auth
If you already have an API key, you can provide it directly:
npx @apitally/cli auth --api-key "your-api-key"
You can also set the API key via the APITALLY_API_KEY environment variable, or pass --api-key to any command.

Commands

CommandDescription
authConfigure API key
whoamiCheck authentication and show team info
appsList all apps in your team
consumersList consumers for an app
endpointsList endpoints for an app, with method and path filters
metricsFetch metrics for an app, with filters and different aggregation options
request-logsFetch request log data, with filters and field selection
request-detailsFetch full details for a specific request and response, including headers, payloads, application logs, and traces
sqlRun SQL queries against a local DuckDB database
reset-dbDrop and recreate all tables in the local DuckDB database
Run npx @apitally/cli --help for detailed usage information, or refer to the command reference in the skill.

DuckDB database

Most commands accept a --db flag. When set, data is written to a local DuckDB database instead of being printed as NDJSON to stdout. The database can then be queried with the sql command. The database defaults to ~/.apitally/data.duckdb if no other path is provided (e.g. --db ./my-investigation.duckdb). It is created automatically on first use, and data is retained between sessions. When writing to tables, existing records are updated rather than duplicated. For the schemas of the tables the CLI writes to, see the DuckDB table reference in the skill.