refactored how the Instagram apiEndpoint is determined