X media upload APPEND: 5 MB chunks, and how to split a Sume MP4
The X API v2 APPEND step takes chunks of at most 5 MB. Count the segments for a Sume MP4 with a short script before you upload to the initialize endpoint.

On the X API v2, each APPEND request carries one chunk of at most 5 MB, after INIT returns a media_id and before FINALIZE completes the upload. For a Sume MP4, read the file in 5 MB pieces, number each piece as a segment, and upload them in order.
What are the four steps?
The chunked quickstart lists four endpoints.
| Step | Request | Notes |
|---|---|---|
| INIT | POST /2/media/upload/initialize | Returns media_id; send media_type, total_bytes, media_category |
| APPEND | POST /2/media/upload/{id}/append | Chunks of at most 5 MB each |
| FINALIZE | POST /2/media/upload/{id}/finalize | May return processing_info |
| STATUS | GET /2/media/upload | Poll while processing |
How many chunks will my file need?
Use 5,000,000 bytes as the chunk size to stay under 5 MB however the vendor counts a megabyte. The script builds a stand-in file, so it runs anywhere; point path at your downloaded MP4 for a real count.
import math, os, tempfile
CHUNK = 5_000_000
def chunks(path):
with open(path, "rb") as f:
index = 0
while block := f.read(CHUNK):
yield index, block
index += 1
with tempfile.NamedTemporaryFile(delete=False) as t:
t.write(os.urandom(12_000_000))
size = os.path.getsize(t.name)
print(size, "bytes ->", math.ceil(size / CHUNK), "chunks")
print([(i, len(b)) for i, b in chunks(t.name)])
os.unlink(t.name)What does Sume add?
Sume returns a durable media.sume.com MP4, which you download before the upload. The X page says media uploads can fail validation at post time when they exceed the entitlements of the authenticated user, so trim first if the file is close to a limit. A trim job costs $0.02 per the Sume docs.
Sources
Related posts
More in Integrations
- X media upload processing_info states: poll until succeeded
After FINALIZE on the X API v2, processing_info moves from pending to in_progress to succeeded or failed. Poll using check_after_secs, then post the Sume video.
- YouTube's Shorts help page says vertical, not 9:16: what to render
YouTube's Shorts help page states 3 minutes, vertical uploads and a 1080p maximum, but names no ratio. Render 1080x1920 with Sume Timeline 1.0 and probe it.
- Zapier MCP bills 2 tasks per success; retry Sume tools with one key
Zapier MCP charges 2 tasks per successful call and nothing for failures. A paid Sume tool needs an idempotency_key, and a repeat with the same key is safe.
- Zendesk vs Sume webhook signatures: base64 no dot vs hex with a dot
Zendesk signs base64(HMAC-SHA256(timestamp + body)) with no separator; Sume signs timestamp.body as sume-v1 hex. One verifier cannot check both.
Written by Sume