Web Search API v7 reference

The Web Search API lets you send a search query to Bing and get back search results that include links to webpages, images, and more. This section provides technical details about the webpages, related searches, and ranking results in addition to the query parameters that affect the search results. For examples that show how to make requests, see Search the web.

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

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

For information about the JSON objects that the response may include, see Response Body. This reference contains JSON object specific to web answers. For details about the JSON objects for other answer types that the search results may include, see the API-specific reference documentation. For example, if the search result contains the images and news answers, see the Image Search API and News Search API.

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

Endpoints

To request web search results, send a GET request to:

https://api.cognitive.microsoft.com/bing/v7.0/search

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 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.
Pragma Optional request header

By default, Bing returns cached content, if available. To prevent Bing from returning cached content, set the Pragma header to no-cache (for example, Pragma: no-cache).
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.

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

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

  • 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-MSEdge-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. The Required column indicates whether you must specify the parameter. You must URL encode the query parameter values.

Name Value Type Required
answerCount The number of answers that you want the response to include. The answers that Bing returns are based on ranking. For example, if Bing returns webpages, images, videos, and relatedSearches for a request and you set this parameter to two (2), the response includes webpages and images.

If you included the responseFilter query parameter in the same request and set it to webpages and news, the response would include only webpages.

For information about promoting a ranked answer into the response, see promote.
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 search results to return in the response. The default is 10 and the maximum value is 50. The actual number delivered may be less than requested.

Use this parameter along with the offset parameter to page results. For more information, see Paging Webpages.

For example, if your user interface displays 10 search results per page, set count to 10 and offset to 0 to get the first page of results. For each subsequent page, increment offset by 10 (for example, 0, 10, 20). It is possible for multiple pages to include some overlap in results.
UnsignedShort No
freshness Filter search results by the following age values:
  • Day—Return webpages that Bing discovered within the last 24 hours

  • Week—Return webpages that Bing discovered within the last 7 days

  • Month—Return webpages that discovered within the last 30 days

This filter applies only to webpage results and not to the other results such as news and images.
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
offset The zero-based offset that indicates the number of search results to skip before returning results. The default is 0. The offset should be less than (totalEstimatedMatches - count).

Use this parameter along with the count parameter to page results. For example, if your user interface displays 10 search results per page, set count to 10 and offset to 0 to get the first page of results. For each subsequent page, increment offset by 10 (for example, 0, 10, 20). it is possible for multiple pages to include some overlap in results.
Unsigned Short No
promote A comma-delimited list of answers that you want the response to include regardless of their ranking. For example, if you set answerCount) to two (2) so Bing returns the top two ranked answers, but you also want the response to include news, you'd set promote to news. If the top ranked answers are webpages, images, videos, and relatedSearches, the response includes webpages and images because news is not a ranked answer. But if you set promote to video, Bing would promote the video answer into the response and return webpages, images, and videos.

The answers that you want to promote do not count against the answerCount limit. For example, if the ranked answers are news, images, and videos, and you set answerCount to 1 and promote to news, the response contains news and images. Or, if the ranked answers are videos, images, and news, the response contains videos and news.

The following are the possible values.
  • Computation
  • Images
  • News
  • RelatedSearches
  • SpellSuggestions
  • TimeZone
  • Videos
  • Webpages

NOTE: Use only if you specify answerCount.
String No
q The user's search query term. The term may not be empty.

The term may contain Bing Advanced Operators. For example, to limit results to a specific domain, use the site: operator.
String Yes
responseFilter A comma-delimited list of answers to include in the response. If you do not specify this parameter, the response includes all search answers for which there's relevant data.

The following are the possible filter values.
  • Computation
  • Entities
  • Images
  • News
  • RelatedSearches
  • SpellSuggestions
  • TimeZone
  • Videos
  • Webpages

Although you may use this filter to get a single answer, you should instead use the answer-specific endpoint in order to get richer results. For example, to receive only images, send the request to one of the Image Search API endpoints.

The RelatedSearches and SpellSuggestions answers do not support a separate endpoint like the Image Search API does (only the Web Search API returns them).

To include answers that would otherwise be excluded because of ranking, see the promote query parameter.
String No
safeSearch A filter used to filter webpages for adult content. The following are the possible filter values.
  • Off—Return webpages with adult text, images, or videos.

  • Moderate—Return webpages with adult text, but not adult images or videos.

  • Strict—Do not return webpages with adult text, images, or videos.

The default is Moderate.

NOTE: If the request comes from a market that Bing's adult policy requires that safeSearch is 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
textDecorations A Boolean value that determines whether display strings should contain decoration markers such as hit highlighting characters. If true, the strings may include markers. The default is false.

To specify whether to use Unicode characters or HTML tags as the markers, see the textFormat query parameter.

For information about hit highlighting, see Hit Highlighting.
Boolean No
textFormat The type of markers to use for text decorations (see the textDecorations query parameter).

The following are the possible values.
  • Raw—Use Unicode characters to mark content that needs special formatting. The Unicode characters are in the range E000 through E019. For example, Bing uses E000 and E001 to mark the beginning and end of query terms for hit highlighting.

  • HTML—Use HTML tags to mark content that needs special formatting. For example, use <b> tags to highlight query terms in display strings.

The default is Raw.

For a list of markers, see Hit Highlighting.

For display strings that contain escapable HTML characters such as <, >, and &, if textFormat is set to HTML, Bing escapes the characters as appropriate (for example, < is escaped to &lt;).

For information about processing strings with the embedded Unicode characters, see Hit Highlighting.
String No

Response objects

The following are the JSON response objects that the response may include. If the request succeeds, the top-level object in the response is the SearchResponse object. If the request fails, the top-level object is the ErrorResponse object.

This list contains JSON objects that are specific to web answers. For details about the JSON objects for other answer types that the search results may include, see the API-specific reference documentation. For example, if the search result contains the images and news answers, see the Image API and News API.

Object Description
Computation Defines an expression and its answer.
Entity Defines an entity such as a person, place, or thing.
Error Defines an error that occurred.
ErrorResponse The top-level object that the response includes when the request fails.
Identifiable Defines a resource ID.
LicenseAttribution Defines a contractual rule for license attribution.
LinkAttribution Defines a contractual rule for link attribution.
MediaAttribution Defines a contractual rule for media attribution.
Query Defines a query string.
QueryContext Defines the query context that Bing used for the request, if the specified query string contains a spelling error.
RankingGroup Defines a search results group, such as mainline.
RankingItem Defines a ranking group item to display.
RankingResponse Defines where on the search results page content should be placed and in what order.
RelatedSearchAnswer Defines a list of related queries made by others.
SearchResponse The top-level object that the response includes when the request succeeds.
SpellSuggestions Defines a suggested query string that likely represents the user's intent.
TextAttribution Defines a contractual rule for plain text attribution.
TimeZone Defines the date and time of one or more geographic locations.
TimeZoneInformation Defines the time zone information about a geographical location.
WebAnswer Defines a list of relevant webpage links.
Webpage Defines a webpage that is relevant to the query.

Entity

Defines an entity such as a person, place, or thing.

Name Value Type
bingId An ID that uniquely identifies this entity. String
contractualRules A list of rules that you must adhere to if you display the entity. For example, the rules may govern attributing the entity's description.

The following contractual rules may apply.


Not all entities include rules. If the entity provides contractual rules, you must abide by them. For more information about using contractual rules, see Attributing Data.
Object[]
description A short description of the entity. String
entityPresentationInfo Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields. For example, the fields help you determine whether the entity is a dominant or disambiguation entity and whether it's a person or movie. The entity is a dominant entity if Bing believes that only one entity satisfies the request. If multiple entities could satisfy the request, the entity is a disambiguation entity and the user needs to select the entity they're interested in. EntityPresentationInfo
image An image of the entity. Image
name The entity's name. String
webSearchUrl The URL that takes the user to the Bing search results page for this entity. String

EntityAnswer

Defines an entity answer.

Name Value Type
queryScenario The supported query scenario. This field is set to DominantEntity or DisambiguationItem. The field is set to DominantEntity if Bing determines that only a single entity satisfies the request. For example, a book, movie, person, or attraction. If multiple entities could satisfy the request, the field is set to DisambiguationItem. For example, if the request uses the generic title of a movie franchise, the entity's type would likely be DisambiguationItem. But, if the request specifies a specific title from the franchise, the entity's type would likely be DominantEntity. String
value A list of entities. Entity[]

EntityPresentationInfo

Defines additional information about an entity such as type hints.

Name Value Type
entityScenario The supported scenario. String
entityTypeDisplayHint A display version of the entity hint. For example, if entityTypeHints is Artist, this field may be set to American Singer. String
entityTypeHint A list of hints that indicate the entity's type. The list could contain a single hint such as Movie or a list of hints such as Place, LocalBusiness, Restaurant. Each successive hint in the array narrows the entity's type.

For a list of possible types, see Entity Types. If the object does not include this field, Generic is assumed.
String[]

Computation

Defines an expression and its answer.

Element Description Type
expression The math or conversion expression.

If the query contains a request to convert units of measure (for example, meters to feet), this field contains the from units and value contains the to units.

If the query contains a mathematical expression such as 2+2, this field contains the expression and value contains the answer.

Note that mathematical expressions may be normalized. For example, if the query was sqrt(4^2+8^2), the normalized expression may be sqrt((4^2)+(8^2)).

If the user's query is a math question and the textDecorations query parameter is set to true, the expression string may include formatting markers. For example, if the user's query is log(2), the normalized expression includes the subscript markers. For more information, see Hit Highlighting.
String
value The expression's answer. String

Error

Defines the error that occurred.

Element Description Type
code The error code that identifies the category of error. For a list of possible codes, see Error Codes. String
message A description of the error. String
moreDetails A description that provides additional information about the error. String
parameter The query parameter in the request that caused the error. String
subCode The error code that identifies the error. For example, if code is InvalidRequest, subCode may be ParameterInvalid or ParameterInvalidValue. 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[]

Identifiable

Defines the identity of a resource.

Name Value Type
id An identifier. String

Image

Defines an image.

Note

Because the URL format and parameters are subject to change without notice, all image 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 Resizing and Cropping Thumbnails.

Name Value Type
height The height of the source image, in pixels. Unsigned Short
hostPageUrl The URL of the webpage that includes the image.

This URL and contentUrl may be the same URL.
String
name An optional text string that contains random information about the image. String
provider The source of the image. The array will contain a single item.

You must attribute the image to the provider. For example, you may display the provider's name as the cursor hovers over the image or make the image a click-through link to the provider's website where the image is found.
Organization[]
thumbnailUrl The URL to a thumbnail of the image. For information about resizing the image, see Resizing Thumbnails. String
width The width of the source image, in pixels. Unsigned Short

LicenseAttribution

Defines a contractual rule for license attribution.

Name Value Type
_type A type hint, which is set to LicenseAttribution. String
license The license under which the content may be used. License
licenseNotice The license to display next to the targeted field. For example, "Text under CC-BY-SA license".

Use the license's name and URL in the license field to create a hyperlink to the website that describes the details of the license. Then, replace the license name in the licenseNotice string (for example, CC-BY-SA) with the hyperlink you just created.
String
mustBeCloseToContent A Boolean value that determines whether the contents of the rule must be placed in close proximity to the field that the rule applies to. If true, the contents must be placed in close proximity. If false, or this field does not exist, the contents may be placed at the caller's discretion. Boolean
targetPropertyName The name of the field that the rule applies to. String

LinkAttribution

Defines a contractual rule for link attribution.

Name Value Type
_type A type hint, which is set to LinkAttribution. String
mustBeCloseToContent A Boolean value that determines whether the contents of the rule must be placed in close proximity to the field that the rule applies to. If true, the contents must be placed in close proximity. If false, or this field does not exist, the contents may be placed at the caller's discretion. Boolean
targetPropertyName The name of the field that the rule applies to.

If a target is not specified, the attribution applies to the entity as a whole and should be displayed immediately following the entity presentation. If there are multiple text and link attribution rules that do not specify a target, you should concatenate them and display them using a "Data from: " label. For example, “Data from <provider name1> | <provider name2>".
String
text The attribution text. String
url The URL to the provider's website. Use text and URL to create of hyperlink. String

MediaAttribution

Defines a contractual rule for media attribution.

Name Value Type
_type A type hint, which is set to MediaAttribution. String
mustBeCloseToContent A Boolean value that determines whether the contents of the rule must be placed in close proximity to the field that the rule applies to. If true, the contents must be placed in close proximity. If false, or this field does not exist, the contents may be placed at the caller's discretion. Boolean
targetPropertyName The name of the field that the rule applies to. String
url The URL that you use to create of hyperlink of the media content. For example, if the target is an image, you would use the URL to make the image clickable. String

MetaTag

Defines a webpage's metadata.

Name Value Type
content The metadata. String
name The name of the metadata. String

Organization

Defines a publisher.

Note that a publisher may provide their name or their website or both.

Name Value Type
name The publisher's name. String
url The URL to the publisher's website.

Note that the publisher may not provide a website.
String

Query

Defines a search query.

The SpellSuggestions object uses this object to suggest a query string that likely represents the user's intent. It's also used by RelatedSearchAnswer to return a related query that other users have made.

Name Value Type
displayText The display version of the query term. This version of the query term may contain special characters that highlight the search term found in the query string. The string contains the highlighting characters only if the query enabled hit highlighting (see the textDecorations query parameter). For details about hit highlighting, see Hit Highlighting. String
text The query string. Use this string as the query term in a new search request. String
webSearchUrl The URL that takes the user to the Bing search results page for the query.

Only related search results include this field.
String

QueryContext

Defines the query string that Bing used for the request.

Element Description Type
adultIntent A Boolean value that indicates whether the specified query has adult intent. The value is true if the query has adult intent.

If true, and the request's safeSearch query parameter is set to Strict, then the response will not contain results except for news results, if applicable.
Boolean
alterationOverrideQuery The query string to use to force Bing to use the original string. For example, if the query string is saling downwind, the override query string is +saling downwind. Remember to encode the query string, which results in %2Bsaling+downwind.

the object includes this field only if the original query string contains a spelling mistake.
String
alteredQuery The query string that Bing used to perform the query. Bing uses the altered query string if the original query string contained spelling mistakes. For example, if the query string is saling downwind, the altered query string is sailing downwind.

The object includes this field only if the original query string contains a spelling mistake.
String
askUserForLocation A Boolean value that indicates whether Bing requires the user's location to provide accurate results. If you specified the user's location by using the X-MSEdge-ClientIP and X-Search-Location headers, you can ignore this field.

For location aware queries, such as "today's weather" or "restaurants near me" that need the user's location to provide accurate results, this field is set to true.

For location aware queries that include the location (for example, "Seattle weather"), this field is set to false. This field is also set to false for queries that are not location aware, such as "best sellers."
Boolean
originalQuery The query string as specified in the request. String

RankingGroup

Defines a search results group, such as mainline.

Name Value Type
items A list of search result items to display in the group. RankingItem[]

RankingItem

Defines a search result item to display. For more information about how to use the IDs, see Using Ranking to Display Results.

Name Value Type
answerType The answer that contains the item to display. For example, News.

Use the type to find the answer in the SearchResponse object. The type is the name of a SearchResponse field.
String
resultIndex A zero-based index of the item in the answer.

If the item does not include this field, display all items in the answer. For example, display all news articles in the News answer.
Integer
value The ID that identifies either an answer to display or an item of an answer to display. If the ID identifies an answer, display all items of the answer. Identifiable

RankingResponse

Defines where on the search results page content should be placed and in what order.

Name Value Type
mainline The search results to display in the mainline. RankingGroup
pole The search results that should be afforded the most visible treatment (for example, displayed above the mainline and sidebar). RankingGroup
sidebar The search results to display in the sidebar. RankingGroup

RelatedSearchAnswer

Defines a list of related queries made by others.

Name Value Type
id An ID that uniquely identifies the related search answer.

The object includes this field only if the Ranking answer specifies that you display all related searches in a group. For more information about how to use the ID, see Using Ranking to Display Results.
String
value A list of related queries that were made by others. Query[]

SearchResponse

The response's top-level object for search requests.

By default, the Search API includes all answers unless:

  • The query specifies the responseFilter query parameter to limit the answers

  • One or more of the search components does not return results (for example, no news results are relevant to the query)

  • The subscription key does not have access to the search component.

If the service suspects a denial of service attack, the request succeeds (HTTP status code is 200 OK), but the body of the response is empty.

Name Value Type
_type Type hint. String
computation The answer to a math expression or units conversion expression. Computation
entities A list of entities that are relevant to the search query. EntityAnswer
images A list of images that are relevant to the search query. Images
news A list of news articles that are relevant to the search query. News
queryContext The query string that Bing used for the request.

The response includes the context only if the query string contains a spelling mistake or has adult intent.
QueryContext
rankingResponse The order that Bing suggests that you display the search results in. RankingResponse
relatedSearches A list of related queries made by others. RelatedSearchAnswer
spellSuggestions The query string that likely represents the user's intent. SpellSuggestions
timeZone The date and time of one or more geographic locations. TimeZone
videos A list of videos that are relevant to the search query. Videos
webPages A list of webpages that are relevant to the search query. WebAnswer

SpellSuggestions

Defines a suggested query string that likely represents the user's intent.

The search results include this response if Bing determines that the user may have intended to search for something different. For example, if the user searches for alon brown, Bing may determine that the user likely intended to search for Alton Brown instead (based on past searches by others of Alon Brown).

Name Value Type
id An ID that uniquely identifies the spelling suggestion answer.

You use this field when you use the ranking response to display the spelling suggestions. For more information about how to use the ID, see Using Ranking to Display Results.
String
value A list of suggested query strings that may represent the user's intention.

The list contains only one Query object.
Query[]

TextAttribution

Defines a contractual rule for plain text attribution.

Name Value Type
_type A type hint, which is set to TextAttribution. String
text The attribution text.

Text attribution applies to the entity as a whole and should be displayed immediately following the entity presentation. If there are multiple text or link attribution rules that do not specify a target, you should concatenate them and display them using a "Data from: " label.
String

TimeZone

Defines the data and time of one or more geographic locations.

Name Value Type
otherCityTimes A list of dates and times of nearby time zones. TimeZoneInformation[]
primaryCityTime The data and time, in UTC, of the geographic location specified in the query.

If the query specified a specific geographic location (for example, a city), this object contains the name of the geographic location and the current date and time of the location, in UTC.

If the query specified a general geographic location, such as a state or country, this object contains the date and time of the primary city or state found in the specified state or country. If the location contains additional time zones, the otherCityTimes field contains the data and time of cities or states located in the other time zones.
TimeZoneInformation

TimeZoneInformation

Defines a date and time for a geographical location.

Name Value Type
location The name of the geographical location.

For example, County; City; City, State; City, State, Country; or Time Zone.
String
time The data and time specified in the form, YYYY-MM-DDThh;mm:ss.ssssssZ. String
utcOffset The offset from UTC. For example, UTC-7. String

WebAnswer

Defines a list of relevant webpage links.

Name Value Type
id An ID that uniquely identifies the web answer.

The object includes this field only if the Ranking answer suggests that you display all web results in a group. For more information about how to use the ID, see Using Ranking to Display Results.
String
someResultsRemoved A Boolean value that indicates whether the response excluded some results from the answer. If Bing excluded some results, the value is true. Boolean
totalEstimatedMatches The estimated number of webpages that are relevant to the query. Use this number along with the count and offset query parameters to page the results. Long
value A list of webpages that are relevant to the query. WebPage[]
webSearchUrl The URL to the Bing search results for the requested webpages. String

Webpage

Defines a webpage that is relevant to the query.

Name Value Type
about For internal use only. Object
dateLastCrawled The last time that Bing crawled the webpage. The date is in the form, YYYY-MM-DDTHH:MM:SS. For example, 2015-04-13T05:23:39. String
deepLinks A list of links to related content that Bing found in the website that contains this webpage.

The Webpage object in this context includes only the name, url, urlPingSuffix, and snippet fields.
Webpage[]
displayUrl The display URL of the webpage. The URL is meant for display purposes only and is not well formed. String
id An ID that uniquely identifies this webpage in the list of web results.

The object includes this field only if the Ranking answer specifies that you mix the webpages with the other search results. Each webpage contains an ID that matches an ID in the Ranking answer. For more information, see Using Ranking to Display Results.
String
name The name of the webpage.

Use this name along with url to create a hyperlink that when clicked takes the user to the webpage.
String
mentions For internal use only. Object
searchTags A list of search tags that the webpage owner specified on the webpage. The API returns only indexed search tags.

The name field of the MetaTag object contains the indexed search tag. Search tags begin with search.* (for example, search.assetId). The content field contains the tag's value.
MetaTag[]
snippet A snippet of text from the webpage that describes its contents. String
url The URL to the webpage.

Use this URL along with name to create a hyperlink that when clicked takes the user to the webpage.
String

Entity Types

This section contains the possible entity hints. The hints are grouped by category of entities.

The following are the base entity types.

  • Generic
  • Person
  • Place
  • Media
  • Organization

The following are the entity hints that fall under the Place base type.

  • Attraction
  • City
  • Continent
  • Country
  • Hotel
  • House
  • LocalBusiness
  • Locality
  • MinorRegion
  • Neighborhood
  • Other
  • PointOfInterest
  • PostalCode
  • RadioStation
  • Region
  • Restaurant
  • State
  • StreetAddress
  • SubRegion
  • TouristAttraction
  • Travel

The following are the entity hints that fall under the Media base type.

  • Book
  • Movie
  • TelevisionSeason
  • TelevisionShow
  • VideoGame

The following are the event-related entity hints.

  • Event

The following are the profession-related entity hints.

  • Actor
  • Artist
  • Attorney

The following are the education-related entity hints.

  • CollegeOrUniversity
  • School
  • Speciality

The following are unrelated entity hints.

  • Animal
  • Car
  • Drug
  • Food
  • Product
  • SportsTeam

Error codes

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

Status Code Description
200 Success.
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, they used a valid subscription key) but they don’t have permission to the requested resource.

Bing may also return this status if the caller exceeded their queries per month quota.
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.
500 Unexpected server error.

If the request fails, the response contains an ErrorResponse object, which contains a list of Error objects that describe what caused of error. If the error is related to a parameter, the parameter field identifies the parameter that is the issue. And if the error is related to a parameter value, the value field identifies the value that is not valid.

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

{
  "_type": "ErrorResponse", 
  "errors": [
    {
      "code": "InvalidAuthorization", 
      "subCode": "AuthorizationMissing", 
      "message": "Authorization is required.", 
      "moreDetails": "Subscription key is not recognized."
    }
  ]
}

The following are the possible error code and sub-error code values.

Code SubCode Description
ServerError UnexpectedError
ResourceError
NotImplemented
HTTP status code is 500.
InvalidRequest ParameterMissing
ParameterInvalidValue
HttpNotAllowed
Blocked
Bing returns InvalidRequest whenever any part of the request is not valid. For example, a required parameter is missing or a parameter value is not valid.

If the error is ParameterMissing or ParameterInvalidValue, the HTTP status code is 400.

If you use the HTTP protocol instead of HTTPS, Bing returns HttpNotAllowed, and the HTTP status code is 410.
RateLimitExceeded No sub-codes Bing returns RateLimitExceeded whenever you exceed your queries per second (QPS) or queries per month (QPM) quota.

If you exceed QPS, Bing returns HTTP status code 429, and if you exceed QPM, Bing returns 403.
InvalidAuthorization AuthorizationMissing
AuthorizationRedundancy
Bing returns InvalidAuthorization when Bing cannot authenticate the caller. For example, the Ocp-Apim-Subscription-Key header is missing or the subscription key is not valid.

Redundancy occurs if you specify more than one authentication method.

If the error is InvalidAuthorization, the HTTP status code is 401.
InsufficientAuthorization AuthorizationDisabled
AuthorizationExpired
Bing returns InsufficientAuthorization when the caller does not have permissions to access the resource. This can occur if the subscription key has been disabled or has expired.

If the error is InsufficientAuthorization, the HTTP status code is 403.

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