Access denied due to invalid subscription key or wrong API endpoint.

HHjAh 0 Reputation points
2023-05-03T12:35:02.1933333+00:00

Hey,

Trying to make an call to the bing image search.

curl "https://api.bing.microsoft.com/v7.0/images/search?Ocp-Apim-Subscription-Key=SECRET_KEY&q=microsoft"

But getting the following error:

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.

Not sure what I'm doing wrong as I've grabbed the key from the key1 input.

Screenshot 2023-05-03 at 14.33.44

Bing Image Search
Bing Image Search
A Bing service that supports searching for images and gets comprehensive results.
44 questions
{count} votes

1 answer

Sort by: Most helpful
  1. VasaviLankipalle-MSFT 15,426 Reputation points
    2023-05-03T23:57:34.3766667+00:00

    Hi @HHjAh , Thanks for using Microsoft Q&A Platform.

    Please make sure you are using correct subscription key or API endpoint.

    I have reproduced this everything works well on my end. Here's the CURL command again for your reference please try this:

    curl "https://api.bing.microsoft.com/v7.0/images/search?q=microsoft" -H "Ocp-Apim-Subscription-Key: YOUR_SECRET_KEY"
    

    Replace YOUR_SECRET_KEY with your actual subscription key. If the issue still persists, I would recommend regenerating your subscription key in the Azure portal and try again.

    I hope this helps.

    Regards,
    Vasavi

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

    2 people found this answer helpful.
    0 comments No comments