Retrieving the manager id to use with login-customer-id

38 views
Skip to first unread message

Olivier B

unread,
Oct 1, 2024, 7:12:23 AM10/1/24
to Google Ads API and AdWords API Forum
Hello,

We're using Google Ads API in our app.

First, the manager account owner starts the OAuth process, then a list of managed accounts is displayed to them, then they select the managed account to use for conversions queries using this C# code :

                var client = new GoogleAdsClient(config);
                var service = client.GetService(Services.V17.ConversionUploadService);

                var searchService = client.GetService(Services.V17.GoogleAdsService);
                SearchGoogleAdsRequest request = new SearchGoogleAdsRequest()
                {
                    Query = "SELECT conversion_action.id FROM conversion_action WHERE conversion_action.name = '" + convs.First().Eventname + "'",
                    CustomerId = customerId.ToString()
                };


But this queries raises an exception because the user has no permission. This is because we provide the managed account id as login-customer-id. However, providing it manually at debug time allows the query to complete.

My question is, how can we retrieve the corresponding manager account id to the selected customer id so that the query succeeds ?

I tried many things from the docs but without success. It seems that it's not possible to retrieve the manager id using any query based on customer id, is it ?

Best,
Olivier

Google Ads API Forum Advisor

unread,
Oct 1, 2024, 1:03:03 PM10/1/24
to adwor...@googlegroups.com
Hi Olivier,

Thank you for reaching out to the Google Ads API support team.

In order to find the manager account, you can login into your Google Ads account then go to the Access & security -> Manager tab. You can see the manager account. 

The USER_PERMISSION_DENIED authorization error, it means the user doesn't have permission to access the customer. According to the documentation, if you're accessing the customer, please specify the login-customer-id as the manager account ID without hyphens (-). Also, kindly check if you have the correct access level to the Google Ads account that you are accessing. 

 
This message is in relation to case "ref:!00D1U01174p.!5004Q02vGbaJ:ref" (ADR-00270226)

Thanks,
 
Google Logo Google Ads API Team





 

Reply all
Reply to author
Forward
0 new messages