Export (0) Print
Expand All

Getting Started With the Bing Ads API

Any Bing Ads user with a developer token can begin using the Bing Ads Application Programming Interface (API). For more information about available services, see Bing Ads API Overview.

Getting a Developer Token

To use Bing Ads APIs, you must have a developer token and valid user credentials. If you do not yet have a Bing Ads account, go to the Bing Ads web application, and click Sign up. To get a developer token for production, login with your Microsoft Account user credentials at the Bing Ads Developer Portal.

The sandbox and production environments use separate credentials. For information about getting immediate access to the sandbox, see Sandbox.

Where to Use the API Credentials

Bing Ads services use Simple Object Access Protocol (SOAP) to exchange the request and response messages with the service operation. For more information, see Bing Ads Services Protocol.

System_CLiX_note Note

In the near future, Bing Ads will transition exclusively to Microsoft Account authentication. 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. For more information, see Managing User Authentication with OAuth.

Each SOAP request must include the following SOAP headers, which contain the user’s credentials.

Element

Description

Data Type

Required

ApplicationToken

The application-access token.

string

No. This header element is not used and should be null.

AuthenticationToken

The OAuth access token used to manage Bing Ads accounts linked to a Microsoft Account. For more information, see Managing User Authentication with OAuth.

string

Required if the UserName and Password elements are not specified.

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.

string

Required for service operations related to ad extensions and bid estimations. As a best practice you should always specify this element for operations limited in scope to a single account per service call.

CustomerId

The identifier of the customer that owns the account.

string

Required for service operations related to targeting and editorial. As a best practice you should always specify this element.

DeveloperToken

The client application's developer access token.

string

Yes.

Password

The Bing Ads user's sign-in password.

string

Required if the AuthenticationToken element is not specified.

UserName

The Bing Ads user's sign-in user name. You may not set this element to a Microsoft account.

string

Required if the AuthenticationToken element is not specified.

Writing Your First Application

You may write your first application from scratch or start with an example.

System_CLiX_note Note

Many Bing Ads service operations require an account ID and some require a customer ID. For more information on getting your customer ID and account ID, see Account and Customer Identifiers.

For code examples in C#, Java and PHP, see Bing Ads Code Examples.

System_CLiX_note Note

Many code examples demonstrate programming concepts with the UserName and Password elements. For Managing User Authentication with OAuth, replace the UserName and Password elements with the AuthenticationToken, which is your OAuth access token.

For details about getting started writing Bing Ads applications in these languages, see C# | Java | PHP.

See Bing Ads API Version 9 Reference for definitions of programming elements and web service addresses.

Account and Customer Identifiers

Many Bing Ads service operations require an account ID and some require a customer ID. The following sections describe the account and customer identifiers, and provides information on retrieving the identifiers.

Account Identifier

The account identifier is a numeric identifier that identifies an account.

Many of the campaign management operations require that you specify the account identifier in the body of the request message. For example, the GetCampaignsByAccountId operation returns all of the campaigns for the account that you specify in the body of the request message.

Do not confuse the account identifier with the account number. The account number is the system generated account number that is used to identify the account in the Bing Ads web application. The account number has the form xxxxxxxx, where xxxxxxxx is a series of any eight alphanumeric characters. The API uses only the account identifier, never the account number.

Customer Account Identifier

The customer account identifier is the same as the account identifier. You specify the account identifier in the CustomerAccountId SOAP request header element.

As a best practice you should always specify the identifier of the account being accessed in the CustomerAccountId header element. Some of the campaign management operations require that you specify the account ID in the request message, and most of them require that you specify the account ID in the CustomerAccountId header element.

Customer Identifier

The customer identifier is the numeric identifier that identifies a customer. You specify the customer identifier in the CustomerId SOAP request header element.

As a best practice you should always specify the identifier of the customer that owns the account in the CustomerId header element. Only operations that store data in the customer library for example targets, require you to set the CustomerId header element. Operations that require you to specify the customer ID will state this in the corresponding service operation topic.

Getting Your Account ID and Customer ID

To get a user’s customer ID and account ID, you can sign in to the Bing Ads web application and click on an account within Accounts & Billing. The URL will contain a cid key/value pair in the query string that identifies your customer ID, and an aid key/value pair that identifies your account ID. For example, https://bingads.microsoft.com/cc/Account/Details?cid=1030&aid=49943.

Need Help?

For troubleshooting tips, see Handling Service Errors and Exceptions.

To get answers to your questions, you can use the Bing Ads API Development forum. Microsoft monitors the forums and replies to questions that the community has not yet answered.

If you cannot find the information you need to solve your problem in the developer forum, contact Bing Ads Support.

Community Additions

ADD
Show:
© 2014 Microsoft