Move encodeURIComponent to API key