How to get Customer Id using Access token for Non-MCC account

1,039 views
Skip to first unread message

Shibu Alist

unread,
Aug 4, 2016, 8:24:53 PM8/4/16
to AdWords API Forum
Hello Team,

We need  Customer Id using Access token for Non-MCC account for creating Campaigns.
Please share api information for same.


Thanks
Shibu

Anthony Madrigal

unread,
Aug 4, 2016, 11:39:58 PM8/4/16
to AdWords API Forum
Hi Shibu,

You can use the ManagedCustomerService from your MCC level in order to get the client accounts under it. This will give you the customer Ids of these accounts as well if you select the field customerId.

Cheers,
Anthony
AdWords API Team

Shibu Alist

unread,
Aug 5, 2016, 6:42:04 AM8/5/16
to AdWords API Forum
Hi Anthony,

Thanks for your reply!!!!

But i am still confused as i get the same answer from everywhere.

Let me clear our application flow.

Actually we are building an application, where normal users will connect their adword account by going through OAuth Authentication process.
After Authentication, they should be able to create campaign from our website. But we have to pass customerid for every request.How to get that customerID? as Authentication process doesn't return it.

ManagedCustomerService  will be used if client account is added in MCC account. But what if any random user, who is not under any MCC account wants to use our application . How he can achieve this ? I have seen many websites doing this But i didn't get any solution yet .

Please do the needful.

Michael Cloonan (AdWords API Team)

unread,
Aug 5, 2016, 2:36:39 PM8/5/16
to AdWords API Forum
Hello,

Use the CustomerService for this. The CustomerService does not require a CustomerID header to be specified, and will return the currently authenticated customer. The Customer that is returned includes the ID, which you can then specify in other requests, as well as other information about the customer.

Regards,
Mike, AdWords API Team

Shibu Alist

unread,
Aug 6, 2016, 12:39:33 PM8/6/16
to AdWords API Forum
Hello Mike,

Thanks for your reply!!!
Does this works in test environment ?.
Because i get error "Missing CLIENT_CUSTOMER_ID" when using CustomerService in test environment.

Michael Cloonan (AdWords API Team)

unread,
Aug 8, 2016, 12:12:29 PM8/8/16
to AdWords API Forum
Hello,

It should work in a test environment. Are you using a refresh token generated on a test account? If not, please try that. If you're still having trouble, please include a SOAP request/response so I can take a closer look.

Regards,
Mike, AdWords API Team

Alfie Max

unread,
Oct 26, 2016, 3:31:50 PM10/26/16
to AdWords API Forum
Hi,

I'm using the ruby client library . How do i make the CustomerService Request so that i get the Customer info for a non MCC account.

And for a MCC account i believe i have to use the ManagedCustomerService but for that i need to get the Customer ID of the MCC account. How do i get that as i don't get that in the OAuth response.

Shwetha Vastrad (AdWords API Team)

unread,
Oct 26, 2016, 7:05:09 PM10/26/16
to AdWords API Forum
Hi Alfie,

If you have the OAuth2 credentials associated with a client account (non-MCC account), you can use CustomerService.getCustomers() method to retrieve the details of the Customer. You need to use the same method to first get the clientCustomerId of the manager account using the manager account's OAuth2 credentials and then use this in the request to ManagedCustomerService to get a list of the client accounts under this manager account. The get_account_hierarchy.rb example demonstrates how to use ManagedCustomerService to retrieve the account hierarchy under a manager account. 

Regards,
Shwetha, AdWords API Team.
Reply all
Reply to author
Forward
0 new messages