Fix API endpoint and pagination