GET /v1/tasks and GET /v1/sandboxes return the newest items first, a page at a time.
The answer is
{"tasks" | "sandboxes": [...], "nextCursor": "<id>" | null}, and nextCursor is null on the last page. The cursor is the id of the last item on the page, and marks a position among all your items: the next page starts after it whatever has changed since, so an item that leaves the state filter between pages (a task that finished, a sandbox that closed) never breaks the listing. Work created after the first page appears only in a new listing. A cursor that names no item of yours is 400 bad-cursor.