X media upload: how many APPEND calls a Sume MP4 needs at 5 MB
X's chunked upload keeps each segment at or below 5 MB, with an 8 MB server limit. Divide your MP4's byte size by 5 MB, rounded up, to count APPEND calls.

Round the file size up to whole 5 MB segments: a 120 MB MP4 needs 24 APPEND calls and a 121 MB one needs 25. X's chunked upload page says to keep each segment at or below 5 MB and notes that the server limit is 8 MB. The flow is INIT at POST /2/media/upload/initialize, then APPEND at /2/media/upload/{id}/append, then FINALIZE, then STATUS polling if processing is needed.
| Step | Endpoint or rule |
|---|---|
| INIT | POST /2/media/upload/initialize with media type, total bytes and category |
| APPEND | POST /2/media/upload/{id}/append, each segment at or below 5 MB |
| FINALIZE | POST /2/media/upload/{id}/finalize |
| STATUS | Poll while processing: pending, in_progress, succeeded or failed |
| Video limits | Default 20 minutes and 8 GB; Premium/verified 125 minutes and 16 GB |
Where the Sume file fits
A finished Timeline 1.0 job returns a video_url. Download it, read its byte length and use that as the total bytes in INIT. Sume does not document the size of its renders, so the count is only known after the job. The media category for a post video is tweet_video.
If a video is longer than the posting account allows, attaching it to a post can return 403 even though the upload succeeded. Keep the render within 1200 s for a default account, or 7500 s for Premium, and you avoid that surprise.
Counting segments
The function divides by 5 MB using the 5 x 1024 x 1024 byte reading; use the decimal reading instead if you prefer a safer margin. Neither is a statement about which one X enforces, so the page's phrase "at or below 5 MB" is the only rule.
import math
SEGMENT = 5 * 1024 * 1024
def append_calls(total_bytes):
return math.ceil(total_bytes / SEGMENT)
print(append_calls(120 * 1024 * 1024)) # 24
print(append_calls(121 * 1024 * 1024)) # 25Sources
Related posts
More in Developers
- Year-in-review videos for 250 customers: bulk queues of 100, 100, 50
A Sume bulk run takes at most 100 items, so 250 year-in-review runs need three queues. Set concurrency 1 to 16, a spend cap per item and a new key per queue.
- Which MCP server lets Claude Code or Cursor generate video and images?
MCP servers that let Claude Code and Cursor make video and images: Sume, fal, Replicate, Runway, Higgsfield. Endpoints, sign-in, billing, setup.
- Idempotency keys for AI video APIs: retry without paying twice
An idempotency key makes a retried create return the original run or job instead of a second paid one. How Sume's Idempotency-Key works on each API.
- Signed webhooks for Sume video runs: events, retries, verification
Sume sends one HMAC-SHA256 signed POST when a Format, Action, or Agent Completion run completes or fails. Verify the raw body and dedupe on request_id.
Written by Sume