x-api

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

1|Updated Oct 11, 2025
One-click install
npx skills add https://github.com/ibytechaos/claude --skill x-api-ibytechaos
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: x-api
Source: https://github.com/ibytechaos/claude/tree/main/plugins/everything-claude-code/skills/x-api
Command: npx skills add https://github.com/ibytechaos/claude --skill x-api-ibytechaos

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires requests, requests-oauthlib.

What problem does it solve? Integrating with X (Twitter) programmatically requires navigating OAuth 1.0a and OAuth 2.0 authentication, versioned API endpoints, media upload flows, and shifting rate limits. This Skill provides ready-to-use patterns for posting, reading, searching, and analyzing X content without re-deriving the API contract each time. ## Core Features & Use Cases - Posting & Threads: Publish single tweets, multi-tweet threads with reply chaining, and tweets with uploaded media via the v1.1 media endpoint. - Reading & Search: Fetch user timelines, look up users by username, and run recent-search queries with field expansions like public_metrics. - Rate Limit & Error Handling: Read x-rate-limit headers at runtime, back off automatically, and handle 403/429 responses with clear exceptions. - Use Case: Generate a product announcement with a content skill, split it into a thread, post it via OAuth 1.0a, then track engagement through public_metrics. ## Quick Start Post the text "Launching our new feature today" as a tweet to X using my stored API credentials.

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?

Posting a tweet requires OAuth 1.0a user-context authentication via requests_oauthlib, then a POST to https://api.x.com/2/tweets with a JSON body containing the text field. A successful call returns HTTP 201 with the new tweet ID.

How to post a Twitter thread programmatically?

Post each tweet sequentially, passing the previous tweet's ID in the reply.in_reply_to_tweet_id field of the next request. This chains tweets into a thread and returns the list of created tweet IDs.

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

OAuth 2.0 bearer tokens are app-only and suit read-heavy operations like search and public data. OAuth 1.0a user-context authentication is required for posting tweets, managing an account, and sending direct messages.

How do I upload images and attach them to a tweet?

Upload the image first to the v1.1 endpoint https://upload.twitter.com/1.1/media/upload.json to get a media_id_string, then include that ID in the media.media_ids array when posting the tweet via the v2 endpoint.

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

A 429 response means you exceeded the endpoint's rate limit for your auth method and account tier. Read the x-rate-limit-remaining and x-rate-limit-reset response headers and back off until the reset timestamp before retrying.

Can I search tweets without user authentication?

Yes, recent search works with an app-only OAuth 2.0 bearer token. Send a GET request to /2/tweets/search/recent with a query parameter and optional tweet.fields like public_metrics and created_at.