We are using Google ads API and we are getting the refresh_token and access_token from the oauthLibrary.

Now due to some reason (Majorly cause we are using JavaScript and there's no library for JavaScript officially from Google) we are relying on the REST API.

I want to fetch a list of Accounts attached to the the given access token. (no matter manager or not Manager) I just need the list.

I have tried the following endpoint

https://googleads.googleapis.com/v1/customers:listAccessibleCustomers

But I am getting 404 Not found in that, So I think it is discontinued, Any idea how I can fetch the list through REST_API.

I am using google-ads-api. My goal is to get impressions and clicks for specific campaign. These are the things I have done.

  1. created google service account
  2. Downloaded google-ads-library from github
  3. Added clientid , secretid, refresh token to my adsapi.ini file.

When I run the code it gives me error .

Google\ApiCore\ApiException { "message": "The caller does not have permission", "code": 7, "status": "PERMISSION_DENIED", "details": [ { "@type": "type.googleapis.com/google.ads.googleads.v9.errors.GoogleAdsFailure", "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" } ], "requestId": "pKHgfIr99F5XApaPFBnrLQ" } ] }

my adsapi.ini

[GOOGLE_ADS] ; Required Google Ads properties. name = "Google Ads" developerToken = "*****-*******_*" ; Optional. Set a friendly application name identifier. userAgent = "Scraper" ; Optional additional AdWords API settings. ; endpoint = "https://adwords.google.com/" ; isPartialFailure = false ; Optional setting for utility usage tracking in the user agent in requests. ; Defaults to true. ; includeUtilitiesInUserAgent = true [ADWORDS_REPORTING] ; Optional reporting settings. ; isSkipReportHeader = false ; isSkipColumnHeader = false ; isSkipReportSummary = false ; isUseRawEnumValues = false [OAUTH2] ; Required OAuth2 credentials. Uncomment and fill in the values for the ; appropriate flow based on your use case. See the README for guidance: ; https://github.com/googleads/googleads-php-lib/blob/master/README.md#getting-started ; For installed application or web application flow. clientId = "**********************" clientSecret = "********************" refreshToken = "***********************"  For service account flow. ; jsonKeyFilePath = "INSERT_ABSOLUTE_PATH_TO_OAUTH2_JSON_KEY_FILE_HERE" ; scopes = "https://www.googleapis.com/auth/adwords" ; impersonatedEmail = "INSERT_EMAIL_OF_ACCOUNT_TO_IMPERSONATE_HERE" [SOAP] ; Optional SOAP settings. See SoapSettingsBuilder.php for more information. ; compressionLevel = <COMPRESSION_LEVEL> ; wsdlCache = <WSDL_CACHE> [PROXY] ; Optional proxy settings to be used by SOAP requests. ; host = "<HOST>" ; port = <PORT> ; user = "<USER>" ; password = "<PASSWORD>" [LOGGING] ; Optional logging settings. ; soapLogFilePath = "/soap.log" ; soapLogLevel = "INFO" ; reportDownloaderLogFilePath = "path/to/your/report-downloader.log" ; reportDownloaderLogLevel = "INFO" ; batchJobsUtilLogFilePath = "path/to/your/bjutil.log" ; batchJobsUtilLogLevel = "INFO" 

I can't seem to figure out why my code isn't returning ads with a specific labels and need help understanding where I went wrong with my code. I am iterating through the ad groups that have a specific label "AUTOENABLE" and then iterating through each ad with the same label but also checking on another script the URL endpoint.

  adCount: 0,   adsEnabled: 0,   adsDisabled: 0,   adsSetEnabled: [],   adsSetDisabled: [] }; function adsTest() {         var ag_iter = AdWordsApp.labels().withCondition("Name = AUTOENABLE").get();      if(ag_iter.totalNumEntities() < 1){     Logger.log("ERROR: No AUTOENABLE label found in AdGroup");     return;            // Iterating through all Ad groups to work individually     while (ag_iter.hasNext()) {     // Getting the ad group and printing it's name     var ag = ag_iter.next();     Logger.log(ag.getName())                   // Taking an iterator from all Ads inside Ad Group     var ad_iter = ag.ads().withCondition("LabelNames = AUTOENABLE").get();     if(ad_iter.totalNumEntities() < 1){     Logger.log("ERROR: No AUTOENABLE label found in Ads.");     return;   }     while(ad_iter.hasNext()){       var ad_iter = ads.next();       checkAd(ad);     }    }   }       report(); } function report(){     Logger.log(stats.adCount + " ads checked");     Logger.log(stats.adsEnabled + " ads are enabled");     Logger.log(stats.adsDisabled + " ads are disabled");     Logger.log((stats.adsSetDisabled.length + stats.adsSetEnabled.length) + " ads modified");     if(stats.adsSetEnabled.length > 0){       Logger.log("Changed to enabled:");       stats.adsSetEnabled.forEach(adLog);     }     if(stats.adsSetDisabled.length > 0){       Logger.log("\nChanged to disabled:");       stats.adsSetDisabled.forEach(adLog);     } } 

Since Google is going to have a new API after April, some of existing reports/metrics will be unavailable such as

  1. Missing the whole CRITERIA_PERFORMANCE_REPORT
  2. Missing CriteriaId in CLICK_PERFORMANCE_REPORT

However, some of the metrics are quite import for existing reports... May I ask if there is any way to get the old metrics in the new Google API?

I have created my service account, following the Google documentation as best I can. I created a JSON Key File and have used it successfully to create and refresh my access token, but when I try to call the Google Ads API using that access token I get a 401 with the message "User in the cookie is not a valid Ads user."

I am using a PHP cURL request, not the Google Client library.

My suspicion is that I have something set up incorrectly somewhere between the Master Ad account, the service account and the project in the Google Cloud Console, but I am finding the documentation confusing and unhelpful.

I submitted a question to the Google Ads API google group, and the support person said that my setup looked OK, but also admitted that he cannot see all of it from his end.

I have created the following pieces of the puzzle:
Google Ads Master Account
Developer Token
Project in Google Cloud Console
Service Account in Project
Private Key for Service Account
Set email of Master Ads Account to role of Owner of Service Account
Enabled Domain-Wide Delegation for the Service Account with scope "https://www.googleapis.com/auth/adwords"
Requested and received Access Token with the private key in the JSON file

Please let me know what extra details I should provide to get my issue resolved. Thanks in advance.