Guides
Campaigns

Create a campaign

Publish a complete search campaign in a single atomic googleAds:mutate, with temporary ids.

A search campaign is made of several resources: budget, campaign, targeting criteria, ad group, keywords and ads. The recommended way to create them is a single googleAds:mutate, in which each operation references the previous ones through negative temporary ids. If any operation is invalid, nothing is applied.

The request

bash
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 @campanha.json
json
{
  "mutateOperations": [
    { "campaignBudgetOperation": { "create": {
      "resourceName": "customers/2220330728/campaignBudgets/-1",
      "name": "Campanha Goiânia · orçamento",
      "amountMicros": "50000000",
      "deliveryMethod": "STANDARD",
      "explicitlyShared": false
    } } },
    { "campaignOperation": { "create": {
      "resourceName": "customers/2220330728/campaigns/-2",
      "name": "Campanha Goiânia",
      "status": "PAUSED",
      "advertisingChannelType": "SEARCH",
      "campaignBudget": "customers/2220330728/campaignBudgets/-1",
      "maximizeConversions": {},
      "networkSettings": { "targetGoogleSearch": true, "targetSearchNetwork": true, "targetContentNetwork": false },
      "endDateTime": "2026-12-06 23:59:59",
      "geoTargetTypeSetting": { "positiveGeoTargetType": "PRESENCE" },
      "containsEuPoliticalAdvertising": "DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING"
    } } },
    { "campaignCriterionOperation": { "create": { "campaign": "customers/2220330728/campaigns/-2", "location": { "geoTargetConstant": "geoTargetConstants/1001552" } } } },
    { "campaignCriterionOperation": { "create": { "campaign": "customers/2220330728/campaigns/-2", "language": { "languageConstant": "languageConstants/1014" } } } },
    { "adGroupOperation": { "create": {
      "resourceName": "customers/2220330728/adGroups/-3",
      "name": "Campanha Goiânia · grupo",
      "campaign": "customers/2220330728/campaigns/-2",
      "status": "ENABLED",
      "type": "SEARCH_STANDARD"
    } } },
    { "adGroupCriterionOperation": { "create": { "adGroup": "customers/2220330728/adGroups/-3", "status": "ENABLED", "keyword": { "text": "gás de cozinha", "matchType": "PHRASE" } } } },
    { "adGroupAdOperation": { "create": {
      "adGroup": "customers/2220330728/adGroups/-3",
      "status": "ENABLED",
      "ad": {
        "finalUrls": ["https://revenda.example.com"],
        "responsiveSearchAd": {
          "headlines": [{ "text": "Gás rápido" }, { "text": "Botijão P13" }, { "text": "Peça já" }],
          "descriptions": [{ "text": "Entrega em 30 min." }, { "text": "Pague no Pix." }],
          "path1": "gas"
        }
      }
    } } }
  ]
}

The response

mutateOperationResponses has one item per operation, in the same order, with the real id that replaced the temporary one:

json
{
  "mutateOperationResponses": [
    { "campaignBudgetResult": { "resourceName": "customers/2220330728/campaignBudgets/54542599976" } },
    { "campaignResult": { "resourceName": "customers/2220330728/campaigns/54542599977" } },
    { "campaignCriterionResult": { "resourceName": "customers/2220330728/campaignCriteria/54542599977~1001552" } },
    { "campaignCriterionResult": { "resourceName": "customers/2220330728/campaignCriteria/54542599977~1014" } },
    { "adGroupResult": { "resourceName": "customers/2220330728/adGroups/54542599986" } },
    { "adGroupCriterionResult": { "resourceName": "customers/2220330728/adGroupCriteria/54542599986~54542599987" } },
    { "adGroupAdResult": { "resourceName": "customers/2220330728/adGroupAds/54542599986~54542599990" } }
  ]
}

The ad id is the part after the ~. With "responseContentType": "MUTABLE_RESOURCE", each result also carries the full resource.

Temporary ids

  • They are negative ids in the create's resourceName, unique per resource type within the request; repeated ones give newResourceCreationError: DUPLICATE_TEMP_IDS.
  • Only later operations can reference them. Referencing one before its create gives mutateError: RESOURCE_NOT_FOUND.
  • They only work in googleAds:mutate. In the per-service mutates, an id in the create gives newResourceCreationError: CANNOT_SET_ID_FOR_CREATE.

Rules for each resource

Budget:

  • amountMicros is the daily amount, a multiple of 10,000 micros and, in Mimicr, at least R$ 1.00.
  • explicitlyShared is true by default. A non-shared budget (false) follows the campaign's name and status and cannot be used by a second campaign.

Campaign:

  • name is required and unique among the account's enabled or paused campaigns (campaignError: DUPLICATE_CAMPAIGN_NAME).
  • advertisingChannelType is immutable. SEARCH is fully simulated; PERFORMANCE_MAX is created but stays NOT_ELIGIBLE (NO_ASSET_GROUPS); DISPLAY and DEMAND_GEN are accepted and do not deliver.
  • Exactly one bidding strategy: manualCpc, maximizeConversions, maximizeConversionValue, targetSpend, targetCpa, targetRoas or targetImpressionShare. None gives fieldError: REQUIRED.
  • SEARCH requires networkSettings.targetGoogleSearch: true.
  • startDateTime and endDateTime use yyyy-MM-dd HH:mm:ss in the account's time zone, with 00:00:00 at the start and 23:59:59 at the end. Without dates, the campaign starts today and never ends.
  • In v26, containsEuPoliticalAdvertising is only required when the campaign targets a European Union country; in v23 to v25 it is always required.

Ad group: name unique within the campaign, type SEARCH_STANDARD for search. cpcBidMicros applies with manualCpc (default R$ 1.00 in Mimicr).

Keywords and ads: see Targeting and Ads and review.

When it goes wrong

An atomic request with an error applies nothing and returns every error found, in operation order. Operations that depend on a temporary id that failed come with TEMP_ID_RESOURCE_HAD_ERRORS:

json
{
  "error": {
    "code": 400,
    "message": "Request contains an invalid argument.",
    "status": "INVALID_ARGUMENT",
    "details": [{
      "@type": "type.googleapis.com/google.ads.googleads.v26.errors.GoogleAdsFailure",
      "errors": [
        {
          "errorCode": { "campaignError": "DUPLICATE_CAMPAIGN_NAME" },
          "message": "Trying to modify the name of an active or paused campaign, where the name is already assigned to another active or paused campaign.",
          "trigger": { "stringValue": "Campanha Goiânia" },
          "location": { "fieldPathElements": [{ "fieldName": "mutate_operations", "index": 1 }, { "fieldName": "campaign_operation" }, { "fieldName": "create" }, { "fieldName": "name" }] }
        },
        {
          "errorCode": { "newResourceCreationError": "TEMP_ID_RESOURCE_HAD_ERRORS" },
          "message": "Parent resource with specified temp ID failed validation, so no validation will be done for this child resource.",
          "trigger": { "stringValue": "customers/2220330728/campaigns/-2" },
          "location": { "fieldPathElements": [{ "fieldName": "mutate_operations", "index": 2 }, { "fieldName": "campaign_criterion_operation" }, { "fieldName": "create" }, { "fieldName": "campaign" }] }
        }
      ],
      "requestId": "Xy3…"
    }]
  }
}

To apply what is valid and skip the rest, use partialFailure; to only validate, validateOnly. See Partial mutates and validation.

After creating

  1. The ads go into review (REVIEW_IN_PROGRESS) and are approved after 10 minutes of the sandbox clock, or right away with ad.approve.
  2. A PAUSED campaign does not deliver. Enable it with a status update (see Edit and pause).
  3. With an approved campaign, ad group, keyword and ad, the campaign becomes ELIGIBLE (or LEARNING with smart bidding) and starts delivering hour by hour. See Metrics and delivery.

The per-service mutates (budgets, campaigns, criteria, ad groups, keywords, ads) accept the same operations in {"operations": [...]}, one resource type per call and without temporary ids.