# Scheduled maintenance

> Announce maintenance on a host, how much notice keeps your uptime score whole, what renters see, and what happens to their rentals.

Source: https://legion.ambient.xyz/docs/providing/maintenance

A maintenance window tells Legion, and the renters on a host, that the host goes down on purpose. With enough notice the window never lowers your [uptime score](https://legion.ambient.xyz/docs/providing/benchmarks-and-score#what-counts-as-uptime), your renters keep their files and are not charged while the host is away, and their rentals start again when you are done.

## Schedule a window

1. Open the host's page and choose the **Manage** tab. Under **Maintenance**, press **Schedule maintenance**. To do several hosts at once, tick them on the **Hosts** page and press **Schedule maintenance** there.
2. Choose when it starts, how long it lasts (15 minutes to 72 hours), and why: hardware, software, network, power, facility or other. Renters see the reason. You can also write a private note of up to 280 characters. Only you see it: it is never in an email or on a renter's page.
3. Read the preview before you confirm. For each host it says which rentals the window stops, by type, whether the notice is enough for them ("Penalty-free" or "Short notice"), and how many renter organizations will be emailed.
4. Press **Schedule maintenance**. Times on these screens are in your own time zone, which the form names. Renters see the same moment in theirs.

A window starts on a whole minute, from 5 minutes to 90 days from now. A host has at most one window that is not over.

## How much notice is enough

Renters need time to finish or move their work. A window is **penalty-free** when the notice you give covers every rental it stops:

| What is running on the host | Notice needed |
| --- | --- |
| An on-demand rental | 72 hours |
| Interruptible rentals only | 1 hour |
| No rentals | None |

The notice counts from when you scheduled the window. If you move the start earlier, or make the window longer, the notice starts again from that moment. You can give less notice than the table says: the window is allowed, but its time counts as downtime in your uptime score, like unplanned downtime. The preview shows the earliest start that is penalty-free, and **Use earliest penalty-free start** sets it for you.

Legion decides once, 5 minutes before the start, from the rentals it then stops. Until then the answer is a forecast.

## What renters see

- **An email** when you schedule, move or cancel a window, a reminder 24 hours and 1 hour before it starts, and an email when it ends. A renter with rentals on several of your hosts gets one email listing all of them. You are not emailed about windows you schedule yourself.
- **A banner on the rental**, and a mark in their rentals list, with when it starts, when it is planned to end and the reason.
- **"Available until"** on your host's offers while the window is ahead. Inside the notice, the host takes no new rentals of a type whose notice is no longer met: no new on-demand rental within 72 hours of the start, and no new interruptible rental within 1 hour. A renter restarting their own stopped rental is still allowed until the last 5 minutes.
- **A countdown** on a running rental in the last 5 minutes, with the same notice file and signal an interruptible rental gets before a preemption. For a maintenance stop the notice file's reason reads `preempted`.

## What happens at the start and the end

- At the start, the host's rentals stop and their files are kept, whatever the renter chose for a preemption. Nothing is deleted by maintenance. Rentals under a Legion hold are left to that hold.
- While the host is in maintenance nothing can start on it, and renters are charged for neither GPU time nor storage. You earn nothing for the window.
- When the window ends, the rentals it stopped start again on the host, on-demand first, unless the renter chose not to, or the renter has no credit, or the host is under review. One that cannot start yet is tried again every minute.
- The clock that deletes a stopped rental's files waits while the window runs and starts again when it ends.

## Done early, or late

Press **Done with maintenance** on an active window to end it now. Its rentals start again. The planned end is only a plan: you can finish early.

If the planned end passes and the host has not reported back, the window is **Overrunning**. Rentals stay stopped and uncharged until the host is back or you end the window, and the extra time counts as downtime. An owner is emailed. If you press **Done with maintenance** while the host is still away, the window says "End requested, completes when the host is back": it completes the moment the host syncs. A window you cancel, even in the last 5 minutes, is called off: rentals still in their notice keep running, and ones already stopped start again.

## Reschedule or cancel

A **scheduled** window's start and length can be changed up to 3 times, and it can be cancelled. Changing only its reason or note does not use one of the 3, does not restart the notice and is not emailed, so you can always correct them while the window is still scheduled. Once it is **starting soon** (the last 5 minutes) you can cancel it but not move it. An active window cannot be moved or made longer: end it, and schedule another if you need to. The Reschedule dialog previews a move before you save it: whether the window stays penalty-free or loses it, and how many reschedules are left after it. Moving and cancelling email the renters again.

## Every host in one place

**Maintenance windows** on the **Hosts** page (or **Maintenance on all hosts** in a host's Maintenance section) lists every window across your hosts: **Upcoming**, **Active** and **Past**. Each row says the host, when, why, whether the notice is enough and how many renter organizations were told. Select several upcoming windows to cancel them in one request, or several active ones to end them with **Done with maintenance**. A window that cannot be cancelled or ended, such as one that began meanwhile, is named with its reason and the rest go ahead.

## Limits

- A window lasts 15 minutes to 72 hours.
- At most 4 windows per host in any 30 days. Cancelled windows count.
- At most 72 hours of maintenance per host in any 30 days count as excused. Minutes beyond that count as downtime.
- At most 3 reschedules per window.
- Up to 100 hosts or windows in one request. 30 scheduling and rescheduling requests per organization per hour, and 120 cancelling and ending requests per hour apart from them: a spent scheduling budget never keeps you from ending or cancelling a window.

Hosts of yours that already have a window, or have used their windows, are skipped by name in the answer. If any host in a request is not yours, the whole request is refused and nothing is scheduled.

## Use the API

Check what a window would do, then schedule it. `previewMaintenance` takes the hosts, the start and the length and writes nothing. `scheduleMaintenance` takes an optional `Idempotency-Key`: a retry with the same key and body returns the same windows.

```sh
curl -s -G "https://api.legion.ambient.xyz/v1/maintenance-windows/preview" \
  -H "Authorization: Bearer $LEGION_API_KEY" \
  --data-urlencode "host_id=HOST_ID" \
  --data-urlencode "start=2026-12-01T10:00:00Z" \
  --data-urlencode "duration_minutes=120"
```

```sh
curl -s -X POST "https://api.legion.ambient.xyz/v1/maintenance-windows" \
  -H "Authorization: Bearer $LEGION_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "host_ids": ["HOST_ID"],
    "start": "2026-12-01T10:00:00Z",
    "duration_minutes": 120,
    "reason": "hardware"
  }'
```

`listMaintenanceWindows` lists them, `rescheduleMaintenance` and `cancelMaintenance` take window IDs, and `endMaintenance` is **Done with maintenance**. An agent can do the same with the tools `list_maintenance_windows`, `preview_maintenance`, `schedule_maintenance`, `reschedule_maintenance`, `cancel_maintenance` and `end_maintenance`, each change after the user's yes. See [Tools](https://legion.ambient.xyz/docs/agents/tools).
