401 errors in API requests

The 401 error is typically shown when you’re using an invalid subscription key to call our APIs. This could happen for a number of reasons:

1.      Incorrect key as result of a copy/Paste error when pulling the key from http://www.microsoft.com/cognitive-services/en-us/subscriptions. Additionally, make sure there are no leading or trailing spaces in your key.

2.      If your key was working before and now is no longer working, you could be out of your monthly quota (number of calls) or trying to make calls too quickly for the TPS (transactions per second) supported for your key. You can check the status of your key by going to the subscriptions page, finding the API subscription, and clicking “Show quota”.

3.      There is a service interruption currently on-going. If you think this is the case, please let us know  through tickets@cognitive.uservoice.com.

 If you’ve tried all of these things and are still experiencing issues, try to make an API call using your subscription key through our testing console. If this still fails, regenerate your key through the subscriptions page by finding the API in your list of subscriptions, identify the key column, and clicking “Regenerate” under the key that is not working. 

***Note that you’ll have to update all references to your old key as this will completely invalidate it in favor of the newly generated key.

Feedback and Knowledge Base