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 Web Search
Bing Web Search
A Bing service that gives you enhanced search details from billions of web documents.
156 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. romungi-MSFT 45,961 Reputation points Microsoft Employee
    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.


Your answer

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