@apitally/cli
v0.2.1
Published
Apitally CLI
Readme
Apitally CLI
A command-line interface for Apitally, built for agents and humans.
Apitally is a simple API monitoring and analytics tool that makes it easy to understand API usage, monitor performance, and troubleshoot issues.
Learn more about Apitally on our 🌎 website or check out the 📚 documentation.
Highlights
- Retrieve API metrics and request logs, including headers, payloads, traces, and more
- Load data into a local DuckDB database and analyze it with arbitrary SQL queries
- Single Rust binary with bundled DuckDB, no runtime dependencies
- Includes an agent skill, so agents know how to use the CLI effectively out of the box
Installation
For agents
Install the apitally-cli skill using the skills CLI:
npx skills add apitally/cliFor humans
The CLI can be used with npx, no installation required:
npx @apitally/cli <command>If you wish to use the apitally binary directly, install it with the standalone installer script:
# On macOS and Linux
curl -fsSL https://apitally.io/cli/install.sh | sh# On 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
Run the auth command to authenticate the CLI:
npx @apitally/cli authThis opens a browser-based auth flow where you log in to the Apitally dashboard and select a team. A newly created API key is then passed back to the CLI and saved to ~/.apitally/auth.json.
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 the --api-key flag to any command.
Commands
| Command | Description |
| ----------------- | ----------------------------------------------- |
| auth | Configure API key |
| whoami | Check authentication and show team info |
| apps | List all apps in your team |
| consumers | List consumers for an app |
| endpoints | List endpoints for an app |
| metrics | Fetch aggregated metrics for an app |
| request-logs | Fetch request log data for an app |
| request-details | Fetch full details for a specific request |
| sql | Run SQL queries against a local DuckDB database |
| reset-db | Drop and recreate all tables in local DuckDB |
All commands output NDJSON to stdout by default. Use the --db flag to write data to a local DuckDB database instead, which can then be queried with the sql command. The database defaults to ~/.apitally/data.duckdb if no other path is specified.
Run npx @apitally/cli --help for detailed usage information.
For a full command reference, see skills/apitally-cli/references/commands.md.
For DuckDB table schemas, see skills/apitally-cli/references/duckdb_tables.md.
Exit codes
| Code | Meaning | | ---- | ------------------------------------------------------- | | 0 | Success | | 1 | General / unknown error | | 2 | Usage error (invalid arguments, missing required flags) | | 3 | Authentication error (missing or invalid API key) | | 4 | Input error (invalid argument values) | | 5 | API / network error |
Getting help
If you need help please create a new discussion on GitHub or email us at [email protected]. We'll get back to you as soon as possible.
