“Call to GoogleAdsService.Search failed: Version v[X] is deprecated. ” – Here’s your fix

“Call to GoogleAdsService.Search failed: Version v[X] is deprecated. Requests to this version will be blocked.” 

Here’s a common situation:
You’ve been running a GAds Script for months with zero issues, and then suddenly it decided to just stop working.

The error log shows a message like
“Call to GoogleAdsService.Search failed: Version v11 is deprecated. Requests to this version will be blocked (file script.gs, line 123) ”

or for the older versions:

“Call to GoogleAdsService.Search failed: Version v10 is deprecated. Requests to this version will be blocked (file script.gs, line 123) ”

“Call to GoogleAdsService.Search failed: Version v9 is deprecated. Requests to this version will be blocked (file script.gs, line 123) ”

 

Cause of the problem:

The script is using an outdated version of the API
Most probably the script is using an old version of the Google Ads API that is no longer supported.
This particularly happens when you copy code from the web and the code is already a few years old.

How to fix?

The solution is very easy. You only need to change the API version for the request to the GoogleAds Search Service.

Find the line in the code that contains the search request and specifies the API version for the search query.

The statement in that line _starts_ with a call to the  ‘AdsApp.search’ method.
The second argument in the request contains the API version.

Here’s an example:

var query = "SELECT shared_set.id, shared_criterion.keyword.match_type, shared_criterion.keyword.text FROM shared_criterion";

var result = AdsApp.search(query, {apiVersion: 'v9'});

The search method allows for optional arguments that specify the Google Ads API version to query. Sunsetted versions are not allowed.

Simply remove the optional argument, and you are good to go.

var query = "SELECT shared_set.id, shared_criterion.keyword.match_type, shared_criterion.keyword.text FROM shared_criterion";

var result = AdsApp.search(query);

 

 

Interested in running more scripts?
Join thousands of PPC geeks who already have access:

If the button above isn’t working for you, you can sign up here to get access.