import requests
api_url = "https://api.useswift.dev"
headers = {
"Authorization": "Bearer YOUR_API_KEY"
}
# Get first page of accounts
response = requests.get(
f"{api_url}/accounts",
headers=headers,
params={"limit": 25}
)
accounts_page = response.json()
# Print first page of accounts
for account in accounts_page["data"]:
print(f"Account: {account['id']}")
# Get next page using cursor
while accounts_page.get("next_cursor"):
response = requests.get(
f"{api_url}/accounts",
headers=headers,
params={
"limit": 25,
"cursor": accounts_page["next_cursor"]
}
)
accounts_page = response.json()
# Print next page of accounts
for account in accounts_page["data"]:
print(f"Account: {account['id']}")