

# DeleteAccountPolicy
<a name="API_DeleteAccountPolicy"></a>

Deletes a CloudWatch Logs account policy. This stops the account-wide policy from applying to log groups or data sources in the account. If you delete a data protection policy or subscription filter policy, any log-group level policies of those types remain in effect. This operation supports deletion of data source-based field index policies, including facet configurations, in addition to log group-based policies.

To use this operation, you must be signed on with the correct permissions depending on the type of policy that you are deleting.
+ To delete a data protection policy, you must have the `logs:DeleteDataProtectionPolicy` and `logs:DeleteAccountPolicy` permissions.
+ To delete a subscription filter policy, you must have the `logs:DeleteSubscriptionFilter` and `logs:DeleteAccountPolicy` permissions.
+ To delete a transformer policy, you must have the `logs:DeleteTransformer` and `logs:DeleteAccountPolicy` permissions.
+ To delete a field index policy, you must have the `logs:DeleteIndexPolicy` and `logs:DeleteAccountPolicy` permissions.

  If you delete a field index policy that included facet configurations, those facets will no longer be available for interactive exploration in the CloudWatch Logs Insights console. However, facet data is retained for up to 30 days.

If you delete a field index policy, the indexing of the log events that happened before you deleted the policy will still be used for up to 30 days to improve CloudWatch Logs Insights queries.

## Request Syntax
<a name="API_DeleteAccountPolicy_RequestSyntax"></a>

```
{
   "policyName": "string",
   "policyType": "string"
}
```

## Request Parameters
<a name="API_DeleteAccountPolicy_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [policyName](#API_DeleteAccountPolicy_RequestSyntax) **   <a name="CWL-DeleteAccountPolicy-request-policyName"></a>
The name of the policy to delete.  
Type: String  
Required: Yes

 ** [policyType](#API_DeleteAccountPolicy_RequestSyntax) **   <a name="CWL-DeleteAccountPolicy-request-policyType"></a>
The type of policy to delete.  
Type: String  
Valid Values: `DATA_PROTECTION_POLICY | SUBSCRIPTION_FILTER_POLICY | FIELD_INDEX_POLICY | TRANSFORMER_POLICY | METRIC_EXTRACTION_POLICY`   
Required: Yes

## Response Elements
<a name="API_DeleteAccountPolicy_ResponseElements"></a>

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

## Errors
<a name="API_DeleteAccountPolicy_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InvalidParameterException **   
A parameter is specified incorrectly.  
HTTP Status Code: 400

 ** OperationAbortedException **   
Multiple concurrent requests to update the same resource were in conflict.  
HTTP Status Code: 400

 ** ResourceNotFoundException **   
The specified resource does not exist.  
HTTP Status Code: 400

 ** ServiceUnavailableException **   
The service cannot complete the request.  
HTTP Status Code: 500

## See Also
<a name="API_DeleteAccountPolicy_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/logs-2014-03-28/DeleteAccountPolicy) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/logs-2014-03-28/DeleteAccountPolicy) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/logs-2014-03-28/DeleteAccountPolicy) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/logs-2014-03-28/DeleteAccountPolicy) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/logs-2014-03-28/DeleteAccountPolicy) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/logs-2014-03-28/DeleteAccountPolicy) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/logs-2014-03-28/DeleteAccountPolicy) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/logs-2014-03-28/DeleteAccountPolicy) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/logs-2014-03-28/DeleteAccountPolicy) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/logs-2014-03-28/DeleteAccountPolicy) 