Unable to update headlines and descriptions in ads of type `responsive_search_ad`.

22 views
Skip to first unread message

xiaochuan li

unread,
Feb 24, 2025, 4:17:22 AM2/24/25
to Google Ads API and AdWords API Forum
As follows, I use the following code to update:

```python
ad_group_ad_operation = client.get_type("AdGroupAdOperation")
ad_group_ad = ad_group_ad_operation.update

ad_group_ad.resource_name = ad_group_ad_resource_name

ad_headlines = []
for headline in headlines:
headline_text = headline['text']
if headline['pinned_field'] == 'UNSPECIFIED':
headline_pinned_field = None
else:
headline_pinned_field = client.enums.ServedAssetFieldTypeEnum[headline['pinned_field']]
ad_headlines.append(create_ad_text_asset(client, headline_text, headline_pinned_field))

ad_group_ad.ad.responsive_search_ad.headlines.extend(ad_headlines)

client.copy_from(
ad_group_ad_operation.update_mask,
protobuf_helpers.field_mask(None, ad_group_ad._pb),
)
```

But I got the following response:
```
status {
code: 3
message: "Field \'ad.responsive_search_ad.headlines\' cannot be modified by \'UPDATE\' operation., at mutate_operations[61].ad_group_ad_operation.update.ad.responsive_search_ad.headlines"
details {
type_url: "type.googleapis.com/google.ads.googleads.v18.errors.GoogleAdsFailure"
value: "\n\300\001\n\002\010\013\022SField 'ad.responsive_search_ad.headlines' cannot be modified by 'UPDATE' operation."e\022\025\n\021mutate_operations\030=\022\027\n\025ad_group_ad_operation\022\010\n\006update\022\004\n\002ad\022\026\n\024responsive_search_ad\022\013\n\theadlines"
}
}
```

How do I update the headlines?

Google Ads API Forum Advisor

unread,
Feb 24, 2025, 8:54:30 AM2/24/25
to clixia...@gmail.com, adwor...@googlegroups.com
Hi,

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

The AssetService only supports create operations. Once an asset is uploaded to an advertiser's account, it cannot be changed or removed programmatically. If you try to update an ad using the adGroupAds method you will encounter an IMMUTABLE_FIELD error because it's not possible to update using this method. Note that you cannot update any assets (headlines and descriptions) because the field 'ad' itself is an immutable field which means if you try to update any sub-field under the ad then it will encounter an IMMUTABLE_FIELD error. You must use ad-level operations to manage associations between individual assets and ads. I would recommend you to use the ad method to update the ads using the Google Ads API. However, I am sharing with you the sample request and response logs to update the responsive search ads via the Google Ads API:
Request Body:
==============

POST https://googleads.googleapis.com/v18/customers/{customerId}/ads:mutate?key=[YOUR_API_KEY] HTTP/1.1

developer-token: **********************
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json
Content-Type: application/json

{
  "operations": [
    {
      "update": {
        "resourceName": "customers/{customerId}/ads/{adId}",
        "responsiveSearchAd": {
          "descriptions": [
            {
              "text": "sjdf ejkkejh"
            },
            {
              "text": "gshahd wjwdhuiwuh"
            }
          ],
          "headlines": [
            {
              "text": "esgegb"
            },
            {
              "text": "adhqwjjk"
            },
            {
              "text": "ajddkjae ejadeaj"
            }
          ]
        }
      },
      "updateMask": "responsiveSearchAd.descriptions,responsiveSearchAd.headlines"
    }
  ]
}

Response:
==========

HTTP/1.1 200 
content-encoding: gzip
content-length: 102
content-type: application/json; charset=UTF-8
date: Mon, 24 Feb 2025 13:37:35 GMT
server: ESF
vary: Origin, X-Origin, Referer

{
  "results": [
    {
      "resourceName": "customers/{customerId}/ads/{adId}"
    }
  ]
}
I hope this helps. 
 

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5
[2025-02-24 13:53:54Z GMT] This message is in relation to case "ref:!00D1U01174p.!5004Q02vH3Wx:ref" (ADR-00289501)



Reply all
Reply to author
Forward
0 new messages