Guides
Edit and pause
Updates with updateMask, pausing and re-enabling, changing budget and dates, removing campaigns and reading the serving status.
Pause and re-enable
curl --request POST \
--url https://google-ads.mimicr.dev/v26/customers/2220330728/googleAds:mutate \
--header 'Authorization: Bearer <token>' \
--header 'login-customer-id: 6446154552' \
--header 'Content-Type: application/json' \
--data '{
"mutateOperations": [{
"campaignOperation": {
"update": { "resourceName": "customers/2220330728/campaigns/54542599977", "status": "ENABLED" },
"updateMask": "status"
}
}]
}'status toggles between ENABLED and PAUSED. The same applies to ad groups, ads and keywords.
How updateMask works
- It is a comma-separated list of paths. snake_case and camelCase are both accepted (
end_date_timeorendDateTime); subfields use a dot (network_settings.target_search_network). - Every path in the mask is written: with the value from the body or, if absent from the body, cleared.
- Body fields outside the mask are ignored.
- No
updateMask:fieldMaskError: FIELD_MASK_MISSING. Unknown path:fieldMaskError: FIELD_NOT_FOUND. Immutable field:IMMUTABLE_FIELD. NoresourceName:requestError: RESOURCE_NAME_MISSING.
Budget and dates
{
"mutateOperations": [
{ "campaignBudgetOperation": {
"update": { "resourceName": "customers/2220330728/campaignBudgets/54542599976", "amountMicros": "80000000" },
"updateMask": "amount_micros"
} },
{ "campaignOperation": {
"update": { "resourceName": "customers/2220330728/campaigns/54542599977" },
"updateMask": "end_date_time"
} }
]
}The second operation lists end_date_time in the mask without sending the field: this clears the end date and the campaign runs indefinitely. Changing startDateTime after the campaign has started gives campaignError: CANNOT_MODIFY_START_DATE_IF_ALREADY_STARTED.
On the campaign, the mutable fields are: name, status, campaignBudget, the bidding strategy, networkSettings.*, startDateTime (before it starts), endDateTime, geoTargetTypeSetting.*, trackingUrlTemplate, finalUrlSuffix and containsEuPoliticalAdvertising. advertisingChannelType is immutable.
A budget or status change only affects delivery in the following hours; hours already generated are not recalculated.
Remove
{ "mutateOperations": [{ "campaignOperation": { "remove": "customers/2220330728/campaigns/54542599977" } }] }Removing is permanent: the campaign becomes REMOVED, cannot be re-enabled and an update on it answers mutateError: RESOURCE_NOT_FOUND. It keeps showing up in GAQL with its historical metrics. A non-shared budget is removed along with it. Removing a budget still in use gives campaignBudgetError: CAMPAIGN_BUDGET_IN_USE. Assets have no remove: unlink them with campaignAssetOperation.remove.
Serving status
curl --request POST \
--url https://google-ads.mimicr.dev/v26/customers/2220330728/googleAds:search \
--header 'Authorization: Bearer <token>' \
--header 'login-customer-id: 6446154552' \
--header 'Content-Type: application/json' \
--data '{ "query": "SELECT campaign.status, campaign.serving_status, campaign.primary_status, campaign.primary_status_reasons FROM campaign WHERE campaign.id = 54542599977" }'primaryStatus and servingStatus are computed on read. The first matching row wins:
| Situation | primaryStatus | primaryStatusReasons |
|---|---|---|
| Removed | REMOVED | CAMPAIGN_REMOVED |
| Paused | PAUSED | CAMPAIGN_PAUSED |
| Suspended account or declined payment | NOT_ELIGIBLE | (empty), servingStatus: SUSPENDED |
| End date has passed | ENDED | CAMPAIGN_ENDED |
| Start in the future | PENDING | CAMPAIGN_PENDING |
| Budget removed | MISCONFIGURED | BUDGET_MISCONFIGURED |
| Performance Max without asset groups | NOT_ELIGIBLE | NO_ASSET_GROUPS |
| No ad group, paused ad groups, no keyword, no ad | NOT_ELIGIBLE | NO_AD_GROUPS, AD_GROUPS_PAUSED, NO_KEYWORDS, NO_AD_GROUP_ADS |
| All ads disapproved | NOT_ELIGIBLE | HAS_ADS_DISAPPROVED |
| Most ads under review | PENDING | MOST_ADS_UNDER_REVIEW |
| Some ads disapproved or limited | LIMITED | HAS_ADS_DISAPPROVED, HAS_ADS_LIMITED_BY_POLICY |
| Daily spend at 95% of the budget | LIMITED | BUDGET_CONSTRAINED |
| Smart bidding for less than 7 days | LEARNING | BIDDING_STRATEGY_LEARNING |
| Otherwise | ELIGIBLE | (empty) |
This table is Mimicr's rule; the enum values are Google's.
Concurrent modification
Two mutates on the same campaign at the same time answer 409 databaseError: CONCURRENT_MODIFICATION "Multiple requests were attempting to modify the same resource at once. Retry the request.". Retry with increasing backoff. To test it: [concorrente] in the campaign name or chaos.concurrent_modification.