All Products
Search
Document Center

Object Storage Service:How to check whether an OSS object is restored

Last Updated:Oct 09, 2026

After you restore Archive, Cold Archive, or Deep Cold Archive objects from Object Storage Service (OSS), you must confirm that the objects are fully restored before you read them. To check multiple objects in a batch, you can call the relevant API operations and specify a prefix to view their restored state. To check a small number of objects, you can call the HeadObject operation and specify the exact object name to view its restored state.

Check the restored state of objects in a batch

To check the restored state of multiple objects in a batch, you can call the ListObjectsV2, ListObjects, or ListObjectVersions operation. Then, you can check the RestoreInfo response element for the following information:

  • If the object is not restored or the restore operation timed out, the RestoreInfo field is not returned.

  • If the object is being restored, the RestoreInfo field shows ongoing-request="true".

  • If the object is restored, the RestoreInfo field shows ongoing-request="false". It also includes an expiry-date that indicates when the readable state of the object expires.

Notes

The ListObjectsV2, ListObjects, and ListObjectVersions operations do not support specifying a storage class. To filter the results for Archive, Cold Archive, or Deep Cold Archive objects, you must manually check the storage-class property of each object and filter them on the client side.

Permissions

  • To check the restored state of objects in a batch, you must have the oss:ListObjects permission.

  • To check the restored state of all versions of objects in a batch, you must have the oss:ListObjectVersions permission.

  • For more information, see Grant custom permissions to a RAM user.

Important

The OSS console and the ossutil command line interface do not support checking the restored state of objects in a batch by calling the ListObjectsV2, ListObjects, or ListObjectVersions operation.

Use Alibaba Cloud SDKs

The following Python sample code shows how to call the ListObjects operation to check the restored state of objects with the prefix exampledir/ in the examplebucket bucket:

# -*- coding: utf-8 -*-
import oss2
from oss2.credentials import EnvironmentVariableCredentialsProvider

# Obtain access credentials from environment variables. Before you run this sample code, make sure that the OSS_ACCESS_KEY_ID and OSS_ACCESS_KEY_SECRET environment variables are set.
auth = oss2.ProviderAuth(EnvironmentVariableCredentialsProvider())

# Specify the endpoint of the region where the bucket is located. For example, if the bucket is in the China (Hangzhou) region, set the endpoint to https://oss-cn-hangzhou.aliyuncs.com.
# Specify the bucket name, for example, examplebucket.
bucket = oss2.Bucket(auth, 'https://oss-cn-hangzhou.aliyuncs.com', 'examplebucket')

# List all objects in the exampledir folder of the bucket.
for obj in oss2.ObjectIterator(bucket, prefix='exampledir/'):
    # Check whether the storage class of the object is Archive, Cold Archive, or Deep Archive.
    if obj.storage_class in ['Archive', 'ColdArchive', 'DeepArchive']:
        print("etag:", obj.etag)
        print("key:", obj.key)
        print("last_modified:", obj.last_modified)
        print("size:", obj.size)
        print("storage_class:", obj.storage_class)
        print("type:", obj.type)
        print("restore_info:", obj.restore_info)
        print("owner.id:", obj.owner.id)
        print("owner.display_name:", obj.owner.display_name)

The following example shows a sample response:

etag: 1797116AF33DB090B2DC79FE70E6F685
key: exampledir/exampleobjec2.txt
last_modified: 1704262519
size: 941
storage_class: DeepColdArchive
type: Normal
restore_info: None
owner.id: 137918634953****
owner.display_name: 137918634953****
etag: 1797116AF33DB090B2DC79FE70E6F685
key: exampledir/exampleobject.txt
last_modified: 1704262504
size: 941
storage_class: ColdArchive
type: Normal
restore_info: None
owner.id: 137918634953****
owner.display_name: 137918634953****
etag: 1797116AF33DB090B2DC79FE70E6F685
key: exampledir/exampleobject1.txt
last_modified: 1704262612
size: 941
storage_class: Archive
type: Normal
restore_info: None
owner.id: 137918634953****
owner.display_name: 137918634953****

For sample code in other programming languages, see List objects in SDK overview.

Use REST API

If your program has high customization requirements, you can directly send REST API requests. To directly send REST API requests, you must manually write code to calculate signatures. For more information, see ListObjectsV2 (GetBucketV2), GetBucket (ListObjects), and ListObjectVersions (GetBucketVersions).

Check the restored state of a specific object

To check the restored state of a small number of objects, you can call the HeadObject operation and check the x-oss-restore response header for the following information:

  • If the object is not restored or the restore operation timed out, the x-oss-restore field is not returned.

  • If the object is being restored, the x-oss-restore field shows ongoing-request="true".

  • If the object is restored, the x-oss-restore field shows ongoing-request="false". It also includes an expiry-date that indicates when the readable state of the object expires.

Notes

If you call the HeadObject operation for many objects, high fees for GET requests are incurred. For more information, see Request fees.

Permissions

To check the restored state of a specific object, you must have the oss:GetObject permission. For more information, see Grant custom permissions to a RAM user.

Use the OSS console

  1. Log on to the OSS console.

  2. Click Buckets, and then click the name of the target bucket.

  3. In the navigation pane on the left, choose Files > Objects.

  4. In the Actions column of the target object, choose Details.

    • If the object is not restored or the restore operation timed out, Restore is displayed to the right of Object Name in the Details panel.

    • If the object is being restored, Restoring is displayed to the right of Object Name in the Details panel.

    • If the object is restored, Restored is displayed to the right of Object Name in the Details panel. The expiration time of the readable state is displayed to the right of Restored State Expiration.

Use Alibaba Cloud SDKs

The following Python sample code shows how to call the HeadObject operation to check the restored state of the Archive object named exampleobject.txt in the exampledir folder of the examplebucket bucket:

# -*- coding: utf-8 -*-
import oss2
from oss2.credentials import EnvironmentVariableCredentialsProvider
import json

# Obtain access credentials from environment variables. Before you run this sample code, make sure that the OSS_ACCESS_KEY_ID and OSS_ACCESS_KEY_SECRET environment variables are set.
auth = oss2.ProviderAuth(EnvironmentVariableCredentialsProvider())
# Specify the endpoint of the region where the bucket is located. For example, if the bucket is in the China (Hangzhou) region, set the endpoint to https://oss-cn-hangzhou.aliyuncs.com.
# Specify the bucket name, for example, examplebucket.
bucket = oss2.Bucket(auth, 'https://oss-cn-hangzhou.aliyuncs.com', 'examplebucket')

# Get the metadata of the object.
result = bucket.head_object('exampledir/exampleobject.txt')

# Print the HTTP response headers to get some metadata about the object. Use json.dumps to format the JSON output.
print(json.dumps(dict(result.headers), indent=4))

The following example shows a sample response:

{
    "Server": "AliyunOSS",
    "Date": "Wed, 03 Jan 2024 03:32:58 GMT",
    "Content-Type": "text/plain",
    "Content-Length": "941",
    "Connection": "keep-alive",
    "x-oss-request-id": "6594D56AE80D013535FE****",
    "Accept-Ranges": "bytes",
    "ETag": "\"1797116AF33DB090B2DC79FE70E6F685\"",
    "Last-Modified": "Wed, 03 Jan 2024 03:26:50 GMT",
    "x-oss-object-type": "Normal",
    "x-oss-hash-crc64ecma": "10914985812740272941",
    "x-oss-storage-class": "Archive",
    "x-oss-restore": "ongoing-request=\"false\", expiry-date=\"Thu, 04 Jan 2024 03:28:54 GMT\"",
    "x-oss-expiration": "expiry-date=\"Thu, 04 Jan 2024 00:00:00 GMT\", rule-id=\"ae01d217-94e8-44a6-989a-b89583b****\"",
    "x-oss-version-id": "null",
    "Content-MD5": "F5cRavM9sJCy3Hn+cOb2hQ==",
    "x-oss-server-time": "54"
}

For sample code in other programming languages, see Get object metadata in SDK overview.

Use the ossutil command line interface

Run the following command to check the restored state of the object with the key exampledir/exampleobject.txt in the examplebucket bucket:

ossutil stat oss://examplebucket/exampledir/exampleobject.txt

The following example shows a sample response for a completed restore operation.

ACL                   : private
Accept-Ranges         : bytes
Content-Length        : 941
Content-Md5           : F5cRavM9sJCy3Hn+cOb2hQ==
Content-Type          : text/plain
Etag                  : 1797116AF33DB090B2DC79FE70E6F685
Last-Modified         : 2024-01-03 11:26:50 +0800 CST
Owner                 : 137918634953****
X-Oss-Expiration      : expiry-date="Thu, 04 Jan 2024 00:00:00 GMT", rule-id="ae01d217-94e8-44a6-989a-b89583b****"
X-Oss-Hash-Crc64ecma  : 10914985812740272941
X-Oss-Object-Type     : Normal
X-Oss-Restore         : ongoing-request="false", expiry-date="Thu, 04 Jan 2024 03:28:54 GMT"
X-Oss-Storage-Class   : Archive
X-Oss-Version-Id      : null

0.291855(s) elapsed

For more information, see stat (View bucket and object information).

Use REST API

If your program has high customization requirements, you can directly send REST API requests. To directly send REST API requests, you must manually write code to calculate signatures. For more information, see HeadObject.