X (Twitter) Upload API Post Videos, Photos & Threads Programmatically

The X (Twitter) upload API without the OAuth headache. One REST endpoint for twitter video upload, photo posts and automatic threads — with scheduling, replies and Communities. URLs are stripped automatically so you are billed X’s $0.015 rate, not $0.200.

x-upload.ts
import { UploadPost } from 'upload-post';

const uploader = new UploadPost('your-api-key');

await uploader.upload('video.mp4', {
  title: 'My tweet with video',
  platforms: ['x']
});

X (Twitter) Upload API — Everything Included

A complete twitter uploader to automate your X content

Twitter Video Upload API

Upload videos to X (Twitter) with one REST call. Send a local file or a public video URL and we handle the chunked media upload and tweet creation for you.

Post Photos & Videos to Twitter

Publish native video tweets and image posts programmatically with the same endpoint. Add a title/caption and post to X in seconds.

Automatic Thread Creation

Long text is intelligently split into a natural-looking X thread: paragraphs are grouped up to 280 chars per tweet. Set x_long_text_as_post=true to post as one tweet instead.

Links Stripped → 13× Cheaper

X bills $0.200 per post that contains a URL vs $0.015 without. Upload-Post automatically strips URLs from every tweet so you are billed the $0.015 rate: 13× cheaper, on every X path.

Replies, Communities & Tagging

Reply to a tweet (reply_to_id), post to a Community (community_id), control reply_settings, tag users (tagged_user_ids) and add a first_comment after publishing.

Schedule & Queue

Schedule tweets with scheduled_date (ISO-8601) or drop them into your auto-publishing queue. URL stripping still applies to scheduled and retried X posts.

Upload a Video to X (Twitter) via API

One POST request to /api/upload — send a file or a public URL

Request — cURL
curl -X POST https://api.upload-post.com/api/upload \
  -H 'Authorization: Apikey your-api-key-here' \
  -F 'user=my-profile' \
  -F 'platform[]=twitter' \
  -F 'video=@/path/to/video.mp4' \
  -F 'title=New video out now!' \
  -F 'x_long_text_as_post=false' \
  -F 'reply_settings=following'
Response — 200 OK
{
  "success": true,
  "results": {
    "twitter": {
      "success": true,
      "url": "https://x.com/i/status/1789...",
      "post_id": "1789...",
      "video_was_transcoded": true
    }
  },
  "usage": { "count": 12, "limit": 100 }
}

Long uploads switch to background automatically — poll the Upload Status endpoint with your request_id. Full reference in the Upload Video API docs.

Why your X posts cost 13× less

X bills $0.200 for every post that contains a URL, versus $0.015 for a post without one — 13× more expensive. To keep your x api post costs low, Upload-Post automatically strips every URL X would turn into a clickable link — schemed URLs (https://, http://), www. hosts, shorteners (t.co, bit.ly), bare hostnames with a path and IPs with a path — from the caption, title and first_comment before sending the tweet.

Stripping runs on every X path: video, photo, text, scheduled and retried posts. Obfuscated forms like example[.]com or hxxp:// are kept because X does not parse them as links — they display as plain text and are billed at the normal $0.015 rate.

X (Twitter) API Parameters

The most-used fields for the twitter api upload video endpoint

Parameter Type Required Description
video File / URL Yes The video file (multipart) or a public video URL to publish to X (Twitter).
title / x_title String No The tweet text / caption. x_title overrides the global title for X only.
x_long_text_as_post Boolean No true publishes long text as a single post. false (default) creates an automatic thread.
reply_settings String No Who can reply: "following", "mentionedUsers", "subscribers" or "verified".
reply_to_id String No ID of the tweet to reply to. Creates a reply to the specified tweet.
community_id String No Community ID to post into. Pair with share_with_followers to also share with your followers.
tagged_user_ids Array No User IDs to tag in the media (max 10 users).
first_comment / x_first_comment String No Posted as a reply to the main post (or the last tweet of the thread). URLs are stripped here too.
scheduled_date ISO-8601 No Future date/time to schedule the tweet (≤ 365 days ahead).

See the complete parameter list in the API documentation.

Start Uploading to X in Minutes

Three steps to integrate the X (Twitter) upload API

1

Create your account

Sign up for Upload-Post and grab your API key from the dashboard.

2

Connect X (Twitter)

Authorize your X account once: we manage the OAuth and the Twitter API v2 access.

3

Upload programmatically

POST to /api/upload with platform[]=twitter and your video or photos. Done.

X (Twitter) Upload API — FAQ

Common questions about posting to X (Twitter) programmatically

Is there an API to upload videos to X (Twitter)?

Yes. Upload-Post exposes a Twitter video upload API through a single REST endpoint (POST /api/upload). You send your video file or a public URL with platform[]=twitter and we publish it to the connected X account. You avoid building your own X developer app, OAuth flow and chunked media upload — it is the simplest way to upload video to Twitter via API.

How do I post a video to Twitter via API?

Send a multipart POST request to https://api.upload-post.com/api/upload with your API key in the Authorization header, user (your profile), platform[]=twitter and the video field (a file or a public URL). Add a title for the tweet text. The API returns a per-platform result you can track with the Upload Status endpoint. A working curl and JavaScript example is shown above.

Can I post photos and videos to Twitter, not just video?

Yes. The X (Twitter) upload API supports both video and photo upload. Use this endpoint for video tweets, and the photo upload endpoint to post images to X — both go through the same Upload-Post API with platform[]=twitter.

How does automatic thread creation work?

By default, long text is turned into a natural-looking X thread. Upload-Post groups whole paragraphs into single tweets, filling each up to the 280-character limit instead of splitting at every line break, so the thread reads like a person wrote it. Paragraphs longer than 280 chars are split by line break, then by word as a last resort. For posts with media, all photos/videos attach to the first tweet and the rest are text-only replies. To publish long text as one post instead, set x_long_text_as_post=true.

Why are links removed from my tweets?

X bills $0.200 per post that contains a URL versus $0.015 for a post without — 13× more. To keep your X API costs low, Upload-Post automatically strips every URL X would turn into a clickable link (https://, http://, www. hosts, shorteners like t.co and bit.ly, bare hostnames with a path, and IPs with a path) from the caption, title and first_comment before sending the tweet. Stripping happens on every X path: video, photo, text, scheduled and retried. Obfuscated forms (example[.]com, hxxp://) are kept because X does not parse them as links.

Can I reply to a tweet or post to a Community?

Yes. Set reply_to_id to publish your post as a reply to a specific tweet, and community_id to post into a Community (pair it with share_with_followers to also share with your followers). You can also control reply_settings ("following", "mentionedUsers", "subscribers", "verified"), tag up to 10 users with tagged_user_ids, and add a first_comment that posts as a reply after publishing.

Can I schedule X (Twitter) posts with the API?

Yes. Add a scheduled_date (ISO-8601, up to 365 days in the future) to schedule the tweet, or use add_to_queue to drop it into your next available auto-publishing slot. URL stripping still applies to scheduled and retried X posts.

How much does the X (Twitter) upload API cost?

You can start free with no credit card — create an account, get a key and connect X. Because Upload-Post strips URLs from your tweets, your posts are billed at X’s $0.015 rate instead of $0.200, 13× cheaper. See the pricing page for current plans.

Ready to automate your X (Twitter) uploads?

Start posting videos, photos and threads to X programmatically today. No credit card required.

Create Free Account

Prefer an AI agent? Use the X Claude Code skill or the X MCP server.