The GetObject operation downloads an object from a bucket. You must have read permissions for the object to call this operation.
Request syntax
GET /ObjectName HTTP/1.1
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue
Range: bytes=ByteRange (Optional)For information about how to calculate the signature for the Authorization header, see Authorization request header.
When you call this operation in an OSS on CloudBox environment, replace the Host with the CloudBox Endpoint. For more information, see CloudBox Endpoint.
When you download large objects (larger than 100 MB) from Object Storage Service (OSS), the transfer might fail due to network issues. You can use HTTP Range requests to retrieve a large object in parts. This method enables resumable and concurrent downloads, improving transfer reliability. For more information, see How to obtain OSS resources in segments using HTTP Range requests.
Usage notes
The GetObject operation supports access over HTTP and HTTPS by default. It also supports multi-range downloads, allowing you to specify multiple byte ranges in a single request to improve download efficiency.
To allow access only over HTTPS, use a bucket policy.
If the object is in the Archive storage class, you must first restore it by sending a RestoreObject request, or enable real-time access for the bucket where the object is stored.
Permissions
Versioning
API behavior
Billing and throttling
Request parameters
Request headers
OSS allows you to customize response headers in GET requests. OSS sets the response headers to the values you specify in the GET request, but only if the request succeeds with a 200 OK status code.
OSS does not support custom response headers in GET requests for anonymous access.
Parameter | Type | Required | Description |
Range | String | No | Specifies the byte range of the object to download.
Default value: None |
x-oss-multi-range-behavior | String | No | Enables multi-range downloads.
Default value: None |
If-Modified-Since | String | No | If the specified time is earlier than the actual modification time of the object, or if the specified time is invalid, the object is returned with a Format: GMT. Example: Default value: None |
If-Unmodified-Since | String | No | If the specified time is the same as or later than the actual modification time of the object, the object is transferred, and a Format: GMT. Example: You can use If-Modified-Since and If-Unmodified-Since at the same time. Default value: None |
If-Match | String | No | If the ETag you provide matches the ETag of the object, the object is transferred, and a The ETag of an object is used to check whether the data has changed. You can use the ETag value to verify data integrity. Default value: None |
If-None-Match | String | No | If the ETag you provide does not match the ETag of the object, the object is transferred, and a You can use If-Match and If-None-Match at the same time. Default value: None |
Accept-Encoding | String | No | Specifies the encoding type of the client. To transfer the returned content in Gzip compressed format, you must explicitly add OSS compresses an object with Gzip for transfer if it is at least 1 KB in size and its Content-Type is supported. Otherwise, OSS transfers the object uncompressed.
Default value: None |
Query parameters
Parameter | Type | Required | Description |
response-content-language | String | No | Specifies the Default value: None |
response-expires | String | No | Specifies the Default value: None |
response-cache-control | String | No | Specifies the Default value: None |
response-content-disposition | String | No | Specifies the Default value: None |
response-content-encoding | String | No | Specifies the Default value: None |
Response parameters
Response headers
If the object is a symbolic link, OSS returns the content of the target object. In the response headers, Content-Length, ETag, and Content-Md5 are the metadata of the target object. Last-Modified is the more recent of the modification times of the target object and the symbolic link. Other headers contain the metadata of the symbolic link.
Parameter | Type | Description |
x-oss-server-side-encryption | String | If the object is stored with server-side encryption, OSS automatically decrypts and returns the object in a GET request. The |
x-oss-sealed-time | String | If the object is a sealed appendable object, this header indicates when the Seal operation was performed. Example: |
x-oss-tagging-count | String | The number of tags associated with the object. This header is included only if you have permission to read tags. |
x-oss-expiration | String | The expiration time of an object in a bucket for which a lifecycle rule is configured.
|
x-oss-object-worm-mode | String | The retention policy mode of the object. If the object has an object-level retention policy configured, the value is |
x-oss-object-worm-retain-until-date | String | The object's retention expiration date, in ISO 8601 format. The object cannot be deleted or overwritten before this date. This header is included only when ObjectWorm is enabled for the bucket, the caller has the |
Examples
Basic download
Sample request
GET /oss.jpg HTTP/1.1 Host: oss-example.oss-cn-hangzhou.aliyuncs.com Date: Fri, 24 Feb 2012 06:38:30 GMT Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218eSample response
HTTP/1.1 200 OK x-oss-request-id: 3a8f-2e2d-7965-3ff9-51c875b***** x-oss-object-type: Normal Date: Fri, 24 Feb 2012 06:38:30 GMT Last-Modified: Fri, 24 Feb 2012 06:07:48 GMT ETag: "5B3C1A2E0563E1B002CC607C*****" Content-Type: image/jpeg Content-Length: 344606 Server: AliyunOSS [344606 bytes of object data]
Range download
Sample request
GET /oss.jpg HTTP/1.1 Host:oss-example.oss-cn-hangzhou.aliyuncs.com Date: Fri, 28 Feb 2012 05:38:42 GMT Range: bytes=100-900 Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218eSample response
HTTP/1.1 206 Partial Content x-oss-request-id: 28f6-15ea-8224-234e-c0ce407***** x-oss-object-type: Normal Date: Fri, 28 Feb 2012 05:38:42 GMT Last-Modified: Fri, 24 Feb 2012 06:07:48 GMT ETag: "5B3C1A2E05E1B002CC607C*****" Accept-Ranges: bytes Content-Range: bytes 100-900/344606 Content-Type: image/jpeg Content-Length: 801 Server: AliyunOSS [801 bytes of object data]
Multi-range download
Sample request
GET /oss.jpg HTTP/1.1 Host:oss-example.oss-cn-hangzhou.aliyuncs.com Date: Fri, 28 Feb 2012 05:38:42 GMT Range: bytes=0-1,3-4,5-6,7-8 x-oss-multi-range-behavior: multi-range Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218eSample response
HTTP/1.1 206 Partial Content x-oss-request-id: 28f6-15ea-8224-234e-c0ce407***** x-oss-object-type: Normal Date: Fri, 28 Feb 2012 05:38:42 GMT Last-Modified: Fri, 24 Feb 2012 06:07:48 GMT ETag: "5B3C1A2E05E1B002CC607C*****" Accept-Ranges: bytes Content-Type: multipart/byteranges;boundary=63ce7776-c104-417f-8a65-ccaa3b17f428 Content-Length: 446 Server: AliyunOSS --63ce7776-c104-417f-8a65-ccaa3b17f428 Content-type: text/plain Content-range: bytes 0-1/10 [ 2 Bytes object content] --63ce7776-c104-417f-8a65-ccaa3b17f428 Content-type: text/plain Content-range: bytes 3-4/10 [ 2 Bytes object content] --63ce7776-c104-417f-8a65-ccaa3b17f428 Content-type: text/plain Content-range: bytes 5-6/10 [ 2 Bytes object content] --63ce7776-c104-417f-8a65-ccaa3b17f428 Content-type: text/plain Content-range: bytes 7-8/10 [ 2 Bytes object content] --63ce7776-c104-417f-8a65-ccaa3b17f428--
Custom response headers
Sample request
GET /oss.jpg?response-expires=Thu%2C%2001%20Feb%202012%2017%3A00%3A00%20GMT&response-cache-control=No-cache&response-content-disposition=attachment%253B%2520filename%253Dtesting.txt&response-content-encoding=utf-8&response-content-language=%E4%B8%AD%E6%96%87 HTTP/1.1 Host: oss-example.oss-cn-hangzhou.aliyuncs.com: Date: Fri, 24 Feb 2012 06:09:48 GMTSample response
HTTP/1.1 200 OK x-oss-request-id: 559CC9BDC75A644***** x-oss-object-type: Normal Date: Fri, 24 Feb 2012 06:09:48 GMT Last-Modified: Fri, 24 Feb 2012 06:07:48 GMT ETag: "5B3C1A2E053D1B002CC607*****" Content-Length: 344606 Connection: keep-alive Content-disposition: attachment; filename=testing.txt Content-language: 中文 Content-type: jpg Cache-control: no-cache Expires: Fri, 24 Feb 2012 17:00:00 GMT Server: AliyunOSS [344606 bytes of object data]
Symbolic link object
Sample request
GET /link-to-oss.jpg HTTP/1.1 Accept-Encoding: identity Date: Tue, 08 Nov 2016 03:17:58 GMT Host: oss-example.oss-cn-hangzhou.aliyuncs.com Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218eSample response
HTTP/1.1 200 OK Server: AliyunOSS Date: Tue, 08 Nov 2016 03:17:58 GMT Content-Type: application/octet-stream Content-Length: 20 Connection: keep-alive x-oss-request-id: 582143E6A212AD***** Accept-Ranges: bytes ETag: "8086265EFC021F9A2F09BF4****" Last-Modified: Tue, 08 Nov 2016 03:17:58 GMT x-oss-object-type: Symlink Content-MD5: gIYmXvwCEe0fmi8Jv0Y****
Archive object (restored)
Sample request
GET /oss.jpg HTTP/1.1 Host: oss-archive-example.oss-cn-hangzhou.aliyuncs.com Date: Sat, 15 Apr 2017 09:38:30 GMT Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218eSample response
HTTP/1.1 200 OK x-oss-request-id: 58F723829F29F18D7F00***** x-oss-object-type: Normal x-oss-restore: ongoing-request="false", expiry-date="Sun, 16 Apr 2017 08:12:33 GMT" Date: Sat, 15 Apr 2017 09:38:30 GMT Last-Modified: Sat, 15 Apr 2017 06:07:48 GMT ETag: "5B3C1A2E0763E1B002CC607C*****" Content-Type: image/jpeg Content-Length: 344606 Server: AliyunOSS [344606 bytes of object data]
Versioning scenarios
Specify a version ID
Sample request
GET /example?versionId=CAEQNhiBgMDJgZCA0BYiIDc4MGZjZGI2OTBjOTRmNTE5NmU5NmFhZjhjYmY0**** HTTP/1.1 Host: versioning-get.oss-cn-hangzhou.aliyuncs.com Date: Tue, 09 Apr 2019 02:58:06 GMT Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218eSample response
HTTP/1.1 200 OK x-oss-request-id: 5CAC0A3EDE0170***** x-oss-version-id: CAEQNhiBgM0BYiIDc4MGZjZGI2OTBjOTRmNTE5NmU5NmFhZjhjYmY***** x-oss-object-type: Normal Date: Tue, 17 Apr 2025 02:58:06 GMT Last-Modified: Fri, 22 Mar 2018 08:07:50 GMT ETag: "5B3C1A2E053D7002CC607C5A*****" Content-Type: text/html Content-Length: 362149 Server: AliyunOSS [362149 bytes of object data]
The current version is a delete marker
Sample request
GET /example HTTP/1.1 Host: versioning-get.oss-cn-hangzhou.aliyuncs.com Date: Tue, 17 Apr 2025 03:22:33 GMT Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218eSample response
HTTP/1.1 404 Not Found x-oss-request-id: 5CAC0FEADE0170***** x-oss-delete-marker: true x-oss-version-id: CAEQNxiBgyA0BYiIDc4ZDdmNTA2MGViZTRiNjE5NzZlZWM4OWM5OT***** Date: Tue, 17 Apr 2025 03:22:33 GMT Content-Type: application/xml Connection: keep-alive Server: AliyunOSS <?xml version="1.0" encoding="UTF-8"?> <Error> <Code>NoSuchKey</Code> <Message>The specified key does not exist.</Message> <RequestId>5CAC0FEADE0170*****</RequestId> <HostId>versioning-get.oss-cn-hangzhou.aliyun*****</HostId> <Key>example</Key> </Error>
Specify the version ID of a delete marker
Sample request
GET /example?versionId=CAEQMxiBgMCfqaWA0BYiIDliMWI4MGQ0MTVmMjQ3MmE5MDNlMmY4YmFkYTk3**** HTTP/1.1 Host: versioning-get.oss-cn-hangzhou.aliyuncs.com Date: Tue, 17 Apr 2025 03:09:44 GMT Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218eSample response
HTTP/1.1 405 Method Not Allowed x-oss-request-id: 5CAC0CF8DE01700***** x-oss-delete-marker: true x-oss-version-id: CAEQMxiBgMCfqaWADliMWI4MGQ0MTVmMjQ3MmE5MDNlMmY4YmFkYTk***** Allow: DELETE Date: Tue, 17 Apr 2025 03:09:44 GMT Content-Type: application/xml Content-Length: 318 Connection: keep-alive Server: AliyunOSS <?xml version="1.0" encoding="UTF-8"?> <Error> <Code>MethodNotAllowed</Code> <Message>The specified method is not allowed against this resource.</Message> <RequestId>5CAC0CF8DE0170*****</RequestId> <HostId>versioning-get.oss-cn-hangzhou.aliyunc*****</HostId> <Method>GET</Method> <ResourceType>DeleteMarker</ResourceType> </Error>
Error codes
If a request fails, OSS returns a response body that contains an error code. The following table lists some common error codes for this operation.
Error code | HTTP status code | Description |
NoSuchKey | 404 | The specified object does not exist. |
SymlinkTargetNotExist | 404 | The object is a symbolic link, and the target object does not exist. |
InvalidTargetType | 400 | The object is a symbolic link, and the target object is also a symbolic link. |
InvalidObjectState | 403 | This error is returned when you attempt to download an object of the Archive storage class under the following conditions:
|
Not Modified | 304 | This error can be returned for the following reasons:
|
Precondition Failed | 412 | This error can be returned for the following reasons:
|
Not Found | 404 | This error is returned if a |
Method Not Allowed | 405 | This error is returned if the specified |