Authorization error when adding keyword via MutateAdGroup

88 views
Skip to first unread message

Scott Vaillancourt

unread,
Jan 20, 2022, 6:17:14 PM1/20/22
to Google Ads API and AdWords API Forum
I'm attempting to add a negative keyword to a specific ad group but am receiving an authorization error ("The user does not have permission to perform this action on the resource or call a method."). I'm able to add keywords via Google Ads (ads.google.com). I'm also able to successfully retrieve information for this same account via API's, so the read functionality seems OK. I'm not sure if I need to regenerate credentials now that I'm doing updates or if there's something else going on. Any guidance or suggestions would be appreciated. Thanks.

Here's the code I'm using to perform the update.

    ad_group_service = client.get_service('AdGroupService', version='v9')
    ad_group_criterion_service = client.get_service('AdGroupCriterionService', version='v9')

    ad_group_criterion_operation = client.get_type("AdGroupCriterionOperation")
    ad_group_criterion = ad_group_criterion_operation.create

    ad_group_criterion.ad_group = ad_group_service.ad_group_path(cid, adgroupid)
    ad_group_criterion.status = client.enums.AdGroupCriterionStatusEnum.ENABLED
    ad_group_criterion.keyword.text = keyword
    ad_group_criterion.keyword.match_type = (client.enums.KeywordMatchTypeEnum.EXACT)
    ad_group_criterion.negative = True

    response = ad_group_criterion_service.mutate_ad_group_criteria(customer_id=cid, operations=[ad_group_criterion_operation])

Here's a portion of the traceback showing the error.

GoogleAdsException: (<_InactiveRpcError of RPC that terminated with:

status = StatusCode.PERMISSION_DENIED

details = "The caller does not have permission"

debug_error_string = "{"created":"@1642719263.522809000","description":"Error received from peer ipv6:[2607:f8b0:4009:819::200a]:443","file":"src/core/lib/surface/call.cc","file_line":1075,"grpc_message":"The caller does not have permission","grpc_status":7}"

>, <_InactiveRpcError of RPC that terminated with:

status = StatusCode.PERMISSION_DENIED

details = "The caller does not have permission"

debug_error_string = "{"created":"@1642719263.522809000","description":"Error received from peer ipv6:[2607:f8b0:4009:819::200a]:443","file":"src/core/lib/surface/call.cc","file_line":1075,"grpc_message":"The caller does not have permission","grpc_status":7}"

>, errors {

  error_code {

    authorization_error: ACTION_NOT_PERMITTED

  }

  message: "The user does not have permission to perform this action on the resource or call a method."

}

request_id: "hxiFkYimaxjxI38nUqPAxw"

, 'hxiFkYimaxjxI38nUqPAxw')

Google Ads API Forum Advisor

unread,
Jan 21, 2022, 2:42:36 AM1/21/22
to sc...@lionhurst.com, adwor...@googlegroups.com

Hi,

Thanks for reaching out to the Google Ads API Forum.

For your statement “I'm also able to successfully retrieve information for this same account via API's, so the read functionality seems OK. ”, could you please double check if you do have Mutate request access enabled to the customer Id used in your API request? If you do have already, you may provide us with the complete request and response logs with the request-id generated, so our team can better check.

For the Python library, logging can be enabled by navigating to the Client libraries > Your client library (select Python) > Logging documentation, which you can access from this link. You may then send the requested information via the Reply privately to author option. If this option is not available, you may send the details directly to our googleadsa...@google.com alias instead.

Regards,

Google Logo
Yasar
Google Ads API Team
 


ref:_00D1U1174p._5004Q2VO4Ry:ref
Reply all
Reply to author
Forward
0 new messages