How do I link a client account to a MCC account using the API

161 views
Skip to first unread message

Dominik Paasche

unread,
Mar 5, 2020, 8:22:48 AM3/5/20
to AdWords API and Google Ads API Forum
Hi,

I want to implement a web workflow to link a customers ad account to our manager account in order to be able to manage his ads and have consistent access to reports etc.

So far I created a test MCC account and a test client account - which has been pretty adventurous already because the test client can only be created using the api due to web interface problems?! https://groups.google.com/forum/#!topic/adwords-api/9YqIOq9gdJU.

Afterwards I unlinked the test client acc from the Test MCC account.

Whats the way to go to fetch the customers ad account and request access?

Right now I tried creating a OAuth2 using the ad manager scope "https://www.googleapis.com/auth/dfp" and authorized the app with the google acc owning the test client Account. But now I am stuck. I cannot get the AccountHierarchy of the google acc I authorized the app with - is this because the app isn't approved yet and the account isn't part of my app's google account?

Is it even possible to realize what I want?


Google Ads API Forum Advisor Prod

unread,
Mar 5, 2020, 3:10:31 PM3/5/20
to d.pa...@gmail.com, adwor...@googlegroups.com

Hello Dominik,

Thank you for reaching out. Could you please confirm if you are looking to fetch the customer within your MCC account and apply for access for these customer accounts via API? If my understanding is correct, you could use ManagedCustomerService to get the account hierarchy under your manager account. Please refer to the complete code sample available here. Also, refer to this guide for linking your manager account to client customer account using API. For your concern related to applying the access for your customer account, you might find this guide useful to generate the OAuth2 credentials via API. Please note, you need to authorize using the AdWords scope to make calls via AdWords API. Let us know if you need any additional information.

Regards,
Nikisha Patel, Google Ads API Team



ref:_00D1U1174p._5001UXUBSu:ref

Dom

unread,
Mar 5, 2020, 6:44:52 PM3/5/20
to AdWords API and Google Ads API Forum
Hello Nikisha and thank you for your quick reply,

unfortunately this is not the usecase I have. We are an agency and we want to create/edit ads and reports on behalf of our clients. But in the first place we don't know our clients ad account id. So whats the easiest way to go to make those users have their ad accounts linked to our manager acc? 

Basically I tried to realize it like this:

1. Request adwords scope oauth2 accesstoken for the user // got this working
2. Fetch his account hierarchy to get a list of his ad accounts. // got a permission error for the user - probably because I only have a test developer token and I used a new google acc I transfered ownership of a test client acc to?
3. Make the user choose which ad account he wants us to have access to
4. Send an invitation to the ad account to be managed be our mcc
5. Have permanent access to the acc.

Is this realistic? 

Best regards

Google Ads API Forum Advisor Prod

unread,
Mar 6, 2020, 3:12:17 PM3/6/20
to d.pa...@gmail.com, adwor...@googlegroups.com

Hello Dominik,

Thank you for clarifying your requirements better. With regards to your concerns, the client accounts must be linked to your MCC account(manager). Linking a manager and client account allows the manager account to make requests on behalf of its client accounts. If you want to perform this operation via API, the manager account must extend an invitation to the client account and the client must accept the invitation. However, as you mentioned, you do not have client customer id of the client accounts to extend the invitation, that being said, you need to get the account id details from the clients to extend an invitation. Please find my response on the steps followed on your end.

  • Fetch his account hierarchy to get a list of his ad accounts: It is not possible to fetch the account hierarchy of their accounts as you are not authenticated to make calls against their account.

  •  Send an invitation to the Ads account to be managed by our MCC: You can refer to this guide to send an invitation to their account using API to link them under your manager account and access the data within their account to create and edit ads performance report.

Alex Mmz

unread,
Apr 1, 2020, 1:12:49 PM4/1/20
to AdWords API and Google Ads API Forum
Hi Nikisha,

I use this approach successfully for all new accounts.
However, when there is already an invitation with status CANCELLED or INACTIVE, I can't mutate its status to PENDING in order to restart the linking process (I get an invalid value error for the status property).

Is it impossible to restart the process in such cases?

Thanks,
Alex

Google Ads API Forum Advisor Prod

unread,
Apr 1, 2020, 4:46:20 PM4/1/20
to alma...@gmail.com, adwor...@googlegroups.com
Hi Alex,

I will be responding on behalf of my colleague Nikisha as she is not currently available. As explained here, only pending invitations will be received from the ManagedCustomerService call. In your situation, you should send a new invitation from the manager account by following the instructions here and accept that request from the client account.

Regards,
Mitchell

Alex Mmz

unread,
Apr 1, 2020, 5:42:30 PM4/1/20
to AdWords API and Google Ads API Forum
Hi Mitchell,

I forgot to mention that I'm using the new google ads api, apologies about that. However, I follow the exact process and it works great with new accounts. My scenario is as follows

1) The manager unlinks a client by setting the state of the Customer Client Link to 'INACTIVE'
2) The manager wants to re-link the same client, checks if there is already a customer client  link and finds the inactive one

- Trying to mutate the existing CustomerClientLink to 'PENDING' fails with
{
  "StatusCode": 3,
  "Details": "Request contains an invalid argument.",
  "RequestId": "NBFq6ewcP6qm-F0wW2m0yg",
  "Failure": {
    "errors": [
      {
        "errorCode": {
          "fieldError": "INVALID_VALUE"
        },
        "message": "The field's value is invalid.",
        "trigger": {
          "int64Value": "3"
        },
        "location": {
          "fieldPathElements": [
            {
              "fieldName": "operation"
            },
            {
              "fieldName": "update"
            },
            {
              "fieldName": "status"
            }
          ]
        }
      }
    ]
  }
}


- Trying to create a new CustomerClientLink with "PENDING" state fails with
{
  "StatusCode": 3,
  "Details": "Request contains an invalid argument.",
  "RequestId": "GnFZoIlG0fNNCg3FaGkD4g",
  "Failure": {
    "errors": [
      {
        "errorCode": {
          "customerClientLinkError": "CLIENT_ALREADY_MANAGED_IN_HIERARCHY"
        },
        "message": "The client sending the invitation already has a manager.",
        "trigger": {
          "stringValue": ""
        },
        "location": {
          "fieldPathElements": [
            {
              "fieldName": "operation"
            }
          ]
        }
      }
    ]
  }
}

Google Ads API Forum Advisor Prod

unread,
Apr 2, 2020, 10:16:43 AM4/2/20
to alma...@gmail.com, adwor...@googlegroups.com
Hi Alex,

Can you please share the client customer IDs of the accounts along withe the request logs when you're trying to create a new link via Reply privately to author? I am unable to replicate this issue. If you're trying to link a manager account to another manager account, make sure the account doesn't already have a separate manager. As explained here, manager accounts can only have 1 direct manager account above them.
Reply all
Reply to author
Forward
0 new messages