View a markdown version of this page

GetPart - Amazon S3

GetPart

Retrieves a single part of an in-progress or completed multipart upload.

Before retrieving any part corresponding to an upload ID, a multipart upload must be initiated (see CreateMultipartUpload). In response to the initiate request, S3 returns an upload ID, a unique identifier that must be included in the GetPart request.

Part numbers can be any number from 1 to 10,000, inclusive. A part number uniquely identifies a part and also defines its position within the object being created.

The GetPart request must specify the full key name for the object. To retrieve a specific range of bytes from a part, use the Range header to specify the byte range (for example, bytes=0-9).

Both the virtual-hosted-style requests and the path-style requests are supported. For a virtual hosted-style request example, the object photos/2006/February/sample.jpg is specified as /photos/2006/February/sample.jpg. For a path-style request example, the object photos/2006/February/sample.jpg in the bucket named examplebucket is specified as /examplebucket/photos/2006/February/sample.jpg. For more information about request types, see HTTP Host Header Bucket Specification in the Amazon S3 User Guide.

Permissions

General purpose bucket permissions - The s3:GetObject permission is required to use GetPart for unversioned objects or uploads. For versioned objects or uploads, the s3:GetObjectVersion permission is required instead. For all requests to in-progress multipart uploads, the s3:GetIncompleteUpload permission is also required. For more information, see Specifying permissions in a policy in the Amazon S3 User Guide.

Storage classes

For completed multipart uploads, GetPart does not support retrieving a part from an object that is stored in the S3 Glacier Flexible Retrieval storage class, the S3 Glacier Deep Archive storage class, or the S3 Intelligent-Tiering storage class. Such requests will return an InvalidObjectState error. Restoring is not supported for GetPart. For more information about storage classes, see Using Amazon S3 storage classes in the Amazon S3 User Guide.

Encryption

Encryption request headers, like x-amz-server-side-encryption, should not be sent for the GetPart requests, if your object uses server-side encryption with Amazon S3 managed encryption keys (SSE-S3), server-side encryption with AWS Key Management Service (AWS KMS) keys (SSE-KMS), or dual-layer server-side encryption with AWS KMS keys (DSSE-KMS). If you include the header in your GetPart requests for the object that uses these types of keys, you’ll get an HTTP 400 Bad Request error.

Server-side encryption with customer-provided keys (SSE-C) is not supported for GetPart.

Note

GetPart is only supported for Amazon S3 general purpose buckets. It is not supported for Amazon S3 on Outposts, S3 directory buckets, and S3 Access Points.

GetPart is only supported for multipart uploads that were initiated after November 29, 2026, 00:00 UTC. GetPart is also not supported for multipart uploads completed with non-consecutive part numbers. Use GetObject instead.

The following operations are related to GetPart:

Important

You must URL encode any signed header values that contain spaces. For example, if your header value is my file.txt, containing two spaces after my, you must URL encode this value to my%20%20file.txt.

Request Syntax

GET /{Key+}?part&partNumber=PartNumber&uploadId=UploadId HTTP/1.1 Host: Bucket.s3.amazonaws.com Range: Range x-amz-request-payer: RequestPayer x-amz-expected-bucket-owner: ExpectedBucketOwner x-amz-checksum-mode: ChecksumMode

URI Request Parameters

The request uses the following URI parameters.

Bucket

The name of the bucket containing the part to retrieve.

Required: Yes

Key

Object key for which the multipart upload was initiated.

Length Constraints: Minimum length of 1.

Required: Yes

partNumber

Part number of the part to retrieve. This is a positive integer between 1 and 10,000.

Required: Yes

Range

Downloads the specified byte range of a part. For more information about the HTTP Range header, see https://www.rfc-editor.org/rfc/rfc9110.html#name-range.

Note

Amazon S3 doesn't support retrieving multiple ranges of data per GetPart request.

uploadId

Upload ID identifying the multipart upload to retrieve the specified part from.

Required: Yes

x-amz-checksum-mode

To retrieve the checksum, this mode must be enabled.

Valid Values: ENABLED

x-amz-expected-bucket-owner

The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code 403 Forbidden (access denied).

x-amz-request-payer

Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests. If either the source or destination S3 bucket has Requester Pays enabled, the requester will pay for the corresponding charges. For information about downloading objects from Requester Pays buckets, see Downloading Objects in Requester Pays Buckets in the Amazon S3 User Guide.

Note

This functionality is not supported for directory buckets.

Valid Values: requester

Request Body

The request does not have a request body.

Response Syntax

HTTP/1.1 200 accept-ranges: AcceptRanges Content-Length: ContentLength ETag: ETag x-amz-multipart-upload-status: MultipartUploadStatus x-amz-checksum-crc32: ChecksumCRC32 x-amz-checksum-crc32c: ChecksumCRC32C x-amz-checksum-crc64nvme: ChecksumCRC64NVME x-amz-checksum-sha1: ChecksumSHA1 x-amz-checksum-sha256: ChecksumSHA256 x-amz-checksum-sha512: ChecksumSHA512 x-amz-checksum-md5: ChecksumMD5 x-amz-checksum-xxhash64: ChecksumXXHASH64 x-amz-checksum-xxhash3: ChecksumXXHASH3 x-amz-checksum-xxhash128: ChecksumXXHASH128 x-amz-version-id: VersionId Content-Range: ContentRange x-amz-server-side-encryption: ServerSideEncryption x-amz-server-side-encryption-aws-kms-key-id: SSEKMSKeyId x-amz-server-side-encryption-bucket-key-enabled: BucketKeyEnabled x-amz-storage-class: StorageClass x-amz-request-charged: RequestCharged Body

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The response returns the following HTTP headers.

accept-ranges

Indicates that a range of bytes was specified in the request.

Content-Length

The size of the retrieved part in bytes.

Content-Range

The portion of the part that was returned in the response.

ETag

The entity tag of the part.

x-amz-checksum-crc32

The Base64 encoded, 32-bit CRC32 checksum of the part. This checksum is only present if the checksum was uploaded with the object. For more information, see Checking object integrity in the Amazon S3 User Guide.

x-amz-checksum-crc32c

The Base64 encoded, 32-bit CRC32C checksum of the part. This checksum is only present if the checksum was uploaded with the object. For more information, see Checking object integrity in the Amazon S3 User Guide.

x-amz-checksum-crc64nvme

The Base64 encoded, 64-bit CRC64NVME checksum of the part. For more information, see Checking object integrity in the Amazon S3 User Guide.

x-amz-checksum-md5

The Base64 encoded, 128-bit MD5 digest of the part. For more information, see Checking object integrity in the Amazon S3 User Guide.

x-amz-checksum-sha1

The Base64 encoded, 160-bit SHA1 digest of the part. This checksum is only present if the checksum was uploaded with the object. For more information, see Checking object integrity in the Amazon S3 User Guide.

x-amz-checksum-sha256

The Base64 encoded, 256-bit SHA256 digest of the part. This checksum is only present if the checksum was uploaded with the object. For more information, see Checking object integrity in the Amazon S3 User Guide.

x-amz-checksum-sha512

The Base64 encoded, 512-bit SHA512 digest of the part. For more information, see Checking object integrity in the Amazon S3 User Guide.

x-amz-checksum-xxhash128

The Base64 encoded, 128-bit XXHASH128 checksum of the part. For more information, see Checking object integrity in the Amazon S3 User Guide.

x-amz-checksum-xxhash3

The Base64 encoded, 64-bit XXHASH3 checksum of the part. For more information, see Checking object integrity in the Amazon S3 User Guide.

x-amz-checksum-xxhash64

The Base64 encoded, 64-bit XXHASH64 checksum of the part. For more information, see Checking object integrity in the Amazon S3 User Guide.

x-amz-multipart-upload-status

The status of the multipart upload. Possible values are:

  • IN_PROGRESS - CompleteMultipartUpload has not been called. The part data exists, and can be overwritten by a subsequent UploadPart call with the same part number.

  • COMPLETED - CompleteMultipartUpload has been called. The part data is immutable, and the full object exists.

Valid Values: IN_PROGRESS | COMPLETED

x-amz-request-charged

If present, indicates that the requester was successfully charged for the request. For more information, see Using Requester Pays buckets for storage transfers and usage in the Amazon Simple Storage Service user guide.

Note

This functionality is not supported for directory buckets.

Valid Values: requester

x-amz-server-side-encryption

The server-side encryption algorithm used when storing this multipart upload in Amazon S3.

Valid Values: AES256 | aws:fsx | aws:backup | aws:kms | aws:kms:dsse

x-amz-server-side-encryption-aws-kms-key-id

If present, indicates the ID of the KMS key that was used for object encryption.

x-amz-server-side-encryption-bucket-key-enabled

Indicates whether the multipart upload uses an S3 Bucket Key for server-side encryption with AWS Key Management Service (AWS KMS) keys (SSE-KMS).

x-amz-storage-class

Provides storage class information about where this part is stored.

For in-progress multipart uploads, this header can return any of the valid values listed for this header.

Note

For completed multipart uploads, GetPart doesn't support the GLACIER, DEEP_ARCHIVE, or INTELLIGENT_TIERING storage classes.

Valid Values: STANDARD | REDUCED_REDUNDANCY | STANDARD_IA | ONEZONE_IA | INTELLIGENT_TIERING | GLACIER | DEEP_ARCHIVE | OUTPOSTS | GLACIER_IR | SNOW | EXPRESS_ONEZONE | FSX_OPENZFS | FSX_ONTAP | AWS_BACKUP_WARM | AWS_BACKUP_LOW_COST_WARM

x-amz-version-id

Version ID of the object.

The following data is returned in binary format by the service.

Errors

InvalidObjectState

Object is archived and inaccessible until restored. Use GetObject to retrieve once restored.

If the object you are retrieving is stored in the S3 Glacier Flexible Retrieval storage class, the S3 Glacier Deep Archive storage class, the S3 Intelligent-Tiering Archive Access tier, or the S3 Intelligent-Tiering Deep Archive Access tier, before you can retrieve the object you must first restore a copy using RestoreObject. Otherwise, this operation returns an InvalidObjectState error. For information about restoring archived objects, see Restoring Archived Objects in the Amazon S3 User Guide.

HTTP Status Code: 403

NoSuchBucket

The specified bucket does not exist.

HTTP Status Code: 404

NoSuchPart

The specified multipart upload part does not exist. Either the part has not been uploaded, or the part number exceeds the number of parts in the completed object.

HTTP Status Code: 404

NoSuchUpload

The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed.

HTTP Status Code: 404

Examples

Sample Request

The following request retrieves part number 1 from the in-progress multipart upload identified by uploadId for the object my-image.jpg.

GET /my-image.jpg?part&partNumber=1&uploadId=EXAMPLEJZ6e0YupT2h66iePQCc9IEbYbDUy4RTpMeoSMLPRp8Z5o1u8feSRonpvnWsKKG35tI2LB9VDPiCgTy.Gq2VxQLYjrue4Nq.NBdqI- HTTP/1.1 Host: amzn-s3-demo-bucket.s3.<Region>.amazonaws.com Date: Mon, 3 Oct 2016 22:32:00 GMT Authorization: authorization string

Sample Response: In-progress multipart upload

The response includes the x-amz-multipart-upload-status header indicating that the multipart upload has not yet been completed. The part data may be overwritten by a subsequent UploadPart call with the same part number.

HTTP/1.1 200 OK x-amz-id-2: eftixk72aD6Ap51TnqcoF8eFidJG9Z/2mkiDFu8yU9AS1ed4OpIszj7UDNEHGran x-amz-request-id: 318BC8BC148832E5 Date: Mon, 3 Oct 2016 22:32:00 GMT ETag: "fba9dede5f27731c9771645a39863328" x-amz-multipart-upload-status: IN_PROGRESS x-amz-storage-class: STANDARD Content-Length: 5242880 [5242880 bytes of part data]

Sample Response: Completed multipart upload

After CompleteMultipartUpload has been called, the x-amz-multipart-upload-status header is set to COMPLETED and the part data is immutable.

HTTP/1.1 200 OK x-amz-id-2: eftixk72aD6Ap51TnqcoF8eFidJG9Z/2mkiDFu8yU9AS1ed4OpIszj7UDNEHGran x-amz-request-id: 318BC8BC148832E5 Date: Mon, 3 Oct 2016 22:32:00 GMT ETag: "fba9dede5f27731c9771645a39863328" x-amz-multipart-upload-status: COMPLETED x-amz-storage-class: STANDARD Content-Length: 5242880 [5242880 bytes of part data]

Sample Request: Range header

The following request specifies the HTTP Range header to retrieve the first 10 bytes of part number 1. For more information about the HTTP Range header, see https://www.rfc-editor.org/rfc/rfc9110.html#name-range.

Note

Amazon S3 doesn't support retrieving multiple ranges of data per GetPart request.

GET /my-image.jpg?part&partNumber=1&uploadId=EXAMPLEJZ6e0YupT2h66iePQCc9IEbYbDUy4RTpMeoSMLPRp8Z5o1u8feSRonpvnWsKKG35tI2LB9VDPiCgTy.Gq2VxQLYjrue4Nq.NBdqI- HTTP/1.1 Host: amzn-s3-demo-bucket.s3.<Region>.amazonaws.com Date: Mon, 3 Oct 2016 22:32:00 GMT Range: bytes=0-9 Authorization: authorization string

Sample Response: Range header

The response returns HTTP 206 Partial Content and includes the Content-Range header indicating the portion of the part that was returned.

HTTP/1.1 206 Partial Content x-amz-id-2: eftixk72aD6Ap51TnqcoF8eFidJG9Z/2mkiDFu8yU9AS1ed4OpIszj7UDNEHGran x-amz-request-id: 318BC8BC148832E5 Date: Mon, 3 Oct 2016 22:32:00 GMT ETag: "fba9dede5f27731c9771645a39863328" x-amz-multipart-upload-status: IN_PROGRESS x-amz-storage-class: STANDARD Accept-Ranges: bytes Content-Range: bytes 0-9/5242880 Content-Length: 10 [10 bytes of part data]

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: