Updates the maintenance window for the specified project. Urgent maintenance activities such as security patches can't wait for your chosen window. MongoDB Cloud starts those maintenance activities when needed. After you schedule maintenance for your cluster, you can't change your maintenance window until the current maintenance efforts complete. The maintenance procedure that MongoDB Cloud performs requires at least one replica set election during the maintenance window per replica set. Maintenance always begins as close to the scheduled hour as possible, but in-progress cluster updates or unexpected system issues could delay the start time. Updating the maintenance window will reset any maintenance deferrals for this project.
Unique 24-hexadecimal digit string that identifies your project. Use the /groups endpoint to retrieve all projects to which the authenticated user has access.
NOTE: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.
Format should match the following pattern: ^([a-f0-9]{24})$.
Flag that indicates whether Application wraps the response in an envelope JSON object. Some API clients cannot access the HTTP response headers or status code. To remediate this, set envelope=true in the query. Endpoints that return a list of results use the results object as an envelope. Application adds the status parameter to the response body.
Default value is false.
Updates the maintenance window for the specified project.
Flag that indicates whether MongoDB Cloud should defer all maintenance windows for one week after you enable them. This setting controls the same underlying auto-deferral feature as the /maintenanceWindow/autoDefer endpoint. Use either this field (to set a specific value) or that endpoint (to toggle the current value). For most use cases, this field in the PATCH request is preferred because it allows setting an explicit value rather than toggling.
One-based integer that represents the day of the week, in the project's configured time zone (see timeZoneId), that the maintenance window starts.
1: Sunday.2: Monday.3: Tuesday.4: Wednesday.5: Thursday.6: Friday.7: Saturday.Minimum value is 1, maximum value is 7.
Zero-based integer that represents the hour of the day, in the project's configured time zone (see timeZoneId), that the maintenance window starts according to a 24-hour clock. Use 0 for midnight and 12 for noon. If you haven't changed your project's time zone, this defaults to UTC.
Minimum value is 0, maximum value is 23.
Defines the a window where maintenance will not begin within.
Flag that indicates whether MongoDB Cloud starts the maintenance window immediately upon receiving this request. To start the maintenance window immediately for your project, MongoDB Cloud must have maintenance scheduled and you must set a maintenance window. This flag resets to false after MongoDB Cloud completes maintenance.
Maintenance wave explicitly assigned to this project. Always returned in GET responses when a value has been set, regardless of the organization's effectiveWaveAssignmentMode. When the mode is ENV_TAG_MAPPING, this stored assignment is preserved but not used for scheduling — the effective wave is derived from environment tags instead. Not editable when the mode is ENV_TAG_MAPPING. Switching back to MANUAL restores this value as the effective wave. Must be between 1 and 3, inclusive. Pass null to clear an explicit assignment.
Minimum value is 1, maximum value is 3.
atlas api maintenanceWindows updateMaintenanceWindow --help
import (
"os"
"context"
"log"
sdk "go.mongodb.org/atlas-sdk/v20250312001/admin"
)
func main() {
ctx := context.Background()
clientID := os.Getenv("MONGODB_ATLAS_CLIENT_ID")
clientSecret := os.Getenv("MONGODB_ATLAS_CLIENT_SECRET")
// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth
client, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))
if err != nil {
log.Fatalf("Error: %v", err)
}
params = &sdk.UpdateGroupMaintenanceWindowApiParams{}
sdkResp, httpResp, err := client.MaintenanceWindowsApi.
UpdateGroupMaintenanceWindowWithParams(ctx, params).
Execute()
}
curl --include --header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header "Accept: application/vnd.atlas.2025-03-12+json" \
--header "Content-Type: application/json" \
-X PATCH "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/maintenanceWindow" \
-d '{ <Payload> }'
curl --user "${PUBLIC_KEY}:${PRIVATE_KEY}" \
--digest --include \
--header "Accept: application/vnd.atlas.2025-03-12+json" \
--header "Content-Type: application/json" \
-X PATCH "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/maintenanceWindow" \
-d '{ <Payload> }'
{
"autoDeferOnceEnabled": true,
"dayOfWeek": 42,
"hourOfDay": 42,
"protectedHours": {
"endHourOfDay": 42,
"startHourOfDay": 42
},
"startASAP": true,
"waveAssignment": 42
}
{
"detail": "(This is just an example, the exception may not be related to this endpoint) No provider AWS exists.",
"error": 400,
"errorCode": "VALIDATION_ERROR",
"reason": "Bad Request"
}
{
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"error": 401,
"errorCode": "NOT_ORG_GROUP_CREATOR",
"reason": "Unauthorized"
}
{
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"error": 403,
"errorCode": "CANNOT_CHANGE_GROUP_NAME",
"reason": "Forbidden"
}
{
"detail": "Invalid Configuration. Contains selections that are unavailable due to your organization's resource policies.",
"error": 403,
"errorCode": "ATLAS_RESOURCE_POLICIES_VIOLATION_NOT_AUTHORIZED",
"parameters": [],
"policiesCausingDecision": [
{
"id": "32b6e34b3d91647abb20e7b8",
"name": "forbid-aws-clusters"
}
],
"reason": "Forbidden"
}
{
"detail": "(This is just an example, the exception may not be related to this endpoint) Cannot find resource AWS",
"error": 404,
"errorCode": "RESOURCE_NOT_FOUND",
"reason": "Not Found"
}
{
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"error": 429,
"errorCode": "RATE_LIMITED",
"reason": "Too Many Requests"
}
{
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"error": 500,
"errorCode": "UNEXPECTED_ERROR",
"reason": "Internal Server Error"
}