Stay organized with collectionsSave and categorize content based on your preferences.
To get an object'sretention configurationyou make a GET request that is
scoped to the object, and you use theretentionquery string parameter. If the
object has a retention configuration, the configuration is returned in an XML
document in the response body. Otherwise, the request fails with a404 Not Foundresponse.
You must haveREADpermission to get an object's retention configuration.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Get object retention\n\nTo get an object's [retention configuration](/storage/docs/object-lock) you make a GET request that is\nscoped to the object, and you use the `retention` query string parameter. If the\nobject has a retention configuration, the configuration is returned in an XML\ndocument in the response body. Otherwise, the request fails with a\n`404 Not Found` response.\n\nYou must have `READ` permission to get an object's retention configuration.\n\nQuery string parameters\n-----------------------\n\nSee [signed URL query string parameters](/storage/docs/authentication/canonical-requests#required-query-parameters) for information on the parameters\nyou include when creating and using [signed URLs](/storage/docs/access-control/signed-urls).\n\nRequest headers\n---------------\n\nSee [common request headers](/storage/docs/xml-api/get-object#request-headers).\n\nRequest body elements\n---------------------\n\nThis request does not include an XML document in the request body.\n\nRequest syntax\n--------------\n\nThe following syntax applies to GET Object requests that use the\n`retention` query string parameter. \n\n```\nGET /OBJECT_NAME?retention&generation=GENERATION HTTP/1.1\nHost: BUCKET_NAME.storage.googleapis.com\nContent-Length: 0\nContent-Type: TYPE\nAuthorization: AUTHENTICATION_STRING\n```\n\nResponse headers\n----------------\n\nThe request can return a variety of response headers depending on the request\nheaders you use.\n\nResponse body elements\n----------------------\n\nThe following response body elements are applicable only if you use the\n`retention` query string parameter.\n\nExamples\n--------\n\nThe following example retrieves the retention configuration for an object named\n`tokyo.jpg`.\n\n**Request** \n\n```\nGET /tokyo.jpg?retention HTTP/1.1\nHost: travel-maps.storage.googleapis.com\nContent-Length: 0\nAuthorization: Bearer ya29.AHES6ZRVmB7fkLtd1XTmq6mo0S1wqZZi3-Lh_s-6Uw7p8vtgSwg\n```\n\n**Response** \n\n```\nHTTP/1.1 200 OK\nContent-Length: 138\nContent-Type: application/xml; charset=UTF-8\nDate: Tue, 01 Nov 2016 17:12:32 GMT\n\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cRetention\u003e\n \u003cMode\u003e\n GOVERNANCE\n \u003c/Mode\u003e\n \u003cRetainUntilDate\u003e\n 2028-04-12T23:20:00Z\n \u003c/RetainUntilDate\u003e\n\u003c/Retention\u003e\n```"]]