X API
Programmatic posting, reading, search, and analytics on X (Twitter). Detalhes em references/.
When to Activate
- User wants to post tweets or threads programmatically
- Reading timeline, mentions, or user data from X
- Searching X for content, trends, or conversations
- Building X integrations or bots
- Analytics and engagement tracking
- User says "post to X", "tweet", "X API", or "Twitter API"
Core Principles
- Bearer for reads — search, timelines, public data
- OAuth 1.0a for writes — tweets, threads, media, DMs
- Read rate headers — back off on
x-rate-limit-*, never hardcode
- Secrets in env only — never commit
.env, rotate on exposure
- Draft before post — voice profile → content-engine → approval → post
Example
resp = oauth.post("https://api.x.com/2/tweets",
json={"text": "Hello from Claude Code"})
tweet_id = resp.json()["data"]["id"]
References
references/auth.md — Bearer app-only reads, OAuth 1.0a writes, env setup
references/operations.md — tweet, thread, timeline, search, voice pull, user lookup, media
references/rate-limits-errors.md — drift warning, header backoff, error map, security rules
references/content-integration.md — brand-voice + content-engine flow, related skills
Checklist
1---2name: x-api3description: "Use when posting tweets, reading timelines, searching X, or tracking engagement programmatically. Triggers on \"x-api\", \"x api\", \"tweet\"."4metadata:5 source: https://skillmd.com/skills/majinmagros/x-api6 origin: ECC7---89# X API1011Programmatic posting, reading, search, and analytics on X (Twitter). Detalhes em `references/`.1213## When to Activate1415- User wants to post tweets or threads programmatically16- Reading timeline, mentions, or user data from X17- Searching X for content, trends, or conversations18- Building X integrations or bots19- Analytics and engagement tracking20- User says "post to X", "tweet", "X API", or "Twitter API"2122## Core Principles23241. **Bearer for reads** — search, timelines, public data252. **OAuth 1.0a for writes** — tweets, threads, media, DMs263. **Read rate headers** — back off on `x-rate-limit-*`, never hardcode274. **Secrets in env only** — never commit `.env`, rotate on exposure285. **Draft before post** — voice profile → content-engine → approval → post2930## Example3132```python33resp = oauth.post("https://api.x.com/2/tweets",34 json={"text": "Hello from Claude Code"})35tweet_id = resp.json()["data"]["id"]36```3738## References3940- `references/auth.md` — Bearer app-only reads, OAuth 1.0a writes, env setup41- `references/operations.md` — tweet, thread, timeline, search, voice pull, user lookup, media42- `references/rate-limits-errors.md` — drift warning, header backoff, error map, security rules43- `references/content-integration.md` — brand-voice + content-engine flow, related skills4445## Checklist4647- [ ] Correct auth: Bearer for reads, OAuth 1.0a for writes48- [ ] Current docs verified (tiers/limits drift frequently)49- [ ] Rate-limit headers read; 429 backs off automatically50- [ ] No secrets in code or logs; `.env` gitignored51- [ ] Draft approved before posting; engagement tracked