/substack-cli:substackfrom substack-cli
CLI wrapper for Substack's unofficial private API — read publication content (archive, posts, RSS feed, comments, search, analytics) and manage a publication you own (create/edit/publish/schedule drafts, moderate comments, manage subscribers, recommendations, and tags), and post/reply-to/list/delete Substack Notes (Substack's micro-blog surface; note that the API has no note-editing endpoint — notes publish immediately), and read (READ-ONLY) Substack Automations — email sequences, their ordered emails and text, audience estimates, stats, saved segments and subscriber tags (no edit/start/send) — and read (READ-ONLY) Substack Chat — list threads, list replies/sub-replies, and check unread counts; Chat endpoints are community-reported and never live-verified, and there is no write support (no send/reply/delete). Triggers on requests to check a Substack newsletter's archive or posts, pull post analytics or subscriber counts, draft or publish a Substack post, schedule a newsletter, reply to or moderate Substack comments, post, reply to, or delete a Substack Note, check Substack Chat threads/replies/unread counts, review Substack Automations (email sequences / drip campaigns), their emails, audience and saved segments, or manage a Substack publication programmatically. Examples: what did I publish on Substack this month, draft a new Substack post, how many subscribers does my newsletter have, schedule my Substack post for Friday, reply to comments on my latest post, post a Substack Note, reply to that Substack note, delete my last note, list my Substack Chat threads, how many unread Substack chats do I have, which Substack automations are running, what does my welcome email sequence say. Requires SUBSTACK_COOKIES_STRING (session cookie) for any authenticated operation; read-only public endpoints (archive, post, feed) work without auth. Write operations additionally require SUBSTACK_ENABLE_WRITE=true.
Trending skills
7-day visitors to each skill page
Ships in substack-cli. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
substack is a Python CLI wrapping Substack's undocumented /api/v1/
surface — there is no official public API for content/publishing/
subscriber automation, so this wraps the same private endpoints the
Substack web app itself uses. Read-only endpoints (archive, single post,
RSS feed) work anonymously; everything else needs a session cookie.
Binary location: substack at
${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/skills/substack/scripts/substack
(optional: ln -s "${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/skills/substack/scripts/substack" /usr/local/bin/substack)
API base: https://{your-subdomain}.substack.com/api/v1/ (some routes
require the bare https://substack.com host instead — the CLI handles
this automatically per command).
Python deps: pip install -r "${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/skills/substack/scripts/requirements.txt" (typer, httpx, rich)
Substack has no API keys — auth is a browser session cookie. See
references/auth-setup.md for the full DevTools walkthrough. Short
version:
substack config set-cookies "connect.sid=...; substack.sid=...; substack.lli=..."
substack config set-publication charliepgarcia
export SUBSTACK_COOKIES_STRING="connect.sid=...; substack.sid=..."
export SUBSTACK_PUBLICATION_URL="charliepgarcia"
All mutating commands (create/update/delete/publish/schedule/add/remove) are disabled by default. Enable explicitly:
export SUBSTACK_ENABLE_WRITE=true
# or: substack config set-value enable_write true
Nine specific commands additionally require --yes even with the gate
enabled, because they are hard to reverse or immediately externally
visible: drafts delete, drafts publish, comments delete,
subscribers remove, recommendations remove, tags delete,
notes create and notes reply (both publish immediately and cannot be
edited; notes create --draft is exempt because it saves without
publishing, while --schedule still needs --yes), and notes delete.
substack config test --pretty
substack archive --sort new --limit 20 # recent posts
substack archive --offset 20 --limit 20 # page 2
substack post brian-sidman-entrepreneur-lessons # single post by slug
substack feed # RSS as parsed JSON
substack feed --raw # raw RSS XML
substack search "AI infrastructure" # full-text search (filtering behavior unconfirmed by Substack)
substack subscribers count # subscriber count / growth summary
substack subscribers stats # detailed subscriber stats (fixed 25-row sample, not a full enumeration — see caveat below)
substack analytics post 204779662 # rich per-post stats: views/opens/open_rate/clicks/signups + firstWeekDailyStats + comps
substack analytics summary # publish dashboard summary
substack analytics posts --sort signups --limit 25 # rank posts by a metric (signups|subscriptions|open_rate|opens|views|clicks|engagement_rate|value)
substack analytics digest --top 5 # "what's working": top posts by signups + publication summary (ranked JSON)
substack comments list 204779662 # reader comments on a post
substack whoami # confirm which account the cookie belongs to
substack categories # list all Substack categories
substack sections # list publication sections
substack leaderboard finance --top 10 # top 10 finance newsletters by paid subs (cross-publication, no auth needed)
substack leaderboard us-politics --rank all # same category, ranked by total reach instead
substack leaderboard 76739 --pretty # numeric category id also accepted (see `substack categories`)
Caveats worth knowing before you rely on these:
analytics post returns a rich stats block (verified live 2026-07-21):
views, opens, open_rate, clicks, signups_within_1_day,
engagement_rate, estimated_value, a firstWeekDailyStats timeseries, and
comps benchmarks — plus post metadata. It does not include social
reactions/restacks (those are a separate surface).subscribers stats always requests limit:25/offset:0 and returns
that fixed 25-row sample — it has no pagination and is not a full
subscriber enumeration.analytics posts / analytics digest list posts from archive and pull
per-post stats from post_management/detail (N+1, throttled). Verified
working 2026-07-21. Ranking note: the meaningful signup signal is
signups_within_1_day — the top-level signups reads 0 on recent posts, so
--sort signups ranks by the within-1-day field. A post whose detail call
fails is still listed (stats {}, ranks as 0). See
docs/plans/amplify-content-flywheel.md.substack drafts create --title "Dear Charlie #37" --body-markdown "$(cat draft.md)"
substack drafts list --limit 10
substack drafts get 123456
substack drafts prepublish 123456 # validation pass — run before publish
SUBSTACK_ENABLE_WRITE=true substack drafts publish 123456 --yes
SUBSTACK_ENABLE_WRITE=true substack drafts schedule 123456 --at 2026-07-11T09:00:00Z
substack drafts scheduled 123456 # check if a draft is scheduled
SUBSTACK_ENABLE_WRITE=true substack drafts unschedule 123456
substack image-upload ./cover.png
substack comments list 204779662
SUBSTACK_ENABLE_WRITE=true substack comments create 204779662 "Thanks for reading!"
SUBSTACK_ENABLE_WRITE=true substack comments react 204779662 --emoji "🔄"
SUBSTACK_ENABLE_WRITE=true substack comments delete 456 --yes --host A
# Moderation — all write commands default to dry-run; add --yes / --no-dry-run to send
SUBSTACK_ENABLE_WRITE=true substack comments report 111 # dry-run: prints request, no network call
SUBSTACK_ENABLE_WRITE=true substack comments report 111 --category spam --details "scam account" --yes
SUBSTACK_ENABLE_WRITE=true substack comments report 111 --publication-id 42 --yes # include publication_id in body (no resolver — find via DevTools)
SUBSTACK_ENABLE_WRITE=true substack comments report-user 456 --category impersonation --details "fake account" --yes
SUBSTACK_ENABLE_WRITE=true substack comments ban 555 --user-id 777 --expiry 1y --visibility visible --yes
SUBSTACK_ENABLE_WRITE=true substack comments ban 555 --user-id 777 --expiry 1000y --visibility delete_all_comments --yes # 1000y = Forever; irreversible
substack comments bans 777 # list bans for a user (read-only)
substack moderation report-categories # GET Substack's reportCategory tree (read-only)
substack moderation delete-reasons # GET comment deletion reason codes (read-only)
Substack Notes are the micro-blog surface (comment-backed internally).
Published notes cannot be edited (only deleted + recreated). To review
before anything goes public, use --draft (saved privately to the Drafts tab
of the Substack Notes composer) or --schedule (a draft that auto-publishes
at the given time). Edit or publish drafts from that Drafts tab.
substack notes list # your personalized Notes home feed
substack notes list --mine # only YOUR posted notes (get ids to delete)
substack notes list --user-id 12345 # a specific user's notes
substack notes get c-98765 # single note (accepts 98765 or c-98765)
# create: publishes IMMEDIATELY + cannot be edited -> requires --yes
SUBSTACK_ENABLE_WRITE=true substack notes create "Shipping Notes support today. **Big.**" --yes
SUBSTACK_ENABLE_WRITE=true substack notes create --body-json ./note.json --yes # rich ProseMirror body
SUBSTACK_ENABLE_WRITE=true substack notes create "Chart of the day" --image ./chart.png --yes # attach an image (repeat --image for several)
# draft: saved to Notes Drafts, NOT published (no --yes needed)
SUBSTACK_ENABLE_WRITE=true substack notes create "Chart of the day" --image ./chart.png --draft
# schedule: draft that auto-publishes at the time (local time, or ...Z for UTC) -> requires --yes
SUBSTACK_ENABLE_WRITE=true substack notes create "Morning take" --schedule 2026-10-12T08:30 --yes
substack notes drafts # list saved + scheduled drafts (delete with notes delete <id> --yes)
SUBSTACK_ENABLE_WRITE=true substack notes create "Subscribers only" --reply-min-role paid_subscriber --yes
# reply: threads a reply under a parent note (accepts 98765 or c-98765); also immediate + uneditable -> requires --yes
SUBSTACK_ENABLE_WRITE=true substack notes reply 98765 "Great point — totally agree." --yes
SUBSTACK_ENABLE_WRITE=true substack notes delete 98765 --yes
Substack Chat is the publication-scoped, thread-based messaging surface — distinct from Notes (public micro-blog) and DMs (private 1:1/group, not implemented at all). This CLI implements exactly four GET commands and nothing else — no send/reply/delete/react/settings. All four endpoints are community-reported and have never been verified against the live API; treat every response shape as provisional and expect a 404 to mean endpoint drift or a wrong id, not necessarily a mistake on your part.
substack chat list --publication-id 12345 # list Chat threads (REQUIRED --publication-id — no resolver exists, see caveat below)
substack chat replies 98765 # replies in a thread, oldest-first
substack chat replies 98765 --before-id 500 --limit 20 # cursor pagination (pass-through)
substack chat sub-replies 55555 # replies to a reply (second-level thread)
substack chat unread --pretty # unread counts; --pretty highlights pubChatUnreadCount
--publication-id has no resolver. No command in this CLI (including
whoami) can currently derive a numeric publication id — /api/v1/user/ profile/self returns your user id, a different number. Find your
publication id via your browser's DevTools Network tab while viewing your
publication's Chat tab, and pass it explicitly.
Substack Automations are publication email sequences ("drip campaigns" in the API). These commands are GET only — there is no command to edit, start, stop, delete, duplicate, or send (including preview sends) an automation, or to change saved segments or subscriber tags. All endpoints were live-verified (2026-11) and are on the publication host; auth required.
substack automations list # every automation: state, running, trigger, audience, emails in send order
substack automations list --details # + audience estimate and stats per automation (2 GETs each)
substack automations list --pretty # human table
substack automations list --raw # API campaign objects unmodified
substack automations get <CAMPAIGN_ID> # one automation: segment query, tag, ordered emails, estimate, stats
substack automations get <CAMPAIGN_ID> --bodies # + every email's plain text (1 GET per email)
substack automations email <CAMPAIGN_ID> <EMAIL_ID> # {subject, text, word_count}
substack automations email <CAMPAIGN_ID> <EMAIL_ID> --format text # plain text, links kept as [text](url)
substack automations email <CAMPAIGN_ID> <EMAIL_ID> --format raw # API response (ProseMirror JSON string body)
substack automations stats <CAMPAIGN_ID> # {"available": false, "stats": null} until it has run
substack automations audience <CAMPAIGN_ID> # {estimatedAudienceSize, windowDays, hasSegment, updatedAt}
substack automations segments # saved subscriber segments with their filter query
substack automations segment <SEGMENT_ID> # one segment + its count
substack automations subscriber-tags # subscriber tags (not post tags; see `tags list`)
Emails are ordered by the trigger chain (from_email_id → to_email_id),
not by the API's unordered arrays. Each email carries after (trigger or
previous_email), delay_hours, and cumulative_delay_hours from the
automation's trigger. Unknown trigger types and missing fields are reported,
not errors. In list/get, a failing secondary lookup (segments, tags,
stats, estimate, one email's text) is shown inline as an error object
instead of aborting the command.
SUBSTACK_ENABLE_WRITE=true substack subscribers add [email protected] --name "John"
SUBSTACK_ENABLE_WRITE=true substack subscribers remove 123 --yes
SUBSTACK_ENABLE_WRITE=true substack recommendations add 999
SUBSTACK_ENABLE_WRITE=true substack recommendations remove 123 --yes
substack tags list
SUBSTACK_ENABLE_WRITE=true substack tags create "AI"
SUBSTACK_ENABLE_WRITE=true substack tags delete 1 --yes
SUBSTACK_ENABLE_WRITE=true substack tags attach 123 1
SUBSTACK_ENABLE_WRITE=true substack tags detach 123 1
SUBSTACK_ENABLE_WRITE=true substack publication update --name "New Name"
SUBSTACK_ENABLE_WRITE=true substack publication update --hero-text "New tagline"
SUBSTACK_ENABLE_WRITE=true substack publication update --welcome-email-content "Thanks for subscribing!"
# One field per call. Options are hyphenated: --hero-text, --welcome-email-content.
substack config set-cookies "connect.sid=..."
substack config set-cookies-file ./cookies.txt
substack config set-publication charliepgarcia
substack config show [--pretty]
substack config test [--pretty]
--pretty renders Rich tables/panels for humans.{"error": true, "message": "...", "status_code": ...} JSON on
stderr, exit code 1 — even under --pretty (a colored panel is
added, the JSON is never dropped).# Pull this week's post titles + URLs
substack archive --limit 10 | jq '.[] | {title, canonical_url}'
# Check subscriber growth before drafting the next "Dear Charlie"
substack subscribers count --pretty
# Full draft -> review -> publish loop
substack drafts create --title "New Post" --body-markdown "$(cat post.md)" | jq -r '.id' > /tmp/draft_id
SUBSTACK_ENABLE_WRITE=true substack drafts prepublish "$(cat /tmp/draft_id)"
SUBSTACK_ENABLE_WRITE=true substack drafts publish "$(cat /tmp/draft_id)" --yes
See references/substack-api.md for the full endpoint-confidence table.
Highlights: search filtering behavior is unconfirmed by Substack itself;
drafts publish verb (PUT vs POST) has a documented source conflict
(this CLI tries PUT then falls back to POST on 404); recommendations add
can 403 a plain HTTP client even with valid cookies (a documented
browser-vs-curl gap, not necessarily an expired cookie). Notes cannot be
edited — Substack exposes no note-update endpoint, so notes supports
create/reply/list/get/delete only; to change a note, delete it and create a
new one (a new id is issued). leaderboard covers category-level
cross-publication discovery only (top 25 per category/rank) — it cannot
answer per-subscriber questions about a publication you don't own; only
finance and us-politics have live-verified slug aliases, everything
else needs a numeric id from substack categories. chat is read-only
and unverified — all four Chat endpoints are community-reported, never
confirmed against the live API, and there is no publication_id resolver
(chat list requires you to supply --publication-id yourself). automations is read-only —
no edit/start/stop/delete/duplicate/preview-send commands exist, and the
stats shape for a running automation has not been observed. No write
support exists for Chat (send/reply/delete/react/settings) or for DMs at
all (no endpoints implemented).
references/auth-setup.md (opens in a new tab)references/substack-api.md (opens in a new tab)scripts/pyproject.toml (opens in a new tab)scripts/requirements-dev.txt (opens in a new tab)scripts/requirements.txt (opens in a new tab)scripts/substack (opens in a new tab)scripts/substack_cli/__init__.py (opens in a new tab)scripts/substack_cli/app.py (opens in a new tab)scripts/substack_cli/auth.py (opens in a new tab)scripts/substack_cli/automations.py (opens in a new tab)scripts/substack_cli/chat.py (opens in a new tab)scripts/substack_cli/client.py (opens in a new tab)scripts/substack_cli/config.py (opens in a new tab)scripts/substack_cli/impersonation.py (opens in a new tab)scripts/substack_cli/impersonation_cmd.py (opens in a new tab)scripts/substack_cli/impersonation_detect.py (opens in a new tab)scripts/substack_cli/impersonation_state.py (opens in a new tab)scripts/substack_cli/manage.py (opens in a new tab)scripts/substack_cli/models.py (opens in a new tab)scripts/substack_cli/moderation.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
Generated from the plugin's indexed repository (griffinwork40/substack-cli) — no native marketplace selected
npx claudepluginhub p/griffinwork40-substack-cli