A simple command-line app for interacting with the Beehiiv V2 API. Use it (with AI! 🤖) to extract data and work with your publications, subscribers, posts, and webhooks from your terminal.
Ready for public use on macOS, Windows, and Linux. Install via Homebrew (macOS/Linux) or winget (Windows), or download a binary from the GitHub releases page. The Codex plugin ships both in-repo and as a release asset for team installs.
- Download the latest release from the GitHub releases page or install via a package manager:
brew tap deldrid1/homebrew-tap
brew install beehiiv- Sign in — your browser opens automatically:
beehiiv login- Try
beehiiv publications listorbeehiiv --help.
If you're setting up release publishing with an agent, start with docs/release-auth-setup.md. It includes the current token requirements, including the classic PAT requirement for winget publication.
The repo includes a Codex-installable plugin at plugins/beehiiv-codex for teammates who would rather ask for outcomes in plain language than memorize CLI commands.
If your team already works in this repo:
- Pull the latest changes.
- Restart Codex.
- Open Plugins in Codex, then install
Beehiivfrom theBeehiiv Local Pluginsmarketplace.
If your team just wants the plugin:
- Download
beehiiv-codex-plugin_VERSION.zipfrom the matching GitHub release. - Extract
beehiiv-codexinto~/.codex/plugins/on macOS/Linux or%USERPROFILE%\\.codex\\plugins\\on Windows. - Add a personal marketplace file at
~/.agents/plugins/marketplace.jsonthat points at./.codex/plugins/beehiiv-codex. - Restart Codex and install
Beehiivfrom that personal marketplace.
Example personal marketplace file:
{
"name": "beehiiv-personal-plugins",
"interface": {
"displayName": "Beehiiv Personal Plugins"
},
"plugins": [
{
"name": "beehiiv-codex",
"source": {
"source": "local",
"path": "./.codex/plugins/beehiiv-codex"
},
"policy": {
"installation": "AVAILABLE",
"authentication": "ON_INSTALL"
},
"category": "Productivity"
}
]
}The repo includes a Claude Code plugin at plugins/beehiiv-claude with a beehiiv-reporting-assistant skill that translates plain-language requests ("summarize the last 14 days", "export subscribers to CSV") into the right beehiiv commands.
Install from this repo:
/plugin marketplace add /absolute/path/to/beehiiv-cli
/plugin install beehiiv-claude@beehiiv-local-plugins
Or install from GitHub:
/plugin marketplace add deldrid1/beehiiv-cli
/plugin install beehiiv-claude@beehiiv-local-plugins
If you prefer to use the skill without the plugin wrapper, copy it into your personal skills directory:
cp -r plugins/beehiiv-claude/skills/beehiiv-reporting-assistant ~/.claude/skills/See plugins/beehiiv-claude/README.md for details and suggested prompts.
- Friendly
--helpoutput on every command - One-command sign-in via OAuth — no API key setup required
- Secure credential storage in the macOS Keychain or Windows Credential Manager
- Handy shortcuts for common subscriber, publication, post, and webhook tasks
- Guided
reportsworkflows for non-technical stats, charts, and CSV exports - JSON output for scripts, with table output when you want something easier to read
- Automatic pagination with
--all - Built-in retry and rate-limit handling
Beehiiv ships an official MCP server for AI-assisted workflows. The table below compares it with this CLI so you can choose the right tool — or use both.
| Resource | CLI | MCP | Notes |
|---|---|---|---|
| Publications (list, get, stats) | ✅ | ✅ | |
| Posts (list, get, stats) | ✅ | ✅ | |
| Post content (free/paid audience views) | ✅ | ✅ | MCP adds audience-scoped rendering |
| Post ISP deliverability breakdown | ❌ | ✅ | MCP-only; per-domain metrics for 50+ subscriber domains |
| Post click tracking (per-link) | ❌ | ✅ | MCP-only; includes per-subscriber click lists |
| Subscriptions (list, get, filter) | ✅ | ✅ | |
| Authors | ✅ | ✅ | |
| Tiers | ✅ | ✅ | |
| Custom fields | ✅ | ✅ | |
| Content tags | ❌ | ✅ | MCP-only |
| Polls + poll responses | ✅ | ✅ | |
| Surveys + survey responses | ❌ | ✅ | MCP-only |
| Automations + journeys | ✅ | ✅ | MCP adds per-step subscriber counts |
| Automation email content | ❌ | ✅ | MCP-only; rendered email from a step |
| Segments (list, get, recalculate) | ✅ | ❌ | CLI-only |
| Segment members / results | ✅ | ❌ | CLI-only |
| Referral program | ✅ | ❌ | CLI-only |
| Advertisement opportunities | ✅ | ❌ | CLI-only |
| Webhooks (CRUD + test) | ✅ | ❌ | CLI-only |
| Email blasts | ✅ | ❌ | CLI-only |
| Engagements | ✅ | ❌ | CLI-only |
| Newsletter lists | ✅ | ❌ | CLI-only (Beta) |
| Workspaces | ✅ | ✅ | |
| Post templates | ✅ | ❌ | CLI-only |
| Condition sets | ✅ | ❌ | CLI-only |
| Beehiiv documentation search | ❌ | ✅ | MCP-only; search and read support articles |
| Operation | CLI | MCP |
|---|---|---|
| Create / update / delete posts | ✅ | ❌ |
| Create / update / delete subscriptions | ✅ | ❌ |
| Bulk import subscriptions | ✅ | ❌ |
| Bulk update subscriptions | ✅ | ❌ |
| Create / update / delete custom fields | ✅ | ❌ |
| Create / update / delete webhooks | ✅ | ❌ |
| Create / update tiers | ✅ | ❌ |
| Create automation journeys | ✅ | ❌ |
| Delete segments | ✅ | ❌ |
| Add subscription tags | ✅ | ❌ |
The MCP is read-only (v1) — Beehiiv has announced write support for a future v2.
| Feature | CLI | MCP |
|---|---|---|
Full pagination (--all aggregation) |
✅ | Capped at 100/page |
| CSV export | ✅ | ❌ |
| ASCII charts in terminal | ✅ | ❌ |
| Publication summary reports | ✅ | ❌ |
| Table, JSON, and raw output | ✅ | JSON only |
| Rate-limit handling + retry | ✅ | Managed server-side |
| OAuth sign-in (no API key) | ✅ | ✅ (managed auth) |
| API key auth | ✅ | ❌ |
| Works on free Beehiiv plan | ✅ | ❌ (paid plans only) |
| Shell scripting / CI pipelines | ✅ | ❌ |
| AI agent integration (MCP) | ❌ | ✅ |
| Verbose request debugging | ✅ | ❌ |
- CLI — scripting, bulk operations, CI/CD, CSV exports, anything that writes data, free-tier accounts, or when you need the full API surface (71 operations across 28 resource groups).
- MCP — conversational AI workflows, asking questions about your newsletter in natural language, deliverability analysis (ISP breakdown), and survey data.
- Both — the CLI and MCP complement each other. Use the MCP for exploration and analysis, then use the CLI to act on what you find.
- For normal use: a Beehiiv account (OAuth sign-in is built in — no API key needed)
- To build from source: Go 1.26 or newer
- For publication-scoped commands: a Beehiiv publication ID
For CI/CD or programmatic use you can also pass an API key directly. See Beehiiv's Create an API Key guide.
From the Go module root:
make buildCross-platform examples:
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o ./dist/beehiiv-darwin-arm64 ./cmd/beehiiv
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o ./dist/beehiiv-darwin-amd64 ./cmd/beehiiv
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o ./dist/beehiiv-windows-amd64.exe ./cmd/beehiiv- Download the correct archive for your machine from the latest release:
beehiiv_VERSION_darwin_arm64.tar.gzon Apple Silicon orbeehiiv_VERSION_darwin_x86_64.tar.gzon Intel. - Extract it:
tar -xzf beehiiv_VERSION_darwin_arm64.tar.gz- Move
beehiivsomewhere on yourPATH, for example:
mv ./beehiiv /usr/local/bin/beehiiv- Run:
beehiiv auth loginThe CLI stores its config at:
~/Library/Application Support/beehiiv-cli/config.json
Secrets are stored in the macOS Keychain by default.
Install via winget (requires Windows 10 1809+ or Windows 11):
winget install Deldrid1.BeehiivCLIThen sign in:
beehiiv loginIf winget is not available, download the correct archive from the latest release (e.g. beehiiv_VERSION_windows_x86_64.zip), extract it into a folder such as C:\Tools\beehiiv\, and add that folder to your PATH.
The CLI stores its config at %AppData%\beehiiv-cli\config.json. Secrets are stored in the Windows Credential Manager by default.
- Download the correct archive from the latest release, for example
beehiiv_VERSION_linux_x86_64.tar.gz. - Extract it:
tar -xzf beehiiv_VERSION_linux_x86_64.tar.gz- Move
beehiivsomewhere on yourPATH, for example:
sudo mv ./beehiiv /usr/local/bin/beehiivHomebrew:
brew tap deldrid1/homebrew-tap
brew install beehiivWinget (Windows 10 1809+ or Windows 11):
winget install Deldrid1.BeehiivCLIMaintainer setup and publication notes live in packaging/winget/README.md, packaging/homebrew/README.md, and docs/release-auth-setup.md.
Sign in with a single command — no API key required:
beehiiv loginYour browser opens the Beehiiv authorization page. After you approve, credentials are saved securely in the OS keyring. The OAuth client is pre-configured; nothing extra to set up.
If you prefer not to open a browser automatically:
beehiiv login --no-browserFor non-interactive environments, pass your API key directly:
beehiiv login --api-key YOUR_API_KEY
beehiiv login --api-key YOUR_API_KEY --publication-id pub_123If --publication-id is omitted the CLI looks up your publications and selects automatically if there is only one, or prompts you to choose.
beehiiv auth status # show masked credential state
beehiiv auth logout # remove saved credentials (revokes OAuth token)
beehiiv auth path # print the config file locationIf you are building your own Beehiiv OAuth integration:
beehiiv auth oauth login --client-id YOUR_CLIENT_ID
beehiiv auth oauth login --client-id YOUR_CLIENT_ID --scope all
beehiiv auth oauth login --client-id YOUR_CLIENT_ID --no-browserThe redirect URI defaults to http://localhost:3008/callback and must match your Beehiiv OAuth app settings. PKCE is used automatically.
The CLI checks configuration in this order:
- Command-line flags
- Environment variables
- Stored session secrets in the OS keychain or keyring plus
config.jsonsettings - Built-in defaults
Supported environment variables:
BEEHIIV_API_KEY
BEEHIIV_BEARER_TOKEN
BEEHIIV_PUBLICATION_ID
BEEHIIV_BASE_URL
BEEHIIV_RATE_LIMIT_RPM
BEEHIIV_OAUTH_CLIENT_ID
BEEHIIV_OAUTH_CLIENT_SECRET
BEEHIIV_OAUTH_REDIRECT_URI
BEEHIIV_OAUTH_SCOPES
The CLI stores non-secret settings in config.json. Secrets are kept out of that file.
Auth status example:
beehiiv auth statusStart with help:
beehiiv
beehiiv --helpList publications:
beehiiv publications list
beehiiv pubs listList all subscribers:
beehiiv subscriptions list --all --query limit=100Use repeatable query flags when an endpoint accepts multiple values:
beehiiv subscriptions list \
--query expand=stats,custom_fields \
--query status=activeShow a subscriber by ID:
beehiiv subscriptions show sub_123Inspect automations and their related email activity:
beehiiv automations list --query expand=stats
beehiiv automations show aut_123 --query expand=stats
beehiiv automations emails aut_123Inspect segments and poll responses:
beehiiv segments members segment_123 --query expand=stats,custom_fields
beehiiv polls show poll_123 --query expand=stats
beehiiv polls responses poll_123Look up a subscriber by email:
beehiiv subscriptions find person@example.comCreate a custom field from inline JSON:
beehiiv custom-fields create --body '{"kind":"string","display":"Favorite Airport"}'Create a webhook from a file:
beehiiv webhooks create --body @webhook.json
beehiiv hooks ping endpoint_123Check the current sign-in state safely:
beehiiv auth statusShow a table instead of JSON:
beehiiv subscriptions list --output tableCreate a friendly publication summary, chart engagement trends, or export a CSV:
beehiiv reports summary
beehiiv reports chart --metric unique_opens --days 14
beehiiv reports export subscriptions --file subscriptions.csvPrint the raw API response body:
beehiiv subscriptions get sub_123 --rawPrint request and response details to stderr for troubleshooting:
beehiiv subscriptions get sub_123 --verbose- List commands return one page by default.
- Add
--allto fetch everything. - For endpoints like subscriptions, the CLI prefers cursor pagination unless you explicitly pass
--query page=.... - Aggregated
--alloutput looks like:
{
"data": [],
"pagination": {
"mode": "cursor",
"pages_fetched": 3,
"items_returned": 250,
"has_more": false,
"next_cursor": null
}
}The CLI defaults to an internal limit of 150 requests per minute and also honors Beehiiv rate-limit headers. When Beehiiv responds with 429, the client waits for the reset window and retries automatically.
Useful local commands:
make build
make docs
make test
make fmt
make fmt-check
make lintGenerated CLI reference docs land in docs/reference/cli/, generated manpages land in share/man/man1/, and generated shell completions land in share/completions/.
To enable the local pre-commit hook:
git config core.hooksPath .githooksSee CONTRIBUTING.md for the contributor workflow, SECURITY.md for responsible disclosure guidance, and CHANGELOG.md for release history.
Override the internal limiter if needed:
beehiiv subscriptions list --rate-limit-rpm 120Run the local unit and integration suite:
go test ./...Run the gated live Beehiiv suite:
BEEHIIV_LIVE_TESTS=1 \
BEEHIIV_API_KEY=your_api_key \
BEEHIIV_PUBLICATION_ID=pub_your_publication \
go test ./... -run LiveThe live tests look for BEEHIIV_API_KEY first, then BEEHIIV_BEARER_TOKEN. They also require BEEHIIV_PUBLICATION_ID.