The forecast period must be within one day from today (e.g., tomorrow) to within one year from today: https://developers.google.com/google-ads/api/reference/rpc/v15/GenerateKeywordForecastMetricsRequest
So when you were testing on 2023-10-25 the last date you could have requested was 2024-10-24. I've tested this today, 2023-10-30. If I put in these parameters – start_date='2023-10-31', end_date='2024-10-29'– the API call returns valid results. This is the maximum forecast period possible. If I put in these parameters – start_date='2023-10-31', end_date='2024-10-30' – the API call returns the same error you got: GoogleAdsException: (<_InactiveRpcError of RPC that terminated with: status = StatusCode.INVALID_ARGUMENT details = "Request contains an invalid argument." debug_error_string = "UNKNOWN:Error received from peer ipv4:xxx.xxx.xxx.xx:xxx {grpc_message:"Request contains an invalid argument.", grpc_status:3, created_time:"2023-10-30T08:48:01.000000+08:00"}" >, <_InactiveRpcError of RPC that terminated with: status = StatusCode.INVALID_ARGUMENT details = "Request contains an invalid argument." debug_error_string = "UNKNOWN:Error received from peer ipv4:xxx.xxx.xxx.xx:xxx {grpc_message:"Request contains an invalid argument.", grpc_status:3, created_time:"2023-10-30T08:48:01.000000+08:00"}" >, errors { error_code { request_error: UNKNOWN } message: "The end time is invalid." location { field_path_elements { field_name: "forecast_period" } } } request_id: "xxxxxxxxxxxxxxxxxxxxxx" , 'xxxxxxxxxxxxxxxxxxxxxx') It doesn't matter even if you put in a shorter period, the end date must be one day less than a year from now, e.g., if I put in start_date='2024-10-25', end_date='2024-10-31' to get the last week of October 2024 it returns the same end time is invalid error. Hope this helps, D.H. On Wednesday, October 25, 2023 at 4:55:58 PM UTC+8 Simone Bonaretti wrote: > Hi, > I'm trying to make forecasts for a 12-month period, but I always encounter > an error on the twelfth date. The same error occurs even when attempting a > single forecast for a 12-month period. > How can I create a forecast for a period longer than 11 months? > > Regards > Simone > > > [2023-10-25 10:10:40] local.DEBUG: DateRange: > [2023-10-25 10:10:40] local.DEBUG: 2023-10-26 > [2023-10-25 10:10:40] local.DEBUG: 2023-11-26 > [2023-10-25 10:10:42] local.DEBUG: DateRange: > [2023-10-25 10:10:42] local.DEBUG: 2023-11-26 > [2023-10-25 10:10:42] local.DEBUG: 2023-12-26 > [2023-10-25 10:10:44] local.DEBUG: DateRange: > [2023-10-25 10:10:44] local.DEBUG: 2023-12-26 > [2023-10-25 10:10:44] local.DEBUG: 2024-01-26 > [2023-10-25 10:10:46] local.DEBUG: DateRange: > [2023-10-25 10:10:46] local.DEBUG: 2024-01-26 > [2023-10-25 10:10:46] local.DEBUG: 2024-02-26 > [2023-10-25 10:10:49] local.DEBUG: DateRange: > [2023-10-25 10:10:49] local.DEBUG: 2024-02-26 > [2023-10-25 10:10:49] local.DEBUG: 2024-03-26 > [2023-10-25 10:10:51] local.DEBUG: DateRange: > [2023-10-25 10:10:51] local.DEBUG: 2024-03-26 > [2023-10-25 10:10:51] local.DEBUG: 2024-04-26 > [2023-10-25 10:10:53] local.DEBUG: DateRange: > [2023-10-25 10:10:53] local.DEBUG: 2024-04-26 > [2023-10-25 10:10:53] local.DEBUG: 2024-05-26 > [2023-10-25 10:10:55] local.DEBUG: DateRange: > [2023-10-25 10:10:55] local.DEBUG: 2024-05-26 > [2023-10-25 10:10:55] local.DEBUG: 2024-06-26 > [2023-10-25 10:10:57] local.DEBUG: DateRange: > [2023-10-25 10:10:57] local.DEBUG: 2024-06-26 > [2023-10-25 10:10:57] local.DEBUG: 2024-07-26 > [2023-10-25 10:10:59] local.DEBUG: DateRange: > [2023-10-25 10:10:59] local.DEBUG: 2024-07-26 > [2023-10-25 10:10:59] local.DEBUG: 2024-08-26 > [2023-10-25 10:11:01] local.DEBUG: DateRange: > [2023-10-25 10:11:01] local.DEBUG: 2024-08-26 > [2023-10-25 10:11:01] local.DEBUG: 2024-09-26 > [2023-10-25 10:11:03] local.DEBUG: DateRange: > [2023-10-25 10:11:03] local.DEBUG: 2024-09-26 > [2023-10-25 10:11:03] local.DEBUG: 2024-10-26 > [2023-10-25 10:11:03] local.DEBUG: { > "message": "Request contains an invalid argument.", > "code": 3, > "status": "INVALID_ARGUMENT", > "details": [ > { > "@type": "type.googleapis.com > \/google.ads.googleads.v14.errors.GoogleAdsFailure", > "errors": [ > { > "errorCode": { > "requestError": "UNKNOWN" > }, > "message": "The end time is invalid.", > "location": { > "fieldPathElements": [ > { > "fieldName": "forecast_period" > } > ] > } > } > ], > "requestId": "FTTj4N4F7MT1HS5JmoTL2Q" > } > ] > } > > > > > [2023-10-25 10:50:25] local.DEBUG: DateRange: > [2023-10-25 10:50:25] local.DEBUG: 2023-10-26 > [2023-10-25 10:50:25] local.DEBUG: 2024-10-26 > [2023-10-25 10:50:25] local.DEBUG: { > "message": "Request contains an invalid argument.", > "code": 3, > "status": "INVALID_ARGUMENT", > "details": [ > { > "@type": "type.googleapis.com > \/google.ads.googleads.v14.errors.GoogleAdsFailure", > "errors": [ > { > "errorCode": { > "requestError": "UNKNOWN" > }, > "message": "The end time is invalid.", > "location": { > "fieldPathElements": [ > { > "fieldName": "forecast_period" > } > ] > } > } > ], > "requestId": "WX1tgnEnRZC5L9kBjIEpZQ" > } > ] > } > -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog: https://googleadsdeveloper.blogspot.com/ =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en --- You received this message because you are subscribed to the Google Groups "Google Ads API and AdWords API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/3bbfc5e0-5d51-4df0-863e-4c42609966b4n%40googlegroups.com.