Install
openclaw skills install x-api-v2Access X (Twitter) via API v2: user profiles, timelines, threads, search, bookmarks, likes, and posting. Use when asked to: (1) get user info or profile, (2) fetch someone's tweets/timeline, (3) extract conversation threads, (4) search for tweets about a topic, (5) retrieve bookmarks, (6) get liked tweets, (7) post tweets, or (8) lookup tweets by ID or URL.
openclaw skills install x-api-v2Interact with X via API v2. Pure Python stdlib — no dependencies.
Public data (bearer token):
User context (OAuth 2.0):
See SETUP.md for credentials setup (bearer token + optional OAuth 2.0).
# Get user profile (bio, followers, verification status)
python3 {baseDir}/scripts/x.py user steipete
python3 {baseDir}/scripts/x.py user elonmusk
# Get user's recent tweets
python3 {baseDir}/scripts/x.py timeline steipete --max 50
# Exclude retweets
python3 {baseDir}/scripts/x.py timeline steipete --max 100 --exclude retweets
# Exclude both retweets and replies
python3 {baseDir}/scripts/x.py timeline steipete --max 100 --exclude retweets,replies
# Get conversation thread (self-thread by same author)
python3 {baseDir}/scripts/x.py thread https://x.com/steipete/status/123456
python3 {baseDir}/scripts/x.py thread 123456789
# Note: Only searches last 7 days (recent search). For older threads, need full-archive search.
# Search recent tweets (last 7 days)
python3 {baseDir}/scripts/x.py search "OpenClaw" --max 20
python3 {baseDir}/scripts/x.py search "from:steipete OpenAI" --max 50
# Advanced search operators work (from:, to:, -filter:retweets, etc.)
# Single tweet
python3 {baseDir}/scripts/x.py tweet 2025504475100614695
python3 {baseDir}/scripts/x.py tweet https://x.com/steipete/status/2025504475100614695
# Multiple tweets (batch)
python3 {baseDir}/scripts/x.py tweets 123456 789012 345678
# One-time auth setup
python3 {baseDir}/scripts/x.py auth
# Get your bookmarks
python3 {baseDir}/scripts/x.py bookmarks --max 100
# Get user's liked tweets (requires OAuth)
python3 {baseDir}/scripts/x.py likes steipete --max 50
# Post a tweet
python3 {baseDir}/scripts/x.py post "Hello from OpenClaw! 🦞"
# Note: 280 character limit enforced by API
All commands output clean, readable text:
👤 Peter Steinberger 🦞 (@steipete)
ID: 25401953
Bio: Polyagentmorous ClawFather...
👥 382,854 followers · 2,241 following · 135,096 tweets
https://x.com/steipete
🐦 @VictorKnox99 I think my stance on using AI here is pretty clear.
📅 2026-02-22 09:34:33
❤️ 5 🔁 0 💬 0
https://x.com/steipete/status/2025504475100614695
Research user activity:
# Get someone's recent thoughts on a topic
python3 {baseDir}/scripts/x.py timeline steipete --max 100 --exclude retweets | grep -i openai
Monitor discussions:
# Search for OpenClaw mentions
python3 {baseDir}/scripts/x.py search "OpenClaw" --max 100
Extract threads:
# Get full thread for analysis
python3 {baseDir}/scripts/x.py thread <tweet_url> > thread.txt
Archive bookmarks:
# Export bookmarks to file
python3 {baseDir}/scripts/x.py bookmarks --max 100 > bookmarks.txt
X API enforces rate limits per 15-minute window:
| Endpoint | App-Only (Bearer) | User Context (OAuth) |
|---|---|---|
| User lookup | 900 | 900 |
| User timeline | ~1,500 | ~900 |
| Search | 450 | 300 |
| Tweet lookup | 900 | 900 |
| Bookmarks | N/A | ~180 |
| Likes | N/A | ~75 |
Headers in responses:
x-rate-limit-limit — max requests allowedx-rate-limit-remaining — requests left in windowx-rate-limit-reset — Unix timestamp when limit resetsDesign tips:
tweets for multiple IDs)Pay-per-usage model:
/2/usage/tweets endpoint or consoleWhat's billable:
What's NOT billable:
See references/pricing.md for detailed pricing info.
X API search supports advanced operators:
| Operator | Example | Description |
|---|---|---|
from: | from:steipete | Tweets from user |
to: | to:steipete | Replies to user |
- | -from:steipete | Exclude user |
-filter: | -filter:retweets | Exclude retweets |
filter: | filter:verified | Only verified users |
lang: | lang:en | Language filter |
since: | since:2026-02-01 | After date |
until: | until:2026-02-20 | Before date |
Example:
# OpenClaw tweets from verified users, excluding retweets
python3 {baseDir}/scripts/x.py search "OpenClaw filter:verified -filter:retweets" --max 50
Recent search only:
search and thread commands only cover last 7 daysBookmarks/likes require OAuth:
No Watch Later equivalent:
Rate limits still apply:
403 Forbidden:
429 Too Many Requests:
x-rate-limit-reset time--max valuesNo results found:
Authentication errors (OAuth):
oauth2.json has correct client_id/client_secretx.py auth to refresh tokens