Bing Ads API Code Examples

Get started developing Bing Ads API applications in any programming language which supports web services. Samples are provided for C#, Java, Php, and Python.

Note

  • Upgrade your expanded text ads to responsive search ads by February 1, 2023. After this date, you will no longer be able to create new or edit existing expanded text ads. For more information, see About responsive search ads.
  • Existing expanded text ads will continue to serve, and you'll be able to view reports on their performance.
  • You'll still be able to pause, enable, or remove your expanded text ads. Otherwise, attempts to add or update expanded text ads will result in a CampaignServiceAdTypeInvalid error.
  • Learn more about this change.

Tip

Use the language selector in the documentation header to choose C#, Java, Php, or Python.

To get access and refresh tokens for your Microsoft Advertising user and make your first service call using the Bing Ads API, see the Quick Start guide. You'll want to review the Get Started guide and walkthroughs for your preferred language e.g., C#, Java, Php, and Python.

Supporting files for C#, Java, Php, and Python examples are available at GitHub. You can clone each repository or repurpose snippets as needed.

Title Description
Ad Extensions How to add, get, and delete extensions for an account's ad extension library, set, get, and delete the extension associations with a campaign, and determine why an extension failed editorial reviews.
Budget Opportunities How to get the budget opportunities for each campaign in the current authenticated account.
Bulk Requests How to download campaigns, ad groups, and ads in a .csv file using the Bulk service.
Client Links How to use agency credentials to invite a client, and use client credentials to accept the invitation.
Conversion Goals How to manage UET tags and conversion goals.
Customer Signup How an aggregator can call SignupCustomer to create a new customer and account.
Dynamic Search Ads How to setup Dynamic Search Ads using the Campaign Management service.
Expanded Text Ads How to setup Expanded Text Ads for a search advertising campaign.
Experiments How to create experiment campaigns from a base campaign.
Geographical Locations How to download the comma separated value (CSV) file that contains geographical location information that can be used with Microsoft Advertising location targeting.
Image Media How to add media for responsive ads and image ad extensions.
Invite User How to invite a user to manage Microsoft Advertising accounts.
Keyword Planner How to get keyword ideas and traffic estimates for search advertising campaigns.
Labels How to add labels and associate them with campaigns, ad groups, keywords, and ads.
Negative Keywords How to associate negative keywords and negative keyword lists with a campaign.
Offline Conversions How to send Microsoft Advertising your offline conversions using the Campaign Management service.
Product Ads How to apply product conditions for Product Ads in Microsoft Shopping Campaigns.
Profile Criteria How to use company, industry, and job function criteria to show ads to your target audience.
Remarketing Lists How to associate remarketing lists with a new ad group.
Report Requests How to request and retrieve performance reports.
Responsive Ads How to setup Responsive Ads for the Microsoft Audience Network using the Campaign Management service.
Responsive Search Ads How to setup Responsive Search Ads for a search advertising campaign.
Search User Accounts How to search for accounts that can be managed by the current authenticated user.
Target Criteria How to use location criteria to show ads to your target audience.

See Also

Bing Ads API Overview
Bing Ads API Concepts
Get Started With the Bing Ads API