Cannot Create Customer

173 views
Skip to first unread message

Radek Karkut

unread,
Jun 26, 2020, 7:59:37 AM6/26/20
to AdWords API and Google Ads API Forum
Hello there,
I'm working on Google Ads API and my goal is to create ads in behalf of my clients.
I have created oAuth authorisation and it works properly (I have access and refresh token).

It's possible that I misunderstand the principles so please correct me.

1. If I would like to create new Ad for my client I need to create new Customer, right?
2. How can I create new Customer on my client Account visible in my Account Manager?

I'm trying to create new Customer using below tutorial but error occurs:
https://developers.google.com/google-ads/api/docs/account-management/create-account

"message": "User doesn't have permission to access customer. Note: If you're accessing a client customer, the manager's customer id must be set in the 'login-customer-id' header. 

3. How can I use login-customer-id if I didn't create Customer yet?

I'm looking forward for your help guys.
Best Regards.

Google Ads API Forum Advisor Prod

unread,
Jun 26, 2020, 11:12:02 AM6/26/20
to slum...@gmail.com, adwor...@googlegroups.com
Hi Radek,

Thank you for reaching out. If your client already has a Google Ads account, then you should follow these instructions to link that account to yours. If they don't have an existing account, then you should create one on their behalf using the example you shared.

The login-customer-id field should be set to the client customer ID of the manager account (your existing account in this case).

Regards,
Mitchell
Google Ads API Team

ref:_00D1U1174p._5004Q219d4e:ref

Radek Karkut

unread,
Jun 29, 2020, 3:35:58 AM6/29/20
to AdWords API and Google Ads API Forum
Hello, thank you very much for your help.

I'm trying to create new customer using client id 7608615007 (it's my account manager id) and  but below error occurs. Could you tell me why?

Uncaught Google\ApiCore\ApiException: {
    "message": "The caller does not have permission",
    "code": 7,
    "status": "PERMISSION_DENIED",
    "details": [
        {
            "@type": 0,
            "data": "type.googleapis.com\/google.ads.googleads.v3.errors.GoogleAdsFailure"
        },
        {
            "@type": 0,
            "data": [
                {
                    "errorCode": {
                        "authorizationError": "USER_PERMISSION_DENIED"
                    },
                    "message": "User doesn't have permission to access customer. Note: If you're accessing a client customer, the manager's customer id must be set in ApiException.php on line 139


Radek Karkut

unread,
Jun 29, 2020, 4:40:31 AM6/29/20
to AdWords API and Google Ads API Forum
I will give you one update about this issue

I have created Refresh Token using oAuth authorisation for my primary account (slum....@gmail.com) and when I have used it Customer was created properly.
After that I have created Refresh Token using my second google account (ads....@gmail.com) and when I have used it PERMISSION_DENIED error occurred.
On my mind I can create Customer using first account because Manager Account (8322203725) is available on this account. I cannot create Customer on any other google account.
Could you tell me why? Does it matter that 8322203725 is a Test Manager Account?

Google Ads API Forum Advisor Prod

unread,
Jun 29, 2020, 10:40:40 AM6/29/20
to slum...@gmail.com, adwor...@googlegroups.com
Hi Radek,

Thank you for providing that information. The USER_PERMISSION_DENIED error occurs when your OAuth credentials don't have access to the account you're trying to make the call to. I looked at both manager accounts and see that the email slum...@gmail.com is added as a user for both but ads...@gmail.com is not a user in either. This is why you're getting that error when trying to create the new user using the credentials of ads...@gmail.com.

You can check the users of your account by going to Tools & Settings -> Setup -> Access and Security in the Google Ads UI. If you would like to make calls to the account with that email, you must add it as a user.

Radek Karkut

unread,
Jun 30, 2020, 1:40:28 AM6/30/20
to AdWords API and Google Ads API Forum
Hello there, so can you tell me how can I make a call to create new customer on account authorised by oAuth? I have oAuth application and account authorised to this application, why I don't have permission to create new customer?
I'm looking forward for your advice.

Google Ads API Forum Advisor Prod

unread,
Jun 30, 2020, 12:31:54 PM6/30/20
to slum...@gmail.com, adwor...@googlegroups.com
Hi Radek,

You need to add the email address you used to generate the OAuth credentials as a user to your account by following these instructions. Once you accept the invitation from your new email address and see it in the list of users for the account (Tools & Settings -> Setup -> Access and Security), then you can make API calls using those credentials.

As I mentioned, looking in your account I only saw slum...@gmail.com listed as a user. Not ads...@gmail.com.

Radek Karkut

unread,
Jul 1, 2020, 5:17:01 AM7/1/20
to AdWords API and Google Ads API Forum
Hello there,
Unfortunately, I think that we misunderstand.
In our previous conversation you gave me instructions how I can link my individual Google Ads Account to Manager account manually (by sending invitation in Manager Account settings).
My goal is to have access to multiple accounts from my Manager Account like it is described here: https://support.google.com/google-ads/answer/6139186?visit_id=637291791366918653-1144634564&rd=1#MCC_invite.
I would like create ads for my clients and link their account to my Manager Account automatically (in background) and I think it's possible using instructions describes below

I'm trying to create link (in pending status) but something is going wrong, could you take a look in my code?

$customerClientLink = new CustomerClientLink(
[
'client_customer' => new StringValue(
['value' => ResourceNames::forCustomer(8322203725)]
),
'status' => ManagerLinkStatus::PENDING
]);

$customerClientLinkOperation = new CustomerClientLinkOperation();
$customerClientLinkOperation->setCreate($customerClientLink);

$customerClientLinkServiceClient = $this->googleAdsClient->getCustomerClientLinkServiceClient();
$response = $customerClientLinkServiceClient->mutateCustomerClientLink(8322203725, $customerClientLinkOperation);

Error:
"errorCode": {
       "authorizationError": "USER_PERMISSION_DENIED"
}

Google Ads API Forum Advisor Prod

unread,
Jul 1, 2020, 11:29:56 AM7/1/20
to slum...@gmail.com, adwor...@googlegroups.com
Hi Radek,

Can you please share your complete detailed request and response logs for the call via Reply privately to author so I can further investigate the issue? Also, which email address are you using to make this call? You can find information on enabling logging here (log level = NOTICE).

Radek Karkut

unread,
Jul 2, 2020, 4:12:22 AM7/2/20
to AdWords API and Google Ads API Forum
Hi there, thank you very much for your help. I would like to reply privately but this option is inactive. Could you activate it?

Radek Karkut

unread,
Jul 6, 2020, 3:50:49 AM7/6/20
to AdWords API and Google Ads API Forum
Hello there, could you enable Replay privately?
I got stuck right now.

Google Ads API Forum Advisor Prod

unread,
Jul 6, 2020, 11:10:28 AM7/6/20
to slum...@gmail.com, adwor...@googlegroups.com
Hi Radek,

If this is still an issue, please send them directly to googleadsa...@google.com.
Reply all
Reply to author
Forward
0 new messages