Skip to content

Iterating over reports

To list all reports, use the cursor-based pagination. Here is an example in Python:

Iterating over Reports from Scratch
# /// 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 = None
reports = []
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")

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:

Iterating over Reports from Timestamp Offset
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "httpx",
# ]
# ///
import httpx
from 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 = None
reports = []
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()}")