Cancel an image job: it only works before generation starts

POST /v1/jobs/{id}/cancel succeeds only while a Sume job has not started generating. Here is the 409 you get otherwise, and what is billed after a cancel.

3 min readSume
All posts

You can cancel a Sume image job only before generation work starts. POST /v1/jobs/{id}/cancel on a queued job cancels it; once generation has begun the API returns 409 job_generation_already_started with details.cancelable: false, and the job runs to completion.

That matters when you fan out many variants: a batch you submitted by mistake is cheap to stop while its jobs wait in queued, and expensive after they start.

What does the cancel call return?

Cancelling a job that is already canceled is idempotent and returns the same canceled job.

Cancel outcomes from Sume's Jobs and results docs, read 2026-10-02
Job stateCancel result
queuedCancelled; job becomes canceled
processing, generation started409 job_generation_already_started, details.cancelable: false
canceledSame canceled job, idempotent
completed or failedNot cancelable

How do I cancel in Python?

Handle the 409 as a normal answer, not an error to retry.

import os
import requests

BASE = "https://api.sume.com/v1/jobs"
HEADERS = {"Authorization": f"Bearer {os.environ['SUME_API_KEY']}"}


def cancel(job_id: str) -> str:
    r = requests.post(f"{BASE}/{job_id}/cancel", headers=HEADERS, timeout=30)
    if r.status_code == 409:
        return "too late: generation already started"
    r.raise_for_status()
    return r.json().get("status", "canceled")


for job_id in ["job_123", "job_124"]:
    print(job_id, cancel(job_id))

Is a cancelled image billed?

Sume's Image API docs say image generation billing is all-or-nothing: completed generations are billed in full, failed or cancelled generations are not. A job that already started cannot be cancelled, so it completes and bills.

Read GET /v1/jobs/{id}/status before and after to confirm the state; the Jobs and results docs list every status.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume