Bing Image Search API Key

Sorry if this is such a newbie question here.

I signed up with Bing Image Search and cannot seem to find an API key anywhere. Can anyone direct me on how to navigate in Bing to access this API key please?

1 Like

I started here and got a key, but still getting Permission denied when running the notebook code :frowning:

ok well I ended up having to slightly modify the code in to include the region (westus) in the endpoint … then it worked…

You can try logging into Azure Portal and search for the yoru Bing Search Cognitive service you create. There you can find the keys in Quick start of in Keys. Here is screenshot (with sensitive info masked)


Hello all,

Just to give some signal boost to this because it can be confusing. If you start from the beginning and you are within the 7 day free trial, you can easily get the key from the try for free page I believe. However, if you try to go to the page after your free 7 days like I did because I wanted to re-do things, then it will give an error because the free trial is up.

You do have to set up your account and enter your credit card credentials and other things. There are some solutions on the forums on alternative ways to get the images if you don’t want to do this.

However, even after signing up, it can be confusing on how to get it working. If you search in the Azure console, Bing Image Search does not show up.


  1. Sign up for Azure. If you ever encounter any payment step, select free for support tier or others.
  2. Log into the home page of the Azure portal
  3. Click “Cognitive Services”
  4. Click “+add” or create resource. Something like that.
  5. Click on BING SEARCH (it has the image search in it too. Seems obvious but I overlooked it and others might too.) Create this.
  6. You will need to fill out some forms and name some things. If it asks you for the payment tier, you can select Free (F1). It is the one with 3 transactions per second / 1000 transactions per month as Jeremy mentioned.
  7. After that. You just basically have to click next and fill in the forms until it says it is deploying.
  8. After it is deployed, click on “Go to Resource”.
  9. There it will display your key which you can copy paste into the notebooks.

Hope this helps make things clearer for anyone wondering like I was.


Thank you, James. I find the resource setup tasks very time consuming, and this helps expedite the process of setting up image search on azure.

Hello guys,

I have been trying to create the API key for two hours now, but to no avail. I followed @jmete’s instructions, and I manage to get to point 6.) on your list. But for some reason I cannot enter any value for the pricing tier. When I click on the down button to select a tier, it just says “No available items”. I have tried different browsers, but nothing changes.

Has anyone had similar problems and could help me with this?

Thank you very much in advance!



Hi there,
I’m not sure about that issue, but make sure the subscription is created and selected.
The pricing tier is linked to that. You will notice for me that it says F1 is already created but for you it should show up:

When I first logged back in to test it, it showed no options (like what you are experiencing). I let it load for a few seconds and made sure to re-select the subscription box and then it started showing me the pricing options.

Hope you get it working!


Thanks a lot, James! I got it working now.



I’m having the same permission denied issue despite generating the API key and pasting in. Can you explain further where you updated this code in My selected region is also different so think it could be my problem too. Hope that makes sense!

Thanks so much @jmete, because I was stuck on this.

At this point in 2020, here’s the steps that worked for me.

James’ steps 1-2.
3. + for ‘create a resource’.
4. use the search box to type “Bing search”, click create once it is found.
5. Then you need to fill out some forms (similar to James’ step 6, looks like this –

of course I am choosing free.
6. After deployed, “Go to resource.”
7. There’s some text about the keys and endpoint on the main page, but the links to the keys are located on the left side of the screen, under the “Resource Management” heading.

Thank you to everyone that contributed to this thread. I was able to get it set up without too many problems. I would have never figured it out.

I got the same thing, but found that if you ‘upgrade’ (which requires CC card info) you can still select a free tier, but just have to be careful you don’t go over the limits (if you do it’s pay for what you use)

I don’t know what is wrong, but I’m still getting this issue “ErrorResponseException: Operation returned an invalid status code ‘PermissionDenied’” and don’t know what should I do with it

if you don’t want to waste your time on the bing api, there are alternatives. see Any Alternative to bing_search_image

The whole Bing API has changed, you need to write your own search-method. I wrote this one, which gets the job done:

def search_images_bing_new(key, term, customConfigId, min_sz=128):
	url = '' + 'q=' + searchTerm + '&' + 'customconfig=' + customConfigId + '&' + 'count=150'
	r = requests.get(url, headers={'Ocp-Apim-Subscription-Key': key})
	search_results = r.json()
	return L([img["thumbnailUrl"] for img in search_results["value"][:150]])

And then call it with the three parameters: search_images_bing_new(apikey, searchterm, customConfigId) where the parameters apikey and customconfigid are acquired from azure

@SimonStochholm have you tried to add a pull-request to to fix those?

@oduvan I’ll look into it, but I haven’t made a PR before, so it may take a while.