Navigation

Create a Cloud Backup Restore Job

Info With Circle IconCreated with Sketch.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.

Important With Circle IconCreated with Sketch.Important

If you specify "deliveryType" : "automated" or "deliveryType" : "pointInTime" in your request body to create an automated restore job, Atlas removes all existing data on the target cluster prior to the restore.

The Atlas API authenticates using HTTP Digest Authentication. Provide a programmatic API public key and corresponding private key as the username and password when constructing the HTTP request.

To learn how to configure API access for an Atlas project, see Configure Atlas API Access.

All requests to this endpoint must originate from an IP address in the organization's API access list.

Bulb IconTip
See Also:

https://cloud.mongodb.com/api/atlas/v1.0

POST /groups/{PROJECT-ID}/clusters/{CLUSTER-NAME}/backup/restoreJobs/
Path ParameterTypeNecessityDescription
PROJECT-IDstringRequiredUnique identifier of the project for the Atlas cluster whose snapshot you want to restore.
SOURCE-CLUSTER-NAMEstringRequiredName of the Atlas cluster whose snapshot you want to restore.

This endpoint might use any of the HTTP request query parameters available to all Atlas API resources. All of these are optional.

NameTypeNecessityDescriptionDefault
prettybooleanOptionalFlag indicating whether the response body should be in a prettyprint format.false
envelopebooleanOptional

Flag indicating if Atlas should wrap the response in a JSON envelope.

This option may be needed for some API clients. These clients cannot access the HTTP response headers or status code. To remediate this, set envelope=true in the query.

For endpoints that return one result, the response body includes:

statusHTTP response code
envelopeExpected response body
false

The request body, response body, and examples depend on the type of restore:

Body ParameterTypeNecessityDescription
deliveryTypestringRequired

Type of restore job to create. Accepted values include:

Job TypeAction
automatedAtlas restores the snapshot corresponding to the snapshotId to the Atlas cluster corresponding to the name targetClusterName in the Atlas project corresponding to the targetGroupId.
download

Atlas generates and displays a URL to download a .tar.gz of the snapshot corresponding to the snapshotId. The contents of the tar.gz archive contain the data files for your Atlas cluster.

Bulb IconTip
See Also:

To learn more about manually restoring the downloaded data files, see Procedure.

Info With Circle IconCreated with Sketch.Note
Download Limitations

Each cloud backup can have one download at a time, and each project can have a maximum of 20 downloads at a time.

pointInTimeAtlas performs a Continuous Cloud Backup restore.
snapshotIdstringRequiredUnique identifier of the snapshot to restore.
target
ClusterName
stringRequiredName of the target Atlas cluster to which the restore job restores the snapshot.
target
GroupId
stringRequiredUnique identifier of the target Atlas project for the specified targetClusterName.
NameTypeDescription
cancelledbooleanFlag indicating whether the restore job was canceled.
createdAtstringTimestamp in ISO 8601 date and time format in UTC when Atlas created the restore job.
deliveryTypestring

Type of restore job to create. Atlas may return:

Job TypeAction
automatedAtlas restores the snapshot corresponding to the snapshotId to the Atlas cluster corresponding to the name targetClusterName in the Atlas project corresponding to the targetGroupId.
download

Atlas generates and displays a URL to download a .tar.gz of the snapshot corresponding to the snapshotId. The contents of the tar.gz archive contain the data files for your Atlas cluster.

Bulb IconTip
See Also:

To learn more about manually restoring the downloaded data files, see Procedure.

Info With Circle IconCreated with Sketch.Note
Download Limitations

Each cloud backup can have one download at a time, and each project can have a maximum of 20 downloads at a time.

pointInTimeAtlas performs a Continuous Cloud Backup restore.
expiredbooleanFlag indicating whether the restore job expired.
expiresAtintegerTimestamp in ISO 8601 date and time format in UTC when the restore job expires.
finishedAtintegerTimestamp in ISO 8601 date and time format in UTC when the restore job completed.
idstringUnique identifier of the restore job.
linksarray of objectsOne or more links to sub-resources and/or related resources. The relation-types between URL s are explained in the Web Linking Specification.
snapshotIdstringUnique identifier of the source snapshot ID of the restore job.
targetGroupIdstringName of the target Atlas project of the restore job.
targetClusterNamestringName of the target Atlas cluster to which the restore job restores the snapshot.
timestampstringTimestamp in ISO 8601 date and time format in UTC when the snapshot associated to snapshotId was taken.
1curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest --include \
2 --header "Accept: application/json" \
3 --header "Content-Type: application/json" \
4 --request POST "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/clusters/{SOURCE-CLUSTER-NAME}/backup/restoreJobs" \
5 --data '{
6 "snapshotId" : "{SNAPSHOT-ID}",
7 "deliveryType" : "automated",
8 "targetClusterName" : "{TARGET-CLUSTER-NAME}",
9 "targetGroupId" : "{TARGET-PROJECT-ID}"
10 }'
1{
2 "cancelled": false,
3 "deliveryType": "automated",
4 "expired": false,
5 "expiresAt": "2020-05-04T16:25:01Z",
6 "id": "{RESTORE-ID}",
7 "links": [
8 {
9 "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/clusters/{SOURCE-CLUSTER-NAME}/backup/restoreJobs/{RESTORE-ID}",
10 "rel": "self"
11 },
12 {
13 "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/clusters/{SOURCE-CLUSTER-NAME}/backup/snapshots/{SNAPSHOT-ID}",
14 "rel": "http://mms.mongodb.com/snapshot"
15 },
16 {
17 "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/clusters/{SOURCE-CLUSTER-NAME}",
18 "rel": "http://mms.mongodb.com/cluster"
19 },
20 {
21 "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}",
22 "rel": "http://mms.mongodb.com/group"
23 }
24 ],
25 "snapshotId": "{SNAPSHOT-ID}",
26 "targetClusterName": "{TARGET-CLUSTER-NAME}",
27 "targetGroupId": "{TARGET-PROJECT-ID}",
28 "timestamp": "2020-05-03T16:25:01Z"
29}
Give Feedback