Receiving Error 401

Mr.T 1 Reputation point
2021-01-14T14:51:57.653+00:00

Hi,

I have entered:
curl -H "Ocp-Apim-Subscription-Key: <key>" https://api.bing.microsoft.com/v7.0/search?q=microsoft+devices

and got this error:

{"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."}}

Please advise.
thx

Bing | Bing Search APIs | Bing Web Search API
0 comments No comments

1 answer

Sort by: Most helpful
  1. Rohit Mungi 49,131 Reputation points Microsoft Employee Moderator
    2021-01-15T04:40:24.237+00:00

    @Mr.T I think you are using your Subscription id instead of subscription key of your bing resource in the request header Ocp-Apim-Subscription-Key. Please navigate to your resource on Azure portal and copy the keys from the keys and Endpoint section.

    56919-image.png

    I am also masking your ID to ensure it is not shared on this public forum.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.