putBucketVersioning method
Written by
Updated at September 2, 2025
Enables or suspends bucket versioning.
Versioning can take one of the two statuses:
Enabled: Turns on version management for objects in the bucket. All new objects added to the bucket will get a unique version ID.Suspended: Suspends version management for objects in the bucket. All new objects added to the bucket will getnullfor the version ID.
Note
With object version lock on, versioning cannot be paused.
For more information on getting started with the API and the general request format, see How to use the S3 API.
Request
PUT /{bucket}?versioning HTTP/2
Path parameters
| Parameter | Description |
|---|---|
bucket |
Bucket name. |
Request parameters
| Parameter | Description |
|---|---|
versioning |
Required parameter that indicates the type of operation. |
Data schema
<?xml version="1.0" encoding="UTF-8"?>
<ListBucketResult
xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<KeyCount>1</KeyCount>
<Name>my-sample-bucket</Name>
<Prefix></Prefix>
<MaxKeys>1000</MaxKeys>
<IsTruncated>false</IsTruncated>
<Contents>
<Key>text.txt</Key>
<LastModified>2025-05-15T07:23:08.030Z</LastModified>
<Owner>
<ID>ajegtlf2q28a********</ID>
<DisplayName>ajegtlf2q28a********</DisplayName>
</Owner>
<ETag>"f75a361db63aa4722fb8e083********"</ETag>
<Size>103</Size>
<StorageClass>STANDARD</StorageClass>
<TagSet></TagSet>
</Contents>
</ListBucketResult>
| Element | Description |
|---|---|
Status |
Bucket versioning status. Type: String. The possible values are: Enabled | Suspended |
Headers
Use only common headers in your requests.
Response
Headers
Responses can only contain common headers.
Response codes
For a list of possible responses, see Responses.
A successful response does not contain any additional data.