Optimizing API performance