# Implementing Retroratchet via the API

**URL:** <https://forum.beeminder.com/t/implementing-retroratchet-via-the-api/5163>\
**Category:** Tech\
**Created:** [March 31, 2019, 11:58pm UTC](https://forum.beeminder.com/t/implementing-retroratchet-via-the-api/5163 "2019-03-31T23:58:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zacharius](https://avatars.discourse-cdn.com/v4/letter/z/c0e974/32.png) [@zacharius](https://forum.beeminder.com/u/zacharius)\
**Post date:** [March 31, 2019, 11:58pm UTC](https://forum.beeminder.com/t/implementing-retroratchet-via-the-api/5163/1 "2019-03-31T23:58:41Z")

</div>

I’ve been going through the API for a project I’m working on and can’t figure out a good way to reduce a goal’s safety buffer programatically.

Once the safety buffer reaches a certain threshold, I would like to lower it to an established minimum. Are there any examples out there or established ways of doing this?

---

<div class="post-metadata">

**Author:** ![matti](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/matti/32/2506_2.png) [@matti](https://forum.beeminder.com/u/matti)\
**Post date:** [April 11, 2019, 10:00am UTC](https://forum.beeminder.com/t/implementing-retroratchet-via-the-api/5163/2 "2019-04-11T10:00:08Z")

</div>

> [@zacharius](#):
>
> Once the safety buffer reaches a certain threshold, I would like to lower it to an established minimum. Are there any examples out there or established ways of doing this?

It might be, that Beeminder doesn’t allow this, because of the auto-trim buffer feature of Bee Plus and higher plans.

---

<div class="post-metadata">

**Author:** ![zzq](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/zzq/32/6471_2.png) [@zzq](https://forum.beeminder.com/u/zzq)\
**Post date:** [April 11, 2019, 10:52pm UTC](https://forum.beeminder.com/t/implementing-retroratchet-via-the-api/5163/3 "2019-04-11T22:52:00Z")

</div>

You’ll need to GET the goal ([http://api.beeminder.com/#getgoal](http://api.beeminder.com/#getgoal)), then build an updated `roadall`, then PUT the updated values for the goal ([http://api.beeminder.com/#putgoal](http://api.beeminder.com/#putgoal)).

`roadall` is an array of (date, value, rate) triples, meaning "on date X, the value for the road was Y, and changing at rate Z from then on.) So you’ll need to do a fair bit of calculation to figure out how to munge it in order to leave you with the exact amount of safety buffer you want, but it’s not impossible.

Unfortunately, while you can replicate it this way, there isn’t (to the best of my knowledge) an API that directly just retroratchets a goal. I doubt, however, that as @matti says it’s because this is a feature reserved for certain premium plans: the road editor is also reserved for the same premium plans, and the API has features to directly replicate what the road editor can do.

---

<div class="post-metadata">

**Author:** ![matti](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/matti/32/2506_2.png) [@matti](https://forum.beeminder.com/u/matti)\
**Post date:** [April 12, 2019, 3:11pm UTC](https://forum.beeminder.com/t/implementing-retroratchet-via-the-api/5163/4 "2019-04-12T15:11:34Z")

</div>

> [@zzq](#):
>
> Unfortunately, while you can replicate it this way, there isn’t (to the best of my knowledge) an API that directly just retroratchets a goal. I doubt, however, that as @openmedi says it’s because this is a feature reserved for certain premium plans: the road editor is also reserved for the same premium plans, and the API has features to directly replicate what the road editor can do.

Thanks @zzq for pointing that out. I stand corrected. 🤓
