Update Cloud Backup Schedule for One Cluster
Updates the cloud backup schedule for one cluster within the specified project. This schedule defines when MongoDB Cloud takes scheduled snapshots and how long it stores those snapshots. To use this resource, the requesting Service Account or API Key must have the Project Owner role. Deprecated versions: v2-{2023-01-01}
Path parameters
-
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})$
. -
Human-readable label that identifies the cluster.
Format should match the following pattern:
^[a-zA-Z0-9][a-zA-Z0-9-]*$
.
Query parameters
-
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
. -
Flag that indicates whether the response body should be in the prettyprint format.
Default value is
false
.Prettyprint
Body
Required
Updates the cloud backup schedule for one cluster within the specified project.
Note: In the request body, provide only the fields that you want to update.
-
Flag that indicates whether MongoDB Cloud automatically exports Cloud Backup Snapshots to the Export Bucket.
-
List that contains a document for each copy setting item in the desired backup policy.
Copy setting item in the desired backup policy.
-
List that contains a document for each deleted copy setting whose backup copies you want to delete.
Deleted copy setting whose backup copies need to also be deleted.
-
Policy for automatically exporting Cloud Backup Snapshots.
-
List that contains a document for each extra retention setting item in the desired backup policy.
extra retention setting item in the desired backup policy.
-
Rules set for this backup schedule.
List that contains a document for each backup policy item in the desired backup policy.
Not more than
1
element. -
Hour of day in Coordinated Universal Time (UTC) that represents when MongoDB Cloud takes the Snapshot.
-
Minute of the referenceHourOfDay that represents when MongoDB Cloud takes the Snapshot.
-
Number of previous days that you can restore back to with Continuous Cloud Backup accuracy. You must specify a positive, non-zero integer. This parameter applies to continuous Cloud Backups only.
-
Flag that indicates whether to apply the retention changes in the updated backup policy to Snapshots that MongoDB Cloud took previously.
-
Flag that indicates whether to use organization and project names instead of organization and project UUIDs in the path to the metadata files that MongoDB Cloud uploads to your Export Bucket.
atlas api updateBackupSchedule --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")
client, err := sdk.NewClient(
sdk.UseOAuthAuth(clientID, clientSecret),
sdk.UseBaseURL(url))
if err != nil {
log.Fatalf("Error: %v", err)
}
params = &sdk.UpdateBackupScheduleApiParams{}
sdkResp, httpResp, err := client.CloudBackupsApi.
UpdateBackupScheduleWithParams(ctx, params).
Execute()
}
curl --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}/clusters/{clusterName}/backup/schedule" \
-d '{ <Payload> }'
curl --user "${PUBLIC_KEY}:${PRIVATE_KEY}" \
--digest \
--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}/clusters/{clusterName}/backup/schedule" \
-d '{ <Payload> }'
{
"autoExportEnabled": true,
"copySettings": [
{
"cloudProvider": "AWS",
"frequencies": [
"HOURLY"
],
"regionName": "string",
"shouldCopyOplogs": true,
"zoneId": "32b6e34b3d91647abb20e7b8"
}
],
"deleteCopiedBackups": [
{
"cloudProvider": "AWS",
"regionName": "string",
"zoneId": "32b6e34b3d91647abb20e7b8"
}
],
"export": {
"exportBucketId": "32b6e34b3d91647abb20e7b8",
"frequencyType": "monthly"
},
"extraRetentionSettings": [
{
"frequencyType": "HOURLY",
"retentionDays": 42
}
],
"policies": [
{
"id": "32b6e34b3d91647abb20e7b8",
"policyItems": [
{
"frequencyInterval": 1,
"frequencyType": "daily",
"retentionUnit": "days",
"retentionValue": 42
}
]
}
],
"referenceHourOfDay": 42,
"referenceMinuteOfHour": 42,
"restoreWindowDays": 42,
"updateSnapshots": true,
"useOrgAndGroupNamesInExportPrefix": true
}
{
"autoExportEnabled": true,
"clusterId": "32b6e34b3d91647abb20e7b8",
"clusterName": "string",
"copySettings": [
{
"cloudProvider": "AWS",
"frequencies": [
"HOURLY"
],
"regionName": "string",
"shouldCopyOplogs": true,
"zoneId": "32b6e34b3d91647abb20e7b8"
}
],
"export": {
"exportBucketId": "32b6e34b3d91647abb20e7b8",
"frequencyType": "monthly"
},
"extraRetentionSettings": [
{
"frequencyType": "HOURLY",
"retentionDays": 42
}
],
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas",
"rel": "self"
}
],
"nextSnapshot": "2025-05-04T09:42:00Z",
"policies": [
{
"id": "32b6e34b3d91647abb20e7b8",
"policyItems": [
{
"frequencyInterval": 1,
"frequencyType": "daily",
"id": "32b6e34b3d91647abb20e7b8",
"retentionUnit": "days",
"retentionValue": 42
}
]
}
],
"referenceHourOfDay": 42,
"referenceMinuteOfHour": 42,
"restoreWindowDays": 42,
"useOrgAndGroupNamesInExportPrefix": true
}
{
"error": 400,
"detail": "(This is just an example, the exception may not be related to this endpoint) No provider AWS exists.",
"reason": "Bad Request",
"errorCode": "VALIDATION_ERROR"
}
{
"error": 401,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Unauthorized",
"errorCode": "NOT_ORG_GROUP_CREATOR"
}
{
"error": 403,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Forbidden",
"errorCode": "CANNOT_CHANGE_GROUP_NAME"
}
{
"error": 404,
"detail": "(This is just an example, the exception may not be related to this endpoint) Cannot find resource AWS",
"reason": "Not Found",
"errorCode": "RESOURCE_NOT_FOUND"
}
{
"error": 500,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Internal Server Error",
"errorCode": "UNEXPECTED_ERROR"
}