Print a Sume job timeline from the events endpoint in Python

Fetch GET /v1/jobs/{id}/events and print one line per event with the standard library. A pull snapshot, not a stream, so run it again to see more.

4 min readSume
All posts

Call GET /v1/jobs/{job_id}/events with your API key and print the list it returns. The script below does that with Python's standard library and prints the time, type, status, source and message of each event, one line each.

The script

It sends x-api-key only. The Authentication page says to send exactly one credential header; sending both Bearer and x-api-key gets a 401.

import json
import os
import urllib.request


def job_events(job_id, base="https://api.sume.com"):
    request = urllib.request.Request(
        f"{base}/v1/jobs/{job_id}/events",
        headers={"x-api-key": os.environ["SUME_API_KEY"]},
    )
    with urllib.request.urlopen(request, timeout=15) as response:
        return json.load(response)["data"]["events"]


def timeline(events):
    for e in events:
        yield f'{e["created_at"]}  {e["type"]:<20} {e["status"]:<10} {e["source"]:<7} {e["message"]}'


if __name__ == "__main__":
    import sys

    print("\n".join(timeline(job_events(sys.argv[1]))))

How to run it

Run it as python events.py <job_id> with SUME_API_KEY set. It reads the envelope's data.events list. The Jobs and results page says the events endpoint is a pull snapshot, not a stream, and that there is no SSE or WebSocket transport on the Developer API.

Events or status

The table says what to use for each kind of wait.

Events, status and webhooks compared (read 2026-10-07)
NeedUseWhy
Is it done?GET status_url, read terminalCheapest read; obey next_poll_after_seconds
What happened so far?GET events_url (this script)A phase timeline, pulled when you ask
Tell me when it endsA signed webhook, with polling as backupNo loop on your side

Cost of reading

Reads have their own request budget, 40 times the write budget for the plan, so an occasional timeline read does not eat into your submits. Do not call it in a tight loop; read next_poll_after_seconds from the status call and poll the events only when you want to look.

When a job fails

A failed job shows a public error with a code and category in the envelope. When you ask support for help, send the job id and the request id from the response, and no keys or signed URLs.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume