Skip to content

Latest commit

 

History

History
101 lines (67 loc) · 1.96 KB

cli.mdx

File metadata and controls

101 lines (67 loc) · 1.96 KB
title CLI
description Use the Inbox Zero API CLI from npm or npx.

Use the Inbox Zero API CLI when you want a thin wrapper around the public API for scripts, bots, or local automation.

The package is published to npm as @inbox-zero/api, and the executable name is inbox-zero-api.

Run with npx

Requires Node.js 18+.

npx @inbox-zero/api --help

You can also install it globally:

npm install -g @inbox-zero/api

Configure access

The CLI reads configuration in this order:

  1. Command flags
  2. Environment variables
  3. ~/.inbox-zero-api/config.json

Supported environment variables:

  • INBOX_ZERO_API_KEY
  • INBOX_ZERO_BASE_URL for self-hosted or custom API deployments

Example:

inbox-zero-api rules list

base-url is optional. The CLI defaults to https://www.getinboxzero.com and only needs an override for self-hosted or custom deployments.

Set INBOX_ZERO_API_KEY in your shell or secret manager before running commands. Avoid passing API keys as CLI arguments because they can leak into shell history and process listings.

Common commands

List rules:

inbox-zero-api rules list
inbox-zero-api rules list --json

Get a rule:

inbox-zero-api rules get rule_123 --json

Create a rule from JSON:

inbox-zero-api rules create --file rule.json
cat rule.json | inbox-zero-api rules create --file -

Update a rule from JSON:

cat rule.json | inbox-zero-api rules update rule_123 --file -

Delete a rule:

inbox-zero-api rules delete rule_123

Read stats:

inbox-zero-api stats by-period --period week --json
inbox-zero-api stats response-time --json

Unsubscribe from a sender:

inbox-zero-api senders unsubscribe news@example.com
inbox-zero-api senders unsubscribe news@example.com --json

Fetch the live OpenAPI document:

inbox-zero-api openapi --json

For bots, prefer --json so the output is stable and machine-readable.