bird
bird is a CLI for the X (Twitter) API: zero-config OAuth2 login, curated commands (me, bookmarks, search, thread, watchlist), and schema-driven raw endpoint access (get, post, put, delete). Most users can run bird login with no setup and start using the API immediately.
- Priority (everywhere): command args > config file > environment > built-in default.
- Docs: CLI design ยท Developer guide
Install
Homebrew (macOS / Linux)
cargo install (Rust required)
cargo binstall (fast, pre-built binary)
From a release
Download the latest binary for your platform from Releases. Extract and put bird on your PATH.
From source
# Binary: target/release/bird
Prerequisite: xurl
bird requires xurl-rs (or the Go xurl) for X API authentication:
# Recommended: xurl-rs (Rust)
# Alternative: xurl (Go original)
bird checks for xr (xurl-rs) first, then xurl (Go). Override with BIRD_XURL_PATH.
Verify your setup: bird doctor
Quick start
- Run
bird login. A browser opens; sign in to X and authorize the app. Tokens are stored by your username. - Run
bird meorbird bookmarks(use--prettyfor readable JSON).
No config or app creation needed.
Config
- Config file (optional):
~/.config/bird/config.toml(XDG). See config.example.toml. - Tokens: managed by xurl in
~/.xurl/.
Credential priority: CLI args > config file > env > default.
Your own app (optional)
To use your own X Developer app (quota isolation, compliance, or custom branding), configure xurl directly. See xurl documentation.
Commands
| Command | Description |
|---|---|
bird login |
OAuth2 PKCE login; opens browser, stores tokens by username |
bird me |
Current user (GET /2/users/me); --pretty for readable JSON |
bird bookmarks |
List bookmarks (paginated, max 100); --pretty |
bird profile <user> |
Look up a user profile by username |
bird search <query> |
Search recent tweets; --sort likes, --min-likes N, --pages N |
bird thread <tweet_id> |
Reconstruct a conversation thread |
bird watchlist check |
Check recent activity for watched users |
bird watchlist add <user> |
Add a user to the watchlist |
bird usage |
View API usage and costs; --sync to refresh from API |
bird get <path> |
Raw GET; path can be template e.g. /2/users/{id}/bookmarks with -p id=123 |
bird post <path> |
Raw POST; optional --body '{"text":"..."}' |
bird put <path> |
Raw PUT |
bird delete <path> |
Raw DELETE |
bird tweet <text> |
Post a tweet |
bird reply <id> <text> |
Reply to a tweet |
bird like <id> |
Like a tweet |
bird follow <user> |
Follow a user |
bird dm <user> <text> |
Send a direct message |
bird doctor |
Diagnostic: xurl status, auth, commands, store health; --pretty |
bird cache stats |
Store status (JSON default, --pretty for human-readable) |
bird cache clear |
Delete all cache entries |
bird completions <shell> |
Generate shell completions (bash, zsh, fish, powershell, elvish) |
Output is JSON to stdout by default; use --pretty for human-readable.
Shell completions
Generate and install completions for your shell:
# Bash
# Zsh
# Fish
Homebrew users get completions installed automatically.
Output: color and hyperlinks
--plainโ No color, no hyperlinks; use in scripts or pipelines.--no-colorโ Disable ANSI colors only (or setNO_COLOR).TERM=dumbor non-TTY โ Colors and hyperlinks are disabled automatically.
Agent / non-interactive usage
Use environment variables only; no browser.
- OAuth2 user:
X_API_ACCESS_TOKEN(and optionallyX_API_REFRESH_TOKENfor refresh). - App-only (bearer):
X_API_BEARER_TOKEN. - OAuth 1.0a:
X_API_CONSUMER_KEY,X_API_CONSUMER_SECRET,X_API_OAUTH1_ACCESS_TOKEN,X_API_OAUTH1_ACCESS_TOKEN_SECRET. - Multi-account:
X_API_USERNAMEor--usernameto select stored account.
Structured error output
Use --output json (or BIRD_OUTPUT=json) for machine-readable errors on stderr. When stderr is not a TTY, JSON is the default.
| Field | Type | Description |
|---|---|---|
error |
string | Error message |
kind |
string | config, auth, or command |
code |
number | Exit code (78, 77, or 1) |
command |
string | Command name (only for kind: "command") |
status |
number | HTTP status (only for API errors with an HTTP status) |
JSON output implicitly suppresses diagnostics (same as --quiet).
Updating the API schema
The bundled OpenAPI spec is openapi/x-api-openapi.json. To support new endpoints:
- Download latest schema:
./scripts/download-openapi.sh - Rebuild:
cargo build --release
Documentation
| Doc | Purpose |
|---|---|
| docs/CLI_DESIGN.md | Auth requirements, doctor, and error design |
| docs/DEVELOPER.md | Build from source, architecture, project layout |
| RELEASING.md | Release process and distribution channels |
| CHANGELOG.md | Version history |
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.