I guess the best solution for that would creating an endpoint to get all records without pagination. But assuming that is not an option, a suitable solution should be based on 2 approaches:
Unfortunately I don’t have a straightforward solution for that case, but there is a pathway you can deep dive and came up with elements you’ll need to solve that.