API call optimization