Pagination
How Pagination Works
The Arkham API uses offset-based pagination:
limit— Maximum results per page (defaults vary by endpoint)offset— Number of results to skip (default: 0)
Responses include count or total showing total matching records.
Pagination Limits by Endpoint
/transfers
Default: 20 · Max: 1650 · 50-500 recommended
/swaps
Default: 20 · Max: 1649 · 50-500 recommended
/counterparties/*
Default: 1000 · Max: 1000 · Hard limit enforced
/tokens
Default: 100 · Max: 250
/tag/{id}/params
Default: 100 · Max: 1000
Why 50-500 recommended?
Large result sets increase response time and credit cost. Elasticsearch queries have internal timeouts (~20s for complex queries), and performance might degrade above ~1000 results.
Iterating Through Results
Option 1: Offset-Based (Simple)
Simple but may miss/duplicate items if data changes during pagination:
python
offset, all_results = 0, []
while True:
resp = api.get_transfers(limit=50, offset=offset)
all_results.extend(resp['transfers'])
if len(resp['transfers']) < 50:
break
offset += 50Option 2: Time-Window Sliding (Consistent)
For frequently-changing data, page by time windows instead of offsets:
python
from datetime import datetime, timedelta
window_end = datetime.utcnow()
window_size = timedelta(hours=1)
all_results = []
while window_end > earliest_date:
window_start = window_end - window_size
resp = api.get_transfers(
timeGte=int(window_start.timestamp() * 1000),
timeLte=int(window_end.timestamp() * 1000),
limit=500
)
all_results.extend(resp['transfers'])
window_end = window_start # slide window backTip
Time-window sliding eliminates duplicates and missed records caused by new data arriving during pagination.