| name | xc |
| description | X/Twitter CLI using the official API v2 with OAuth 2.0. Read, search, post, manage DMs, bookmarks, lists, followers, and track API costs. |
| homepage | https://github.com/jalehman/xc |
| metadata | {"clawdbot":{"emoji":"𝕏","requires":{"bins":["xc"]}}} |
xc — X API v2 CLI
Use xc to interact with X (Twitter) via the official API. Pay-per-use with built-in cost tracking — no cookie scraping.
Prerequisites
- Must be authenticated first:
xc auth status to check
- If not authenticated:
xc auth login --client-id <CLIENT_ID> (requires X Developer Portal app)
- With client secret:
xc auth login --client-id <ID> --client-secret <SECRET> (enables token refresh)
- Config stored in
~/.xc/ (or $XC_CONFIG_DIR)
Quick Reference
xc whoami
xc auth status
xc search "query" -n 10
xc search "from:username" -n 5
xc user <username>
xc timeline -n 10
xc timeline <username> -n 10
xc post "Hello world"
xc post "Reply" --reply <post-id>
xc post "Look" --quote <post-id>
xc post "1/3" --thread "2/3" "3/3"
xc post "Photo" --media image.jpg
xc delete <post-id>
xc like <post-id>
xc unlike <post-id>
xc bookmark <post-id>
xc unbookmark <post-id>
xc bookmarks
xc followers <username> -n 20
xc following <username> -n 20
xc follow <username>
xc unfollow <username>
xc lists
xc list <list-id>
xc dm list
xc dm history <username>
xc dm send <username> "message"
xc stream rules
xc stream add "query"
xc stream remove <rule-id>
xc stream clear
xc stream connect
xc cost
xc cost --daily
xc cost log
xc budget show
xc budget set --daily 2.00
xc budget set --daily 5.00 --action block
xc usage
Important Notes
- Cost footer: Every command prints estimated cost. Suppress with
--quiet.
- JSON output: Most commands support
--json for machine-readable output.
- Multi-account: Use
--account <name> on any command, or xc auth switch <name>.
- Rate limits: The X API has rate limits per endpoint. If you hit 429 errors, wait and retry.
- OAuth scopes: xc requests all scopes at login including
media.write, dm.read, dm.write. If you get 403 on media/DMs, re-authenticate to pick up the new scopes.
- Paid tier features: DMs and media upload require a paid X API plan (pay-per-use or Basic+). Free tier returns 403.
- Bearer Token features:
stream and usage commands require app-only Bearer Token auth (xc auth token <TOKEN>), not OAuth 2.0.
- Search minimum: X API returns a minimum of 10 results regardless of
-n value.
Posting Guidelines
Always confirm with the user before posting. Never post, like, follow, or send DMs without explicit approval. Read operations (search, timeline, user lookup) are safe to run freely.
When composing posts:
- X limit is 280 characters (or 25,000 for Premium subscribers)
- Use
--thread for longer content
- Delete test posts after verification:
xc delete <id>
Common Patterns
xc search "topic" -n 10 --json | jq '.[] | {text: .text, author: .author}'
xc post "1/ Here's a thread about..." --thread "2/ Second point" "3/ Final thought"
xc budget show
xc cost --daily