# Enables or disables the retain recovery key setting Enables or disables the retain recovery key setting for the customer, optionally removing old recovery keys. ## Endpoint **POST** `/bitlocker/api/retainRecoveryKey` ## Request ### Request URL `https://{server-hostname}:8383/bitlocker/api/retainRecoveryKey` ### Scope `DataEncryption.CREATE` ### Header `Authorization: d92d4xxxxxxxxxxxxx15f52` ### Request Parameters #### Request Headers | Name | Type | Required | Value | |---|---|---|---| | Accept | string | Mandatory | `application/json` | | Content-Type | string | Mandatory | `application/json` | #### Request Body Content type: `application/json` | Name | Type | Required | Description | |---|---|---|---| | retainRecoveryKeyEnabled | boolean | Mandatory | Set to true to enable recovery key retention, false to disable. Required. | | removeOldRecKey | boolean | Optional | Optional. Set to true to immediately remove old recovery keys. Only relevant when disabling retention (`retainRecoveryKeyEnabled=false`). | ### Sample Request ```curl curl --request POST \ --url https://appdomain/bitlocker/api/retainRecoveryKey \ --header 'Accept: application/json' \ --header 'Authorization: d92d4xxxxxxxxxxxxx15f52' \ --header 'Content-Type: application/json' \ --data '{"retainRecoveryKeyEnabled":true,"removeOldRecKey":false}' ``` ### Sample Request Body #### Enable recovery key retention ```json { "retainRecoveryKeyEnabled": true, "removeOldRecKey": false } ``` #### Disable recovery key retention and remove old keys ```json { "retainRecoveryKeyEnabled": false, "removeOldRecKey": true } ``` ## Response Parameters ### HTTP Code 200 Response body: `application/json` | Name | Type | Description | |---|---|---| | retainRecoveryKeyEnabled | boolean | Current state of the recovery key retention setting | | paramValue | string | Persisted parameter value as string (`true` or `false`) | ### HTTP Code 400 Response body: `application/json` | Name | Type | Description | |---|---|---| | errorCode | long | Validation error code raised when the request body is missing, malformed, exceeds max-len=100, or fails retainRecoveryKeyTemplate validation (retainRecoveryKeyEnabled / removeOldRecKey not boolean) | | errorMsg | string | Detailed message identifying which body key failed validation or why the payload was rejected | ### HTTP Code 401 Response body: `application/json` | Name | Type | Description | |---|---|---| | errorCode | long | Unauthorized error code returned when authentication credentials are missing, expired, or invalid (authentication=required) | | errorMsg | string | Authentication failure reason | ### HTTP Code 403 Response body: `application/json` | Name | Type | Description | |---|---|---| | errorCode | long | Forbidden error code returned when the authenticated user does not have the required uem-roles (e.g., DataEncryption_Admin or DataEncryptionRecoveryKey_Admin) | | errorMsg | string | Message indicating insufficient privileges to access this resource | ### HTTP Code 429 Response body: `application/json` | Name | Type | Description | |---|---|---| | errorCode | long | Rate limit error code returned when the API call threshold (configured via threshold/duration in security XML) is exceeded; client is locked out for lock-period minutes | | errorMsg | string | Rate limit exceeded message with retry guidance | ### HTTP Code 500 Response body: `application/json` | Name | Type | Description | |---|---|---| | errorCode | long | Internal server error code (DCAPIErrorCodes.INTERNAL_ERROR) thrown when persisting the retain-recovery-key parameter or removing old recovery keys fails | | errorMsg | string | Server-side error message — typically `Exception while forming response` | ### Possible Response Codes - `200` HTTP code - `400` HTTP code - `401` HTTP code - `403` HTTP code - `429` HTTP code - `500` HTTP code ### Sample Response: HTTP 200 Successful update of retain recovery key setting ```json { "retainRecoveryKeyEnabled": true, "paramValue": "true" } ``` ### Sample Response: HTTP 400 Invalid or malformed request body ```json { "errorCode": 40001, "errorMsg": "Invalid request parameters" } ``` ### Sample Response: HTTP 401 Authentication credentials missing or invalid ```json { "errorCode": 40101, "errorMsg": "Authentication failed" } ``` ### Sample Response: HTTP 403 User does not have DataEncryptionRecoveryKey_Admin role ```json { "errorCode": 40301, "errorMsg": "Insufficient privileges to access this resource" } ``` ### Sample Response: HTTP 429 Throttle limit exceeded; client locked out for lock-period minutes ```json { "errorCode": 42901, "errorMsg": "Too many requests. Please retry after the cooldown period" } ``` ### Sample Response: HTTP 500 Internal server error — thrown from catch block via DCAPIException ```json { "errorCode": 10000, "errorMsg": "Exception while forming response" } ``` ## Rate Limits ![](https://www.zohowebstatic.com/sites/zweb/images/people/ico-help.png) **Duration:** 1 minute | **Threshold:** 30 | **Lock period:** 5 minutes Duration - Time window for the threshold. Threshold - Number of API calls allowed within the specified duration. Lock Period - Wait time before consecutive API requests.