Pagination helper for APIs