newsletter
Beehiiv CLI for Headless Automation
Use the Beehiiv CLI for headless automation with headless JSON commands, schema discovery, credentials, and permission controls.
10 functions 6 read 4 write API key auth
Beehiiv CLI for Headless Automation
Use KosmoKrator as a non-interactive integration runtime for local automations and wrappers.
Use headless automation when another tool needs a stable local command surface. The Beehiiv CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.
Command Shape
# Beehiiv CLI for Headless Automation
kosmokrator integrations:configure beehiiv --set api_key="$BEEHIIV_API_KEY" --set publication_id="$BEEHIIV_PUBLICATION_ID" --enable --read allow --write ask --json
kosmo integrations:call beehiiv.beehiiv_list_posts '{"status":"example_status","limit":1,"page":1}' --json Discovery Before Execution
Agents and scripts can inspect Beehiiv docs and schemas before choosing a function.
kosmo integrations:docs beehiiv --json
kosmo integrations:docs beehiiv.beehiiv_list_posts --json
kosmo integrations:schema beehiiv.beehiiv_list_posts --json
kosmo integrations:search "Beehiiv" --json
kosmo integrations:list --json Useful Beehiiv CLI Functions
| Function | Type | Parameters | Description |
|---|---|---|---|
beehiiv.beehiiv_list_posts | Read | status, limit, page | List posts from your Beehiiv publication. Filter by status (draft, confirmed, etc.) and paginate with limit/page. |
beehiiv.beehiiv_get_post | Read | post_id | Get a single post from your Beehiiv publication by its post ID. |
beehiiv.beehiiv_create_post | Write | title, content, status, subtitle, audience, thumbnail_url, content_tags | Create a new post in your Beehiiv publication. Requires title and content. Set status to "draft" to save without publishing, or "confirmed" to publish. |
beehiiv.beehiiv_update_post | Write | post_id, title, content, status, subtitle, audience, thumbnail_url, content_tags | Update an existing post in your Beehiiv publication. Provide the post ID and the fields you want to change. |
beehiiv.beehiiv_delete_post | Write | post_id | Delete a post from your Beehiiv publication. This action is irreversible. |
beehiiv.beehiiv_list_subscribers | Read | status, limit, page | List subscribers for your Beehiiv publication. Filter by status (active, inactive, etc.) and paginate with limit/page. |
beehiiv.beehiiv_get_subscriber | Read | subscription_id | Get a single subscriber from your Beehiiv publication by their subscription ID. |
beehiiv.beehiiv_create_subscriber | Write | email, reactivate_existing, utm_source, utm_medium, utm_campaign, referring_pub | Add a new subscriber to your Beehiiv publication by email address. |
beehiiv.beehiiv_get_stats | Read | intent, days, start_date, end_date | Get analytics and stats for your Beehiiv publication. Use the "intent" parameter to specify the type of stats (overview, traffic, growth, subscribers). |
beehiiv.beehiiv_get_current_user | Read | none | Verify your Beehiiv API key and list all publications you have access to. Use this to confirm the integration is working and to find your publication ID. |
Automation Notes
- Use
--jsonfor machine-readable output. - Keep credentials out of argv by using environment variables or stored KosmoKrator configuration.
- Configure read/write policy before unattended runs; use
--forceonly for trusted automation. - Use the MCP gateway instead when the agent needs dynamic tool discovery inside a conversation.