Use the Beehiiv CLI from KosmoKrator to call Beehiiv tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.
Beehiiv can be configured headlessly with `kosmokrator integrations:configure beehiiv`.
# Install KosmoKrator first if it is not available on PATH.curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash# Configure and verify this integration.kosmokrator integrations:configure beehiiv --set api_key="$BEEHIIV_API_KEY" --set publication_id="$BEEHIIV_PUBLICATION_ID" --enable --read allow --write ask --jsonkosmokrator integrations:doctor beehiiv --jsonkosmokrator integrations:status --json
Credentials
Authentication type: API keyapi_key. Configure credentials once, then use the same stored profile from
scripts, coding CLIs, Lua code mode, and the MCP gateway.
Key
Env var
Type
Required
Label
api_key
BEEHIIV_API_KEY
Secret secret
yes
API Key
publication_id
BEEHIIV_PUBLICATION_ID
Text string
yes
Publication ID
Call Beehiiv Headlessly
Use the generic call form when another coding CLI or script needs a stable universal interface.
Every function below can be called headlessly. The generic form is stable across all integrations;
the provider shortcut is shorter but specific to Beehiiv.
beehiiv.beehiiv_list_posts
Read read
List posts from your Beehiiv publication. Filter by status (draft, confirmed, etc.) and paginate with limit/page.
Create a new post in your Beehiiv publication. Requires title and content. Set status to "draft" to save without publishing, or "confirmed" to publish.
Get analytics and stats for your Beehiiv publication. Use the "intent" parameter to specify the type of stats (overview, traffic, growth, subscribers).
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.
Create a new post in your Beehiiv publication. Requires title and content. Set status to "draft" to save without publishing, or "confirmed" to publish.
Whether to reactivate the subscription if the email already exists. Default: false.
utm_source
string
no
UTM source to attribute the subscription to.
utm_medium
string
no
UTM medium to attribute the subscription to.
utm_campaign
string
no
UTM campaign to attribute the subscription to.
referring_pub
string
no
Referring publication ID.
beehiiv.beehiiv_get_stats
Get analytics and stats for your Beehiiv publication. Use the "intent" parameter to specify the type of stats (overview, traffic, growth, subscribers).
Type of stats to retrieve: "overview", "traffic", "growth", "subscribers". Default: "overview".
days
integer
no
Number of days to look back (default: 30).
start_date
string
no
Start date for custom range (ISO 8601, e.g., "2026-01-01").
end_date
string
no
End date for custom range (ISO 8601, e.g., "2026-01-31").
beehiiv.beehiiv_get_current_user
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.
Headless calls still follow the integration read/write permission policy. Configure read/write defaults
with integrations:configure. Add --force only for trusted automation that should bypass that policy.