Simpaisa interview question

What steps would you take to optimize API endpoints in java spring boot that is fetching records?