x-api

Posts tweets, threads, and reads timelines via the X API with OAuth authentication.

Updated Mar 22, 2026
One-click install
npx skills add https://github.com/diazMelgarejo/orama-system --skill x-api-diazmelgarejo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: x-api
Source: https://github.com/diazMelgarejo/orama-system/tree/main/.cursor/.agents/skills/x-api
Command: npx skills add https://github.com/diazMelgarejo/orama-system --skill x-api-diazmelgarejo

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires requests, requests-oauthlib.

What problem does it solve? Integrating with X (Twitter) programmatically requires navigating OAuth flows, rate limits, and multiple API versions, which is error-prone without a clear reference. ## Core Features & Use Cases - Posting & Threads: Post single tweets, multi-tweet threads, and media uploads using OAuth 1.0a user-context authentication. - Reading & Search: Read user timelines, search recent tweets, and look up users by username with a Bearer token. - Rate Limit & Error Handling: Read rate limit headers at runtime, back off automatically, and handle 403/429 errors gracefully. - Use Case: Generate a platform-native post with a content workflow, then publish it to X only after user approval, tracking engagement via public_metrics. ## Quick Start Use the x-api skill to post a tweet saying "Hello from Claude Code" using my configured X 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?

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 do I 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 each subsequent request. Collect the returned tweet IDs to track the full thread.

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 best for read operations like search and timelines. OAuth 1.0a user-context authentication is required for write operations such as posting tweets, managing accounts, and DMs.

How do I handle X API rate limits?

Read the x-rate-limit-remaining and x-rate-limit-reset response headers at runtime and back off when remaining calls are low. Avoid hardcoding static rate limit tables since limits vary by endpoint, auth method, and account tier.

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

Upload media first via 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 through the v2 endpoint.

Why does the X API return a 403 Forbidden error when posting?

A 403 error typically means your app lacks write permissions or you are using app-only Bearer auth for a write operation. Switch to OAuth 1.0a user-context credentials and verify your app's permissions in the X developer portal.