x-api

Post tweets, threads, and search timelines through the X API with OAuth.

Updated Mar 18, 2026
One-click install
npx skills add https://github.com/freedom909/real-estate-saas --skill x-api-freedom909
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: x-api
Source: https://github.com/freedom909/real-estate-saas/tree/main/.trae/skills/x-api
Command: npx skills add https://github.com/freedom909/real-estate-saas --skill x-api-freedom909

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires requests, requests_oauthlib.

What problem does it solve? Integrating with X (Twitter) programmatically requires navigating two different OAuth schemes, versioned endpoints, and shifting rate limits. This Skill provides working patterns for authentication, posting, reading, searching, and analytics so you avoid trial-and-error against the API. ## Core Features & Use Cases - Posting and Threads: Publish single tweets, multi-tweet threads, and media-attached posts using OAuth 1.0a user-context auth. - Reading and Search: Pull user timelines, search recent tweets with query operators, and fetch user profiles with public metrics. - Rate Limit and Error Handling: Read rate-limit headers at runtime, back off automatically, and handle 429/403 responses correctly. - Use Case: You want to build a bot that posts a daily thread summarizing your product updates. Use this Skill to authenticate with OAuth 1.0a, chain replies into a thread, and track engagement via public_metrics. ## Quick Start Ask the AI to post a tweet saying "Hello from my app" using the X API with my OAuth credentials stored in environment variables.

Frequently Asked Questions about x-api

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I post a tweet with the X API in Python?▼

Post a tweet by sending a POST request to https://api.x.com/2/tweets with a JSON body containing the text field, authenticated via OAuth 1.0a user context. Use requests_oauthlib's OAuth1Session with your consumer key, consumer secret, access token, and access token secret.

How to post a Twitter thread programmatically?▼

Post a thread by chaining tweets where each subsequent tweet includes a reply object with in_reply_to_tweet_id set to the previous tweet's ID. Iterate through your list of texts, capture each returned tweet ID, and pass it as the reply target for the next post.

What is the difference between OAuth 2.0 bearer token and OAuth 1.0a for X API?▼

OAuth 2.0 bearer tokens provide app-only authentication suited for read-heavy operations like search and public data access. OAuth 1.0a user-context authentication is required for write operations such as posting tweets, managing accounts, and sending direct messages.

How do I upload images and attach them to tweets?▼

Upload media using the v1.1 endpoint at https://upload.twitter.com/1.1/media/upload.json with OAuth 1.0a, which returns a media_id_string. Then include that ID in the media.media_ids array when posting the tweet through the v2 tweets endpoint.

Why am I getting a 429 error from the X API?▼

A 429 error means you have hit the rate limit for that endpoint and auth method. Read the x-rate-limit-remaining and x-rate-limit-reset response headers, then back off until the reset timestamp instead of retrying immediately.

Can I search tweets without user authentication?▼

Yes, recent tweet search works with an app-only OAuth 2.0 bearer token, which does not require user context. Set the Authorization header to Bearer followed by your token and query the /2/tweets/search/recent endpoint with operators like from: or -is:retweet.