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]
)
On Friday, August 29, 2025 at 10:45:18 AM UTC-4 Google Ads API Forum 
Advisor wrote:

> 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,
>   
> [image: Google Logo] Google Ads API Team 
> Feedback
> How was our support today? 
>
> [image: rating1] 
> <https://docs.google.com/forms/d/e/1FAIpQLSeRhIg5VeThVmbcD0c5DTWTDjmpJuSktN8vFelEL7_KV_Orbg/viewform?usp=pp_url&entry.141427034=1&entry.295079254=500Ht00001u5G1iIAE>
>   
>   [image: rating2] 
> <https://docs.google.com/forms/d/e/1FAIpQLSeRhIg5VeThVmbcD0c5DTWTDjmpJuSktN8vFelEL7_KV_Orbg/viewform?usp=pp_url&entry.141427034=2&entry.295079254=500Ht00001u5G1iIAE>
>   
>   [image: rating3] 
> <https://docs.google.com/forms/d/e/1FAIpQLSeRhIg5VeThVmbcD0c5DTWTDjmpJuSktN8vFelEL7_KV_Orbg/viewform?usp=pp_url&entry.141427034=3&entry.295079254=500Ht00001u5G1iIAE>
>   
>   [image: rating4] 
> <https://docs.google.com/forms/d/e/1FAIpQLSeRhIg5VeThVmbcD0c5DTWTDjmpJuSktN8vFelEL7_KV_Orbg/viewform?usp=pp_url&entry.141427034=4&entry.295079254=500Ht00001u5G1iIAE>
>   
>   [image: rating5] 
> <https://docs.google.com/forms/d/e/1FAIpQLSeRhIg5VeThVmbcD0c5DTWTDjmpJuSktN8vFelEL7_KV_Orbg/viewform?usp=pp_url&entry.141427034=5&entry.295079254=500Ht00001u5G1iIAE>
>
> [2025-08-29 14:44:34Z GMT] This message is in relation to case 
> "ref:!00D1U01174p.!500Ht01u5G1i:ref" (ADR-00331072)
>
>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/adwords-api/abe2b1dd-97e3-4d15-96d4-e2c3f99ccd88n%40googlegroups.com.
  • en... GDZ
    • ... GDZ
      • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
        • ... GDZ
          • ... GDZ
            • ... GDZ
              • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
                • ... GDZ
                • ... GDZ
                • ... GDZ
                • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
                • ... GDZ

Reply via email to