x-api
Use when building applications that access X's public data, including posts, users, trends, spaces, and direct messages. Reach for this skill when integrating X data into applications, building search or streaming solutions, managing user interactions, or analyzing X platform data.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- x-api
- metadata
- { "version": "1.0", "mintlify-proj": "x" }
- description
- Use when building applications that access X's public data, including posts, users, trends, spaces, and direct messages. Reach for this skill when integrating X data into applications, building search or streaming solutions, managing user interactions, or analyzing X platform data.
- compatibility
- Requires an X developer account and API credentials; most X API access tiers are paid.
02 资源文件 67
- 其他.build-trigger24 B
- 其他articles/.gitkeep—
- 参考文档articles/1940-pago-pago-proto-tiki-cocktail-recipe.md6.1 KB
- 参考文档articles/anna-sawai-hibiki-first-global-ambassador.md5.3 KB
- 参考文档articles/antinori-family-purchases-napas-arcadia-vineyard-longtime-grape-source-for-stags-leap-wine-cellars.md3.3 KB
- 参考文档articles/at-napas-annual-barrel-auction-bidders-show-enthusiasm-for-the-latest-vintage.md2.9 KB
- 参考文档articles/beginner-guide-mediterranean-island-wines.md5.1 KB
- 参考文档articles/beginners-guide-to-wine-making-an-introductory-course.md5.4 KB
- 参考文档articles/brunello-di-montalcino-2019-a-top-choice-for-collectors.md3.7 KB
- 参考文档articles/costa-rica-foods-guide.md4.7 KB
- 参考文档articles/costa-rican-foods-to-eat-first.md5.9 KB
- 参考文档articles/craft-the-perfect-banana-rum-cocktail-with-old-monk-rum.md4.6 KB
- 参考文档articles/crafting-delicious-homemade-wine-from-fresh-fruit-the-ultimate-guide.md5.0 KB
- 参考文档articles/crafting-unique-tomato-wine-at-home-a-step-by-step-guide.md5.6 KB
- 参考文档articles/creating-festive-grape-wine-at-home-with-ann-sindhu.md3.5 KB
- 参考文档articles/creating-homemade-watermelon-wine-a-step-by-step-guide.md5.0 KB
- 参考文档articles/culinary-experiences-worth-traveling-for.md10.0 KB
- 参考文档articles/discover-3-delicious-sessionable-cocktails-charlie-chaplin-chrysanthemum-and-bitter-giuseppe.md5.9 KB
- 参考文档articles/discover-glendronach-200th-anniversary-whisky.md4.2 KB
- 参考文档articles/discover-our-top-rated-corkscrew-under-10-an-affordable-excellence-unveiled.md3.2 KB
- 参考文档articles/discover-the-semester-abroad-a-3-ingredient-whiskey-cocktail-delight.md5.3 KB
- 参考文档articles/discovering-affordable-greek-red-wines-a-hidden-gem.md5.5 KB
- 参考文档articles/discovering-wine-a-beginners-guide-to-the-world-of-vino.md5.0 KB
- 参考文档articles/easy-fall-cocktails-gathering.md5.4 KB
- 参考文档articles/eurovision-wine-tasting-reds-from-france-australia-austria-greece-and-beyond.md7.3 KB
- 参考文档articles/exploring-american-wines-terroir-varietals-and-regions-unveiled.md3.5 KB
- 参考文档articles/exploring-the-influence-of-different-soils-on-garnacha-wine.md4.0 KB
- 参考文档articles/exploring-the-traditional-vietnamese-wine-making-process-and-farm-life.md3.2 KB
- 参考文档articles/exploring-unique-winemaking-techniques-in-argentinas-patagonia.md4.4 KB
- 参考文档articles/find-best-local-food-travel.md4.3 KB
- 参考文档articles/food-access-vs-nutrition-hidden-barriers.md5.6 KB
- 参考文档articles/hotel-restaurant-dining-as-destination-regent-hotels.md7.5 KB
- 参考文档articles/how-to-eat-like-a-local-in-japan.md4.7 KB
- 参考文档articles/how-to-pick-a-great-restaurant-when-traveling.md7.2 KB
- 参考文档articles/is-this-the-best-merlot-in-the-world-a-visit-to-st-emilion.md6.1 KB
- 参考文档articles/master-the-art-of-blind-wine-tasting-with-expert-tips.md5.7 KB
- 参考文档articles/miami-restaurants-world-cup.md5.1 KB
- 参考文档articles/michael-white-opens-santi-in-new-york.md2.9 KB
- 参考文档articles/mulled-apple-cider-caramel-rim-sharp-cheddar.md5.2 KB
- 参考文档articles/napas-historic-newton-vineyard-will-close-permanently.md3.6 KB
- 参考文档articles/national-taco-day-2026-find-real-deals.md5.9 KB
- 参考文档articles/new-haven-pizza-trip-planning-guide.md5.8 KB
- 参考文档articles/nyc-vs-houston-american-food-capitals.md6.8 KB
- 参考文档articles/oktoberfest-beer-etiquette-tips.md5.1 KB
- 参考文档articles/oregon-tops-global-wine-destinations-says-vinepair.md3.9 KB
- 参考文档articles/pennsylvania-wine-country-historic-vineyards-limestone-terroir-and-east-coast-grapes.md7.1 KB
- 参考文档articles/plant-forward-lower-fat-diets-aging-study.md5.9 KB
- 参考文档articles/raw-milk-legislation-surges-health-risks.md5.5 KB
- 参考文档articles/signs-youre-overdoing-fiber.md4.5 KB
- 参考文档articles/street-food-safety-checklist-hot-dog-carts.md4.3 KB
- 参考文档articles/terroir-compost-and-organic-viticulture-in-new-zealand.md4.1 KB
- 参考文档articles/the-art-of-making-a-cake-batter-martini.md5.0 KB
- 参考文档articles/top-6-wine-fridges-recommended-by-our-editors-a-guide-for-wine-lovers-not-just-sommeliers.md3.8 KB
- 参考文档articles/top-culinary-hotspots-travel-bucket-list.md5.7 KB
- 参考文档articles/traditional-chinese-winemaking-the-art-of-stomping-fermentation-bricks.md5.7 KB
- 参考文档articles/understanding-the-impact-of-wine-barrels-on-flavor-and-aroma.md4.5 KB
- 参考文档articles/vintage-cocktails-you-need-to-try.md4.9 KB
- 参考文档articles/what-does-trocken-mean-in-english.md3.2 KB
- 参考文档articles/why-dishoom-became-a-global-traveler-favorite.md4.9 KB
- 参考文档articles/why-food-and-drink-taste-better-at-the-source.md5.6 KB
- 参考文档articles/wine-101-beginners-guide.md4.9 KB
- 参考文档articles/wine-expert-blind-test-cheap-chablis-vs-expensive.md4.9 KB
- 参考文档articles/wine-expert-challenges-boxed-wine-stigma-blind-taste-test.md4.9 KB
- 参考文档articles/wine-lovers-beat-stress-eating-precommitment-strategy.md5.9 KB
- 资产文件assets/.gitkeep—
- 参考文档dedup-index.json2.4 KB
- 参考文档site.yaml4.4 KB
03 SKILL.md 正文
X API Skill
Product summary
The X API provides programmatic access to X's public conversation through modern REST endpoints. Agents use it to read posts, publish content, manage users, search historical data, and stream near real-time posts. Key files: Developer Console credentials (API keys, Bearer Token, OAuth tokens), API endpoints at https://api.x.com/2/, authentication headers. Primary docs: https://docs.x.com/x-api/introduction
When to use
Reach for this skill when:
- Building applications that need to search, retrieve, or publish posts
- Streaming near real-time posts matching specific criteria (filtered stream)
- Looking up user profiles, managing follows, blocks, or mutes
- Accessing trends, spaces, direct messages, or lists
- Analyzing engagement metrics or post analytics
- Integrating X data into dashboards, research tools, or monitoring systems
- User requests mention "X API", "Twitter API", "posts", "tweets", "users", or "streaming"
Quick reference
Authentication methods
| Method | Use case | Credentials |
|---|---|---|
| Bearer Token (App-only) | Public data, no user context | API Key + Secret → Bearer Token |
| OAuth 1.0a | User-context requests, signing requests | API Key, Secret, Access Token, Token Secret |
| OAuth 2.0 | Modern user-context, fine-grained scopes | Client ID, Client Secret, Authorization Code |
| Basic Auth | Enterprise APIs only | Email + password (HTTPS only) |
Essential endpoints
| Resource | Endpoint | Method | Purpose |
|---|---|---|---|
| User lookup | /2/users/by/username/{username} |
GET | Get user by username |
| Post lookup | /2/tweets/{id} |
GET | Get post by ID |
| Recent search | /2/tweets/search/recent |
GET | Search last 7 days |
| Full-archive search | /2/tweets/search/all |
GET | Search all posts (paid) |
| Filtered stream | /2/tweets/search/stream |
GET | Stream matching posts |
| Stream rules | /2/tweets/search/stream/rules |
POST/GET | Manage stream filters |
| Create post | /2/tweets |
POST | Publish a post |
| Delete post | /2/tweets/{id} |
DELETE | Remove a post |
Field parameters
Request additional data with field parameters:
# Posts
?tweet.fields=created_at,public_metrics,lang,author_id
# Users
?user.fields=created_at,description,public_metrics,verified
# Media
?media.fields=url,preview_image_url,alt_text,public_metrics
Rate limit headers
Every response includes:
x-rate-limit-limit— Max requests in windowx-rate-limit-remaining— Requests leftx-rate-limit-reset— Unix timestamp when window resets
Decision guidance
When to use Bearer Token vs OAuth
| Scenario | Use Bearer Token | Use OAuth |
|---|---|---|
| Public data only | ✓ | |
| Need user context | ✓ | |
| App-only requests | ✓ | |
| User authorization required | ✓ | |
| Simpler setup | ✓ | |
| Fine-grained scopes needed | ✓ |
When to use search vs filtered stream
| Need | Use search | Use filtered stream |
|---|---|---|
| Historical data | ✓ | |
| Real-time delivery | ✓ | |
| One-time query | ✓ | |
| Continuous monitoring | ✓ | |
| Full archive access | ✓ (paid) | |
| Lower latency | ✓ | |
| Complex queries | ✓ | ✓ |
When to use SDKs vs direct HTTP
| Scenario | Use SDK | Use cURL/HTTP |
|---|---|---|
| Production code | ✓ | |
| Quick testing | ✓ | |
| Type safety needed | ✓ (TypeScript) | |
| Python async | ✓ | |
| Simple one-off request | ✓ | |
| Automatic pagination | ✓ |
Workflow
-
Verify credentials exist
- Check Developer Console at console.x.com
- Confirm app has Bearer Token or OAuth tokens
- Verify app has access to required endpoints
-
Choose authentication method
- Public data only → Bearer Token (simplest)
- User-context needed → OAuth 1.0a or 2.0
- Enterprise APIs → Basic Auth
-
Build the request
- Select endpoint from API reference
- Add required parameters (query, user ID, etc.)
- Add field parameters to request specific data
- Add expansions for related objects
- Set Authorization header with credentials
-
Handle the response
- Check HTTP status code (200 = success, 4xx/5xx = error)
- Parse JSON response; primary data in
datafield - Check for
errorsarray even in 200 responses (partial errors) - Extract rate limit headers for monitoring
-
Implement error handling
- 401: Check authentication credentials
- 403: Verify app has endpoint access
- 429: Implement exponential backoff, check
x-rate-limit-reset - 400: Validate request syntax and parameters
-
For streaming
- Create rules with operators (keywords, hashtags, users)
- POST rules to
/2/tweets/search/stream/rules - GET
/2/tweets/search/streamto connect - Handle keep-alive signals (blank lines every 20 seconds)
- Implement reconnection logic for disconnects
Common gotchas
- Bearer Token vs OAuth confusion: Bearer Token is app-only (public data). OAuth is for user-context. Don't mix them up.
- Missing fields in response: Fields are opt-in. Default responses are minimal. Always add
?tweet.fields=or?user.fields=for the data you need. - Rate limits reset every 15 minutes: Not per hour. Check
x-rate-limit-resetheader, not clock time. - Stream requires at least one rule: Connecting to
/2/tweets/search/streamwithout rules returns 409 Conflict. - Callback URLs must match exactly: Trailing slashes, protocol, and case matter. Use
http://127.0.0.1for local dev, notlocalhost. - Partial errors in 200 responses: When requesting multiple resources, some may fail. Check the
errorsarray even if status is 200. - Search query syntax is strict: Operators like
from:,has:images,lang:are case-sensitive. Quotes required for phrases. - Deleted posts return 404: Don't retry; the post is gone.
- Protected accounts' posts need authorization: Can't access with Bearer Token alone.
- Stream disconnects after 20 seconds of silence: If no data or keep-alive received, reconnect immediately.
- Expansions require field parameters: Adding
expansions=author_iddoesn't return author data withoutuser.fields=.
Verification checklist
Before submitting work with X API:
- [ ] Authentication credentials are valid and not hardcoded
- [ ] Correct authentication method chosen (Bearer vs OAuth)
- [ ] All required parameters included in request
- [ ] Field parameters added for needed data (not relying on defaults)
- [ ] Error handling implemented (401, 403, 429, 400, 5xx)
- [ ] Rate limit headers checked in response
- [ ] For streaming: rules created before connecting to stream
- [ ] For streaming: reconnection logic handles disconnects
- [ ] Response parsing handles both success and error cases
- [ ] Partial errors checked (errors array in 200 responses)
- [ ] No credentials in code or logs
- [ ] Tested with actual API (not just documentation)
Resources
Comprehensive navigation: https://docs.x.com/llms.txt
Critical pages:
- X API Introduction — Overview of all endpoints and features
- Make Your First Request — Quick start with cURL examples
- Authentication Overview — All auth methods explained
For additional documentation and navigation, see: https://docs.x.com/llms.txt
04 同仓库更多 Skills
turnstile-spin
Set up Cloudflare Turnstile end-to-end in a project. Scan the codebase, create the widget via the Cloudflare API, embed it where user requests need bot verification (form submissions, SPA actions, API endpoints, download links, comment or vote submissions, etc.), wire canonical server-side siteverify in the customer's existing backend, validate, and persist the skill. Load this when a user asks to add Turnstile, set up CAPTCHA, protect a form or endpoint from bots, or fix a Turnstile integration. Uses Cloudflare's documented Turnstile contract.
frontend-design
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
source-insights
Prepare inspected source evidence, preserve exact citations, and publish reviewed insights into an explicit local library.
skill-graph
Discover skills and workflows through independent lexical search, relationship paths and a terminal graph.
session-search
Recall public session turns with exact provenance, bounded excerpts and independent piped exports.
newsletter
Produce a private local AI newsletter from bounded public research, with cited deep dives, HTML/Markdown output, Dagu scheduling and seven-day retention.