Image Search API v5 reference

The Image Search API lets you send a search query to Bing and get back a list of relevant images. This section provides technical details about the query parameters and headers that you use to request images and the JSON response objects that contain them. For examples that show how to make requests, see Searching the Web for Images.

For information about the headers that requests should include, see Request Headers.

For information about the query parameters that requests should include, see Query Parameters.

For information about the JSON response objects that responses may include, see Response Objects.

For information about permitted use and display of results, see Bing Search API Use and Display requirements.

Endpoints

To request images, send a GET request to one of the following URLs:

Endpoint Description
https://api.cognitive.microsoft.com/bing/v5.0/images/search Returns images that are relevant to the users search query. You can also use this endpoint to get insights about an image, such as webpages that include the image.
https://api.cognitive.microsoft.com/bing/v5.0/images/trending Returns images that are trending based on search requests made by others. The images are broken out into different categories. For example, Popular People Searches.

For a list of markets that support trending images, see Trending Images.

The request must use the HTTPS protocol.

Note

The maximum URL length is 2,048 characters. To ensure that your URL length does not exceed the limit, the maximum length of your query parameters should be less than 1,500 characters. If the URL exceeds 2,048 characters, the server returns 404 Not found.

Headers

The following are the headers that a request and response may include.

Header Description
Accept Optional request header.

The default media type is application/json. To specify that the response use JSON-LD, set the Accept header to application/ld+json.
Accept-Language Optional request header.

A comma-delimited list of languages to use for user interface strings. The list is in decreasing order of preference. For more information, including expected format, see RFC2616.

This header and the setLang query parameter are mutually exclusive—do not specify both.

If you set this header, you must also specify the cc query parameter. To to determine the market to return results for, Bing uses the first supported language it finds from the list and combines it with the cc parameter value. If the list does not include a supported language, Bing finds the closest language and market that supports the request or it uses an aggregated or default market for the results. To determine the market that Bing used, see the BingAPIs-Market header.

Use this header and the cc query parameter only if you specify multiple languages. Otherwise, use the mkt and setLang query parameters.

A user interface string is a string that's used as a label in a user interface. There are few user interface strings in the JSON response objects. Any links to Bing.com properties in the response objects apply the specified language.
BingAPIs-Market Response header.

The market used by the request. The form is <languageCode>-<countryCode>. For example, en-US.

If you specify a market that is not listed in Market Codes, this value may differ from the market you specified in the mkt query parameter. The same is true if you specify values for cc and Accept-Language that can't be reconciled.
BingAPIs-TraceId Response header.

The ID of the log entry that contains the details of the request. When an error occurs, capture this ID. If you are not able to determine and resolve the issue, include this ID along with the other information that you provide the Support team.
Ocp-Apim-Subscription-Key Required request header.

The subscription key that you received when you signed up for this service in Cognitive Services.
Retry-After Response header.

The response includes this header if you exceed the number of queries allowed per second (QPS) or per month (QPM). The header contains the number of seconds that you must wait before sending another request.
User-Agent Optional request header.

The user agent originating the request. Bing uses the user agent to provide mobile users with an optimized experience. Although optional, you are encouraged to always specify this header.

The user-agent should be the same string that any commonly used browser sends. For information about user agents, see RFC 2616.

The following are examples of user-agent strings.
  • Windows Phone—Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)

  • Android—Mozilla/5.0 (Linux; U; Android 2.3.5; en-us; SCH-I500 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML; like Gecko) Version/4.0 Mobile Safari/533.1

  • iPhone—Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML; like Gecko) Mobile/10B142 iPhone4;1 BingWeb/3.03.1428.20120423

  • PC—Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko

  • iPad—Mozilla/5.0 (iPad; CPU OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53
X-MSEdge-ClientID Optional request and response header.

Bing uses this header to provide users with consistent behavior across Bing API calls. Bing often flights new features and improvements, and it uses the client ID as a key for assigning traffic on different flights. If you do not use the same client ID for a user across multiple requests, then Bing may assign the user to multiple conflicting flights. Being assigned to multiple conflicting flights can lead to an inconsistent user experience. For example, if the second request has a different flight assignment than the first, the experience may be unexpected. Also, Bing can use the client ID to tailor web results to that client ID’s search history, providing a richer experience for the user.

Bing also uses this header to help improve result rankings by analyzing the activity generated by a client ID. The relevance improvements help with better quality of results delivered by Bing APIs and in turn enables higher click-through rates for the API consumer.

IMPORTANT: Although optional, you should consider this header required. Persisting the client ID across multiple requests for the same end user and device combination enables 1) the API consumer to receive a consistent user experience, and 2) higher click-through rates via better quality of results from the Bing APIs.

The following are the basic usage rules that apply to this header.
  • Each user that uses your application on the device must have a unique, Bing generated client ID.

    If you do not include this header in the request, Bing generates an ID and returns it in the X-MSEdge-ClientID response header. The only time that you should NOT include this header in a request is the first time the user uses your app on that device.

  • Use the client ID for each Bing API request that your app makes for this user on the device.

  • ATTENTION: You must ensure that this Client ID is not linkable to any authenticatable user account information.

  • Persist the client ID. To persist the ID in a browser app, use a persistent HTTP cookie to ensure the ID is used across all sessions. Do not use a session cookie. For other apps such as mobile apps, use the device's persistent storage to persist the ID.

    The next time the user uses your app on that device, get the client ID that you persisted.

NOTE: Bing responses may or may not include this header. If the response includes this header, capture the client ID and use it for all subsequent Bing requests for the user on that device.

NOTE If you include the X-MSEdge-ClientID, you must not include cookies in the request.
X-Search-ClientIP Optional request header.

The IPv4 or IPv6 address of the client device. The IP address is used to discover the user's location. Bing uses the location information to determine safe search behavior.

NOTE: Although optional, you are encouraged to always specify this header and the X-Search-Location header.

Do not obfuscate the address (for example, by changing the last octet to 0). Obfuscating the address results in the location not being anywhere near the device's actual location, which may result in Bing serving erroneous results.
X-Search-Location Optional request header.

A semicolon-delimited list of key/value pairs that describe the client's geographical location. Bing uses the location information to determine safe search behavior and to return relevant local content. Specify the key/value pair as <key>:<value>. The following are the keys that you use to specify the user's location.

  • lat—Required. The latitude of the client's location, in degrees. The latitude must be greater than or equal to -90.0 and less than or equal to +90.0. Negative values indicate southern latitudes and positive values indicate northern latitudes.

  • long—Required. The longitude of the client's location, in degrees. The longitude must be greater than or equal to -180.0 and less than or equal to +180.0. Negative values indicate western longitudes and positive values indicate eastern longitudes.

  • re—Required. The radius, in meters, which specifies the horizontal accuracy of the coordinates. Pass the value returned by the device's location service. Typical values might be 22m for GPS/Wi-Fi, 380m for cell tower triangulation, and 18,000m for reverse IP lookup.

  • ts—Optional. The UTC UNIX timestamp of when the client was at the location. (The UNIX timestamp is the number of seconds since January 1, 1970.)

  • head—Optional. The client's relative heading or direction of travel. Specify the direction of travel as degrees from 0 through 360, counting clockwise relative to true north. Specify this key only if the sp key is nonzero.

  • sp—Optional. The horizontal velocity (speed), in meters per second, that the client device is traveling.

  • alt—Optional. The altitude of the client device, in meters.

  • are—Optional. The radius, in meters, that specifies the vertical accuracy of the coordinates. Specify this key only if you specify the alt key.

NOTE: Although many of the keys are optional, the more information that you provide, the more accurate the location results are.

NOTE: Although optional, you are encouraged to always specify the user's geographical location. Providing the location is especially important if the client's IP address does not accurately reflect the user's physical location (for example, if the client uses VPN). For optimal results, you should include this header and the X-Search-ClientIP header, but at a minimum, you should include this header.

Note

Remember that the Terms of Use require compliance with all applicable laws, including regarding use of these headers. For example, in certain jurisdictions, such as Europe, there are requirements to obtain user consent before placing certain tracking devices on user devices.

Query parameters

The following are the query parameters that the request may include. See the Required column for required parameters. The query parameter values must be URL encoded. For information about query parameters used to filter the images that Bing returns, see Filter Query Parameters.

Name Value Type Required
cab The bottom coordinate of the region to crop.

The coordinate is a fractional value of the original image's height and is measured from the top, left corner of the image. Specify the coordinate as a value from 0.0 through 1.0.

This parameter is supported only by the Insights API; do not specify this parameter when calling the Images, Trending Images, or Web Search APIs.
Float No
cal The left coordinate of the region to crop.

The coordinate is a fraction of the original image's width and is measured from the top, left corner of the image. Specify the coordinate as a value from 0.0 through 1.0.

This parameter is supported only by the Insights API; do not specify this parameter when calling the Images, Trending Images, or Web Search APIs.
Float No
car The right coordinate of the region to crop.

The coordinate is a fraction of the original image's width and is measured from the top, left corner of the image. Specify the coordinate as a value from 0.0 through 1.0.

This parameter is supported only by the Insights API; do not specify this parameter when calling the Images, Trending Images, or Web Search APIs.
Float No
cat The top coordinate of the region to crop.

The coordinate is a fraction of the original image's height and is measured from the top, left corner of the image. Specify the coordinate as a value from 0.0 through 1.0.

This parameter is supported only by the Insights API; do not specify this parameter when calling the Images, Trending Images, or Web Search APIs.
Float No
ct The crop type to use to crop the image based on the coordinates specified in the cal, cat, car, and cab parameters.

The following are the possible values.
  • 0—Rectangular (default)

This parameter is supported only by the Insights API; do not specify this parameter when calling the Images, Trending Images, or Web Search APIs.
Unsigned Integer No
cc A 2-character country code of the country where the results come from. For a list of possible values, see Market Codes.

If you set this parameter, you must also specify the Accept-Language header. Bing uses the first supported language it finds in the specified languages and combines it with the country code to determine the market to return results for. If the languages list does not include a supported language, Bing finds the closest language and market that supports the request. Or, Bing may use an aggregated or default market for the results.

Use this query parameter and the Accept-Language header only if you specify multiple languages. Otherwise, you should use the mkt and setLang query parameters.

This parameter and the mkt query parameter are mutually exclusive—do not specify both.
String No
count The number of images to return in the response. The actual number delivered may be less than requested. The default is 35. The maximum value is 150.

You may use this parameter along with the offset parameter to page results. For example, if your user interface presents 20 images per page, you would set count to 20 and offset to 0 to get the first page of results. For each subsequent page, you would increment offset by 20 (for example, 0, 20, 40).

This parameter is supported only by the Image Search API; do not specify this parameter when calling the Insights, Trending Images, or Web Search APIs.
UnsignedShort No
id An ID that uniquely identifies an image. You can use this parameter to ensure that the specified image is the first image in the images list. The Image object's imageId field contains the ID that you would set this parameter to. String No
imgUrl The URL to an image that you want to get insights of. Use this parameter as an alternative to specifying the image by using the insightsToken parameter.

To specify the image, you may use this parameter or you may place the binary of the image in the body of a POST request (see the Content-Type header.

The maximum supported image size is 1 MB.

This parameter is supported only by the Insights API; do not specify this parameter when calling the Images, Trending Images, or Web Search APIs.
String No
insightsToken The token from a previous Image Search API call (see imageInsightsToken). Specify this parameter to get additional information about an image, such as a caption or shopping source. For a list of the additional information that you can get, see the modulesRequested query parameter.

This parameter is supported only by the Insights API; do not specify this parameter when calling the Images, Trending Images, or Web Search APIs.
String No
mkt The market where the results come from. Typically, mkt is the country where the user is making the request from. However, it could be a different country if the user is not located in a country where Bing delivers results. The market must be in the form <language code>-<country code>. For example, en-US. The string is case insensitive. For a list of possible market values, see Market Codes.

NOTE: If known, you are encouraged to always specify the market. Specifying the market helps Bing route the request and return an appropriate and optimal response. If you specify a market that is not listed in Market Codes, Bing uses a best fit market code based on an internal mapping that is subject to change.

This parameter and the cc query parameter are mutually exclusive—do not specify both.
String No
modulesRequested A comma-delimited list of one or more insights to request. (When you URL encode the query string, the commas change to %2C.) The following are the possible case-insensitive values.
  • All—Return all insights, if available, except RecognizedEntities.

  • Annotations—Provides characteristics of the type of content found in the image. For example, if the image is of a person, the annotations might indicate the person's gender and the type of clothes they're wearing.

  • BRQ—Best representative query that describes the image.

  • Caption—A caption that provides information about the image. If the caption contains entities, the response may include links to images of those entities.

  • Collections—A list of related images.

  • Recipes—A list of recipes for cooking the food shown in the images.
  • PagesIncluding—A list of webpages that include the image.

  • RecognizedEntities—A list of entities (people) that were recognized in the image.

    NOTE: You may not specify this module with any other module. If you specify it with other modules, the response does not include this module.

  • RelatedSearches—A list of related searches that were made by others.

  • ShoppingSources—A list of merchants where you can buy related offerings.

  • SimilarImages—A list of images that are visually similar to the original image.

  • SimilarProducts—A list of images that contain a product that is similar to a product found in the original image.

If you specify a module and there is no data for the module, the response object does not include the related field. For example, if you specify Caption and it does not exist, the response does not include the imageCaption field.

To include related searches, the request must include the original query string.

Although the original query string is not required for similar images or products, you should always include it because it can help improve relevance and the results.

This parameter is supported only by the Image Search API; do not specify this parameter when calling the Trending Images API or the Search API.
String No
offset The zero-based offset that indicates the number of images to skip before returning images. The default is 0. The offset should be less than (totalEstimatedMatches - count).

Use this parameteralong with the count parameter to page results. For example, if your user interface presents 20 images per page, you would set count to 20 and offset to 0 to get the first page of results. For each subsequent page, you would increment offset by 20 (for example, 0, 20, 40).

It is possible for multiple pages to include some overlap in results. To prevent duplicates, see nextOffsetAddCount.

This parameter is supported only by the Image Search API; do not specify this parameter when calling the Trending Images API or the Search API.
Unsigned Short No
q The user's search query string. The query string cannot be empty.

The query string may contain Bing Advanced Operators. For example, to limit images to a specific domain, use the site: operator.

To help improve relevance of an insights query (see insightsToken), you should always include the user's query string.

This parameter is supported only by the Image Search API; do not specify this parameter when calling the Trending Images API.
String Yes
safeSearch Filter images for adult content. The following are the possible filter values.
  • Off—May return images with adult content. If the request is through the Image Search API, the response includes thumbnail images that are clear (non-fuzzy). If the request is through the Web Search API, the response includes thumbnail images that are pixelated (fuzzy).

  • Moderate—If the request is through the Image Search API, the response does not include images with adult content. If the request is through the Web Search API, the response may include images with adult content (the thumbnail images are pixelated (fuzzy)).

  • Strict—Do not return images with adult content.

If not specified, the default is Moderate.

NOTE: If the request comes from a market that Bing's adult policy requires safeSearch be set to Strict, Bing ignores the safeSearch value and uses Strict.

NOTE: If you use the site: query operator, there is the chance that the response may contain adult content regardless of what the safeSearch query parameter is set to. Use site: only if you are aware of the content on the site and your scenario supports the possibility of adult content.
String No
setLang The language to use for user interface strings. Specify the language using the ISO 639-1 2-letter language code. For example, the language code for English is EN. The default is EN (English).

Although optional, you should always specify the language. Typically, you set setLang to the same language specified by mkt unless the user wants the user interface strings displayed in a different language.

This parameter and the Accept-Language header are mutually exclusive—do not specify both.

A user interface string is a string that's used as a label in a user interface. There are few user interface strings in the JSON response objects. Also, any links to Bing.com properties in the response objects apply the specified language.
String No

Filter query parameters

The following are the optional filter query parameters that you can use to filter the images that Bing returns. The query parameter values must be URL encoded.

Only the Image Search API supports these query parameters; do not specify these parameters when calling the Trending Images API or Web Search API.

Name Value Type
aspect Filter images by aspect ratio. The following are the possible filter values.
  • Square—Return images with standard aspect ratio
  • Wide—Return images with wide screen aspect ratio
  • Tall—Return images with tall aspect ratio
  • All—Do not filter by aspect. Specifying this value is the same as not specifying the aspect parameter.
String
color Filter images by color. The following are the possible filter values.
  • ColorOnly—Return color images
  • Monochrome—Return black and white images

Return images with one of the following dominant colors:
  • Black
  • Blue
  • Brown
  • Gray
  • Green
  • Orange
  • Pink
  • Purple
  • Red
  • Teal
  • White
  • Yellow
String
freshness Filter images by when Bing discovered the image. The following are the possible filter values.
  • Day—Return images discovered within the last 24 hours
  • Week—Return images discovered within the last 7 days
  • Month—Return images discovered within the last 30 days
  • Year—Return images discovered within the last year
String
height Filter images that have the specified height, in pixels.

You may use this filter along with the size filter. For example, return small images that have a height of 150 pixels.
UnsignedShort
imageContent Filter images by content. The following are the possible filter values.
  • Face—Return images that show only a person's face
  • Portrait—Return images that show only a person's head and shoulders
String
imageType Filter images by image type. The following are the possible filter values.

  • AnimatedGif—Return only animated GIFs

  • Clipart—Return only clip art images

  • Line—Return only line drawings

  • Photo—Return only photographs (excluding line drawings, animated Gifs, and clip art)

  • Shopping—Return only images that contain items where Bing knows of a merchant that is selling the items. This option is valid in the en-US market only.

  • Transparent—Return only images with a transparent background.
String
license Filter results by its associated type of license. The following are the possible filter values.
  • Any—Return images that are under any license type. The response only includes images that explicitly specify a license.

  • Public—Return images where the creator has waived their exclusive rights, to the fullest extent allowed by law.

  • Share—Return images that may be shared with others. Changing or editing the image might not be allowed. Also, modifying, sharing, and using the image for commercial purposes might not be allowed. Typically, this option returns the most images.

  • ShareCommercially—Return images that may be shared with others for personal or commercial purposes. Changing or editing the image might not be allowed.

  • Modify—Return images that may be modified, shared, and used. Changing or editing the image might not be allowed. Modifying, sharing, and using the image for commercial purposes might not be allowed.

  • ModifyCommercially—Return images that may be modified, shared, and used for personal or commercial purposes. Typically, this option returns the fewest images.

  • All—Do not filter by license type. Specifying this value is the same as not specifying the license parameter.

NOTE: Bing doesn't verify or represent that a specific license is associated with an image or that users can use the image under that license. For more information about these license types, see Filter Images By License Type.
String
size Filter images by size. The following are the possible filter values.
  • Small—Return images that are less than 200x200 pixels

  • Medium—Return images that are greater than or equal to 200x200 pixels but less than 500x500 pixels

  • Large—Return images that are 500x500 pixels or larger

  • Wallpaper—Return wallpaper images.

  • All—Do not filter by size. Specifying this value is the same as not specifying the size parameter.

You may use this parameter along with the height or width parameters. For example, you may use height and size to request small images that are 150 pixels tall.
String
width Filter images that have the specified width, in pixels.

you may use this filter along with the size filter. For example, return small images that have a width of 150 pixels.
UnsignedShort

Response objects

The following are the JSON objects that the response may include. If the request succeeds, the top-level object in the response is the Images object if the endpoint is /images/search, ImageInsightsResponse if the request is for image insights, and TrendingImages if the endpoint is /images/trending. If the request fails, the top-level object is the ErrorResponse object.

Object Description
AggregateOffer Defines a list of offers from merchants that have offerings that are related to the image.
AggregateRating Defines the metrics that indicate how well an item was rated by others.
Category (ImageInsights) Defines a characteristic found in the image.
Category (TrendingImages) Defines the category of trending images.
CategoryClassification Defines the categories of the characteristics found in an image.
Error Defines an error that occurred.
ErrorResponse The top-level object that the response includes when the request fails.
Image An object that contains information about an image that is relevant to the query.
ImageCaption Defines a caption about the image.
ImageGallery Defines a link to a webpage that contains the collection of related images.
ImageInsightsResponse The top-level object that the response includes when an image insights request succeeds.
Images The top-level object that the response includes when an image request succeeds.
InsightsSourcesSummary Defines a count of the number of websites where you can shop or perform other actions related to the image.
MediaSize Defines the size of the media content.
NormalizedRectangle Defines a region of an image.
Instrumentation Defines the Bing instrumentation URLs.
Offer Defines a merchant's offer.
Organization Defines information about a merchant.
Person Defines a person.
Pivot Defines the pivot segment.
ProductSummaryImage Defines an image of a product and provides summary information about offers that Bing found online for the product.
Query Defines a search query string.
Recipe Defines a cooking recipe.
RecognizedEntity Defines a recognized entity.
RecognizedEntityGroup Defines a group of previously recognized entities.
RecognizedEntityRegion Defines a region where an entity was found and a list of entities that might match it.
Thumbnail Defines a thumbnail image.
Tile Defines an image tile.
TrendingImages The top-level object that the response includes when a trending images request succeeds.

AggregateOffer

Defines a list of offers from merchants that are related to the image.

Element Description Type
offers A list of offers from merchants that have offerings that are related to the image. Offer[]

AggregateRating

Defines the metrics that indicate how well an item was rated by others.

Name Value Type
bestRating The highest rated review. The possible values are 1.0 through 5.0. float
ratingValue The mean (average) rating. The possible values are 1.0 through 5.0. float
reviewCount The number of times the recipe has been rated or reviewed. Unsigned Integer
text The mean (average) rating, in string form. String

Category (TrendingImages)

Defines the category of trending images.

The TrendingImages namespace defines this object.

Element Description Type
tiles A list of images that are trending in the category. Each tile contains an image and a Bing query that returns more images of the subject. For example, if the category is Popular People Searches, the image is of a popular person and the query would be to more images of that person. Tile[]
title The name of the image category. For example, Popular People Searches. String

Category (ImageInsights)

Defines a characteristic found in the image.

The ImageInsights namespace defines this object.

Element Description Type
confidence The confidence that Bing has that it correctly identified the category. The possible values are 0.0 through 1.0 where 1.0 indicates that Bing is 100% confident that the category is correct. Float
name The name of the category. String

CategoryClassification

Defines the categories of the characteristics found in an image.

Element Description Type
categories A list of characteristics found in the image. For example, if the image is of a musical artist, the array might include Female, Dress, and Music to indicate the person is female, wearing a dress, and is a musical artist. Category[]

Error

Defines an error that occurred.

Element Description Type
code The error code that identifies the error. For a list of possible codes, see Error Codes. String
message A description of the error. String
parameter The query parameter in the request that caused the error. String
value The query parameter's value that was not valid. String

ErrorResponse

The top-level object that the response includes when the request fails.

Name Value Type
_type Type hint. String
errors A list of errors that describe the reasons why the request failed. Error[]

Image

Defines an image that is relevant to the query.

Note

Because the URL format and parameters are subject to change without notice, all URLs should be used as-is; you should not take dependencies on the URL format or parameters. The exception is those parameters and values discussed by Resize and crop thumbnail images.

Name Value Type
accentColor A three-byte hexadecimal number that represents the color that dominates the image. Clients may use the color as the temporary background until the image is loaded. String
contentSize The image's file size. The format of the string is {size} {units}, where {units} may be set to B for byte, KB for Kilobyte, etc. For example, 12345 B indicates that the size of the image is 12,345 bytes. String
contentUrl The URL to the image on the source website. String
datePublished The date and time, in UTC, that Bing discovered the image. The date is in the format, YYYY-MM-DDTHH:MM:SS. String
encodingFormat The image's mime type (for example, jpeg). String
height The height of the source image, in pixels. Unsigned Short
hostPageDisplayUrl The display URL of the webpage that hosts the image.

You would use this URL in your user interface to identify the host webpage that contains the image. This URL is not a well-formed so don't use it to access the host webpage. The URL does not include the protocol (for example, HTTP) and may include hit highlighting characters. To access the host webpage, use the hostPageUrl URL.
String
hostPageUrl The URL of the webpage that includes the image.

This URL and contentUrl may be the same URL.
String
id An ID that uniquely identifies this image in the list of images.

The Image object includes this field only when the image is included in the Search API search results and the ranking response specifies a specific position for the image. For information about how to use this field, see Using Ranking to Display Results in the Web Search API guide.
String
imageId An ID that uniquely identifies this image in the list of images. If you want the image to be the first image in the response, set the id query parameter to this ID in your request. String
imageInsightsToken A token that you use in a subsequent call to the Image Search API to get additional information about the image. For information about using this token, see the insightsToken query parameter. String
insightsSourcesSummary A count of the number of websites where you can shop or perform other actions related to the image.

For example, if the image is of an apple pie, this object includes a count of the number of websites where you can buy an apple pie. You could then include badging (for example, a shopping cart icon) and the count to indicate the number of offers. When the user clicks the icon, you could use imageInisghtsToken to get the list of websites.

For related information about when to display badging, see displayRecipeSourcesBadges and displayShoppingSourcesBadges.
InsightsSourcesSummary
name A title of the image. String
thumbnail The width and height of the thumbnail image (see thumbnailUrl). MediaSize
thumbnailUrl The URL to a thumbnail of the image. For information about resizing the image, see Resize and crop thumbnail images. String
webSearchUrl The URL to the Bing search results for this image. String
width The width of the source image, in pixels. Unsigned Short

ImageCaption

Defines an image's caption.

Name Value Type
caption A caption about the image. String
dataSourceUrl The URL to the website where the caption was found. You must attribute the caption to the source. For example, display the domain name from the URL next to the caption and use the URL to link to the source website. String
relatedSearches A list of entities found in the caption. To take the user to images of the entity, use the links in the Query object. Query

ImageGallery

Defines a link to a webpage that contains a collection of related images.

Name Value Type
creator The person that owns the collection. You must attribute the collection to the creator. Person
description A description of the collection. The description may be empty. String
followersCount The number of users on the social network that follow the creator. Unsigned Integer
imagesCount The number of related images found in the collection. Unsigned Integer
source The publisher or social network where the images were found. You must attribute the publisher as the source where the collection was found. String
thumbnailUrl The URL to a thumbnail of one of the images found in the collection. String
url The URL to the webpage that contains the collection of related images. String

ImageInsightsResponse

The top-level object that the response includes when an image insights request succeeds.

For information about requesting image insights, see the insightsToken query parameter.

The modulesRequested query parameter affects the fields that Bing includes in the response. If you set modulesRequested to only Caption, then this object includes only the imageCaption field.

Name Value Type
_type Type hint. String
bestRepresentativeQuery The query string that best represents the image. Clicking the link in the Query object, takes the user to a webpage with more pictures of the image. Query
categoryClassification A list of categories that identify the characteristics of the content found in the image. For example, if the image is of a person, the annotations might indicate the person's gender and the type of clothes they're wearing. CategoryClassification
imageCaption The caption to use for the image. ImageCaption
imageInsightsToken A token that you use in a subsequent call to the Image Search API to get additional information about the image. For information about using this token, see the insightsToken query parameter.

This token has the same usage as the token that's included in an Image object. Typically, you use this token in the recognize entity scenario where you send Bing an image by using the imgUrl query parameter and set the modulesRequested parameter to RecognizedEntities. The response includes the recognized entities and an insights token that you can use to get additional insights about the image.

If you set modulesRequested to All, you get all available insights in addition to the recognized entities (you do not have to use the insights token in a subsequent call).
String
pagesIncluding A list of webpages that contain the image. To access the webpage, use the URL in the image's hostPageUrl field. Image[]
recipes A list of recipes related to the image. For example, if the image is of an apple pie, the list would contain recipes for making an apple pie. Recipe[]
recognizedEntityGroups A list of groups that contain images of entities that match the entity found in the specified image. For example, the response might include images from the general celebrity group if the entity was recognized in that group. recognizedEntityGroup[]
relatedCollections A list of links to webpages that contains related images. ImageGallery[]
relatedSearches A list of related queries made by others. Query[]
shoppingSources A list of merchants that are offering items related to the image. For example, if the image is of an apple pie, the list would contain merchants that are selling apple pies. AggregateOffer[]
visuallySimilarImages A list of images that are visually similar to the original image. For example, if the specified image is of a sunset over a body of water, the list of similar images of other sunsets over a body of water.

If the specified image is of a person, similar images might be of the same person or they might be of persons dressed similarly or in a similar setting.

Note that the criteria for similarity continues to evolve.
Image[]
visuallySimilarProducts A list of images that contain products that are visually similar to products found in the original image. For example, if the specified image contains a dress, the list of similar images would contain a dress. ProductSummaryImage[]

Images

The top-level object that the response includes when an image request succeeds.

Name Value Type
_type Type hint. String
displayRecipeSourcesBadges A Boolean value that determines whether you should include badging to indicate that there are recipes available. Bing sets this flag to true when it believes the user's intent is to find recipes. If Bing does not believe the user's intent is to find recipes, this flag is set to false.

It is possible for displayRecipeSourcesBadges to be false although the recipeSourcesCount field of insightsSourcesSummary has a value greater than zero.

This flag merely indicates the user's intent. Typically, if the image's recipeSourcesCount is greater than zero and displayRecipeSourcesBadges is true, you would display the recipe badge and count on the image. Otherwise, if displayRecipeSourcesBadges is false, you would not. For your application, you must decide how to use these fields to determine whether to display the badge.
Boolean
displayShoppingSourcesBadges A Boolean value that determines whether you should include badging (for example, a shopping cart icon) to indicate that there are shopping sources available. Bing sets this flag to true when it believes the user's intent is to shop. If Bing does not believe the user's intent is to shop, this flag is set to false.

It is possible for displayShoppingSourcesBadges to be false although the shoppingSourcesCount field of insightsSourcesSummary has a value greater than zero.

This flag merely indicates the user's intent. Typically, if the image's shoppingSourcesCount is greater than zero and displayShoppingSourcesBadges is true, you would display the shopping badge and count on the image. Otherwise, if displayShoppingSourcesBadges is false, you would not. For your application, you must decide how to use these fields to determine whether to display the badge.
Boolean
id An ID that uniquely identifies the image answer.

The object includes this field only if the images are included as part of the Web Search API search results. For information about how to use this field, see Using Ranking to Display Results in the Web Search API guide.
String
isFamilyFriendly A Boolean value that determines whether one or more of the images contain adult content. If none of the images contain adult content, isFamilyFriendly is set to true. Otherwise, if one or more of the images contain adult content, isFamilyFriendly is set to false.

If false, the thumbnail images are pixelated (fuzzy).

NOTE: This field is included only in Web Search API responses, not in Image Search API responses.
Boolean
nextOffsetAddCount The number to add to the offset query parameter to ensure that you don't receive duplicates when paging results.

If you set offset to 0 and count to 30 on your first request, and then set offset to 30 on your second request, some of the results in the second response may be duplicates of the first response.

To prevent duplicates, add the value of nextOffsetAddCount to the sum of count and offset. For example, if the current value of offset and count is 30 and the value of nextOffsetAddCount is 9, set offset to 69 (count + offset + nextOffsetAddCount).
Integer
pivotSuggestions A list of segments in the original query. For example, if the query was Red Flowers, Bing might segment the query into Red and Flowers.

The Flowers pivot may contain query suggestions such as Red Peonies and Red Daisies, and the Red pivot may contain query suggestions such as Green Flowers and Yellow Flowers.
Pivot
queryExpansions A list of expanded queries that narrows the original query. For example, if the query was Microsoft Surface, the expanded queries might be: Microsoft Surface Pro 3, Microsoft Surface RT, Microsoft Surface Phone, and Microsoft Surface Hub. Query
readLink The URL that returns this answer. To use the URL, you must append query parameters as appropriate and include the Ocp-Apim-Subscription-Key header.

Both the Image Search API and Search API responses include this field. Typically, you'd use the URL when it's included in a Search response and you want to query the Image Search API directly.
String
totalEstimatedMatches The estimated number of images that are relevant to the query. Use this number along with the count and offset query parameters to page the results.

The object includes this field only when calling the Image Search API. The object does not include this field when you call the Web Search API.
Long
value A list of images that are relevant to the query.

If there are no results, the array is empty.
Image[]
webSearchUrl The URL to the Bing search results for the requested images. String

InsightsSourcesSummary

Defines a count of the number of websites where you can shop or perform other actions related to the image.

Element Description Type
recipeSourcesCount The number of websites that offer recipes related to the subject of the image. Unsigned Integer
shoppingSourcesCount The number of websites that offer goods or services related to the subject of the image. Unsigned Integer

MediaSize

Defines the size of the media content.

Name Value Type
height The height of the media content, in pixels. Integer
width The width of the media content, in pixels. Integer

NormalizedRectangle

Defines a region of an image. The region is defined by the coordinates of the top, left corner and bottom, right corner of the region. The coordinates are fractional values of the original image's width and height in the range 0.0 through 1.0.

Name Value Type
bottom The bottom coordinate. Float
left The left coordinate. Float
right The right coordinate Float
top The top coordinate Float

Offer

Defines a merchant's offer.

This object is used by both ShoppingSources insights and SimilarProducts insights. For the insight that the field applies to, see the description.

Element Description Type
aggregateRating An aggregated rating that indicates how well the product has been rated by others.

Used by SimilarProducts.
AggregateRating
availability The availability of the item being offered. The following are the possible values.
  • Discontinued
  • InStock
  • InStoreOnly
  • LimitedAvailability
  • OnlineOnly
  • OutOfStock
  • PreOrder
  • SoldOut

Used by ShoppingSources.
String
lowPrice The lowest price for the product that Bing found online.

Used by SimilarProducts.
Float
name The name of the product being offered. String
offerCount The number of offers that Bing found online.

Used by SimilarProducts.
Unsigned Integer
price The price at which the product is being offered.

Used by ShoppingSources.
Float
priceCurrency The monetary currency. For example, USD. String
seller The merchant's name.

Used by ShoppingSources.
Organization
url The URL that takes the user to the offer on the merchant's website.

Used by ShoppingSources.
String

Organization

Defines information about a merchant.

Element Description Type
image The merchant's logo. The Image object includes only the url field. Image
name The merchant's name. String

Person

Defines a person.

Name Value Type
_type Type hint. String
description A short description of the person String
image An image of the person. Image
jobTitle The person's job title String
name The person's name. String
url The URL to the person's social network home page, if applicable. String
webSearchUrl The URL that takes the user to the Bing search results page for a query that contains this person's name. String

Pivot

Defines the pivot segment.

Name Value Type
pivot The segment from the original query to pivot on. String
suggestions A list of suggested queries for the pivot. Query

ProductSummaryImage

Defines an image of a product and provides summary information about offers that Bing found online for the product.

Note

Because the URL format and parameters are subject to change without notice, all URLs should be used as-is; you should not take dependencies on the URL format or parameters. The exception is those parameters and values discussed by Resize and crop thumbnail images.

Name Value Type
accentColor A three-byte hexadecimal number that represents the color that dominates the image. Clients may use the color as the temporary background until the image is loaded. String
aggregateOffer A summary of the offers that Bing found online for the product in the image. For example, if the image is of a dress, the offer identifies the lowest price of the dress and the number of offers found. Offer
contentSize The image's file size. The format of the string is {size} {units}, where {units} may be set to B for byte, KB for Kilobyte, and so on. For example, 12345 B indicates that the size of the image is 12,345 bytes. String
contentUrl The URL to the image on the source website. String
datePublished The date and time that Bing discovered the image. The date is in the format, YYYY-MM-DDTHH:MM:SS. String
encodingFormat The image's mime type (for example, jpeg). String
height The height of the source image, in pixels. Unsigned Short
hostPageDisplayUrl The display URL of the webpage that hosts the image.

You may use this URL in your user interface to identify the host webpage that contains the image. This URL is not a well-formed so don't use it to access the host webpage. The URL does not include the protocol (for example, HTTP) and may include hit highlighting characters.. To access the host webpage, use the URL found in the hostPageUrl property.
String
hostPageUrl The URL of the webpage that includes the image.

This URL and contentUrl may be the same URL.
String
id An ID that uniquely identifies this image in the list of images.

The Image object includes this field only when the image is included in the Web Search API search results and the ranking response specifies a specific position for the image. For information about how to use this field, see Using Ranking to Display Results in the Web Search API guide.
String
imageId An ID that uniquely identifies this image in the list of images. You can use the ID in a subsequent request to ensure that this image is the first returned image in the list of images. To ensure that this image is the first image in the list, include the id query parameter and set it to the image ID. String
imageInsightsToken A token that you use in a subsequent call to the Image Search API to get additional information about the image. For information about using this token, see the insightsToken query parameter. String
insightsSourcesSummary A count of the number of websites where you can shop or perform other actions related to the image.

For example, if the image is of an apple pie, this object includes a count of the number of websites where you can buy an apple pie. You could then include badging (for example, a shopping cart icon) and the count to indicate the number of offers. When the user clicks the icon, you could use imageInisghtsToken to get the list of websites.

For related information about when to display badging, see displayRecipeSourcesBadges and displayShoppingSourcesBadges.
InsightsSourcesSummary
name A title of the image. String
thumbnail The width and height of the thumbnail image (see thumbnailUrl). MediaSize
thumbnailUrl The URL to a thumbnail of the image. For information about resizing the image, see Resize and crop thumbnail images. String
webSearchUrl A URL to the Bing search results for this image. String
width The width of the source image, in pixels. Unsigned Short

Query

Defines a search query string.

Name Value Type
displayText The display version of the query string.

For expanded queries (see queryExpansions) and pivot suggestions (see pivotSuggestions), this field identifies the term that expanded the original query. For example, if the query was Microsoft Surface and the expanded query is Microsoft Surface RT, displayText would contain RT.
String
searchLink The URL that you use to get the results of the related search. Before using the URL, you must append query parameters as appropriate and include the Ocp-Apim-Subscription-Key header.

Use this URL if you're displaying the results in your own user interface; otherwise, use the webSearchUrl URL.
String
text The query string. String
thumbnail The URL to a thumbnail of a related image.

The object includes this field only for pivot suggestions and related searches.
Thumbnail
webSearchUrl The URL that takes the user to the Bing search results page for the query.

Use this URL if you're not displaying the results in your own user interface; otherwise, use the searchUrl URL.

Included only for related searches.
String

Recipe

Defines a cooking recipe.

Element Description Type
aggregateRating Aggregated ratings that indicate how well the recipe has been rated by others. AggregateRating
cookTime The amount of time the food takes to cook. For example, PT25M. For information about the time format, see Durations on Wikipedia.com. String
creator The recipe's author. Person
name The name of the recipe. String
prepTime The amount of time required to prepare the ingredients. For example, PT15M. For information about the time format, see Durations on Wikipedia.com. String
thumbnailUrl The URL to a thumbnail image of the prepared food. String
totalTime The total amount of time it takes to prepare and cook the recipe. For example, PT45M. For information about the time format, see Durations on Wikipedia.com. String
url The URL that takes the user to the webpage that contains the recipe. String

RecognizedEntity

Defines a recognized entity.

Element Description Type
entity The entity that was recognized.

The following are the possible entity objects.
Object
matchConfidence The confidence that Bing has that the entity in the image matches this entity. The confidence ranges from 0.0 through 1.0 with 0.0 being not confident and 1.0 being confident. Float

RecognizedEntityGroup

Defines a group of previously recognized entities.

Element Description Type
name The name of the group where images of the entity were also found.

The following are possible groups.
  • CelebRecognitionAnnotations—Similar to CelebrityAnnotations but provides a higher probability of an accurate match.

  • CelebrityAnnotations—Contains celebrities such as actors, politicians, athletes, and historical figures.
String
recognizedEntityRegions The regions of the image that contain entities. RecognizedEntityRegion[]

RecognizedEntityRegion

Defines a region of the image where an entity was found and a list of entities that might match it.

Element Description Type
matchingEntities A list of entities that Bing believes match the entity found in the region. The entities are in descending order of confidence (see the matchConfidence field of RecognizedEntity). RecognizedEntity[]
region A region of the image that contains an entity.

The values of the rectangle are relative to the width and height of the original image and are in the range 0.0 through 1.0.

For example, if the image is 300x200 and the region's top, left corner is at point (10, 20) and the bottom, right corner is at point (290, 150), then the normalized rectangle is:

Left = 0.0333333333333333

Top = 0.1

Right = 0.9666666666666667

Bottom = 0.75

For people, the region represents the person's face.
NormalizedRectangle

Thumbnail

Defines a thumbnail of an image.

Element Description Type
url The URL to a thumbnail of an image. String

Tile

Defines an image tile.

Element Description Type
image The URL to the image's thumbnail. Image
query A query that returns a Bing search results page with more images of the subject. For example, if the category is Popular People Searches, then the thumbnail in the image field would be of a popular person. To return more images of the person, use the links in the Query object. Query

TrendingImages

The top-level object that the response includes when a trending images request succeeds.

Element Description Type
categories A list that identifies categories of images and a list of trending images in that category. Category[]

Error codes

The following are the possible HTTP status codes that a request may return.

Status Code Description
200 The call succeeded.
400 One of the query parameters is missing or not valid.
401 The subscription key is missing or is not valid.
403 The user is authenticated (for example, used a valid subscription key) but they don’t have permission to the requested resource.

If the caller exceeded their queries per month quota, Bing may also return this status.
410 The request used HTTP instead of the HTTPS protocol. HTTPS is the only supported protocol.
429 The caller exceeded their queries per second quota.

If the request fails, the body of the response will contain an ErrorResponse object. The response object will include an error code and description of the error. If the error is related to a parameter, the parameter field will identify the parameter that is the issue. And if the error is related to a parameter value, the value field will identify the value that is not valid.

{
  "_type": "ErrorResponse", 
  "errors": [
    {
      "code": "RequestParameterMissing", 
      "message": "Required parameter is missing.", 
      "parameter": "q" 
    }
  ]
}


{
  "_type": "ErrorResponse", 
  "errors": [
    {
      "code": "AuthorizationMissing", 
      "message": "Authorization is required.", 
    }
  ]
}

The following are the possible error codes.

Error code Description
RequestParameterMissing The request is missing a required parameter. The parameter field identifies the missing parameter.
RequestParameterInvalidValue The parameter value is not valid. The parameter field identifies the parameter that contains the invalid value, and the value field contains the value that is not valid.
ResourceAccessDenied The caller does not have permissions to access the resource. This error can occur if the subscription key has been disabled or has expired.
ExceededVolume The caller exceeded their queries per month (QPM) quota.
ExceededQpsLimit The caller exceeded their queries per second (QPS).
Disabled The caller does not have permissions to access the resource.
UnexpectedError An unexpected error occurred on the server. Try again later.
DataSourceErrors There was an error access the resource.
AuthorizationMissing Bing is unable to authenticate the caller. This error may occur if the Ocp-Apim-Subscription-Key header is missing.
HttpNotAllowed The request used the HTTP protocol instead of the HTTPS protocol; Bing supports only HTTPS.
InvalidAuthorization Bing is unable to authenticate the caller. This may occur if the subscription key is not valid.
InsufficientScope The caller does not have permissions to access the resource. This error can occur if the subscription key has expired.

Market codes

The following table lists the market code values that you may use to specify the mkt query parameter. Bing returns content for only these markets. The list is subject to change.

For a list of country codes that you may specify in the cc query parameter, see Country codes.

Country/Region Language Market code
Argentina Spanish es-AR
Australia English en-AU
Austria German de-AT
Belgium Dutch nl-BE
Belgium French fr-BE
Brazil Portuguese pt-BR
Canada English en-CA
Canada French fr-CA
Chile Spanish es-CL
Denmark Danish da-DK
Finland Finnish fi-FI
France French fr-FR
Germany German de-DE
Hong Kong SAR Traditional Chinese zh-HK
India English en-IN
Indonesia English en-ID
Italy Italian it-IT
Japan Japanese ja-JP
Korea Korean ko-KR
Malaysia English en-MY
Mexico Spanish es-MX
Netherlands Dutch nl-NL
New Zealand English en-NZ
Norway Norwegian no-NO
People's republic of China Chinese zh-CN
Poland Polish pl-PL
Republic of the Philippines English en-PH
Russia Russian ru-RU
South Africa English en-ZA
Spain Spanish es-ES
Sweden Swedish sv-SE
Switzerland French fr-CH
Switzerland German de-CH
Taiwan Traditional Chinese zh-TW
Turkey Turkish tr-TR
United Kingdom English en-GB
United States English en-US
United States Spanish es-US

Country codes

The following are the country codes that you may specify in the cc query parameter. The list is subject to change.

Country/Region Country Code
Argentina AR
Australia AU
Austria AT
Belgium BE
Brazil BR
Canada CA
Chile CL
Denmark DK
Finland FI
France FR
Germany DE
Hong Kong SAR HK
India IN
Indonesia ID
Italy IT
Japan JP
Korea KR
Malaysia MY
Mexico MX
Netherlands NL
New Zealand NZ
Norway NO
People's Republic of China CN
Poland PL
Portugal PT
Republic of the Philippines PH
Russia RU
Saudi Arabia SA
South Africa ZA
Spain ES
Sweden SE
Switzerland CH
Taiwan TW
Turkey TR
United Kingdom GB
United States US