curl and jq: count Sume jobs by status in one command

GET /v1/jobs with limit=100 piped into jq group_by prints how many jobs are queued, processing, failed and so on, and warns when next_cursor says more.

4 min readSume
All posts

Pipe GET /v1/jobs?limit=100&scope=workspace into jq and group the data.jobs array on status. The list returns up to 100 jobs a page, each with one of five statuses, so a single command shows how many are queued, processing, completed, failed or canceled. The third line of the script prints a warning when the response carries next_cursor, which means more pages remain.

What the list call accepts

The parameters below come from Sume's OpenAPI spec. The response is data.jobs[] plus data.next_cursor, which is absent on the last page and which you pass back as starting_after. Do not build a cursor from the last job's id.

GET /v1/jobs query parameters (Sume OpenAPI spec, read 2026-10-07)
ParameterValuesUse
limit1 to 100Page size
scopethread or workspaceWhich jobs to read
statusqueued, processing, completed, failed, canceledFilter server-side
typea job typeFilter by product
starting_aftera next_cursor valueNext page

The command

Set SUME_API_KEY and run it. It prints one tab-separated line per status.

To count a single status without grouping, add &status=queued to the URL and read .data.jobs | length.

curl -s "https://api.sume.com/v1/jobs?limit=100&scope=workspace" \
  -H "Authorization: Bearer $SUME_API_KEY" \
| jq -r '(.data.jobs | group_by(.status) | map("\(.[0].status)\t\(length)") | .[]),
          (if .data.next_cursor then "more pages: starting_after=\(.data.next_cursor)" else empty end)'

What the counts do not mean

An API key reads only the jobs its own member created, and other jobs return 404, so the counts describe your key's member, not the whole workspace, even with scope=workspace. The counts cover one page. Over 100 jobs, loop on next_cursor or filter by status.

The numbers are a snapshot. A job can move from queued to processing between two calls. Use them to eyeball a backlog, and use generation_limits in a submit response when you need admission headroom.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume