OpenTweet CLI
Post and schedule to X (Twitter) straight from your terminal or a CI pipeline. The OpenTweet CLI wraps the same REST API, so one ot_ key is all you need. No X developer account, no OAuth dance.
Install
Install the CLI globally with npm:
npm install -g @opentweet/cliAuthenticate
Run opentweet auth once and paste your API key. Create a key (prefix ot_) in your developer dashboard.
opentweet auth # paste your ot_ key from opentweet.io/developerKeep keys secret
Anyone with yourot_ key can post to your X account. Never commit it to a repo. In CI, store it as an encrypted secret and read it from the OPENTWEET_API_KEY environment variable instead of running opentweet auth.Tweet
Publish immediately with --now:
opentweet tweet "Shipped a new release." --nowOr schedule with --schedule and a "YYYY-MM-DD HH:MM" timestamp:
opentweet tweet "Launch day." --schedule "2026-07-10 09:00"Manage posts
List, schedule drafts, publish, and delete:
opentweet list # show your posts
opentweet schedule # review and schedule drafts
opentweet publish # publish a draft now
opentweet delete # remove a postAnalytics, evergreen, and accounts
opentweet analytics # posting stats and insights
opentweet evergreen # manage your evergreen queue
opentweet accounts # list connected X accountsLong-form Articles
The CLI covers posts, threads, evergreen, and analytics. Long-form X Articles are not a CLI command yet, so write, schedule, and publish them over the REST API or MCP instead. From a shell that is one curl:
curl -X POST https://opentweet.io/api/v1/articles \
-H "Authorization: Bearer $OPENTWEET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"title": "Release notes: v2.0", "content_markdown": "## What shipped\n\n...", "publish_now": true}'See the REST reference for the full article endpoints, or the MCP tools if an agent is doing the writing.
Use in CI/CD
In a pipeline, set OPENTWEET_API_KEY as an environment variable and the CLI picks it up automatically. This example posts to X on every release:
# GitHub Actions: post to X when a release ships
- name: Announce release
env:
OPENTWEET_API_KEY: ${{ secrets.OPENTWEET_API_KEY }}
run: |
npm install -g @opentweet/cli
opentweet tweet "v2.0 is live. Changelog in the thread." --nowExit codes
The CLI exits with code0 on success and a non-zero code on error, so your pipeline fails loudly if a post does not go out.Next steps
- • CLI overview: what the terminal tool can do at a glance.
- • Quickstart: post your first tweet with REST, MCP, or the CLI.
- • Errors: status codes, JSON error shapes, and retry guidance.