# Setting a Break in the API (seeking custom days off per week)

**URL:** <https://forum.beeminder.com/t/setting-a-break-in-the-api-seeking-custom-days-off-per-week/12312>\
**Category:** Tech\
**Created:** [April 9, 2025, 6:03pm UTC](https://forum.beeminder.com/t/setting-a-break-in-the-api-seeking-custom-days-off-per-week/12312 "2025-04-09T18:03:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxtrussell](https://avatars.discourse-cdn.com/v4/letter/m/b3f665/32.png) [@maxtrussell](https://forum.beeminder.com/u/maxtrussell)\
**Post date:** [April 9, 2025, 6:03pm UTC](https://forum.beeminder.com/t/setting-a-break-in-the-api-seeking-custom-days-off-per-week/12312/1 "2025-04-09T18:03:11Z")

</div>

I was wondering if there was any way to set a break for a goal in the Beeminder API currently?

Specifically, I’m aiming to use the API to accomplish something similar to weekends off but not restricted to only taking weekends off (e.g. taking Tues-Wed off). Is this a supported use case?

It may be possible to hack something together by setting a rate of zero in the API for the break and then resetting the rate to its previous value. This is a bit hacky though and would require remembering the goal’s original rate.

---

<div class="post-metadata">

**Author:** ![scarabaea](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/scarabaea/32/5475_2.png) [@scarabaea](https://forum.beeminder.com/u/scarabaea)\
**Post date:** [April 10, 2025, 8:55am UTC](https://forum.beeminder.com/t/setting-a-break-in-the-api-seeking-custom-days-off-per-week/12312/2 "2025-04-10T08:55:42Z")

</div>

Yes, you can submit the road through API, so it should be pretty easy to have a script create the road fragments based on your needs and then submit without doing that manually through the road editor.

---

<div class="post-metadata">

**Author:** ![narthur](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/narthur/32/5113_2.png) [@narthur](https://forum.beeminder.com/u/narthur)\
**Post date:** [April 10, 2025, 1:12pm UTC](https://forum.beeminder.com/t/setting-a-break-in-the-api-seeking-custom-days-off-per-week/12312/3 "2025-04-10T13:12:34Z")

</div>

I would love if a new feature were added to the API that let you specify two dates and the rate this portion of the graph should be set to. Would have made some of my previous projects a ton easier.

Something like:

```bash
curl -X PUT https://www.beeminder.com/api/v1/users/alice/goals/exercise/graph.json \
    -d auth_token=abc124 \
    -d start=2025-06-01 \
    -d end=2025-06-07 \
    -d rate=3

```

---

<div class="post-metadata">

**Author:** ![maxtrussell](https://avatars.discourse-cdn.com/v4/letter/m/b3f665/32.png) [@maxtrussell](https://forum.beeminder.com/u/maxtrussell)\
**Post date:** [April 10, 2025, 4:26pm UTC](https://forum.beeminder.com/t/setting-a-break-in-the-api-seeking-custom-days-off-per-week/12312/4 "2025-04-10T16:26:33Z")

</div>

Thanks both! Seems like there’s a functional if somewhat cumbersome solution.

I’ll do some testing with the API and see what I can come up with. If it’s any good or sufficiently generalizable I’ll share a github link here.

+1 to being able to specify a start/end time for rate changes. That would be very helpful.

---

<div class="post-metadata">

**Author:** ![poisson](https://avatars.discourse-cdn.com/v4/letter/p/48db29/32.png) [@poisson](https://forum.beeminder.com/u/poisson)\
**Post date:** [April 11, 2025, 1:09am UTC](https://forum.beeminder.com/t/setting-a-break-in-the-api-seeking-custom-days-off-per-week/12312/5 "2025-04-11T01:09:45Z")

</div>

I did have a script to do this through road changes, but then my laptop died without a backup and I never got around to rewriting it…

---

<div class="post-metadata">

**Author:** ![maxtrussell](https://avatars.discourse-cdn.com/v4/letter/m/b3f665/32.png) [@maxtrussell](https://forum.beeminder.com/u/maxtrussell)\
**Post date:** [April 11, 2025, 10:16pm UTC](https://forum.beeminder.com/t/setting-a-break-in-the-api-seeking-custom-days-off-per-week/12312/6 "2025-04-11T22:16:43Z")

</div>

Alright, here it is: [GitHub - maxtrussell/bee-scheduler: Scheduler for beeminder.com](https://github.com/maxtrussell/bee-scheduler)

Installable with `pip install bee-scheduler`

Here’s an example of using it to scheduler a break from April 19th to April 20th:

```python
from datetime import date

from bee_scheduler.scheduler import schedule_rate

start = date(year=2025, month=4, day=19)
end = date(year=2025, month=4, day=20)
rate = 0
schedule_rate(goal_name, start, end, rate)

```
