INVALID_CUSTOMER_ID when accepting a manager link request

323 views
Skip to first unread message

Ethan Crabb

unread,
Feb 20, 2024, 5:39:02 PM2/20/24
to Google Ads API and AdWords API Forum
Hi there.
I'm getting this response when accepting a manager link request using https://googleads.googleapis.com/v15/customers/${customer}/customerManagerLinks:mutate

Invalid customer ID 'CUSTOMER_ID'.

The customer ID in question does not include hyphens, and comes directly from the Google Ads API itself.

Our flow is the following:
- Create an access link authenticating as the manager account
- Accept the access link as the client account using the generated resourceName

Here is the code:
await axios.post(`https://googleads.googleapis.com/v15/customers/${agencyCustomerID}/customerClientLinks:mutate`, {
operation: {
create: {
status: "PENDING",
clientCustomer: `customers/${customer}`,
}
}
}, {
headers: {
"developer-token": process.env.GOOGLE_ADS_DEVELOPER_TOKEN,
Authorization: `Bearer ${accessToken}`
}
}).then((res) => {
// Now the link has been created, we'll accept it acting as the client https://developers.google.com/google-ads/api/rest/reference/rest/v15/customers.customerManagerLinks/mutate
const linkResourceName = res.data.result.resourceName
axios.post(`https://googleads.googleapis.com/v15/customers/${customer}/customerManagerLinks:mutate`, {
operations: [
{
update: {
resourceName: linkResourceName,
status: "ACTIVE"
},
updateMask: "resourceName,status"
}
]
}, {
headers: {
"developer-token": process.env.GOOGLE_ADS_DEVELOPER_TOKEN,
Authorization: `Bearer ${accessToken}`
}
}).then(() => {
...
}).catch(err => {
// Error happens here
...
})
}).catch(err => {
...
})

Here is the full error message:
{
  error: {
    code: 400,
    message: 'Request contains an invalid argument.',
    status: 'INVALID_ARGUMENT',
    details: [
      {
        '@type': 'type.googleapis.com/google.ads.googleads.v15.errors.GoogleAdsFailure',
        errors: [
          {
            errorCode: { requestError: 'INVALID_CUSTOMER_ID' },
            message: "Invalid customer ID 'CUSTOMER_ID'.",
            location: {
              fieldPathElements: [
                { fieldName: 'operations', index: 0 },
                { fieldName: 'update' },
                { fieldName: 'resource_name' }
              ]
            }
          }
        ],
        requestId: 'TtHTpWOPj-JKGQnjRq5y2w'
      }
    ]
  }
}

Google Ads API Forum Advisor

unread,
Feb 20, 2024, 5:42:58 PM2/20/24
to cybert...@gmail.com, adwor...@googlegroups.com
Hi,

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

By reviewing your concern, I can see that you’ve encountered an INVALID_CUSTOMER_ID error. When making an API call, you must use a client account ID as the customer Id in your request, while your login-customer-id is your manager account, if you're authenticating as a user that has access to our manager account. This error is also encountered if the API request sends to pause Ads from one account that belonged to a different account.

You may check this guide for the common structure of all API calls, this documentation as you will see here where the customer ID is located and this article as it will show you how to locate your customer ID.

However, If you are still facing the issue, please provide us the following information :

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java, .Net, PHP, Python, Ruby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

You can send the details via Reply privately to the author option, or direct private reply to this email.

This message is in relation to case "ref:!00D1U01174p.!5004Q02rzIgu:ref"

Thanks,
 
Google Logo Google Ads API Team


Ethan Crabb

unread,
Feb 20, 2024, 9:48:03 PM2/20/24
to Google Ads API and AdWords API Forum
Hi,

Thanks for your response.
I responded but my message didn't seem to post so I'll write it out again.

I'm a little confused as to what you mean by "When making an API call, you must use a client account ID as the customer Id in your request". Which request of the 2 are you referring to? 

Our current flow is:
- Create a link authenticating as the manager account
- Change the status of the link from PENDING to ACTIVE authenticating as the client account

For context, the client account is the account that is being added to the manager account.
In the code, the customer variable represents the ID of the client account.
And the agencyCustomerID variable represents the ID of the manager account.

Please let me know what we need to change to get this working.

Thanks a lot, Ethan

Ethan Crabb

unread,
Feb 20, 2024, 9:48:07 PM2/20/24
to Google Ads API and AdWords API Forum
Hi,
Thanks for your response.

I'm still a little confused as to what you mean by using the "client account ID as the customer Id in your request".
Which of the 2 requests are you referring to?

As to your point about authenticating.
For the first request (creating the pending link), we authenticate as the manager account.
For the second request (changing the status from PENDING to ACTIVE), we authenticate as the client account (the account being added to the manager account).

For context, the customer variable is the client account ID, and the agencyCustomerID is the manager account ID.

Is this implementation correct?

Thanks again, Ethan


On Tuesday 20 February 2024 at 22:42:58 UTC Google Ads API Forum Advisor wrote:

Google Ads API Forum Advisor

unread,
Feb 21, 2024, 2:01:00 AM2/21/24
to cybert...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for getting back to us.

Yes, you are correct the customer Id is the client Id and it needs to be associated with the Manger account Id. Login-customer-id refers to the Manager account Id. In order to investigate your issue further, kindly provide us with the earlier requested complete API logs (request and response with request-id and request header) generated at your end.


If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java, .Net, PHP, Python, Ruby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.
 

Ethan Crabb

unread,
Feb 21, 2024, 6:56:41 PM2/21/24
to Google Ads API and AdWords API Forum
Thanks for your response.
I've sent over the requested details privately.

Thanks, Ethan 

Google Ads API Forum Advisor

unread,
Feb 22, 2024, 2:07:36 AM2/22/24
to cybert...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for getting back to us.

I would like to inform you that you have provided us with the request and response headers only which are not sufficient to investigate the issue. So, I request you to send us the request and response body along with the visible Manager ID and Client ID to assist you further.

You can send the details via Reply privately to the author option or a direct private reply to this email.
Reply all
Reply to author
Forward
0 new messages