Updated on 2026-01-08 GMT+08:00

Restoring Data to the Original DB Instance

Description

  • This API is used to restore data to the original DB instance.

URI

  • URI format

    POST https://{Endpoint}/v3/{project_id}/instances/recovery

Table 1 Path parameters

Parameter

Type

IN

Mandatory

Description

X-Language

string

header

No

Language

project_id

string

path

Yes

Project ID. To obtain the project ID, see Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Type

Mandatory

Description

X-Auth-Token

String

Yes

User token

Table 3 Parameter description

Parameter

Type

Mandatory

Description

source

Object

Yes

The instance from which the backup was created

For details, see Table 4.

target

Object

Yes

The instance to which the backup is restored.

For details, see Table 5.

Table 4 source field data structure description

Parameter

Type

Mandatory

Description

instance_id

String

Yes

Instance ID, which can be obtained by calling the API described in Querying Instances and Details. If you do not have an instance, call the API described in Creating a DB Instance to create one.

type

String

No

The restoration mode. Enumerated values:

  • backup: indicates using backup files for restoration. In this mode, type is optional and backup_id is mandatory.
  • timestamp: indicates the point-in-time restoration mode. In this mode, type is mandatory and restore_time is mandatory.

backup_id

String

No

The ID of the backup to be restored. This parameter must be specified when the backup file is used for restoration.

restore_time

String

No

The point in time that data is restored in the UNIX timestamp. The unit is millisecond and the time zone is UTC.

NOTE:

This parameter takes effect only for replica set instances.

Table 5 target field data structure description

Parameter

Type

Mandatory

Description

instance_id

String

Yes

Specifies ID of the DB instance to be restored from a backup. You can call the API for querying DB Instances to obtain the DB instance ID. If you do not have an instance, you can call the API used for creating an instance.

  • Request example
    • Restoring a backup:
      {
        "source": {
          "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin02",
          "type": "backup",
          "backup_id": "2f4ddb93-b901-4b08-93d8-1d2e472f30fe"
        },
        "target": {
          "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin02"
        }
      }
    • Restoring to a point in time (applicable to replica set instances of versions 4.0, 4.2, and 4.4 and cluster instances of versions 4.0, 4.2, and 4.4)
      {
        "source": {
          "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin02",
          "type": "timestamp",
          "restore_time": 1532001446987
        },
        "target": {
          "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin02"
        }
      }

Response Parameters

Table 6 Parameter description

Parameter

Type

Mandatory

Description

job_id

String

Yes

ID of the asynchronous task for the restore operation.

  • Example response
    {
        "job_id": "a03b1b8a-b756-467c-8a49-38720c3d23ec"
    }

Status Code

For details, see Status Code.

Error Code

For details, see Error Code.