Google Rest API - GenerateKeywordForecastMetrics - Error Invalid Argument KeywordPlanIdeaError

143 views
Skip to first unread message

Tyler Hanson

unread,
Dec 14, 2023, 10:56:23 AM12/14/23
to Google Ads API and AdWords API Forum
Hey Team, currently testing out with the rest API doing a call to the endpoint for keyword forecast metrics. I keep getting this dang error for invalid argument for the keywordplan idea but I tried all the ENUMs provided in the documentation but still no go. Not sure what to do here. See traceID and requests below: 

Request Body: 
{
  "currencyCode": "USD",
  "forecastPeriod": {
    "startDate": "2023-12-14",
    "endDate": "2024-02-24"
  },
  "campaign": {
    "conversionRate": 0.10,
    "keywordPlanNetwork": "GOOGLE_SEARCH",
    "languageConstants": [
      "languageConstants/1000"
    ],
    "geoModifiers": [
      {
        "geoTargetConstant": "geoTargetConstants/2840"
      }
    ],
    "biddingStrategy": {
      "maximizeClicksBiddingStrategy": {
        "dailyTargetSpendMicros": 50000000
      }
    },
    "adGroups": [
      {
        "biddableKeywords": [
          {
            "keyword": {
              "matchType": "BROAD",
              "text": "HVAC Plumbers Near Me"
            }
          },
          {
            "keyword": {
              "matchType": "BROAD",
              "text": "HVAC services"
            }
          },
          {
            "keyword": {
              "matchType": "BROAD",
              "text": "HVAC Installation"
            }
          },
          {
            "keyword": {
              "matchType": "BROAD",
              "text": "HVAC Plumbers"
            }
          }
        ]
      }
    ]
  }
}

requestID: dDhXeCLddM9yP9e5yDMo9g



Tyler Hanson

unread,
Dec 14, 2023, 11:39:47 AM12/14/23
to Google Ads API and AdWords API Forum
POST /v15/customers/CustomerID:generateKeywordForecastMetrics HTTP/1.1 Host: googleads.googleapis.com Developer-token: redacted Content-length: 650 Content-type: application/json Authorization: Bearer redacted Login-customer-id: redacted(My MCC ID where I Oauthed){
 
"forecastPeriod": {
   
"startDate": "2023-12-14",
   
"endDate": "2024-02-14"
 
},
 
"currencyCode": "USD",
 
"campaign": {
   
"biddingStrategy": {
     
"maximizeConversionsBiddingStrategy": {
       
"dailyTargetSpendMicros": 10000000,
     
}
   
},
   
"conversionRate": 0.05,
   
"keywordPlanNetwork": "GOOGLE_SEARCH",
   
"geoModifiers": [
     
{
       
"geoTargetConstant": "geoTargetConstants/2840"
     
}
   
],
   
"adGroups": [
     
{
       
"biddableKeywords": [
         
{
           
"keyword": {
             
"matchType": "PHRASE",
             
"text": "ISNetworld"
           
}
         
}
       
]
     
}
   
]
 
}
}
HTTP/1.1 400 Bad Request Content-length: 510 X-xss-protection: 0 X-content-type-options: nosniff Transfer-encoding: chunked Request-id: 05-D0lXDktWMJpwLmVTP7g Vary: Origin, X-Origin, Referer Server: ESF -content-encoding: gzip Cache-control: private Date: Thu, 14 Dec 2023 16:15:34 GMT X-frame-options: SAMEORIGIN Alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Content-type: application/json; charset=UTF-8{
 
"error": {
   
"status": "INVALID_ARGUMENT",
   
"message": "Request contains an invalid argument.",
   
"code": 400,
   
"details": [
     
{
       
"errors": [
         
{
           
"errorCode": {
             
"keywordPlanIdeaError": "INVALID_VALUE"
           
},
           
"message": "The input has an invalid value."
         
}
       
],
       
"@type": "type.googleapis.com/google.ads.googleads.v15.errors.GoogleAdsFailure",
       
"requestId": "05-D0lXDktWMJpwLmVTP7g"
     
}
   
]
 
}
}

Google Ads API Forum Advisor

unread,
Dec 14, 2023, 4:51:43 PM12/14/23
to ty...@ppcfoundry.com, adwor...@googlegroups.com
Hi,

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

After reviewing your concern, I understand that you are encountering an error "INVALID_VALUE" while trying to mutate "generateKeywordForecastMetrics". I can see that you are using the same day start date, please note that the start date must be in the future and the end date must be within 1 year from today. You may check this reference link for more information. That being said, I would suggest you change your start date to a future date.

Let me know if you have further questions.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02r1owC:ref"

Thanks,
 
Google Logo Google Ads API Team

 

Reply all
Reply to author
Forward
0 new messages