---
title: "Make object enter or leave maintenance mode, immediately or on schedule"
method: POST
path: "/v1/objects/{object-id}/set-maintenance"
tags: ["Objects"]
---

# Make object enter or leave maintenance mode, immediately or on schedule

`POST /v1/objects/{object-id}/set-maintenance`

Without time fields, immediately changes object maintenance state according to the "maintenance" field.
If "startTime" and/or "endTime" is provided, maintenance is scheduled instead by creating one-time
scheduled tasks (visible in scheduled task list and cancellable via the scheduled tasks API):
  * startTime + endTime - schedule maintenance window (enter at startTime, leave at endTime);
  * startTime only - schedule maintenance entry, leave manually;
  * endTime only - schedule maintenance exit; combined with "maintenance": true the object
    enters maintenance immediately and leaves at endTime.
If "schedule" is provided, a recurring maintenance window is scheduled instead: a recurrent
scheduled task enters maintenance mode each time the cron expression matches, and maintenance
mode is left automatically after "duration" minutes (required in this form). Other time fields
are ignored in this form.
Scheduling requires the "schedule object maintenance" system access right.

## Path parameters

- `object-id` integer, required

## Request body

- object
  - `maintenance` boolean — true - if object should enter maintenance mode, false - if leave (ignored if startTime is provided)
  - `comments` string — Optional maintenance comments (also set on created scheduled tasks)
  - `startTime` union — Scheduled maintenance start time - UNIX timestamp, ISO 8601 string, or relative time ("+30m", "now")
    - integer
    - string
  - `endTime` union — Scheduled maintenance end time - UNIX timestamp, ISO 8601 string, or relative time ("+2h")
    - integer
    - string
  - `schedule` string — Cron expression for recurring maintenance window start ("minute hour day-of-month month day-of-week", e.g. "0 2 * * 0")
  - `duration` integer — Recurring maintenance window duration in minutes (required together with "schedule")

## Response `204`

Maintenance mode changed or scheduled successfully

## Other responses

- `400` — Invalid arguments
- `401` — Unauthorized
- `403` — User does not have control access to given object or scheduling rights
- `404` — Object with given ID does not exist

---

[API](https://skmtc.net/netxms/apis/netxms-api.md) · [All operations](https://skmtc.net/netxms/apis/netxms-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/netxms/netxms-api/versions/ee1f54ee3abd/schema)
