Creating Accounts with the AdWords API

in AdWords API

This post explains how to automatically add a customer account to an MCC account using the AdWords API. After five years of being asked the same question, I can finally answer “yes!”, when people ask me if it's possible to create accounts via the AdWords API. The new CreateAccountService was announced last week, which is great news for AdWords API developers.

How to Create Accounts in the AdWords API

The API announcement follows on from an earlier one about a feature that allows accounts to be created within an MCC account without needing to have an associated Google login. You can now go into an MCC account and simply press the “Create Account” button, then it will be added to your list of managed accounts:

Adding an MCC Only Account
Adding an MCC Only Account

You need to specify the country, timezone, and currency at this point, and you can also invite a user—for example your client—to access the account with a normal Google login. However, it's not possible to add a payment method from this screen, so you need to either use Manager Defined Spend or manually go into the account and set it.

Adding Accounts using the ManagedCustomerService

It's actually pretty simple to create a new account as it just follows the same format as most AdWords API operations. Here's an example using the PHP client library:

require_once 'Google/Api/Ads/AdWords/Lib/AdWordsUser.php';
$username = "[email protected]";
$password = "pa55word";
$developerToken = "your_dev_token";
$user = new AdWordsUser(null, $username, $password, $developerToken);
$managedCustomerService = $user->GetService("ManagedCustomerService", "v201209"); 
$customer = new ManagedCustomer();
$customer->name = "Test Account";
$customer->currencyCode = "USD";
$customer->dateTimeZone = 'Europe/London';
$operation = new ManagedCustomerOperation();
$operation->operator = 'ADD';
$operation->operand = $customer;
$operations = array($operation);
$accounts = $managedCustomerService->mutate($operations);
Script to Create an Account using the AdWords API

That's pretty much it. There are just a few items of note here:

  • Accounts are actually called "Customers", so you create ManagedCustomer objects and send them to the ManagedCustomerService.
  • You need to construct an ManagedCustomer object for each account you want to create; these require a name, currency code, and timezone.
  • As with most mutate operations, you can create multiple accounts at the same time by using multiple operations.

This is definitely going to be a useful addition to the AdWords API, and I'm sure I'll be using it in a project soon. It would also be nice to have the ability to invite a user once the account was created, but apart from that it should be perfect for agencies; especially ones using MDS who won't need to worry about adding credit card details.

← Using OAuth with the AdWords API New Google Analytics API →

To help me decide what to write about, I'd like to asses the value of my blog posts to see which ones people find most beneficial. If you found the information here useful then could you please +1 it, but if you didn't find what you were looking for then please leave a comment and I'll be happy to help where I can. Thanks!


I'm keen to get feedback on my posts, so if you have any questions or comments, then please send me a message and I'll be happy to help.