How to fix this error code: 401 "Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource."

louie cagas 0 Reputation points
2023-09-28T20:24:36.9266667+00:00

How to fix this error from the endpoint

https://api.bing.microsoft.com/v7.0/news/search
{"error":{"code":"401","message":"Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource."}}
Bing News Search
Bing News Search
A Bing service that supports searching for news and get comprehensive results.
47 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. VasaviLankipalle-MSFT 15,836 Reputation points
    2023-09-29T01:47:10.1166667+00:00

    Hello @louie cagas , Thanks for using Microsoft Q&A Platform.

    Generally, the error 401is caused due to the subscription key is missing or is not valid. Please verify that you are using a valid subscription key for the API endpoint. Try to regenerate the subscription key in the Azure portal and add the latest one and see if that helps.

    User's image

    Also try to check this following information:

    • Bing returns InvalidAuthorization when Bing cannot authenticate the caller. For example, the Ocp-Apim-Subscription-Key header is missing or the subscription key is not valid.
    • Redundancy occurs if you specify more than one authentication method.
    • If the error is InvalidAuthorization, the HTTP status code is 401

    I hope this helps.

    Regards,
    Vasavi

    -Please kindly accept the answer and vote 'yes' if you feel helpful to support the community, thanks.

    0 comments No comments