CINXE.COM
GetBucketVersioning - Amazon Simple Storage Service
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>GetBucketVersioning - Amazon Simple Storage Service</title><meta name="viewport" content="width=device-width,initial-scale=1" /><meta name="assets_root" content="/assets" /><meta name="target_state" content="API_GetBucketVersioning" /><meta name="default_state" content="API_GetBucketVersioning" /><link rel="icon" type="image/ico" href="/assets/images/favicon.ico" /><link rel="shortcut icon" type="image/ico" href="/assets/images/favicon.ico" /><link rel="canonical" href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketVersioning.html" /><meta name="description" content="Returns the versioning state of a bucket." /><meta name="deployment_region" content="IAD" /><meta name="product" content="Amazon Simple Storage Service" /><meta name="guide" content="API Reference" /><meta name="abstract" content="Explains how to use the Amazon S3 API to store data in the cloud." /><meta name="guide-locale" content="en_us" /><meta name="tocs" content="toc-contents.json" /><link rel="canonical" href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketVersioning.html" /><link rel="alternative" href="https://docs.aws.amazon.com/id_id/AmazonS3/latest/API/API_GetBucketVersioning.html" hreflang="id-id" /><link rel="alternative" href="https://docs.aws.amazon.com/id_id/AmazonS3/latest/API/API_GetBucketVersioning.html" hreflang="id" /><link rel="alternative" href="https://docs.aws.amazon.com/de_de/AmazonS3/latest/API/API_GetBucketVersioning.html" hreflang="de-de" /><link rel="alternative" href="https://docs.aws.amazon.com/de_de/AmazonS3/latest/API/API_GetBucketVersioning.html" hreflang="de" /><link rel="alternative" href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketVersioning.html" hreflang="en-us" /><link rel="alternative" href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketVersioning.html" hreflang="en" /><link rel="alternative" href="https://docs.aws.amazon.com/es_es/AmazonS3/latest/API/API_GetBucketVersioning.html" hreflang="es-es" /><link rel="alternative" href="https://docs.aws.amazon.com/es_es/AmazonS3/latest/API/API_GetBucketVersioning.html" hreflang="es" /><link rel="alternative" href="https://docs.aws.amazon.com/fr_fr/AmazonS3/latest/API/API_GetBucketVersioning.html" hreflang="fr-fr" /><link rel="alternative" href="https://docs.aws.amazon.com/fr_fr/AmazonS3/latest/API/API_GetBucketVersioning.html" hreflang="fr" /><link rel="alternative" href="https://docs.aws.amazon.com/it_it/AmazonS3/latest/API/API_GetBucketVersioning.html" hreflang="it-it" /><link rel="alternative" href="https://docs.aws.amazon.com/it_it/AmazonS3/latest/API/API_GetBucketVersioning.html" hreflang="it" /><link rel="alternative" href="https://docs.aws.amazon.com/ja_jp/AmazonS3/latest/API/API_GetBucketVersioning.html" hreflang="ja-jp" /><link rel="alternative" href="https://docs.aws.amazon.com/ja_jp/AmazonS3/latest/API/API_GetBucketVersioning.html" hreflang="ja" /><link rel="alternative" href="https://docs.aws.amazon.com/ko_kr/AmazonS3/latest/API/API_GetBucketVersioning.html" hreflang="ko-kr" /><link rel="alternative" href="https://docs.aws.amazon.com/ko_kr/AmazonS3/latest/API/API_GetBucketVersioning.html" hreflang="ko" /><link rel="alternative" href="https://docs.aws.amazon.com/pt_br/AmazonS3/latest/API/API_GetBucketVersioning.html" hreflang="pt-br" /><link rel="alternative" href="https://docs.aws.amazon.com/pt_br/AmazonS3/latest/API/API_GetBucketVersioning.html" hreflang="pt" /><link rel="alternative" href="https://docs.aws.amazon.com/zh_cn/AmazonS3/latest/API/API_GetBucketVersioning.html" hreflang="zh-cn" /><link rel="alternative" href="https://docs.aws.amazon.com/zh_tw/AmazonS3/latest/API/API_GetBucketVersioning.html" hreflang="zh-tw" /><link rel="alternative" href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketVersioning.html" hreflang="x-default" /><meta name="feedback-item" content="S3" /><meta name="this_doc_product" content="Amazon Simple Storage Service" /><meta name="this_doc_guide" content="API Reference" /><script defer="" src="/assets/r/vendor4.js?version=2021.12.02"></script><script defer="" src="/assets/r/vendor3.js?version=2021.12.02"></script><script defer="" src="/assets/r/vendor1.js?version=2021.12.02"></script><script defer="" src="/assets/r/awsdocs-common.js?version=2021.12.02"></script><script defer="" src="/assets/r/awsdocs-doc-page.js?version=2021.12.02"></script><link href="/assets/r/vendor4.css?version=2021.12.02" rel="stylesheet" /><link href="/assets/r/awsdocs-common.css?version=2021.12.02" rel="stylesheet" /><link href="/assets/r/awsdocs-doc-page.css?version=2021.12.02" rel="stylesheet" /><script async="" id="awsc-panorama-bundle" type="text/javascript" src="https://prod.pa.cdn.uis.awsstatic.com/panorama-nav-init.js" data-config="{'appEntity':'aws-documentation','region':'us-east-1','service':'s3'}"></script><meta id="panorama-serviceSubSection" value="API Reference" /><meta id="panorama-serviceConsolePage" value="GetBucketVersioning" /></head><body class="awsdocs awsui"><div class="awsdocs-container"><awsdocs-header></awsdocs-header><awsui-app-layout id="app-layout" class="awsui-util-no-gutters" ng-controller="ContentController as $ctrl" header-selector="awsdocs-header" navigation-hide="false" navigation-width="$ctrl.navWidth" navigation-open="$ctrl.navOpen" navigation-change="$ctrl.onNavChange($event)" tools-hide="$ctrl.hideTools" tools-width="$ctrl.toolsWidth" tools-open="$ctrl.toolsOpen" tools-change="$ctrl.onToolsChange($event)"><div id="guide-toc" dom-region="navigation"><awsdocs-toc></awsdocs-toc></div><div id="main-column" dom-region="content" tabindex="-1"><awsdocs-view class="awsdocs-view"><div id="awsdocs-content"><head><title>GetBucketVersioning - Amazon Simple Storage Service</title><meta name="pdf" content="/pdfs/AmazonS3/latest/API/s3-api.pdf#API_GetBucketVersioning" /><meta name="forums" content="https://repost.aws/tags/TADSTjraA0Q4-a1dxk6eUYaw" /><meta name="feedback" content="https://docs.aws.amazon.com/forms/aws-doc-feedback?hidden_service_name=S3&topic_url=https://docs.aws.amazon.com/en_us/AmazonS3/latest/API/API_GetBucketVersioning.html" /><meta name="feedback-yes" content="feedbackyes.html?topic_url=https://docs.aws.amazon.com/en_us/AmazonS3/latest/API/API_GetBucketVersioning.html" /><meta name="feedback-no" content="feedbackno.html?topic_url=https://docs.aws.amazon.com/en_us/AmazonS3/latest/API/API_GetBucketVersioning.html" /><meta name="keywords" content="API,requests,GetBucketVersioning" /><script type="application/ld+json"> { "@context" : "https://schema.org", "@type" : "BreadcrumbList", "itemListElement" : [ { "@type" : "ListItem", "position" : 1, "name" : "AWS", "item" : "https://aws.amazon.com" }, { "@type" : "ListItem", "position" : 2, "name" : "Amazon Simple Storage Service (S3)", "item" : "https://docs.aws.amazon.com/s3/index.html" }, { "@type" : "ListItem", "position" : 3, "name" : "API Reference", "item" : "https://docs.aws.amazon.com/AmazonS3/latest/API" }, { "@type" : "ListItem", "position" : 4, "name" : "S3 API Reference", "item" : "https://docs.aws.amazon.com/AmazonS3/latest/API/Type_API_Reference.html" }, { "@type" : "ListItem", "position" : 5, "name" : "Actions", "item" : "https://docs.aws.amazon.com/AmazonS3/latest/API/API_Operations.html" }, { "@type" : "ListItem", "position" : 6, "name" : "Amazon S3", "item" : "https://docs.aws.amazon.com/AmazonS3/latest/API/API_Operations_Amazon_Simple_Storage_Service.html" }, { "@type" : "ListItem", "position" : 7, "name" : "GetBucketVersioning", "item" : "https://docs.aws.amazon.com/AmazonS3/latest/API/API_Operations_Amazon_Simple_Storage_Service.html" } ] } </script></head><body><div id="main"><div style="display: none"><a href="/pdfs/AmazonS3/latest/API/s3-api.pdf#API_GetBucketVersioning" target="_blank" rel="noopener noreferrer" title="Open PDF"></a></div><div id="breadcrumbs" class="breadcrumb"><a href="https://aws.amazon.com">AWS</a><a href="/index.html">Documentation</a><a href="/s3/index.html">Amazon Simple Storage Service (S3)</a><a href="Welcome.html">API Reference</a></div><div id="page-toc-src"><a href="#API_GetBucketVersioning_RequestSyntax">Request Syntax</a><a href="#API_GetBucketVersioning_RequestParameters">URI Request Parameters</a><a href="#API_GetBucketVersioning_RequestBody">Request Body</a><a href="#API_GetBucketVersioning_ResponseSyntax">Response Syntax</a><a href="#API_GetBucketVersioning_ResponseElements">Response Elements</a><a href="#API_GetBucketVersioning_Examples">Examples</a><a href="#API_GetBucketVersioning_SeeAlso">See Also</a></div><div id="main-content" class="awsui-util-container"><div id="main-col-body"><awsdocs-language-banner data-service="$ctrl.pageService"></awsdocs-language-banner><h1 class="topictitle" id="API_GetBucketVersioning">GetBucketVersioning</h1><div class="awsdocs-page-header-container"><awsdocs-page-header></awsdocs-page-header><awsdocs-filter-selector id="awsdocs-filter-selector"></awsdocs-filter-selector></div><div class="awsdocs-note"><div class="awsdocs-note-title"><awsui-icon name="status-info" variant="link"></awsui-icon><h6>Note</h6></div><div class="awsdocs-note-text"><p>This operation is not supported for directory buckets.</p></div></div><p>Returns the versioning state of a bucket.</p><p>To retrieve the versioning state of a bucket, you must be the bucket owner.</p><p>This implementation also returns the MFA Delete status of the versioning state. If the MFA Delete status is <code class="code">enabled</code>, the bucket owner must use an authentication device to change the versioning state of the bucket.</p><p>The following operations are related to <code class="code">GetBucketVersioning</code>:</p><div class="itemizedlist"> <ul class="itemizedlist"><li class="listitem"> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html">GetObject</a> </p> </li><li class="listitem"> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html">PutObject</a> </p> </li><li class="listitem"> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html">DeleteObject</a> </p> </li></ul></div> <h2 id="API_GetBucketVersioning_RequestSyntax">Request Syntax</h2> <pre class="programlisting"><div class="code-btn-container"></div><!--DEBUG: cli ()--><code class="nohighlight">GET /?versioning HTTP/1.1 Host: <code class="replaceable">Bucket</code>.s3.amazonaws.com x-amz-expected-bucket-owner: <code class="replaceable">ExpectedBucketOwner</code> </code></pre> <h2 id="API_GetBucketVersioning_RequestParameters">URI Request Parameters</h2> <p>The request uses the following URI parameters.</p> <div class="variablelist"> <dl> <dt id="AmazonS3-GetBucketVersioning-request-header-Bucket"><span class="term"> <b> <a href="#API_GetBucketVersioning_RequestSyntax">Bucket</a> </b> </span></dt> <dd> <p>The name of the bucket for which to get the versioning information.</p> <p>Required: Yes</p> </dd> <dt id="AmazonS3-GetBucketVersioning-request-header-ExpectedBucketOwner"><span class="term"> <b> <a href="#API_GetBucketVersioning_RequestSyntax">x-amz-expected-bucket-owner</a> </b> </span></dt> <dd> <p>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 <code class="code">403 Forbidden</code> (access denied).</p> </dd> </dl></div> <h2 id="API_GetBucketVersioning_RequestBody">Request Body</h2> <p>The request does not have a request body.</p> <h2 id="API_GetBucketVersioning_ResponseSyntax">Response Syntax</h2> <pre class="programlisting"><div class="code-btn-container"></div><!--DEBUG: cli ()--><code class="nohighlight">HTTP/1.1 200 <?xml version="1.0" encoding="UTF-8"?> <<a href="#AmazonS3-GetBucketVersioning-response-GetBucketVersioningOutput">VersioningConfiguration</a>> <<a href="#AmazonS3-GetBucketVersioning-response-Status">Status</a>><b><em>string</em></b></<a href="#AmazonS3-GetBucketVersioning-response-Status">Status</a>> <<a href="#AmazonS3-GetBucketVersioning-response-MFADelete">MfaDelete</a>><b><em>string</em></b></<a href="#AmazonS3-GetBucketVersioning-response-MFADelete">MfaDelete</a>> </<a href="#AmazonS3-GetBucketVersioning-response-GetBucketVersioningOutput">VersioningConfiguration</a>></code></pre> <h2 id="API_GetBucketVersioning_ResponseElements">Response Elements</h2> <p>If the action is successful, the service sends back an HTTP 200 response.</p> <p>The following data is returned in XML format by the service.</p> <div class="variablelist"> <dl> <dt id="AmazonS3-GetBucketVersioning-response-GetBucketVersioningOutput"><span class="term"> <b> <a href="#API_GetBucketVersioning_ResponseSyntax">VersioningConfiguration</a> </b> </span></dt> <dd> <p>Root level tag for the VersioningConfiguration parameters.</p> <p>Required: Yes</p> </dd> <dt id="AmazonS3-GetBucketVersioning-response-MFADelete"><span class="term"> <b> <a href="#API_GetBucketVersioning_ResponseSyntax">MFADelete</a> </b> </span></dt> <dd> <p>Specifies whether MFA delete is enabled in the bucket versioning configuration. This element is only returned if the bucket has been configured with MFA delete. If the bucket has never been so configured, this element is not returned.</p> <p>Type: String</p> <p>Valid Values: <code class="code">Enabled | Disabled</code> </p> </dd> <dt id="AmazonS3-GetBucketVersioning-response-Status"><span class="term"> <b> <a href="#API_GetBucketVersioning_ResponseSyntax">Status</a> </b> </span></dt> <dd> <p>The versioning state of the bucket.</p> <p>Type: String</p> <p>Valid Values: <code class="code">Enabled | Suspended</code> </p> </dd> </dl></div> <h2 id="API_GetBucketVersioning_Examples">Examples</h2> <h3 id="API_GetBucketVersioning_Example_1">Example</h3> <p>This example returns the versioning state of <code class="code">myBucket</code>.</p> <pre class="programlisting"><div class="code-btn-container"><div class="btn-copy-code" title="Copy"><awsui-icon name="copy"></awsui-icon></div></div><!--DEBUG: cli ()--><code class=""> GET /?versioning HTTP/1.1 Host: myBucket.s3.<Region>.amazonaws.com Date: Wed, 12 Oct 2009 17:50:00 GMT Authorization: authorization string Content-Type: text/plain </code></pre> <h3 id="API_GetBucketVersioning_Example_2">Example</h3> <p>There are three versioning states:</p> <p>If you enabled versioning on a bucket, the response is:</p> <pre class="programlisting"><div class="code-btn-container"><div class="btn-copy-code" title="Copy"><awsui-icon name="copy"></awsui-icon></div></div><!--DEBUG: cli ()--><code class=""> <VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Status>Enabled</Status> </VersioningConfiguration> </code></pre> <h3 id="API_GetBucketVersioning_Example_3">Example</h3> <p>If you suspended versioning on a bucket, the response is:</p> <pre class="programlisting"><div class="code-btn-container"><div class="btn-copy-code" title="Copy"><awsui-icon name="copy"></awsui-icon></div></div><!--DEBUG: cli ()--><code class=""> <VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Status>Suspended</Status> </VersioningConfiguration> </code></pre> <h3 id="API_GetBucketVersioning_Example_4">Example</h3> <p>If you never enabled (or suspended) versioning on a bucket, the response is:</p> <pre class="programlisting"><div class="code-btn-container"><div class="btn-copy-code" title="Copy"><awsui-icon name="copy"></awsui-icon></div></div><!--DEBUG: cli ()--><code class=""> <VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"/> </code></pre> <h2 id="API_GetBucketVersioning_SeeAlso">See Also</h2> <p>For more information about using this API in one of the language-specific AWS SDKs, see the following:</p> <div class="itemizedlist"> <ul class="itemizedlist"><li class="listitem"> <p> <a href="https://docs.aws.amazon.com/goto/aws-cli/s3-2006-03-01/GetBucketVersioning">AWS Command Line Interface</a> </p> </li><li class="listitem"> <p> <a href="https://docs.aws.amazon.com/goto/DotNetSDKV3/s3-2006-03-01/GetBucketVersioning">AWS SDK for .NET</a> </p> </li><li class="listitem"> <p> <a href="https://docs.aws.amazon.com/goto/SdkForCpp/s3-2006-03-01/GetBucketVersioning">AWS SDK for C++</a> </p> </li><li class="listitem"> <p> <a href="https://docs.aws.amazon.com/goto/SdkForGoV2/s3-2006-03-01/GetBucketVersioning">AWS SDK for Go v2</a> </p> </li><li class="listitem"> <p> <a href="https://docs.aws.amazon.com/goto/SdkForJavaV2/s3-2006-03-01/GetBucketVersioning">AWS SDK for Java V2</a> </p> </li><li class="listitem"> <p> <a href="https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/s3-2006-03-01/GetBucketVersioning">AWS SDK for JavaScript V3</a> </p> </li><li class="listitem"> <p> <a href="https://docs.aws.amazon.com/goto/SdkForPHPV3/s3-2006-03-01/GetBucketVersioning">AWS SDK for PHP V3</a> </p> </li><li class="listitem"> <p> <a href="https://docs.aws.amazon.com/goto/boto3/s3-2006-03-01/GetBucketVersioning">AWS SDK for Python</a> </p> </li><li class="listitem"> <p> <a href="https://docs.aws.amazon.com/goto/SdkForRubyV3/s3-2006-03-01/GetBucketVersioning">AWS SDK for Ruby V3</a> </p> </li></ul></div> <awsdocs-copyright class="copyright-print"></awsdocs-copyright><awsdocs-thumb-feedback right-edge="{{$ctrl.thumbFeedbackRightEdge}}"></awsdocs-thumb-feedback></div><noscript><div><div><div><div id="js_error_message"><p><img src="https://d1ge0kk1l5kms0.cloudfront.net/images/G/01/webservices/console/warning.png" alt="Warning" /> <strong>Javascript is disabled or is unavailable in your browser.</strong></p><p>To use the Amazon Web Services Documentation, Javascript must be enabled. Please refer to your browser's Help pages for instructions.</p></div></div></div></div></noscript><div id="main-col-footer" class="awsui-util-font-size-0"><div id="doc-conventions"><a target="_top" href="/general/latest/gr/docconventions.html">Document Conventions</a></div><div class="prev-next"><div id="previous" class="prev-link" accesskey="p" href="./API_GetBucketTagging.html">GetBucketTagging</div><div id="next" class="next-link" accesskey="n" href="./API_GetBucketWebsite.html">GetBucketWebsite</div></div></div><awsdocs-page-utilities></awsdocs-page-utilities></div><div id="quick-feedback-yes" style="display: none;"><div class="title">Did this page help you? - Yes</div><div class="content"><p>Thanks for letting us know we're doing a good job!</p><p>If you've got a moment, please tell us what we did right so we can do more of it.</p><p><awsui-button id="fblink" rel="noopener noreferrer" target="_blank" text="Feedback" click="linkClick($event)" href="https://docs.aws.amazon.com/forms/aws-doc-feedback?hidden_service_name=S3&topic_url=https://docs.aws.amazon.com/en_us/AmazonS3/latest/API/API_GetBucketVersioning.html"></awsui-button></p></div></div><div id="quick-feedback-no" style="display: none;"><div class="title">Did this page help you? - No</div><div class="content"><p>Thanks for letting us know this page needs work. We're sorry we let you down.</p><p>If you've got a moment, please tell us how we can make the documentation better.</p><p><awsui-button id="fblink" rel="noopener noreferrer" target="_blank" text="Feedback" click="linkClick($event)" href="https://docs.aws.amazon.com/forms/aws-doc-feedback?hidden_service_name=S3&topic_url=https://docs.aws.amazon.com/en_us/AmazonS3/latest/API/API_GetBucketVersioning.html"></awsui-button></p></div></div></div></body></div></awsdocs-view><div class="page-loading-indicator" id="page-loading-indicator"><awsui-spinner size="large"></awsui-spinner></div></div><div id="tools-panel" dom-region="tools"><awsdocs-tools-panel id="awsdocs-tools-panel"></awsdocs-tools-panel></div></awsui-app-layout><awsdocs-cookie-banner class="doc-cookie-banner"></awsdocs-cookie-banner></div></body></html>