Google Ads API REQUESTED_METRICS_FOR_MANAGER"

1,224 views
Skip to first unread message

Sebastian Iskra

unread,
Jul 14, 2022, 11:03:48 AM7/14/22
to Google Ads API and AdWords API Forum
Hi everyone,

with OAuth2 Playground i've been trying to send a POST request to access campaign data in a google ads test account (test account access), but always have been receiving the status message "REQUESTED_METRICS_FOR_MANAGER". 

I tried to adjust the Request URI, switch manager customer id to account customer id or added other header without any result. 
What do i need to change in the request to access account level and campaign level data?
Do i need to add the test account credentials to the cloud project?

Here is the full request & response:

POST /v11/customers/39xxxx/googleAds:searchStream HTTP/1.1 Host: googleads.googleapis.com Content-length: 381 Manager-customer-id: xxxxx Customer-id: xxxxx Developer-token: xxxxx Content-type: application/json Authorization: Bearer ya29xxxxxx
{
"query": "SELECT campaign.name,
  campaign_budget.amount_micros,
  campaign.status,
  campaign.optimization_score,
  campaign.advertising_channel_type,
  metrics.clicks,
  metrics.impressions,
  metrics.ctr,
  metrics.average_cpc,
  metrics.cost_micros,
  campaign.bidding_strategy_type
FROM campaign
WHERE segments.date DURING LAST_7_DAYS
  AND campaign.status != 'REMOVED'"
}

HTTP/1.1 400 Bad Request Content-length: 637 X-xss-protection: 0 X-content-type-options: nosniff Transfer-encoding: chunked Request-id: lOAGC-ddlL5Ve5mA_GhaPQ Vary: Origin, X-Origin, Referer Server: ESF -content-encoding: gzip Cache-control: private Date: Thu, 14 Jul 2022 13:59:33 GMT X-frame-options: SAMEORIGIN Alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43" Content-type: application/json; charset=UTF-8[
  {
    "error": {
      "status": "INVALID_ARGUMENT",
      "message": "Request contains an invalid argument.",
      "code": 400,
      "details": [
        {
          "errors": [
            {
              "errorCode": {
                "queryError": "REQUESTED_METRICS_FOR_MANAGER"
              },
              "message": "Metrics cannot be requested for a manager account. To retrieve metrics, issue separate requests against each client account under the manager account."
            }
          ],
          "@type": "type.googleapis.com/google.ads.googleads.v11.errors.GoogleAdsFailure",
          "requestId": "lOAGC-ddlL5Ve5mA_GhaPQ"
        }
      ]
    }
  }
]

Thanks 
Sebastian

Sebastian

unread,
Jul 14, 2022, 11:57:49 AM7/14/22
to Google Ads API and AdWords API Forum
The developer token used is from the main account (not test account). The email used with google cloud and the main google ads account has full access to the test account, which was created under a new e-mail. 

I also tried adding linked-customer-id in the header with the subaccount of test account with the following result 

HTTP/1.1 403 Forbidden Content-length: 735 X-xss-protection: 0 X-content-type-options: nosniff Transfer-encoding: chunked Request-id: BOHIrkVbrCFXtb28rGTdSA Vary: Origin, X-Origin, Referer Server: ESF -content-encoding: gzip Cache-control: private Date: Thu, 14 Jul 2022 15:50:06 GMT X-frame-options: SAMEORIGIN Alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43" Content-type: application/json; charset=UTF-8[
  {
    "error": {
      "status": "PERMISSION_DENIED",
      "message": "The caller does not have permission",
      "code": 403,
      "details": [
        {
          "errors": [
            {
              "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 the 'login-customer-id' header. See https://developers.google.com/google-ads/api/docs/concepts/call-structure#cid"
            }
          ],
          "@type": "type.googleapis.com/google.ads.googleads.v11.errors.GoogleAdsFailure",
          "requestId": "BOHIrkVbrCFXtb28rGTdSA"
        }
      ]
    }
  }
]

The manager customer id is already set under the header login-customer-id. 
OAuth 2.0 Playground is connected to the test account email when configuring the POST request. 
Not sure if i miss any header besides the mentioned ones?

Google Ads API Forum Advisor

unread,
Jul 14, 2022, 2:53:58 PM7/14/22
to sebastia...@gmail.com, adwor...@googlegroups.com
Hi Sebastian,

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

With regards to your concern, it seems that you've encountered the USER_PERMISSION_DENIED error. The authorized customer does not have access to the operating customer. The common cause of this is when authenticating as a user with access to a manager account but not specifying login-customer-id in the request.

To prevent this kind of error, I would suggest specifying the login-customer-id as the manager account ID without hyphens (-). That being said, you will need to ensure that the user / email address you used to generate the credentials indeed has access to the account in your request. If the user / email address has access or is associated with the MCC / manager account, you will need to specify the MCC / manager account's ID without hyphens (-) as the value of the login-customer-id field. If the issue still persists.

To investigate the issue further, could you please provide the complete request and response logs, with the request-id generated on your end along with the email address used to generate the OAuth2 credentials, so that our team will investigate this problem.

Thanks,
Google Logo
Nirmitabahen Gaurav
Google Ads API Team
 


ref:_00D1U1174p._5004Q2cW6XK:ref

Google Ads API Forum Advisor

unread,
Jul 14, 2022, 2:55:23 PM7/14/22
to sebastia...@gmail.com, adwor...@googlegroups.com
Hi Sebastian,

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

You can provide it via Reply privately to author option. If this option is not available, you may send the details directly to our googleadsa...@google.com alias instead. 
Reply all
Reply to author
Forward
0 new messages