Buttondown Documentation
The Buttondown CLI (Command Line Interface) is a powerful tool that lets you manage your newsletter content from your local machine. It enables workflows like editing newsletters in your preferred text editor, backing up your content, and syncing media files.
Install the CLI globally using npm:
Or use it with npx without installing:
The CLI provides several capabilities:
Before using the CLI, you need to authenticate with your Buttondown API key:
You'll be prompted to enter your API key, which you can find in your Buttondown settings.
To download your newsletters from Buttondown:
This creates a ./buttondown
directory with all your content.
Create a new draft:
Then edit the created Markdown file with your preferred editor.
When you're ready to save your changes back to Buttondown:
Important: buttondown push
doesn't publish emails with the status: draft
field, which is the default status for new emails. See the Publishing Behavior section below for details on how to actually send your emails.
When you run buttondown push
, it syncs your content to Buttondown maintaining the status in the frontmatter. Here's how publishing works:
The status
field in your email's frontmatter determines what happens:
Status | Description |
---|---|
draft | Email remains a draft when pushed |
scheduled | Email will be sent at the specified publish_date |
about_to_send | Email is queued and will be sent very soon (typically within a few minutes) |
sent | Email has already been sent -- editing these will change their body in the archives |
More information on statuses is available in the API reference.
The CLI creates this structure in your local folder:
Each newsletter is stored as a Markdown file with YAML frontmatter:
media/
directorybuttondown push
, the CLI uploads the images and updates the URLsConsider adding this to a scheduled task for regular backups.
You can work with different newsletters using different directories:
Create a script like publish.sh
:
Make it executable with chmod +x publish.sh
Command | Description |
---|---|
buttondown login | Authenticate with Buttondown |
buttondown logout | Clear stored credentials |
buttondown pull | Download content from Buttondown |
buttondown push | Upload content to Buttondown |
buttondown create | Create a new draft email locally |
If you encounter authentication errors:
If you've modified the same email both locally and on Buttondown:
cp -r ./buttondown ./buttondown-backup
buttondown pull --force
buttondown push
For more information, contact Buttondown support.