> For the complete documentation index, see [llms.txt](https://docs.petabox.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.petabox.io/http-api-compatible-with-amazon-s3/api-reference/getbucketversioning.md).

# GetBucketVersioning

Returns the versioning state of a bucket

To retrieve the versioning state of a bucket, you must be the bucket owner.

## Request Syntax <a href="#api_getbucketversioning_requestsyntax" id="api_getbucketversioning_requestsyntax"></a>

```http
GET /?versioning HTTP/1.1
Host: Bucket.s3.petabox.io
x-amz-expected-bucket-owner: ExpectedBucketOwner
```

## URI Request Parameters <a href="#api_getbucketversioning_requestparameters" id="api_getbucketversioning_requestparameters"></a>

The request uses the following URI parameters.

#### Bucket

The name of the bucket for which to get the versioning information.

Required: Yes

#### x-amz-expected-bucket-owner

The account ID of the expected bucket owner. If the bucket is owned by a different account, the request fails with the HTTP status code `403 Forbidden` (access denied).

## Request Body <a href="#api_getbucketversioning_requestbody" id="api_getbucketversioning_requestbody"></a>

The request does not have a request body.

## Response Syntax <a href="#api_getbucketversioning_responsesyntax" id="api_getbucketversioning_responsesyntax"></a>

```xml
HTTP/1.1 200
<?xml version="1.0" encoding="UTF-8"?>
<VersioningConfiguration>
   <Status>string</Status>
   <MfaDelete>string</MfaDelete>
</VersioningConfiguration>
```

## Response Elements <a href="#api_getbucketversioning_responseelements" id="api_getbucketversioning_responseelements"></a>

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

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

#### VersioningConfiguration

Root level tag for the VersioningConfiguration parameters.

Required: Yes

#### Status

The versioning state of the bucket.

Type: String

Valid Values: `Enabled | Suspended`

## Examples <a href="#api_getbucketversioning_examples" id="api_getbucketversioning_examples"></a>

### Example <a href="#api_getbucketversioning_example_1" id="api_getbucketversioning_example_1"></a>

This example returns the versioning state of `myBucket`.

```http
GET /?versioning HTTP/1.1
Host: myBucket.s3.<Region>.petabox.io
Date: Wed, 12 Oct 2009 17:50:00 GMT
Authorization: authorization string
Content-Type: text/plain       
```

### Example <a href="#api_getbucketversioning_example_2" id="api_getbucketversioning_example_2"></a>

There are three versioning states:

If you enabled versioning on a bucket, the response is:

```xml
<VersioningConfiguration xmlns="http://s3.petabox.io/doc/2006-03-01/">
   <Status>Enabled</Status>
</VersioningConfiguration>  
```

### Example <a href="#api_getbucketversioning_example_3" id="api_getbucketversioning_example_3"></a>

If you suspended versioning on a bucket, the response is:

```xml
<VersioningConfiguration xmlns="http://s3.petabox.io/doc/2006-03-01/">
   <Status>Suspended</Status>
</VersioningConfiguration>    
```

### Example <a href="#api_getbucketversioning_example_4" id="api_getbucketversioning_example_4"></a>

If you never enabled (or suspended) versioning on a bucket, the response is:

```xml
<VersioningConfiguration xmlns="http://s3.petabox.io/doc/2006-03-01/"/>    
```
