# Adding maintenance windows to Oh Dear

We've just released a new feature: maintenance windows!

You can now place your site in maintenance which will mute all notifications during that period.

## Setting maintenance windows

You can add a maintenance period per website. You set the start and end date, and during that timeframe the notifications will be muted.

We'll still perform our checks, so you can see in your website history when the site _was_ unavailable, but all notifications will be stopped so no one will be disturbed.

![Maintenance Periods](/uploads/blogs/maintenance-periods/maintenance-period.png)

In your dashboard you can click through on any site and find the _Maintenance periods_ menu item on the left.

## Setting on-demand maintenance windows

One implementation we've always frowned upon (a bit) was the idea of recurring maintenance windows. A fixed time where all alerts would be muted.

Sure, in some cases _actual_ maintenance would happen. But how often would a recurring maintenance window be configured where _nothing_ happens?

And if there _was_ real downtime during that time, would anyone know?

For that reason we took a different approach. On the maintenance overview, we give the actual API commands you could use to implement this in your deploy or maintenance script. It's super easy.

```bash
$ OHDEAR_TOKEN="your API token"

$ curl -X POST https://ohdear.app/api/sites/1/start-maintenance \
    -H "Authorization: Bearer $OHDEAR_TOKEN" \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json'
	
$ curl -X POST https://ohdear.app/api/sites/1/stop-maintenance \
    -H "Authorization: Bearer $OHDEAR_TOKEN" \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json'
```

The first API call starts a maintenance window for that site (which defaults to 60 minutes, [but you can customize that](/docs/api/maintenance-windows#creating-a-new-maintenance-period-on-demand)), the second API call stops the maintenance window.

If you add this as the first & last steps in your deploy scripts, you've just configured on-demand maintenance windows. No matter when you deploy or how long it might take, the maintenance window will be timed _just right_.

## More API commands

Of course the API also allows for pre-defined maintenance windows (as does our dashboard). You can still configure a start- and end date manually for alerts to be muted.

You can find all [API calls related to maintenance windows](/docs/api/maintenance-windows) right in our documentation, as well as updated information on using [the PHP SDK to start/stop a maintenance window](/docs/tools-and-sdks/the-oh-dear-php-sdk) for a site.