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:

bash
npm install -g @opentweet/cli

Authenticate

Run opentweet auth once and paste your API key. Create a key (prefix ot_) in your developer dashboard.

bash
opentweet auth        # paste your ot_ key from opentweet.io/developer

Keep keys secret

Anyone with your ot_ 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:

bash
opentweet tweet "Shipped a new release." --now

Or schedule with --schedule and a "YYYY-MM-DD HH:MM" timestamp:

bash
opentweet tweet "Launch day." --schedule "2026-07-10 09:00"

Manage posts

List, schedule drafts, publish, and delete:

bash
opentweet list        # show your posts
opentweet schedule    # review and schedule drafts
opentweet publish     # publish a draft now
opentweet delete      # remove a post

Analytics, evergreen, and accounts

bash
opentweet analytics   # posting stats and insights
opentweet evergreen   # manage your evergreen queue
opentweet accounts    # list connected X accounts

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:

release.yml
# 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." --now

Exit codes

The CLI exits with code 0 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.