What is the 401 unauthorized error To solve it, first test the request with curl to see if the problem comes from your code or the api key. A 401 unauthorized error means your request didn’t pass authentication — most often because the api key is missing, wrong, or restricted
Jordin Swetof's Incredible Comeback - Truth or Fiction