Navigation

Create a Cloud Backup Restore Job

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

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 on the Atlas user’s API whitelist. For complete documentation on configuring API whitelists, see Enable API Whitelisting for Your Organization.

Syntax

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

POST /groups/{PROJECT-ID}/clusters/{CLUSTER-NAME}/backup/restoreJobs/

Request Path Parameters

Path Parameter Type Necessity Description
PROJECT-ID string Required Unique identifier of the project for the Atlas cluster whose snapshot you want to restore.
SOURCE-CLUSTER-NAME string Required Name of the Atlas cluster whose snapshot you want to restore.

Request Query Parameters

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

Name Type Necessity Description Default
pretty boolean Optional Flag indicating whether the response body should be in a prettyprint format. false
envelope boolean Optional

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:

status HTTP response code
envelope Expected response body
false

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

Request Body Parameters

Body Parameter Type Necessity Description
deliveryType string Required

Type of restore job to create. Accepted values include:

Job Type Action
automated Atlas 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.

See also

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

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.

pointInTime Atlas performs a Continuous Cloud Backup restore.
snapshotId string Required Unique identifier of the snapshot to restore.
target
ClusterName
string Required Name of the target Atlas cluster to which the restore job restores the snapshot.
target
GroupId
string Required Unique identifier of the target Atlas project for the specified targetClusterName.
Body Parameter Type Necessity Description
deliveryType string Required

Type of restore job to create. Accepted values include:

Job Type Action
automated Atlas 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.

See also

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

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.

pointInTime Atlas performs a Continuous Cloud Backup restore.
oplogTs integer Conditional

Timestamp in the number of seconds that have elapsed since the UNIX epoch from which to you want to restore this snapshot. This is the first part of an Oplog timestamp.

Three conditions apply to this parameter:

oplogInc integer Conditional

Oplog operation number from which to you want to restore this snapshot. This is the second part of an Oplog timestamp.

Three conditions apply to this parameter:

pointInTime
UTCSeconds
integer Conditional

Timestamp in the number of seconds that have elapsed since the UNIX epoch from which you want to restore this snapshot.

Two conditions apply to this parameter:

target
ClusterName
string Required Name of the target Atlas cluster to which the restore job restores the snapshot.
target
GroupId
string Required Unique identifier of the target Atlas project for the specified targetClusterName.
Body Parameter Type Necessity Description
deliveryType string Required

Type of restore job to create. Atlas accepts:

Job Type Action
automated Atlas 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.

See also

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

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.

pointInTime Atlas performs a Continuous Cloud Backup restore.
snapshotId string Required Unique identifier of the snapshot to restore.

Response

Name Type Description
cancelled boolean Flag indicating whether the restore job was canceled.
createdAt string Timestamp in ISO 8601 date and time format in UTC when Atlas created the restore job.
deliveryType string

Type of restore job to create. Atlas may return:

Job Type Action
automated Atlas 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.

See also

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

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.

pointInTime Atlas performs a Continuous Cloud Backup restore.
expired boolean Flag indicating whether the restore job expired.
expiresAt integer Timestamp in ISO 8601 date and time format in UTC when the restore job expires.
finishedAt integer Timestamp in ISO 8601 date and time format in UTC when the restore job completed.
id string Unique identifier of the restore job.
links array of objects One or more links to sub-resources and/or related resources. The relation-types between URLs are explained in the Web Linking Specification.
snapshotId string Unique identifier of the source snapshot ID of the restore job.
targetGroupId string Name of the target Atlas project of the restore job.
targetClusterName string Name of the target Atlas cluster to which the restore job restores the snapshot.
timestamp string Timestamp in ISO 8601 date and time format in UTC when the snapshot associated to snapshotId was taken.
Name Type Description
cancelled boolean Flag indicating whether the restore job was canceled.
createdAt string Timestamp in ISO 8601 date and time format in UTC when Atlas created the restore job.
deliveryType string

Type of restore job to create. Atlas may return:

Job Type Action
automated Atlas 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.

See also

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

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.

pointInTime Atlas performs a Continuous Cloud Backup restore.
expired boolean Flag indicating whether the restore job expired.
expiresAt integer Timestamp in ISO 8601 date and time format in UTC when the restore job expires.
finishedAt integer Timestamp in ISO 8601 date and time format in UTC when the restore job completed.
id string Unique identifier of the restore job.
links array of objects One or more links to sub-resources and/or related resources. The relation-types between URLs are explained in the Web Linking Specification.
oplogTs integer Timestamp in the number of seconds that have elapsed since the UNIX epoch from which to you want to restore this snapshot. This is the first part of an Oplog timestamp. Atlas returns this parameter when “oplogTs” exceeds 0.
oplogInc integer Oplog operation number from which to you want to restore this snapshot. This is the second part of an Oplog timestamp. Atlas returns this parameter when “oplogTs” exceeds 0.
pointInTimeUTCSeconds integer Timestamp in the number of seconds that have elapsed since the UNIX epoch from which Atlas restored this snapshot. Atlas returns this parameter when “pointInTimeUTCSeconds” exceeds 0.
targetGroupId string Name of the target Atlas project of the restore job.
targetClusterName string Name of the target Atlas cluster to which the restore job restores the snapshot.
timestamp string Timestamp in ISO 8601 date and time format in UTC when the snapshot associated to snapshotId was taken.
Name Type Description
cancelled boolean Flag indicating whether the restore job was canceled.
createdAt string Timestamp in ISO 8601 date and time format in UTC when Atlas created the restore job.
components array of objects

Collection of clusters to be downloaded. Atlas returns this parameter when restoring a sharded cluster and “deliveryType” : “download”.

Atlas checks if the snapshot was for a sharded cluster or replica set based on the snapshotId.

components
.downloadUrl
string

URL from which the snapshot of the components.replicaSetName should be downloaded. Atlas returns null for this parameter if the download URL:

  • Has expired,
  • Has been used, or
  • Hasn’t been created.
components
.replicaSetName
string Name of the shard or config server included in the snapshot.
deliveryType string

Type of restore job to create. Atlas may return:

Job Type Action
automated Atlas 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.

See also

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

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.

pointInTime Atlas performs a Continuous Cloud Backup restore.
deliveryUrl array of strings

One or more URLs for the compressed snapshot files for manual download. Atlas returns this parameter when restoring a replica set and “deliveryType”: “download”.

Note

If empty, Atlas is processing the restore job. Use the Get All Cloud Backup Restore Jobs endpoint periodically check for a deliveryUrl download value for the restore job.

expired boolean Flag indicating whether the restore job expired.
expiresAt integer Timestamp in ISO 8601 date and time format in UTC when the restore job expires.
finishedAt integer Timestamp in ISO 8601 date and time format in UTC when the restore job completed.
id string Unique identifier of the restore job.
links array of objects One or more links to sub-resources and/or related resources. The relation-types between URLs are explained in the Web Linking Specification.
snapshotId string Unique identifier of the source snapshot ID of the restore job.
timestamp string Timestamp in ISO 8601 date and time format in UTC when the snapshot associated to snapshotId was taken.

Example Request

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest --include \
     --header "Accept: application/json" \
     --header "Content-Type: application/json" \
     --request POST "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/clusters/{SOURCE-CLUSTER-NAME}/backup/restoreJobs" \
     --data '{
         "snapshotId" : "{SNAPSHOT-ID}",
         "deliveryType" : "automated",
         "targetClusterName" : "{TARGET-CLUSTER-NAME}",
         "targetGroupId" : "{TARGET-PROJECT-ID}"
       }'
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest --include \
     --header "Accept: application/json" \
     --header "Content-Type: application/json" \
     --request POST "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/clusters/{SOURCE-CLUSTER-NAME}/backup/restoreJobs" \
     --data '{
       "deliveryType" : "pointInTime",
       "pointInTimeUTCSeconds" : 1588523147,
       "targetClusterName" : "{TARGET-CLUSTER-NAME}",
       "targetGroupId" : "{TARGET-PROJECT-ID}"
     }'
1
2
3
4
5
6
7
8
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest --include \
     --header "Accept: application/json" \
     --header "Content-Type: application/json" \
     --request POST "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/clusters/{SOURCE-CLUSTER-NAME}/backup/restoreJobs" \
     --data '{
         "snapshotId" : "{SNAPSHOT-ID}",
         "deliveryType" : "download",
       }'

Example Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
  "cancelled": false,
  "deliveryType": "automated",
  "expired": false,
  "expiresAt": "2020-05-04T16:25:01Z",
  "id": "{RESTORE-ID}",
  "links": [
    {
      "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/clusters/{SOURCE-CLUSTER-NAME}/backup/restoreJobs/{RESTORE-ID}",
      "rel": "self"
    },
    {
      "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/clusters/{SOURCE-CLUSTER-NAME}/backup/snapshots/{SNAPSHOT-ID}",
      "rel": "http://mms.mongodb.com/snapshot"
    },
    {
      "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/clusters/{SOURCE-CLUSTER-NAME}",
      "rel": "http://mms.mongodb.com/cluster"
    },
    {
      "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}",
      "rel": "http://mms.mongodb.com/group"
    }
  ],
  "snapshotId": "{SNAPSHOT-ID}",
  "targetClusterName": "{TARGET-CLUSTER-NAME}",
  "targetGroupId": "{TARGET-PROJECT-ID}",
  "timestamp": "2020-05-03T16:25:01Z"
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
  "cancelled": false,
  "deliveryType": "pointInTime",
  "expired": false,
  "expiresAt": "2020-05-04T16:25:01Z",
  "id": "{RESTORE-ID}",
  "links": [
    {
      "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/clusters/{SOURCE-CLUSTER-NAME}/backup/restoreJobs/{RESTORE-ID}",
      "rel": "self"
    },
    {
      "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/clusters/{SOURCE-CLUSTER-NAME}/backup/snapshots/{SNAPSHOT-ID}",
      "rel": "http://mms.mongodb.com/snapshot"
    },
    {
      "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/clusters/{SOURCE-CLUSTER-NAME}",
      "rel": "http://mms.mongodb.com/cluster"
    },
    {
      "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}",
      "rel": "http://mms.mongodb.com/group"
    }
  ],
  "pointInTimeUTCSeconds" : 1588523147,
  "targetClusterName": "{TARGET-CLUSTER-NAME}",
  "targetGroupId": "{TARGET-PROJECT-ID}",
  "timestamp": "2020-05-03T16:25:01Z"
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{
  "cancelled": false,
  "components" : [ {
    "downloadUrl" : null,
    "replicaSetName" : "atlas-y6hegk-config-0"
  }, {
    "downloadUrl" : null,
    "replicaSetName" : "atlas-y6hegk-shard-0"
  } ],
  "deliveryType": "download",
  "expired": false,
  "expiresAt": "2020-05-04T16:25:01Z",
  "id": "{RESTORE-ID}",
  "links": [
    {
      "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/clusters/{SOURCE-CLUSTER-NAME}/backup/restoreJobs/{RESTORE-ID}",
      "rel": "self"
    },
    {
      "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/clusters/{SOURCE-CLUSTER-NAME}/backup/snapshots/{SNAPSHOT-ID}",
      "rel": "http://mms.mongodb.com/snapshot"
    },
    {
      "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/clusters/{SOURCE-CLUSTER-NAME}",
      "rel": "http://mms.mongodb.com/cluster"
    },
    {
      "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}",
      "rel": "http://mms.mongodb.com/group"
    }
  ],
  "snapshotId": "{SNAPSHOT-ID}",
  "deliveryUrl": "{URL}",
  "timestamp": "2020-05-03T16:25:01Z"
}