SCALIX help

← All tools

gads_update_keyword_bid

Google Ads write medium risk

Part of the Bidding Agent.

What it does

Set cpc_bid_micros on one or more ad_group_criterion keywords. SCALIX SOP HARD BLOCK: the ad group's campaign bidding strategy is read first, and if the campaign uses ANY automated strategy (MAXIMIZE_CONVERSIONS, MAXIMIZE_CONVERSION_VALUE, TARGET_CPA, TARGET_ROAS, TARGET_SPEND, TARGET_IMPRESSION_SHARE) or a portfolio bidding strategy, the change is REFUSED with error_class 'blocked_by_bidding_strategy' — Google sets keyword bids automatically there, so a manual bid would be silently ignored. Only MANUAL_CPC (including Enhanced CPC) proceeds; if the strategy cannot be read the call proceeds with a warning. PREVIEW->APPROVE->COMMIT. Returns {success, data:{applied:{count, bidding_strategy_verified, resource_names}}, warnings}. The preview shows each keyword's current bid (the ad group's, flagged, when the keyword has none of its own) next to the new one, in the account currency. PREVIEW SEMANTICS: the first call (no preview_id) is sent to the Google Ads API in validation mode — field, enum, policy and permission errors surface AT PREVIEW, nothing is changed, and the response returns a preview_id. To apply, show the preview to the user, get their approval, and re-call with that preview_id and IDENTICAL arguments within 30 minutes; changed arguments or an expired token fail closed to a fresh preview. validate_only=true forces another preview; validate_only=false alone never commits.

When to use it

Only for MANUAL_CPC campaigns. If it is blocked, adjust the campaign target with gads_set_campaign_bidding_strategy instead of the keyword bid.

Inputs

NameTypeRequiredDescription
customer_idstringyes10-digit CID, dashes stripped; tenant/RLS server-derived.
updatesarrayyesList of {ad_group_id, criterion_id, cpc_bid_micros}. cpc_bid_micros is ALREADY in micros (e.g. $2.00 = 2000000), NOT a currency amount (no x1e6 conversion); must be > 0. Up to 10,000 ops.
ad_group_idstringnoConvenience: ad group used to build resource names for criterion_id-based updates when criterion_resource_name is not supplied.
validate_onlybooleannoOptional. true forces another preview even with a preview_id; false is DEPRECATED and no longer commits — only a valid preview_id applies the write.
preview_idstringnoOmit it to preview: nothing is applied, and the call returns a preview_id bound to this exact request. Pass it only after the user approves that preview in a later message, with the same arguments (leave out validate_only, and add any confirmation flag the preview names). Single-use, expires in 30 minutes; changed arguments need a fresh preview.

Safeguards

A change in two steps. The first call previews and changes nothing; Claude shows you the preview and applies it only after you approve, within 30 minutes and with the same arguments. Every applied change goes to the audit log. How changes are approved.

Policy

Bid changes carry no content-policy risk but require explicit approval + accuracy; never apply a bid the user did not approve in the preview. Log who approved each change to the immutable audit log.

Reminder

Bids are money — confirm currency/micros and log the approving actor; never expose tokens.

Errors

Error classMeansWhat to doRetry
CUSTOMER_NOT_FOUNDAccount not found/linked.Verify CID/authorization.no
TOKEN_REVOKEDAuthorization expired/revoked.needs_reauth.no
INVALID_ARGUMENTNegative/zero/out-of-range bid, or malformed criterion reference.Surface Google's message; correct the value.no
CRITERION_NOT_FOUNDReferenced keyword criterion does not exist (possibly removed).Re-list keywords (gads_list_keywords) and retry with a valid resource_name.no
MANAGER_ACCOUNT_NOT_SUPPORTEDCannot mutate bids on a manager (MCC) account.Target a child serving account.no
PARTIAL_FAILURESome bid updates failed while others succeeded.Return per-op errors with index and Google message; succeeded ops are committed.no
PERMISSION_DENIEDNo write access / out of bearer scope.Confirm role/scope.no
RESOURCE_EXHAUSTEDRate/quota limit (HTTP 429).Backoff 5/10/20s cap 60s; honor retryDelay.yes
TOO_MANY_MUTATE_OPERATIONSRequest exceeds the 10,000-operation mutate cap.Batch the updates into chunks <=10,000.no
INTERNAL_ERRORTransient 5xx.Retry once after backoff.yes

Edge cases

  • Empty updates (or rows without cpc_bid_micros) -> invalid_argument naming the row shape; nothing is sent.
  • Parent campaign on an automated or portfolio strategy -> refused at preview (blocked_by_bidding_strategy): Google would ignore the bid.
  • Setting a bid equal to the current one: the preview shows both values side by side, and Google applies it as a no-op.
  • validate_only clean -> still require explicit approval before commit.
  • Re-preview required if the user edits the proposed bid after the first preview.
  • Idempotency: re-running the same approved commit does not double-apply (bids are absolute, not delta).
  • Expired token -> refresh once and retry.