Handling overlapping midnight ad schedules

70 views
Skip to first unread message

KHMob

unread,
Jun 25, 2025, 8:03:41 PMJun 25
to Google Ads API and AdWords API Forum
Hey there,

Background: I'm trying to create an ad schedule that would overlap between days. It should end at 00:00 on Saturday, and start at 00:00 on Sunday. Imagine a nightclub or something similar, where it's open from Saturday to Sunday.

I'm running into an issue where I cannot create an overlapping schedule. It's possible to set Saturday to end at 23:45, and Sunday to start at 00:00, but then it creates a gap of 15 minutes where the ads are not. However, if I set the end time to 00:00 on Saturday, then I'll get this error:

 message: "AdSchedule time interval specified is invalid, endTime cannot be earlier than startTime."
  trigger {
    string_value: "AdScheduleAuto{startMinute=MINUTEOFHOUR_ZERO, endMinute=MINUTEOFHOUR_ZERO, startHour=23, endHour=0, dayOfWeek=SATURDAY, scheduleType=AD_SCHEDULE}


My question in this case, how are you supposed to handle these types of overlapping hours?

Cheers,
Kh
Message has been deleted

Google Ads API and AdWords API Forum

unread,
Jun 26, 2025, 5:32:22 AMJun 26
to Google Ads API and AdWords API Forum
Hi Kh,

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

It seems that you've encountered the AD_SCHEDULE_INVALID_TIME_INTERVAL error. This indicates that the end time specified for your AdSchedule is earlier than the start time. To fix this, please ensure that your 'endTime' is set after your 'startTime'. 

To investigate the issue further, please share the complete API logs (request and response with request-id and request header) generated at your end.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java.NetPHPPythonRuby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

You can send the details via Reply privately to the author option, or direct private reply to this email.

Thanks,
Google Ads API Team

Kasper Henriksson

unread,
Jun 27, 2025, 4:26:30 AMJun 27
to adwor...@googlegroups.com
I understand that I'm encountering the AD_SCHEDULE_INVALID_TIME_INTERVAL error. My question in this case is, how are you supposed to set the end time to 00:00 (or 24:00) using the API? Since currently it does not work to set it to 00:00, as it causes this error.

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api...@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 a topic in the Google Groups "Google Ads API and AdWords API Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-api/YdX-TvizShs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-api...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/adwords-api/b56288cb-0ff7-4ddd-91f4-12e7e9669a59n%40googlegroups.com.

Google Ads API Forum Advisor

unread,
Jun 27, 2025, 6:58:38 AMJun 27
to adwor...@googlegroups.com

Hi,

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

Based on the information provided, it appears that you've passed 0 as the end hour and 23 as the start hour. Please note that startHour refers to the beginning of the day, while endHour represents the end of the day. Since these values were reversed 0 for end and 23 for start, the system triggered an error. As a correction, I recommend setting startHour to 0 and endHour to 23.

If you still persist with the issue even after following the above suggestion, please share the complete API logs (request and response with request-id and request header) generated at your end.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java, .Net, PHP, Python, Ruby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

You can send the details via Reply privately to the author option, or direct private reply to this email.

 

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5
[2025-06-27 10:57:59Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01rgVEx:ref" (ADR-00316015)



Google Ads API Forum Advisor

unread,
Jun 27, 2025, 2:09:20 PMJun 27
to kas...@mobal.io, adwor...@googlegroups.com

Hi,

When scheduling ads using the `AdScheduleInfo` criteria via the API, please note the following:

The `start_hour` can range from 0 to 23, inclusive. The `end_hour` can range from 0 to 24, where 24 signifies the end of the day. To schedule an ad from 23:00 to 24:00, set the `start_hour` to 23 and the `end_hour` to 24. I have successfully scheduled the ad campaign as per your requirements. A sample code snippet is provided below for your reference.

POST https://googleads.googleapis.com/v20/customers/5295995858/campaignCriteria:mutate?key=[YOUR_API_KEY] HTTP/1.1

developer-token: **********************
login-customer-id: 8878545793
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json
Content-Type: application/json

{
  "operations": [
    {
      "create": {
        "campaign": "customers/5295995858/campaigns/20621915732",
        "adSchedule": {
          "startHour": 23,
          "startMinute": "ZERO",
          "endHour": 24,
          "endMinute": "ZERO",
          "dayOfWeek": "MONDAY"
        }
      }
    }
  ]
}

{
  "results": [
    {
      "resourceName": "customers/5295995858/campaignCriteria/20621915732~309296"
    }
  ]
}

I hope it helps.

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5

[2025-06-27 18:08:09Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01rgVEx:ref" (ADR-00316015)



Kasper Henriksson

unread,
Jun 27, 2025, 8:13:59 PMJun 27
to Google Ads API Forum Advisor, adwor...@googlegroups.com
This is excellent! Thank you very much!

Sent from Outlook for iOS

From: Google Ads API Forum Advisor <ads...@forumsupport.google>
Sent: Friday, June 27, 2025 8:08:11 PM
To: kas...@mobal.io <kas...@mobal.io>
Cc: adwor...@googlegroups.com <adwor...@googlegroups.com>
Subject: Re: handling overlapping midnight ad schedules
 

Kasper Henriksson

unread,
Jun 27, 2025, 8:14:14 PMJun 27
to ads...@forumsupport.google, adwor...@googlegroups.com
 That doesn’t solve the problem though, because in that case it’ll be open from 0 to 23, however, I want it to be open from 23-24.

Sent from Outlook for iOS

From: 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum <adwor...@googlegroups.com>
Sent: Friday, June 27, 2025 1:58:02 PM
To: adwor...@googlegroups.com <adwor...@googlegroups.com>
Subject: RE: handling overlapping midnight ad schedules
 
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api...@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 a topic in the Google Groups "Google Ads API and AdWords API Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-api/YdX-TvizShs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-api...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages