New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@hashnode/cli

Package Overview
Dependencies
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hashnode/cli

Manage Hashnode posts, drafts and publications from the terminal. Requires a publication on Hashnode Pro.

latest
npmnpm
Version
0.1.1
Version published
Maintainers
2
Created
Source

Hashnode CLI

Manage your Hashnode posts, drafts, and publications from the terminal. It needs a publication on Hashnode Pro.

npm install -g @hashnode/cli

Requires Node.js 20 or later.

Set up

Run hashnode login. It prints a code and opens your browser. Type the code on the page and allow access.

For CI, create a Personal Access Token in Settings, Developer and set HASHNODE_PAT. On a shared machine, run hashnode logout when you are done.

Commands that use a publication need --publication-id <id> (or -p <id>), or --host <host> for reads. To find the id:

hashnode --host blog.example.com publication get

Set HASHNODE_PUBLICATION_ID or HASHNODE_PUBLICATION_HOST to skip the flag.

Create a post

hashnode --publication-id <id> post create --title "Hello" --content-file post.md --tag java --tag javascript
hashnode --publication-id <id> draft create --title "Hello" --content-file post.md
cat post.md | hashnode --publication-id <id> post create --title "Hello" --content-file -

Content comes from a file or stdin and is sent unchanged, so frontmatter is not read. Add several tags with a comma list (--tag java,javascript) or by repeating the flag. Flags are in kebab-case, such as --original-article-url and --series-id. Use --input file.json to send the whole input as JSON, including nested fields. Run hashnode post create --help for the full list.

Upload an image and use its URL in your markdown or as --cover-image:

hashnode image upload cover.png

Commands

Add --json to any command for JSON output.

CommandWhat it does
loginlog in through your browser
logoutremove the saved token
whoamishow the account the token belongs to
post createpublish a new post
post update <id>update a post
post get [id]show a post by id, or by --slug. --body prints only the markdown
post listlist a publication's posts
post search <query>search a publication's posts
post remove <id>remove a post. This cannot be undone
draft createcreate a draft
draft update <id>update a draft
draft get <id>show a draft. --body prints only the markdown
draft listlist your drafts. --scheduled for scheduled ones. Editors also have --all, --all-scheduled, and --submitted
draft publish <id>publish a draft
draft submit <id>submit a draft for review (team publications)
draft reject <id>send a submitted draft back to its author (team publications)
draft delete <id>delete a draft
publication listlist the publications you own
publication getshow a publication, including its id
publication memberslist members and their roles
publication static-pageslist static pages
publication top-commenterslist who comments most
series listlist a publication's series
series get <slug>show a series
comment list <postId>list a post's comments
user <username>show a public profile
tag <slug>show a tag
image upload <files...>upload images and print their CDN URLs
gql '<query>'run a raw query. --vars '{...}' or --file q.graphql

Lists print More results: --after <cursor> when there is another page. post remove and draft delete ask for confirmation, or need --yes without a terminal.

Keywords

hashnode

FAQs

Package last updated on 06 Oct 2026

Related posts