Hi Barbara,
Thanks for reaching out to the Google Ads API Forum.
For your question “Is there anyway we could get from this list the manager account ID after logging in using Google OAuth2?”, since you are using the customers:listAccessibleCustomers method, then it is necessary to understand which customers are returned in this type of request.
If you’ve used the customers:listAccessibleCustomers method to list customers accessible to you, then note that the resulting list of customers is based on your OAuth credentials. The request returns a list of all accounts that you are able to act upon directly given your current credentials. This will not necessarily include all accounts within the account hierarchy; rather, it will only include accounts where your authenticated user has been added with admin or other rights in the account.
Since each top-level manager account can branch out to manage client accounts or other manager accounts. Those manager accounts can then branch out to manage more client accounts or other manager accounts, and so on. You can get the account hierarchy of your manager account, by building a Google Ads Query Language statement to query all the child accounts specified by the client_customer field from CustomerClient, and executing it recursively on the sub-manager accounts. You'll be able to check which accounts are directly linked to your manager account and which are indirectly linked through sub-managers. For more information, you may refer to this guide.
Regards,
|
||||||