:doc:`Organizations <../../organizations>` / Client / delete_policy

*************
delete_policy
*************



.. py:method:: Organizations.Client.delete_policy(**kwargs)

  

  Deletes the specified policy from your organization. Before you perform this operation, you must first detach the policy from all organizational units (OUs), roots, and accounts.

   

  You can only call this operation from the management account or a member account that is a delegated administrator.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DeletePolicy>`_  


  **Request Syntax**
  ::

    response = client.delete_policy(
        PolicyId='string'
    )
    
  :type PolicyId: string
  :param PolicyId: **[REQUIRED]** 

    ID for the policy that you want to delete. You can get the ID from the  ListPolicies or  ListPoliciesForTarget operations.

     

    The `regex pattern <http://wikipedia.org/wiki/regex>`__ for a policy ID string requires "p-" followed by from 8 to 128 lowercase or uppercase letters, digits, or the underscore character (_).

    

  
  
  :returns: None
  **Exceptions**
  
  *   :py:class:`Organizations.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`Organizations.Client.exceptions.AWSOrganizationsNotInUseException`

  
  *   :py:class:`Organizations.Client.exceptions.ConcurrentModificationException`

  
  *   :py:class:`Organizations.Client.exceptions.InvalidInputException`

  
  *   :py:class:`Organizations.Client.exceptions.PolicyInUseException`

  
  *   :py:class:`Organizations.Client.exceptions.PolicyNotFoundException`

  
  *   :py:class:`Organizations.Client.exceptions.ServiceException`

  
  *   :py:class:`Organizations.Client.exceptions.TooManyRequestsException`

  
  *   :py:class:`Organizations.Client.exceptions.UnsupportedAPIEndpointException`

  

  **Examples**

  The following example shows how to delete a policy from an organization. The example assumes that you previously detached the policy from all entities:


  ::

    response = client.delete_policy(
        PolicyId='p-examplepolicyid111',
    )
    
    print(response)

  
  Expected Output:
  ::

    {
        'ResponseMetadata': {
            '...': '...',
        },
    }

  