--- title: "PutObjectRetention" slug: "ncloudstorage-putobjectretention" updated: 2026-09-17T10:12:27Z published: 2026-09-17T10:12:27Z canonical: "api.ncloud-docs.com/ncloudstorage-putobjectretention" --- > ## Documentation Index > Fetch the complete documentation index at: https://api.ncloud-docs.com/llms.txt > Use this file to discover all available pages before exploring further. # PutObjectRetention Available in Classic and VPC Set retention on an Ncloud Storage object. Objects subject to retention cannot be deleted or changed until the specified expiration date. ## Request This section describes the request format. The method and URI are as follows: | Method | URI | | --- | --- | | PUT | /{Key} | ### Request headers The following describes the request headers. Note For information about the headers common to all Ncloud Storage APIs, see [Ncloud Storage request headers](/docs/en/storage-ncloudstorage#%EC%9A%94%EC%B2%AD%ED%97%A4%EB%8D%94). | Field | Required | Description | | --- | --- | --- | | `Content-MD5` | Conditional | Base64-encoded 128-bit MD5 hash of the request body - Used to verify the integrity of the request body. - Required if `x-amz-checksum-*` is not entered. | | `x-amz-checksum-*` | Conditional | Checksum hash value - Enter the used algorithm in `*` of the key. - Supported algorithms: `crc32` \| `crc32c` \| `sha1` \| `sha256` \| `crc64nvme` - Required if `Content-MD5` is not entered. | | `x-amz-bypass-governance-retention` | Optional | Whether to bypass GOVERNANCE mode retention - Relax or remove the existing GOVERNANCE retention when set to `true`. - Separate bypass permission is required. | ### Request path parameters You can use the following path parameters with your request: | Field | Type | Required | Description | | --- | --- | --- | --- | | `Key` | String | Required | Object name | ### Request query parameters You can use the following query parameters with your request: | Field | Type | Required | Description | | --- | --- | --- | --- | | `versionId` | String | Optional | Version ID of the object to set the retention for - Set to the latest version if not entered. | ### Request body You can include the following data in the body of your request: | Field | Type | Required | Description | | --- | --- | --- | --- | | `Retention` | Object | Required | Retention settings | | `Retention.Mode` | String | Optional | Retention mode - `GOVERNANCE` \| `COMPLIANCE` - `GOVERNANCE`: Can be bypassed with special permissions. - `COMPLIANCE`: No one can bypass it. - Specify with `RetainUntilDate`. | | `Retention.RetainUntilDate` | String | Optional | Retention expiration date - ISO 8601 format. - It must be set in the future. - Specify with `Mode`. | Note If both `Mode` and `RetainUntilDate` are omitted, the object's retention settings are disabled. ### Request example The request example is as follows: ``` PUT /object.csv?retention HTTP/1.1 Host: {Bucket}.kr.ncloudstorage.com Content-MD5: {MD5 hash value} GOVERNANCE 2025-12-31T00:00:00.000Z ``` ## Response This section describes the response format. ### Response headers For information about the headers common to all Ncloud Storage APIs, see [Ncloud Storage response headers](/docs/en/storage-ncloudstorage#%EC%9D%91%EB%8B%B5%ED%97%A4%EB%8D%94). ### Response status codes The following describes the response status codes. Note For information about the HTTP status codes common to all Ncloud Storage APIs, see [Common Ncloud Storage response status codes](/docs/en/storage-ncloudstorage#%EC%9D%91%EB%8B%B5%EC%83%81%ED%83%9C%EC%BD%94%EB%93%9C). | Error code | HTTP status code | Description | | --- | --- | --- | | `InvalidRequest` | 400 | No object lock settings exist in the bucket. | | `InvalidArgument` | 400 | The retention expiration date (`RetainUntilDate`) is not in the future. | | `MalformedXML` | 400 | The request body XML does not conform to the schema. - `Mode` is not `GOVERNANCE`/`COMPLIANCE`. - Only one of `Mode` and `RetainUntilDate` is specified. | | `AccessDenied` | 403 | The existing retention settings were relaxed or removed without bypass permissions. | | `NoSuchKey` | 404 | Specified object does not exist. | | `NoSuchVersion` | 404 | Specified version does not exist. | | `MethodNotAllowed` | 405 | Retention is set on a deletion marker. | ### Response example The response example is as follows: ``` HTTP/1.1 200 OK ```