2 min read
The pagination loop
def fetch_all(path):
items, cursor = [], None
while True:
params = {'limit': 100}
if cursor:
params['cursor'] = cursor
body = requests.get(f'{BASE}/{path}', params=params, timeout=10).json()
items.extend(body['data'])
cursor = body.get('next_cursor')
if not cursor:
return itemsPass the returned next_cursor back as the cursor parameter on the next request. When the response has no next_cursor (or it is null), you have reached the end.
Why cursors, not offsets
Offset paging (?page=3) breaks when rows are inserted between requests — you re-see or skip items. A cursor points at a stable position in the result set, so paging stays correct even as data changes underneath you.
Frequently asked questions
What page size should I use?
Request the largest limit the endpoint allows to minimise round-trips; the API caps it, so an over-large value is simply clamped.
Can I jump to page N?
No — cursors are sequential by design. If you need random access, fetch and index the full set once, then page in memory.
Related reading

Quickstart: list Credicorp business-finance products
GET /public/v1/products returns the live catalogue of Credicorp business-finance products. Each item carries…
Read →
Quickstart: handle Credicorp API error responses
Every Credicorp API error uses the same envelope: { error: { type, code, message, request_id } }. Branch on…
Read →
Quickstart: handle rate limits on the public API
The public ring is rate-limited, and a 429 tells you exactly when to try again. Read the RateLimit-Remaining…
Read →Funding for UK limited companies
Credicorp lends to your company, not to you personally — short-term working capital with no personal guarantee. See what your business could access.