correct logic for getting API domain