Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Issue with Creating Campaign - Invalid Bidding Strategy Context

44 views
Skip to first unread message

Ashish Chaturvedi (Ashu)

unread,
Apr 25, 2025, 7:05:47 AMApr 25
to Google Ads API and AdWords API Forum

Dear Google Ads Support Team,

I am experiencing an issue while attempting to create a Demand Gen Campaign using the Google Ads API. The campaign budget and bidding strategy were created successfully, but I am encountering an error when trying to create the campaign itself, specifically with the bidding strategy.

Below are the details: 1. Creating Campaign Budget:

Request:


curl --request POST \ 'https://googleads.googleapis.com/v19/customers/xxxxxxxx/campaignBudgets:mutate?key=[YOUR_API_KEY]' \ --header 'developer-token: **********************' \ --header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{"operations":[{"create":{"name":"Budget Demand Gen #1","deliveryMethod":"STANDARD","amountMicros":500000}}]}' \ --compressed

Response:

{ "results": [ { "resourceName": "customers/xxxxxxxx/campaignBudgets/xxxxxxxx" } ] }
2. Creating Bidding Strategy:

Request:


curl --request POST \ 'https://googleads.googleapis.com/v19/customers/xxxxxxxx/biddingStrategies:mutate?key=[YOUR_API_KEY]' \ --header 'developer-token: **********************' \ --header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{"operations":[{"create":{"name":"Bidding For Demand Gen #1","maximizeConversions":{"cpcBidCeilingMicros":200000}}}]}' \ --compressed

Response:


{ "results": [ { "resourceName": "customers/xxxxxxxx/biddingStrategies/xxxxxxxx" } ] }
3. Creating Campaign (Issue Occurs Here):

Request:


curl --request POST \ 'https://googleads.googleapis.com/v19/customers/xxxxxxxx/campaigns:mutate?key=[YOUR_API_KEY]' \ --header 'developer-token: **********************' \ --header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{"operations":[{"create":{"name":"Hypeddit Demand Gen Campaign : 35904","advertisingChannelType":"DEMAND_GEN","status":"PAUSED","startDate":"20250426","endDate":"20250525","campaignBudget":"customers/xxxxxxxx/campaignBudgets/xxxxxxxx","biddingStrategy":"customers/xxxxxxxx/biddingStrategies/xxxxxxxx"}}]}' \ --compressed

Response:


{ "error": { "code": 400, "message": "Request contains an invalid argument.", "status": "INVALID_ARGUMENT", "details": [ { "@type": "type.googleapis.com/google.ads.googleads.v19.errors.GoogleAdsFailure", "errors": [ { "errorCode": { "contextError": "OPERATION_NOT_PERMITTED_FOR_CONTEXT" }, "message": "The operation is not allowed for the given context.", "trigger": { "int64Value": "11537883468" }, "location": { "fieldPathElements": [ { "fieldName": "operations", "index": 0 }, { "fieldName": "create" }, { "fieldName": "bidding_strategy" } ] } } ], "requestId": "2Jvkns8NRxcMZmSdGu7ynw" } ] } }
Error Explanation:
  • Error Code: INVALID_ARGUMENT

  • Message: "Request contains an invalid argument."

  • Details: "The operation is not allowed for the given context."

  • Field: bidding_strategy

  • Trigger: 11537883468 (Bidding Strategy resource name)

It seems that the bidding strategy is not valid for the Demand Gen campaign type. I have confirmed that both the campaign budget and bidding strategy are being created successfully in separate API calls, but the issue arises when I attempt to assign the bidding strategy to the campaign in the final step.

Could you please advise on:

  1. The correct way to assign a bidding strategy to a Demand Gen campaign.

  2. If there are any additional constraints or requirements for Demand Gen campaigns regarding bidding strategies.

Thank you for your assistance, and I look forward to your response.

Best regards,

Ashish

Google Ads API Forum Advisor

unread,
Apr 25, 2025, 12:37:24 PMApr 25
to ashish007...@gmail.com, adwor...@googlegroups.com

Hi Ashish,

Thank you for reaching out to the Google Ads API support team.

Based on the provided information, it appears that you’ve encountered the "OPERATION_NOT_PERMITTED_FOR_CONTEXT’ error while attempting to create a demand gen campaign via the Google Ads API. This error occurs when an operation is not allowed within the current context. We tried to replicate the same error from my side but we were able to create the campaign successfully without any errors. Kindly refer to the sample request and response bodies below for reference:

{
  "operations": [
    {
      "create": {
        "name": "Hypeddit Demand Gen Campaign",
        "advertisingChannelType": "DEMAND_GEN",
        "status": "PAUSED",
        "startDate": "20250426",
        "endDate": "20250525",
        "campaignBudget": "customers/{customerId}/campaignBudgets/{campaign_budget_id}",
        "biddingStrategy": "customers/{customerId}/biddingStrategies/{biddingStrategyId}"
      }
    }
  ]
}



{
  "results": [
    {
      "resourceName": "customers/{customerId}/campaigns/{campaignId}"
    }
  ]
}

Please be informed that while creating a demand gen campaign check that minimum requirements are met: Demand Gen campaign assets must meet high standards of quality, as they will be served on visual, entertainment-focused surfaces such as Discover and YouTube.

To create a Demand Gen campaign:

  1. Create a budget.
  2. Create a Demand Gen campaign with appropriate bidding strategies.
  3. Create an ad group without a type.
  4. Create audiences.
  5. Create assets and Demand Gen ads.
Also, Demand Gen campaigns have an AdvertisingChannelType of DEMAND_GEN. No AdvertisingChannelSubType should be set. Set up conversion goals for your campaign. Supported bidding strategies are maximize clicks, target CPA, maximize conversions, and target ROAS. Kindly refer to create a demand gen campaign for more information. Reporting information for Demand Gen campaigns can be retrieved at different levels, similar to other campaign types, refer to the Report and optimize.

I hope this helps! Feel free to get back to us in case of any further queries.

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5
[2025-04-25 16:36:31Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01qUyQB:ref" (ADR-00301833)



Reply all
Reply to author
Forward
0 new messages