Request Headers

Set the required header elements for each service request. New customers are required to sign up for Bing Ads with a Microsoft Account, and to manage those accounts you must use OAuth. Existing users with legacy Bing Ads credentials may continue to specify the UserName and Password header elements. In future versions of the API, Bing Ads will transition exclusively to Microsoft Account authentication. For more information, see Getting Started With the Bing Ads API.

OAuth Authentication

The OAuth access token that represents a Microsoft Account user who has permissions to Bing Ads accounts.

string

CustomerAccountId

The identifier of the account that owns the entities in the request. This header element must have the same value as the AccountId body element when both are required.

Note: Required for most service operations, and as a best practice you should always specify this element.

string

CustomerId

The identifier of the customer that contains and owns the account. If you manage an account of another customer, you should use that customer ID instead of your own customer ID.

Note: Required for most service operations, and as a best practice you should always specify this element.

string

DeveloperToken

The developer token used to access the Bing Ads API.

string

Password Authentication

These request headers are required for legacy username and password authentication.

Element

Description

Data Type

CustomerAccountId

The identifier of the account that owns the entities in the request. This header element must have the same value as the AccountId body element when both are required.

Note: Required for most service operations, and as a best practice you should always specify this element.

string

CustomerId

The identifier of the customer that contains and owns the account. If you manage an account of another customer, you should use that customer ID instead of your own customer ID.

Note: Required for most service operations, and as a best practice you should always specify this element.

string

DeveloperToken

The developer token used to access the Bing Ads API.

string

Password

The Bing Ads user's sign-in password.

string

UserName

The Bing Ads user's sign-in user name. You must not set this element to a Microsoft account or email address. To authenticate a Microsoft account, use the AuthenticationToken header instead of UserName and Password.

string

Request SOAP

<s:Envelopexmlns:i="http://www.w3.org/2001/XMLSchema-instance"xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Headerxmlns="https://bingads.microsoft.com/CampaignManagement/v11"><ActionmustUnderstand="1">AddAdGroups</Action><ApplicationTokeni:nil="false"></ApplicationToken><AuthenticationTokeni:nil="false"></AuthenticationToken><CustomerAccountIdi:nil="false"></CustomerAccountId><CustomerIdi:nil="false"></CustomerId><DeveloperTokeni:nil="false"></DeveloperToken><Passwordi:nil="false"></Password><UserNamei:nil="false"></UserName></s:Header><s:Body><AddAdGroupsRequestxmlns="https://bingads.microsoft.com/CampaignManagement/v11"><CampaignId></CampaignId><AdGroupsi:nil="false"><AdGroup><AdDistributioni:nil="false"></AdDistribution><AdRotationi:nil="false"><EndDatei:nil="false"></EndDate><StartDatei:nil="false"></StartDate><Typei:nil="false"></Type></AdRotation><BiddingSchemei:nil="false"i:type="-- specify derived type here with the appropriate prefix --"><Typei:nil="false"></Type><!--Keep these fields if you set the i:type attribute to MaxClicksBiddingScheme--><MaxCpci:nil="false"><Amounti:nil="false"></Amount></MaxCpc><!--Keep these fields if you set the i:type attribute to MaxConversionsBiddingScheme--><MaxCpci:nil="false"><Amounti:nil="false"></Amount></MaxCpc><!--Keep these fields if you set the i:type attribute to TargetCpaBiddingScheme--><MaxCpci:nil="false"><Amounti:nil="false"></Amount></MaxCpc><TargetCpai:nil="false"></TargetCpa><!--Keep these fields if you set the i:type attribute to ManualCpcBiddingScheme--><!--Keep these fields if you set the i:type attribute to EnhancedCpcBiddingScheme--><!--Keep these fields if you set the i:type attribute to InheritFromParentBiddingScheme--><InheritedBidStrategyTypei:nil="false"></InheritedBidStrategyType></BiddingScheme><ContentMatchBidi:nil="false"><Amounti:nil="false"></Amount></ContentMatchBid><EndDatei:nil="false"><Day></Day><Month></Month><Year></Year></EndDate><ForwardCompatibilityMapxmlns:e18="http://schemas.datacontract.org/2004/07/System.Collections.Generic"i:nil="false"><e18:KeyValuePairOfstringstring><e18:keyi:nil="false"></e18:key><e18:valuei:nil="false"></e18:value></e18:KeyValuePairOfstringstring></ForwardCompatibilityMap><Idi:nil="false"></Id><Languagei:nil="false"></Language><Namei:nil="false"></Name><NativeBidAdjustmenti:nil="false"></NativeBidAdjustment><Networki:nil="false"></Network><PricingModeli:nil="false"></PricingModel><RemarketingTargetingSettingi:nil="false"></RemarketingTargetingSetting><SearchBidi:nil="false"><Amounti:nil="false"></Amount></SearchBid><StartDatei:nil="false"><Day></Day><Month></Month><Year></Year></StartDate><Statusi:nil="false"></Status><TrackingUrlTemplatei:nil="false"></TrackingUrlTemplate><UrlCustomParametersxmlns:e19="http://schemas.datacontract.org/2004/07/Microsoft.AdCenter.Advertiser.CampaignManagement.Api.DataContracts.V11"i:nil="false"><e19:Parametersi:nil="false"><e19:CustomParameter><e19:Keyi:nil="false"></e19:Key><e19:Valuei:nil="false"></e19:Value></e19:CustomParameter></e19:Parameters></UrlCustomParameters></AdGroup></AdGroups></AddAdGroupsRequest></s:Body></s:Envelope>

Response Body

Element

Description

Data Type

AdGroupIds

A list of unique system identifiers corresponding to the ad groups that were added.

The list of identifiers corresponds directly to the list of ad groups in the request. Items of the list may be returned as null. For each list index where an ad group was not added, the corresponding element will be null.

long array

PartialErrors

An array of BatchError objects that contain details for any request items that were not successful.

The list of errors do not correspond directly to the list of items in the request. The list can be empty if there were no errors, or can include one or more error objects corresponding to each unsuccessful list item in the request.

Response Header

Response SOAP

<s:Envelopexmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Headerxmlns="https://bingads.microsoft.com/CampaignManagement/v11"><TrackingIdp4:nil="false"xmlns:p4="http://www.w3.org/2001/XMLSchema-instance"></TrackingId></s:Header><s:Body><AddAdGroupsResponsexmlns="https://bingads.microsoft.com/CampaignManagement/v11"><AdGroupIdsp4:nil="false"xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"xmlns:p4="http://www.w3.org/2001/XMLSchema-instance"><a1:long></a1:long></AdGroupIds><PartialErrorsp4:nil="false"xmlns:p4="http://www.w3.org/2001/XMLSchema-instance"><BatchErrorp4:type="-- specify derived type here with the appropriate prefix --"><Code></Code><Detailsp4:nil="false"></Details><ErrorCodep4:nil="false"></ErrorCode><FieldPathp4:nil="false"></FieldPath><ForwardCompatibilityMapxmlns:e20="http://schemas.datacontract.org/2004/07/System.Collections.Generic"p4:nil="false"><e20:KeyValuePairOfstringstring><e20:keyp4:nil="false"></e20:key><e20:valuep4:nil="false"></e20:value></e20:KeyValuePairOfstringstring></ForwardCompatibilityMap><Index></Index><Messagep4:nil="false"></Message><Typep4:nil="false"></Type><!--Keep these fields if you set the i:type attribute to EditorialError--><Appealablep4:nil="false"></Appealable><DisapprovedTextp4:nil="false"></DisapprovedText><Locationp4:nil="false"></Location><PublisherCountryp4:nil="false"></PublisherCountry><ReasonCode></ReasonCode></BatchError></PartialErrors></AddAdGroupsResponse></s:Body></s:Envelope>