# How to Automate X (Twitter) Post Scheduling using the API

- Tool: API Automations
- Difficulty: Intermediate
- Fix time: 4–6 hours
- Compatibility: X API v2, Basic tier ($200/month) or pay-per-use
- Last updated: May 2026

## TL;DR

X API v2 has no native scheduling endpoint — build your own with a queue and cron that calls POST /2/tweets at the target time. The real story in 2026 is cost: $0.015 per text post or $0.20 per link post on pay-per-use, or $200/month for Basic tier. Media uploads require OAuth 1.0a (not OAuth 2.0) via POST /2/media/upload with a chunked INIT/APPEND/FINALIZE flow.

## Best practices

- Calculate whether pay-per-use or Basic ($200/month) is cheaper before starting — the break-even point is about 13,333 text posts or 1,000 link posts per month
- Use the content_publishing_limit check equivalent — read x-user-limit-24hour-remaining on every tweet creation response to track toward the 2,400/day account cap
- Upload media before scheduled time (at least 1 hour earlier for videos) to decouple media processing delays from post timing
- Never post duplicate text — use a hash of the post content in your queue to detect and reject duplicates before attempting to post
- Add randomized timing variation of ±5 minutes to scheduled times to avoid looking like a bot posting at exactly :00 seconds
- For link posts ($0.20 each), use a URL shortener to reduce tweet character count but note: X counts t.co-wrapped URLs regardless of original length, and cost is based on URL presence not count

## Frequently asked questions

### Is the X API free tier usable for scheduling automation?

No, not for new developers. The Free tier has been effectively closed since February 2026. New apps default to pay-per-use, where each text post costs $0.015 and each link post costs $0.20. The Free tier also allows only 500 posts/month total and 1 request per 24 hours on most read endpoints, making real automation impossible.

### Why does media upload require OAuth 1.0a when everything else uses OAuth 2.0?

X deprecated the v1.1 media upload endpoint on March 31, 2025 and migrated to v2 — but the v2 media upload endpoint still requires OAuth 1.0a signing. This is a known inconsistency in X's API. You need both OAuth 2.0 credentials (for tweet creation) and OAuth 1.0a credentials (for media upload) in the same application.

### How much does it cost to post 1,000 tweets per month?

It depends on link vs. text content. 1,000 text-only posts: $15/month on pay-per-use — significantly cheaper than Basic ($200/month). 1,000 posts with URLs: $200/month on pay-per-use — exactly the same as Basic. Mixed content: calculate your text/link ratio and compare. If your posts frequently include links, Basic tier often makes more economic sense.

### Can I schedule a post with multiple images?

Yes — upload up to 4 images via the media upload flow and include all 4 media_id_string values in the media.media_ids array when creating the tweet. Note: you cannot mix images and video in the same tweet. Upload all images before the scheduled post time since media IDs expire after 24 hours.

### My scheduler posted a tweet with an error — how do I delete it?

Use DELETE /2/tweets/{id} with the user-context OAuth 2.0 token. The tweet ID is returned in the POST /2/tweets response — always log it. Deleting a tweet does not refund the $0.015 or $0.20 post cost. Keep a published_tweet_ids log in your database specifically for cleanup operations.

### Can RapidDev help me build the scheduling infrastructure?

Yes. RapidDev has guides for building content scheduling backends with Supabase (for the post queue) and Next.js Server Actions (for the publish triggers). If you're using Lovable or V0, we have step-by-step tutorials for connecting your scheduler to a visual content calendar dashboard.

---

Source: https://www.rapidevelopers.com/api-automations/how-to-automate-twitter-post-scheduling-using-the-api
© RapidDev — https://www.rapidevelopers.com/api-automations/how-to-automate-twitter-post-scheduling-using-the-api
