Iterating over reports
Without any Previous Results
Section titled “Without any Previous Results”To list all reports, use the cursor-based pagination. Here is an example in Python:
# /// script# requires-python = ">=3.13"# dependencies = [# "httpx",# ]# ///import httpx
API_KEY = "<your_api_key_here>"URL = "https://api.rosti.bin.re/v2/reports"
HEADERS = { 'X-API-Key': API_KEY}
cursor = Nonereports = []while True: print(f"fetching reports, have {len(reports)} so far") params = {"cursor": cursor} if cursor else {} r = httpx.get(URL, headers=HEADERS, params=params) rj = r.json()
reports.extend(rj['data'])
meta = rj["meta"] if not meta["has_more"]: break cursor = meta["next_cursor"]
print(f"fetched {len(reports)} reports total")With Previous Results
Section titled “With Previous Results”If you previsouly fetched reports and want to get only new or updated reports since your last fetch, you can use the timestamp parameter. This should be set to the last_updated value of the most recent report you have. Since reports come back sorted in descending order by last_updated, this is simply the last_updated value of the first report in your previous results.
Here the modified Python script to only fetch reports updated since a given timestamp:
# /// script# requires-python = ">=3.13"# dependencies = [# "httpx",# ]# ///import httpxfrom datetime import datetime
API_KEY = "<your_api_key_here>"URL = "https://api.rosti.bin.re/v2/reports"
HEADERS = { 'X-API-Key': API_KEY}
starting_point = datetime.fromisoformat("2025-09-01T14:23:17Z")cursor = Nonereports = []
print(f"fetching reports updated since {starting_point.isoformat()}")while True: print(f"fetching reports, have {len(reports)} so far") params = {} if cursor: params["cursor"] = cursor if starting_point: params["timestamp"] = starting_point.isoformat()
r = httpx.get(URL, headers=HEADERS, params=params) rj = r.json()
data = rj['data'] reports.extend(data)
meta = rj["meta"] if not meta["has_more"]: break cursor = meta["next_cursor"]
if reports: # Reports come back in descending order by last_updated, # so the first one is the new most recent report starting_point = datetime.fromisoformat(reports[0]['last_updated'])
print(f"fetched {len(reports)} reports total")print(f"new starting point is {starting_point.isoformat()}")