Skip to Content
Developers

Pagination

How to read every page of a list.

Lists return a page of results and a cursor:

{
  "data": [ ... ],
  "nextCursor": "eyJwIjoyfQ"
}

Pass nextCursor as cursor to get the next page. On the last page, nextCursor is null.

ParameterDefaultRange
limit501 to 100
cursornone (first page)The nextCursor of the previous page

Cursors are opaque: don't build or change them. Keep the other query parameters the same while you page.

import os, requests

def all_codes(pro_deal_id: str):
    url = f"https://api.endvr.io/v1/pro-deals/{pro_deal_id}/codes"
    headers = {"Authorization": f"Bearer {os.environ['ENDVR_API_KEY']}"}
    cursor = None
    while True:
        params = {"limit": 100, **({"cursor": cursor} if cursor else {})}
        page = requests.get(url, headers=headers, params=params).json()
        yield from page["data"]
        cursor = page["nextCursor"]
        if cursor is None:
            break