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

Restoring Databases and Tables to a Point in Time

Description

This API is used to restore databases and tables at a point in time.

Restrictions

This API applies only to replica sets.

URI

  • URI format

    POST https://{Endpoint}/v3/{project_id}/instances/{instance_id}/restore/collections

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.

instance_id

string

path

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.

Request Parameters

Table 2 Request header parameters

Parameter

Type

IN

Mandatory

Description

X-Auth-Token

string

header

Yes

User token

Table 3 Parameter description

Parameter

Type

Mandatory

Description

restore_collections

Array of objects

Yes

The database information.

For details, see Table 4.

Table 4 restore_collections data structure description

Parameter

Type

Mandatory

Description

database

String

Yes

Database name.

collections

Array of objects

No

The collection information.

For details, see Table 5.

restore_database_time

String

No

The database restoration time point.

This parameter is mandatory for database-level restoration,

The value is a UNIX timestamp, in milliseconds. The time zone is UTC.

Table 5 collections data structure description

Parameter

Type

Mandatory

Description

old_name

String

Yes

The table name before the restoration.

new_name

String

No

The table name after the restoration.

restore_collection_time

String

Yes

The collection restoration time point.

The value is a UNIX timestamp, in milliseconds. The time zone is UTC.

  • Request example
    • Database-level restoration
      {
        "restore_collections": [
          {
            "database": "test",
            "restore_database_time": 1607762955000
          }
        ]
      }
    • Collection-level restoration
      {
        "restore_collections": [
          {
            "database": "test",
            "collections": [
              {
                "old_name": "test",
                "restore_collection_time": 1607762955000
              }
            ]
          }
        ]
      }

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.