Added pagination to api