NO_CUSTOMER_FOUND response when user have accounts [PHP]

289 views
Skip to first unread message

Ravi Chandran

unread,
Nov 29, 2019, 9:18:04 AM11/29/19
to AdWords API and Google Ads API Forum
Hi Team,

We are trying to fetch a list of Ad accounts using the Google Adwords API. The developer token has "basic access".

$selector = new Selector();
$selector->setFields(['Name', 'CustomerId']);
$page = $managedCustomerService->get($selector);

However, we are getting the following error for a certain account and works for another. 
Fatal error: Uncaught Google\AdsApi\AdWords\v201809\cm\ApiException: [AuthorizationError.NO_CUSTOMER_FOUND

The strange thing is both accounts belong to the same organization and have the same Google Adwords Access level.

I would like to know if anybody else has faced a similar situation. 

Google Ads API Forum Advisor Prod

unread,
Dec 2, 2019, 1:47:32 PM12/2/19
to ra...@socialbeat.in, adwor...@googlegroups.com
Hi Ravi, 

The AuthorizationError.NO_CUSTOMER_FOUND error you encountered means that the customer/account is indeed not found or to simply say, the clientCustomerId that you set in your request header is not a valid account. Could you please check the client customer Id in the header? If you're still receiving the error, could you please enable logging by following this guide and share the logs using Reply privately to author option?

Thanks,
Bharani, Google Ads API Team

ref:_00D1U1174p._5001UODV5I:ref

Ravi Chandran

unread,
Dec 3, 2019, 5:52:19 AM12/3/19
to AdWords API and Google Ads API Forum
Hi Team,

Our requirement is to use Web flow not Installed app.

We are trying to get all client customer ID who logged in and it will show the list of root accounts they have. We will fetch campaigns data based on user selection account. 

I would like to know how to fetch list of root account as we can see in Adwords dashboard. 

Thanks. 

Google Ads API Forum Advisor Prod

unread,
Dec 3, 2019, 2:12:22 PM12/3/19
to ra...@socialbeat.in, adwor...@googlegroups.com
Hi Ravi, 

You will be able to use the CustomerService.getCustomers() which returns details of all the customers directly accessible by the user authenticating the call. If you're looking to get the complete account hierarchy, you may use the GetAccountHierarchy code sample by adding the manager account Id in the request header to return all the accounts as in the Google Ads dashboard. Could you please give this a try and let me know if you have any questions?

Ravi Chandran

unread,
Dec 9, 2019, 8:09:53 AM12/9/19
to Google Ads API Forum Advisor Prod, adwor...@googlegroups.com
Hi Team,

It is working now and thanks for your timely response. 

Could you please help us to get list of accounts/pages from an MCC account. Please find the following flow for your reference,
  1. Once we can pull the list of accounts from the connected user
  2. Need to get detailed information/ list of all ad account / MCC account from the selected account(From step 1)
We are using Customer services but we are getting all the list of accounts instead of the selected accounts. 

$adWordsServices = new AdWordsServices(); 
$CustomerService = $adWordsServices->get($session, CustomerService::class); 
$customers = $CustomerService->getCustomers([$customerId]);

Could you please let us know how to pull the required information? 

TIA

Regards,

Ravichandran S

Lead PHP Developer

+91-9843390404  |  ra...@socialbeat.in

SocialBeat

Ravi Chandran

unread,
Dec 9, 2019, 8:12:40 AM12/9/19
to AdWords API and Google Ads API Forum
Hi Team,

It is working now and thanks for your timely response. 

Could you please help us to get list of accounts/pages from an MCC account. Please find the following flow for your reference,
  1. Once we can pull the list of accounts from the connected user
  2. Need to get detailed information/ list of all ad account / MCC account from the selected account(From step 1)
We are using Customer services but we are getting all the list of accounts instead of the selected accounts. 

$adWordsServices = new AdWordsServices(); 
$CustomerService = $adWordsServices->get($session, CustomerService::class); 
$customers = $CustomerService->getCustomers([$customerId]);

Could you please let us know how to pull the required information? 

TIA

Google Ads API Forum Advisor Prod

unread,
Dec 9, 2019, 3:18:41 PM12/9/19
to ra...@socialbeat.in, adwor...@googlegroups.com
Hi Ravi, 

The complete list of account under a MCC account can be retrieved using the GetAccountHierarchy code sample by adding the manager account Id in the request header. You will then need to make another API call using the the CustomerService.getCustomers() including the specific account in the request. This will return the customer details. Let me know if you have any further questions. 
Reply all
Reply to author
Forward
0 new messages