Render a Short and wait for it in one request? Timeline sync mode

Timeline 1.0 can answer a Short render in one request when mode is sync and the job finishes within 30 seconds. Otherwise it returns 202 and you poll.

4 min readSume
All posts

Yes, if the render finishes quickly. Pass mode: "sync" on a Timeline 1.0 render and Sume waits up to 30 seconds for a finished job and returns 200. If the render takes longer, you get 202 and poll the job instead. Write the client to accept both.

What the docs say

The default mode is async, which answers 202 with a job id straight away. Sync mode is a wait, not a promise. The Timeline 1.0 docs say you get 202 when the job is not done in time, so the same code path must handle both.

Timeline 1.0 request modes (read 2026-10-07)
ModeAnswerWhat you do
async (default)202 with a job idPoll or use a webhook
sync200 if finished in 30 s, otherwise 202Read the result, or poll if 202

A client that handles both

The script posts a render, reads the response, and polls GET /v1/jobs/{id}/status only when it did not get a 200. It uses an Idempotency-Key so a retry does not start a second paid render. The job id key name below follows the response shape in the docs; print the body once to confirm the field in your account.

import os, time, requests

API = "https://api.sume.com"
H = {"Authorization": "Bearer " + os.environ["SUME_API_KEY"],
     "Idempotency-Key": "short-ep3-render-1"}

def render(body):
    r = requests.post(API + "/v1/timeline-1.0/render",
                      json={**body, "mode": "sync"}, headers=H, timeout=60)
    r.raise_for_status()
    if r.status_code == 200:
        return r.json()
    job = r.json()
    job_id = job.get("id") or job.get("request_id")
    for _ in range(60):
        s = requests.get(f"{API}/v1/jobs/{job_id}/status", headers=H, timeout=30)
        s.raise_for_status()
        if s.json().get("status") in ("completed", "failed"):
            return requests.get(f"{API}/v1/jobs/{job_id}/result",
                                headers=H, timeout=30).json()
        time.sleep(5)
    raise TimeoutError(job_id)

When to use it

Sync suits short, simple edits such as a title card plus one clip. Long chunked renders or many slots are more likely to pass 30 seconds. Do not resubmit with a new key because the first call returned 202; the job is already running and billed once.

Cost is the same

Billing does not depend on the mode. A Short of up to a minute costs $0.10 per ceil(output minute), and the free plan call shows the billable minutes beforehand.

Sources

Related posts

More in Formats

All Formats posts

Written by Sume