optimizing api requests