Optimized api pagination