List Sume Formats with GET /v1/formats: limit, next_cursor, has_more

GET /v1/formats pages with a keyset cursor and a default limit of 50. Loop on has_more and pass next_cursor back as cursor to read the whole catalog.

5 min readSume
All posts

To read every Format your key can see, call GET /v1/formats, then repeat the call with cursor set to the previous next_cursor for as long as has_more is true. The default limit is 50. This is keyset paging, so an opaque cursor marks your place and you never compute an offset.

A script that reads only the first response silently misses everything past 50, which is the usual bug.

What does the loop look like?

This Python reads the key from the environment and needs pip install requests. The list is under data, as on other Sume list endpoints.

import os
import requests


def list_formats() -> list[dict]:
    out: list[dict] = []
    cursor = None
    while True:
        params = {"limit": 50}
        if cursor:
            params["cursor"] = cursor
        resp = requests.get(
            "https://api.sume.com/v1/formats",
            headers={"Authorization": f"Bearer {os.environ['SUME_API_KEY']}"},
            params=params,
            timeout=30,
        )
        resp.raise_for_status()
        body = resp.json()
        out.extend(body["data"])
        if not body.get("has_more"):
            return out
        cursor = body["next_cursor"]

What are the paging fields?

Per the Format API docs, read 2026-10-04:

Paging fields on the Formats list.
FieldRole
limitPage size; defaults to 50
cursorThe next_cursor from the previous page
has_moreTrue while another page exists
next_cursorOpaque; pass it back unchanged

Common mistakes

Keep the cursor opaque.

  • Do not parse or build a cursor; pass back what you received.
  • Do not loop on an empty page; stop when has_more is false.
  • Do not cache the list forever; new Formats appear as authors publish them.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume