Page Summary
-
The Google Ads API offers resource-specific services for mutating individual resource types like campaigns.
-
The
GoogleAdsService.Mutateendpoint provides benefits like grouping actions across different resource services and using temporary resource names. -
You can use
GoogleAdsService.Mutateto perform linked operations, such as creating a complete campaign structure in a single request. -
Generally, cross-account mutation is not permitted unless the account is the manager of the client that created the object.
The Google Ads API provides multiple ways to mutate resources depending on your use case:
- Resource service mutates: Each
mutable resource has a dedicated service that executes operations for that
specific resource type. For example, the
Campaignresource uses theCampaignService.MutateCampaignsendpoint for creating, updating, or removing campaigns. - Bulk mutates: The
GoogleAdsService.Mutateendpoint wraps a sequence of mutate operations across multiple resource types (and, in v23 and later, supported action operations such as booking or quoting campaigns) in a single synchronous request. - Asynchronous batch jobs: For
large-scale mutations or long-running workloads,
BatchJobServiceexecutes operations asynchronously without risking synchronous request timeouts. UnlikeGoogleAdsService.Mutate,BatchJobServicealways executes under partial-failure semantics and does not supportvalidate_onlymode or action operations (book_campaigns_operation,quote_campaigns_operation). Because partial failure is always active,BatchJobServicerejects resource operations whose underlying services don't support partial failure (such asCustomerOperation,CampaignConversionGoalOperation,ConversionGoalCampaignConfigOperation,CustomConversionGoalOperation, andCustomerConversionGoalOperation) withMutateError.OPERATION_DOES_NOT_SUPPORT_PARTIAL_FAILURE.
Benefits of bulk mutates
Using GoogleAdsService.Mutate provides the following benefits
(see Mutate best practices for implementation
guidance):
- Grouped actions across different resource services: Whereas individual
resource service calls only accept operations for a single resource type,
GoogleAdsService.Mutatelets you mutate multiple resource types in one call. - Temporary resource names: You can assign negative integer IDs (such as
customers/CUSTOMER_ID/campaigns/-1) to newly created parent entities and reference those temporary IDs in child operations within the same request.
With these capabilities, you can use GoogleAdsService.Mutate to
create an entire campaign hierarchy atomically so that all operations succeed or
fail together, or set partial_failure to true to commit valid operations
independently.