enable_ai_max = False not working

80 views
Skip to first unread message

GDZ

unread,
Aug 26, 2025, 5:07:26 PM (9 days ago) Aug 26
to Google Ads API and AdWords API Forum
v21, Python, campaign.ai_max_setting.enable_ai_max = False doesn't turn off AI max in search campaign.

GDZ

unread,
Aug 27, 2025, 3:16:08 PM (8 days ago) Aug 27
to Google Ads API and AdWords API Forum
campaign.ai_max_setting.enable_ai_max = True works, but "False" doesn't! Pls fix.

Google Ads API Forum Advisor

unread,
Aug 27, 2025, 10:26:59 PM (8 days ago) Aug 27
to pakh...@gmail.com, adwor...@googlegroups.com

Hi,

Thank you for contacting the Google Ads API support team.

Please note that we have replicated your issue on our end and the functionality seems to be working as expected. In other words, 'campaign.ai_max_setting.enable_ai_max = false' setting is working correctly for us. In order to assist you further, please provide the complete API logs (request and response with request-id and request header) generated on your end without redacting any information and the uncropped UI screenshots of the campaign settings page with the visibility of the “Optimize your campaign with AI Max” setting  before and after setting the ai_max_setting.enable_ai_max = false.

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.

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5
[2025-08-28 02:26:03Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01u5G1i:ref" (ADR-00331072)



GDZ

unread,
Aug 28, 2025, 1:03:15 PM (7 days ago) Aug 28
to Google Ads API and AdWords API Forum
Just sent you debug info. As I said, OFF request goes through just fine but when you check AI Max setting in UI, it still shows ON. 

GDZ

unread,
Aug 28, 2025, 4:14:59 PM (7 days ago) Aug 28
to Google Ads API and AdWords API Forum
Just to confirm, I tried again with ai_max_setting.enable_ai_max = True and it work just fine, AI Max switches to ON in UI.

Google Ads API Forum Advisor

unread,
Aug 28, 2025, 6:24:15 PM (7 days ago) Aug 28
to pakh...@gmail.com, adwor...@googlegroups.com
Hi,

I've reviewed the campaign and noticed that AI Max for Search campaigns has been turned off in the Google Ads UI.

To verify this, please navigate to your account, go to "Campaigns," filter by campaign ID and then click on "Campaign Settings." Under "AI Max for Search campaigns," you will see that it has been disabled.

I hope this helps! Let us know if you face any issues.  

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5

[2025-08-28 22:23:27Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01u5G1i:ref" (ADR-00331072)



GDZ

unread,
Aug 28, 2025, 6:56:19 PM (7 days ago) Aug 28
to Google Ads API and AdWords API Forum
Yes it is off because I turned it off MANUALLY after API request to turn it off did nothing. I tried it with several campaigns and was able to turn AI Max ON via API requests, but turning them OFF is impossible. What is going on?

Google Ads API Forum Advisor

unread,
Aug 29, 2025, 10:45:18 AM (7 days ago) Aug 29
to pakh...@gmail.com, adwor...@googlegroups.com
Hi,

From the logs provided, I see that the request was unable to update the setting because the update_mask was set to "resource_name", which is incorrect. The resource name of the campaign is immutable. The updateMask tells the API which fields you are updating. The paths you specify must be correct and match the fields you are modifying. So, use the updateMask to update the enableAiMax field as shown below:
curl --request POST \
  'https://googleads.googleapis.com/v21/customers/{customer ID}/campaigns:mutate?key=[YOUR_API_KEY]' \
  --header 'developer-token: **********************' \
  --header 'login-customer-id: {login customer ID}' \
  --header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{"operations":[{"update":{"aiMaxSetting":{"enableAiMax":false},
"resourceName":"customers/{customer ID}/campaigns/{campaign ID}"},
"updateMask":"aiMaxSetting.enableAiMax"}]}' \
  --compressed
Retry at your end by making this change and let us know how it goes.
 

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5

[2025-08-29 14:44:34Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01u5G1i:ref" (ADR-00331072)



Message has been deleted
Message has been deleted

GDZ

unread,
Sep 2, 2025, 1:02:38 PM (2 days ago) Sep 2
to Google Ads API and AdWords API Forum
I see your point but that's what logs show:

When enable_ai_max is set to True:

operations {                                                                                                                                                                                                        
  update_mask {                                                                                                                                                                                                    
    paths: "resource_name"                                                                                                                                                                                          
    paths: "ai_max_setting.enable_ai_max"                                                                                                                                                                          
  }                                                                                                                                                                                                                
  update {                                                                                                                                                                                                          
    resource_name: "customers/{CustomerID}/campaigns/{CampaignID}"                                                                                                                                                    
    ai_max_setting {                                                                                                                                                                                                
      enable_ai_max: true                                                                                                                                                                                          
    }                                                                                                                                                                                                              
  }                                                                                                                                                                                                                
}

And all is working fine, setting is updated.



When enable_ai_max is set to False:

operations {                                                                                                                                                                                                        
  update_mask {                                                                                                                                                                                                    
    paths: "resource_name"                                                                                                                                                                                                                                                                                                                                              
  }                                                                                                                                                                                                                
  update {                                                                                                                                                                                                          
    resource_name: "customers/{CustomerID}/campaigns/{CampaignID}"                                                                                                                                                    
    ai_max_setting {                                                                                                                                                                                                
      enable_ai_max: true                                                                                                                                                                                          
    }                                                                                                                                                                                                              
  }                                                                                                                                                                                                                
}

So when set to False, paths: "ai_max_setting.enable_ai_max"  disappears and setting is not updated.


Here's the code I'm using:

campaign_service = self.client.get_service("CampaignService")
campaign_operation = self.client.get_type("CampaignOperation")
campaign = campaign_operation.update

campaign.ai_max_setting.enable_ai_max = True   #False

campaign.resource_name = campaign_service.campaign_path(
str(client_id), str(campaign_id)
)

self.client.copy_from(
campaign_operation.update_mask,
protobuf_helpers.field_mask(None, campaign._pb),
)

campaign_response = campaign_service.mutate_campaigns(
customer_id=str(client_id), operations=[campaign_operation]
)

Google Ads API Forum Advisor

unread,
Sep 2, 2025, 5:54:14 PM (2 days ago) Sep 2
to pakh...@gmail.com, adwor...@googlegroups.com
Hi,

From the provided information, I see that you have provided logs only for enable_ai_max field set to True. Could you please confirm if you had tried updating the enable_ai_max field as suggested earlier. If yes, please provide us with the complete API logs when enable_ai_max field is set to False. This would help us investigate the issue further.

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5

[2025-09-02 21:53:27Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01u5G1i:ref" (ADR-00331072)



Message has been deleted

GDZ

unread,
Sep 2, 2025, 6:28:20 PM (2 days ago) Sep 2
to Google Ads API and AdWords API Forum
I just sent both. As you can see if request contains "true" setting, then update mask contains "ai_max_setting.enable_ai_max".
If request contains "false" setting, then update mask is missing "ai_max_setting.enable_ai_max".
Reply all
Reply to author
Forward
0 new messages