Edit

Share via


GetKeywordIdeas Service Operation - Ad Insight

Gets the list of keyword ideas.

Suggests new ad groups and keywords based on your existing keywords, website, and product category. You can also request historical statistics for keywords e.g., monthly searches, competition, average CPC, and ad impression share. You can use the returned suggested keyword bids as input to the GetKeywordTrafficEstimates operation.

Tip

For an overview, see the Keyword Ideas and Traffic Estimates technical guide.

Request Elements

The GetKeywordIdeasRequest object defines the body and header elements of the service operation request. The elements must be in the same order as shown in the Request SOAP.

Note

Unless otherwise noted below, all request elements are required.

Request Body Elements

Element Description Data Type
ExpandIdeas Determines whether you want new keyword ideas, or if you only want keyword attributes for the set of keywords that you specified in the SearchParameters list. If you set this element false, the QuerySearchParameter object must be included in the SearchParameters list. boolean
IdeaAttributes The keyword idea attributes that you want included in the response e.g., Keyword, Competition, MonthlySearchCounts, and SuggestedBid.

The Competition attribute is required.

The Keyword attribute will always be returned for each returned KeywordIdea whether or not you include the Keyword value in the requested list of idea attributes.
KeywordIdeaAttribute array
SearchParameters The search parameters define your criteria and filters for the requested keyword ideas.

Do not try to instantiate a SearchParameter. You can include one or more the following objects that derive from it: CategorySearchParameter, CompetitionSearchParameter, DateRangeSearchParameter, DeviceSearchParameter, ExcludeAccountKeywordsSearchParameter, IdeaTextSearchParameter, ImpressionShareSearchParameter, LanguageSearchParameter, LocationSearchParameter, NetworkSearchParameter, QuerySearchParameter, SearchVolumeSearchParameter, SuggestedBidSearchParameter and UrlSearchParameter. Other objects that derive from SearchParameter are not valid for this operation.

You cannot include duplicates of any search parameter type.

The list must include all of these search parameters: LanguageSearchParameter, LocationSearchParameter, and NetworkSearchParameter.

The list must include one or more of these search parameters: CategorySearchParameter, QuerySearchParameter, or UrlSearchParameter. If the ExpandIdeas element is false, then the QuerySearchParameter is required whether or not you included additional search parameters.

It can take up to 72 hours for the previous calendar month's data to be available. For example, if you request keyword ideas on August 1st, 2nd or 3rd, and July's data is not ready, the response will be based on June's data. If you do not include the DateRangeSearchParameter in the GetKeywordIdeas request, then you will not be able to confirm whether the first list item is data for the previous month, or the month prior. If the date range is specified and the most recent month's data is not yet available, then GetKeywordIdeas will return an error.
SearchParameter array

Request Header Elements

Element Description Data Type
AuthenticationToken The OAuth access token that represents the credentials of a user who has permissions to Microsoft Advertising accounts.

For more information see Authentication with OAuth.
string
CustomerAccountId The identifier of the ad account that owns or is associated with the entities in the request. This header element must have the same value as the AccountId body element when both are required. This element is required for most service operations, and as a best practice you should always set it.

For more information see Get Your Account and Customer IDs.
string
CustomerId The identifier of the manager account (customer) the user is accessing or operating from. A user can have access to multiple manager accounts. This element is required for most service operations, and as a best practice you should always set it.

For more information see Get Your Account and Customer IDs.
string
DeveloperToken The developer token used to access the Bing Ads API.

For more information see Get a Developer Token.
string
Password This element is reserved for internal use and will be removed from a future version of the API. You must use the AuthenticationToken element to set user credentials. string
UserName This element is reserved for internal use and will be removed from a future version of the API. You must use the AuthenticationToken element to set user credentials. string

Response Elements

The GetKeywordIdeasResponse object defines the body and header elements of the service operation response. The elements are returned in the same order as shown in the Response SOAP.

Response Body Elements

Element Description Data Type
KeywordIdeas The list of keyword ideas.

Currently up to 3,000 list items can be returned although the limit is subject to change.
KeywordIdea array

Response Header Elements

Element Description Data Type
TrackingId The identifier of the log entry that contains the details of the API call. string

Request SOAP

This template was generated by a tool to show the order of the body and header elements for the SOAP request. For supported types that you can use with this service operation, see the Request Body Elements reference above.

<s:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header xmlns="https://bingads.microsoft.com/AdInsight/v13">
    <Action mustUnderstand="1">GetKeywordIdeas</Action>
    <AuthenticationToken i:nil="false">ValueHere</AuthenticationToken>
    <CustomerAccountId i:nil="false">ValueHere</CustomerAccountId>
    <CustomerId i:nil="false">ValueHere</CustomerId>
    <DeveloperToken i:nil="false">ValueHere</DeveloperToken>
  </s:Header>
  <s:Body>
    <GetKeywordIdeasRequest xmlns="https://bingads.microsoft.com/AdInsight/v13">
      <ExpandIdeas i:nil="false">ValueHere</ExpandIdeas>
      <IdeaAttributes i:nil="false">
        <KeywordIdeaAttribute>ValueHere</KeywordIdeaAttribute>
      </IdeaAttributes>
      <SearchParameters i:nil="false">
        <SearchParameter i:type="-- derived type specified here with the appropriate prefix --">
          <!--This field is applicable if the derived type attribute is set to QuerySearchParameter-->
          <Queries i:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <a1:string>ValueHere</a1:string>
          </Queries>
          <!--This field is applicable if the derived type attribute is set to UrlSearchParameter-->
          <Url i:nil="false">ValueHere</Url>
          <!--This field is applicable if the derived type attribute is set to CategorySearchParameter-->
          <CategoryId>ValueHere</CategoryId>
          <!--These fields are applicable if the derived type attribute is set to SearchVolumeSearchParameter-->
          <Maximum i:nil="false">ValueHere</Maximum>
          <Minimum i:nil="false">ValueHere</Minimum>
          <!--These fields are applicable if the derived type attribute is set to SuggestedBidSearchParameter-->
          <Maximum i:nil="false">ValueHere</Maximum>
          <Minimum i:nil="false">ValueHere</Minimum>
          <!--These fields are applicable if the derived type attribute is set to IdeaTextSearchParameter-->
          <Excluded i:nil="false">
            <Keyword>
              <Id i:nil="false">ValueHere</Id>
              <MatchType>ValueHere</MatchType>
              <Text i:nil="false">ValueHere</Text>
            </Keyword>
          </Excluded>
          <Included i:nil="false">
            <Keyword>
              <Id i:nil="false">ValueHere</Id>
              <MatchType>ValueHere</MatchType>
              <Text i:nil="false">ValueHere</Text>
            </Keyword>
          </Included>
          <!--This field is applicable if the derived type attribute is set to ExcludeAccountKeywordsSearchParameter-->
          <ExcludeAccountKeywords>ValueHere</ExcludeAccountKeywords>
          <!--These fields are applicable if the derived type attribute is set to ImpressionShareSearchParameter-->
          <Maximum i:nil="false">ValueHere</Maximum>
          <Minimum i:nil="false">ValueHere</Minimum>
          <!--This field is applicable if the derived type attribute is set to LocationSearchParameter-->
          <Locations i:nil="false">
            <LocationCriterion>
              <LocationId>ValueHere</LocationId>
            </LocationCriterion>
          </Locations>
          <!--This field is applicable if the derived type attribute is set to NetworkSearchParameter-->
          <Network i:nil="false">
            <Network>ValueHere</Network>
          </Network>
          <!--This field is applicable if the derived type attribute is set to DeviceSearchParameter-->
          <Device i:nil="false">
            <DeviceName i:nil="false">ValueHere</DeviceName>
          </Device>
          <!--This field is applicable if the derived type attribute is set to LanguageSearchParameter-->
          <Languages i:nil="false">
            <LanguageCriterion>
              <Language i:nil="false">ValueHere</Language>
            </LanguageCriterion>
          </Languages>
          <!--This field is applicable if the derived type attribute is set to CompetitionSearchParameter-->
          <CompetitionLevels i:nil="false">
            <CompetitionLevel>ValueHere</CompetitionLevel>
          </CompetitionLevels>
          <!--These fields are applicable if the derived type attribute is set to DateRangeSearchParameter-->
          <EndDate i:nil="false">
            <Day>ValueHere</Day>
            <Month>ValueHere</Month>
            <Year>ValueHere</Year>
          </EndDate>
          <StartDate i:nil="false">
            <Day>ValueHere</Day>
            <Month>ValueHere</Month>
            <Year>ValueHere</Year>
          </StartDate>
        </SearchParameter>
      </SearchParameters>
    </GetKeywordIdeasRequest>
  </s:Body>
</s:Envelope>

Response SOAP

This template was generated by a tool to show the order of the body and header elements for the SOAP response.

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header xmlns="https://bingads.microsoft.com/AdInsight/v13">
    <TrackingId d3p1:nil="false" xmlns:d3p1="http://www.w3.org/2001/XMLSchema-instance">ValueHere</TrackingId>
  </s:Header>
  <s:Body>
    <GetKeywordIdeasResponse xmlns="https://bingads.microsoft.com/AdInsight/v13">
      <KeywordIdeas d4p1:nil="false" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">
        <KeywordIdea>
          <AdGroupId d4p1:nil="false">ValueHere</AdGroupId>
          <AdGroupName d4p1:nil="false">ValueHere</AdGroupName>
          <AdImpressionShare d4p1:nil="false">ValueHere</AdImpressionShare>
          <Competition d4p1:nil="false">ValueHere</Competition>
          <Keyword d4p1:nil="false">ValueHere</Keyword>
          <MonthlySearchCounts d4p1:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <a1:long>ValueHere</a1:long>
          </MonthlySearchCounts>
          <Relevance d4p1:nil="false">ValueHere</Relevance>
          <Source d4p1:nil="false">ValueHere</Source>
          <SuggestedBid d4p1:nil="false">ValueHere</SuggestedBid>
        </KeywordIdea>
      </KeywordIdeas>
    </GetKeywordIdeasResponse>
  </s:Body>
</s:Envelope>

Code Syntax

The example syntax can be used with Bing Ads SDKs. See Bing Ads API Code Examples for more examples.

public async Task<GetKeywordIdeasResponse> GetKeywordIdeasAsync(
	bool? expandIdeas,
	IList<KeywordIdeaAttribute> ideaAttributes,
	IList<SearchParameter> searchParameters)
{
	var request = new GetKeywordIdeasRequest
	{
		ExpandIdeas = expandIdeas,
		IdeaAttributes = ideaAttributes,
		SearchParameters = searchParameters
	};

	return (await AdInsightService.CallAsync((s, r) => s.GetKeywordIdeasAsync(r), request));
}
static GetKeywordIdeasResponse getKeywordIdeas(
	boolean expandIdeas,
	ArrayOfKeywordIdeaAttribute ideaAttributes,
	ArrayOfSearchParameter searchParameters) throws RemoteException, Exception
{
	GetKeywordIdeasRequest request = new GetKeywordIdeasRequest();

	request.setExpandIdeas(expandIdeas);
	request.setIdeaAttributes(ideaAttributes);
	request.setSearchParameters(searchParameters);

	return AdInsightService.getService().getKeywordIdeas(request);
}
static function GetKeywordIdeas(
	$expandIdeas,
	$ideaAttributes,
	$searchParameters)
{

	$GLOBALS['Proxy'] = $GLOBALS['AdInsightProxy'];

	$request = new GetKeywordIdeasRequest();

	$request->ExpandIdeas = $expandIdeas;
	$request->IdeaAttributes = $ideaAttributes;
	$request->SearchParameters = $searchParameters;

	return $GLOBALS['AdInsightProxy']->GetService()->GetKeywordIdeas($request);
}
response=adinsight_service.GetKeywordIdeas(
	ExpandIdeas=ExpandIdeas,
	IdeaAttributes=IdeaAttributes,
	SearchParameters=SearchParameters)

Requirements

Service: AdInsightService.svc v13
Namespace: https://bingads.microsoft.com/AdInsight/v13

Request Url

https://adinsight.api.bingads.microsoft.com/AdInsight/v13/KeywordIdeas/Query

Request Elements

The GetKeywordIdeasRequest object defines the body and header elements of the service operation request.

Note

Unless otherwise noted below, all request elements are required.

Request Body Elements

Element Description Data Type
ExpandIdeas Determines whether you want new keyword ideas, or if you only want keyword attributes for the set of keywords that you specified in the SearchParameters list. If you set this element false, the QuerySearchParameter object must be included in the SearchParameters list. boolean
IdeaAttributes The keyword idea attributes that you want included in the response e.g., Keyword, Competition, MonthlySearchCounts, and SuggestedBid.

The Competition attribute is required.

The Keyword attribute will always be returned for each returned KeywordIdea whether or not you include the Keyword value in the requested list of idea attributes.
KeywordIdeaAttribute array
SearchParameters The search parameters define your criteria and filters for the requested keyword ideas.

Do not try to instantiate a SearchParameter. You can include one or more the following objects that derive from it: CategorySearchParameter, CompetitionSearchParameter, DateRangeSearchParameter, DeviceSearchParameter, ExcludeAccountKeywordsSearchParameter, IdeaTextSearchParameter, ImpressionShareSearchParameter, LanguageSearchParameter, LocationSearchParameter, NetworkSearchParameter, QuerySearchParameter, SearchVolumeSearchParameter, SuggestedBidSearchParameter and UrlSearchParameter. Other objects that derive from SearchParameter are not valid for this operation.

You cannot include duplicates of any search parameter type.

The list must include all of these search parameters: LanguageSearchParameter, LocationSearchParameter, and NetworkSearchParameter.

The list must include one or more of these search parameters: CategorySearchParameter, QuerySearchParameter, or UrlSearchParameter. If the ExpandIdeas element is false, then the QuerySearchParameter is required whether or not you included additional search parameters.

It can take up to 72 hours for the previous calendar month's data to be available. For example, if you request keyword ideas on August 1st, 2nd or 3rd, and July's data is not ready, the response will be based on June's data. If you do not include the DateRangeSearchParameter in the GetKeywordIdeas request, then you will not be able to confirm whether the first list item is data for the previous month, or the month prior. If the date range is specified and the most recent month's data is not yet available, then GetKeywordIdeas will return an error.
SearchParameter array

Request Header Elements

Element Description Data Type
Authorization The OAuth access token that represents the credentials of a user who has permissions to Microsoft Advertising accounts. Please ensure that the token is prefixed with "Bearer ", this is necessary for proper authentication.

For more information see Authentication with OAuth.
string
CustomerAccountId The identifier of the ad account that owns or is associated with the entities in the request. This header element must have the same value as the AccountId body element when both are required. This element is required for most service operations, and as a best practice you should always set it.

For more information see Get Your Account and Customer IDs.
string
CustomerId The identifier of the manager account (customer) the user is accessing or operating from. A user can have access to multiple manager accounts. This element is required for most service operations, and as a best practice you should always set it.

For more information see Get Your Account and Customer IDs.
string
DeveloperToken The developer token used to access the Bing Ads API.

For more information see Get a Developer Token.
string
Password This element is reserved for internal use and will be removed from a future version of the API. You must use the AuthenticationToken element to set user credentials. string
UserName This element is reserved for internal use and will be removed from a future version of the API. You must use the AuthenticationToken element to set user credentials. string

Response Elements

The GetKeywordIdeasResponse object defines the body and header elements of the service operation response. The elements are returned in the same order as shown in the Response JSON.

Response Body Elements

Element Description Data Type
KeywordIdeas The list of keyword ideas.

Currently up to 3,000 list items can be returned although the limit is subject to change.
KeywordIdea array

Response Header Elements

Element Description Data Type
TrackingId The identifier of the log entry that contains the details of the API call. string

Request JSON

This template was generated by a tool to show the body and header elements for the JSON request. For supported types that you can use with this service operation, see the Request Body Elements reference above.

{
  "ExpandIdeas": "ValueHere",
  "IdeaAttributes": [
    "ValueHere"
  ],
  "SearchParameters": [
    {
      "Queries": {
        "string": "ValueHere"
      },
      "Url": "ValueHere",
      "CategoryId": "ValueHere",
      "Maximum": [
        "ValueHere",
        "ValueHere",
        "ValueHere"
      ],
      "Minimum": [
        "ValueHere",
        "ValueHere",
        "ValueHere"
      ],
      "Excluded": {
        "Keyword": {
          "Id": "ValueHere",
          "MatchType": "ValueHere",
          "Text": "ValueHere"
        }
      },
      "Included": {
        "Keyword": {
          "Id": "ValueHere",
          "MatchType": "ValueHere",
          "Text": "ValueHere"
        }
      },
      "ExcludeAccountKeywords": "ValueHere",
      "Locations": {
        "LocationCriterion": {
          "LocationId": "ValueHere"
        }
      },
      "Network": {
        "Network": "ValueHere"
      },
      "Device": {
        "DeviceName": "ValueHere"
      },
      "Languages": {
        "LanguageCriterion": {
          "Language": "ValueHere"
        }
      },
      "CompetitionLevels": {
        "CompetitionLevel": "ValueHere"
      },
      "EndDate": {
        "Day": "ValueHere",
        "Month": "ValueHere",
        "Year": "ValueHere"
      },
      "StartDate": {
        "Day": "ValueHere",
        "Month": "ValueHere",
        "Year": "ValueHere"
      }
    }
  ]
}

Response JSON

This template was generated by a tool to show the body and header elements for the JSON response.

{
  "KeywordIdeas": [
    {
      "AdGroupId": "LongValueHere",
      "AdGroupName": "ValueHere",
      "AdImpressionShare": DoubleValueHere,
      "Competition": "ValueHere",
      "Keyword": "ValueHere",
      "MonthlySearchCounts": [
        "LongValueHere"
      ],
      "Relevance": DoubleValueHere,
      "Source": "ValueHere",
      "SuggestedBid": DoubleValueHere
    }
  ]
}

Code Syntax

To call REST API through SDKs, you need to upgrade SDK to a certain version and configure the system parameters.The example syntax can be used with Bing Ads SDKs. See Bing Ads API Code Examples for more examples.

public async Task<GetKeywordIdeasResponse> GetKeywordIdeasAsync(
	bool? expandIdeas,
	IList<KeywordIdeaAttribute> ideaAttributes,
	IList<SearchParameter> searchParameters)
{
	var request = new GetKeywordIdeasRequest
	{
		ExpandIdeas = expandIdeas,
		IdeaAttributes = ideaAttributes,
		SearchParameters = searchParameters
	};

	return (await AdInsightService.CallAsync((s, r) => s.GetKeywordIdeasAsync(r), request));
}
static GetKeywordIdeasResponse getKeywordIdeas(
	boolean expandIdeas,
	ArrayOfKeywordIdeaAttribute ideaAttributes,
	ArrayOfSearchParameter searchParameters) throws RemoteException, Exception
{
	GetKeywordIdeasRequest request = new GetKeywordIdeasRequest();

	request.setExpandIdeas(expandIdeas);
	request.setIdeaAttributes(ideaAttributes);
	request.setSearchParameters(searchParameters);

	return AdInsightService.getService().getKeywordIdeas(request);
}
static function GetKeywordIdeas(
	$expandIdeas,
	$ideaAttributes,
	$searchParameters)
{

	$GLOBALS['Proxy'] = $GLOBALS['AdInsightProxy'];

	$request = new GetKeywordIdeasRequest();

	$request->ExpandIdeas = $expandIdeas;
	$request->IdeaAttributes = $ideaAttributes;
	$request->SearchParameters = $searchParameters;

	return $GLOBALS['AdInsightProxy']->GetService()->GetKeywordIdeas($request);
}
response=adinsight_service.GetKeywordIdeas(
	ExpandIdeas=ExpandIdeas,
	IdeaAttributes=IdeaAttributes,
	SearchParameters=SearchParameters)