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.

5 min readSume
All posts

After FINALIZE, the X API may return processing_info with a state of pending, in_progress, then succeeded or failed, and a check_after_secs value that says how long to wait before the next check. Poll GET /2/media/upload on that schedule, and create the post only after succeeded.

What does each state mean for my code?

Treat only succeeded as ready. A missing processing_info means no polling is needed.

X processing_info states (read 2026-10-05)
StateAction
pendingWait check_after_secs, then poll
in_progressWait check_after_secs, then poll
succeededCreate the post with the media_id
failedStop; re-render or re-encode the video

How do I write the loop?

The function takes any status callable, so the sample runs offline with a scripted sequence. Replace the stub with a real status request.

import time

def wait_ready(get_status, sleep=time.sleep, max_polls=20):
    for _ in range(max_polls):
        info = get_status().get("processing_info")
        if info is None or info["state"] == "succeeded":
            return True
        if info["state"] == "failed":
            return False
        sleep(info.get("check_after_secs", 1))
    return False

script = iter([{"processing_info": {"state": "pending", "check_after_secs": 1}},
               {"processing_info": {"state": "in_progress", "check_after_secs": 1}},
               {"processing_info": {"state": "succeeded"}}])
print(wait_ready(lambda: next(script), sleep=lambda s: None))

How does this pair with Sume jobs?

Run the same pattern on both sides. A Sume render is a job that you poll through the status and result endpoints, then you hand the finished URL to X, which runs its own processing before the post is valid. Do not publish when only the Sume job is done.

Sources

Related posts

More in Integrations

All Integrations posts

Written by Sume