:doc:`Rekognition <../../rekognition>` / Client / delete_faces

************
delete_faces
************



.. py:method:: Rekognition.Client.delete_faces(**kwargs)

  

  Deletes faces from a collection. You specify a collection ID and an array of face IDs to remove from the collection.

   

  This operation requires permissions to perform the ``rekognition:DeleteFaces`` action.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/rekognition-2016-06-27/DeleteFaces>`_  


  **Request Syntax**
  ::

    response = client.delete_faces(
        CollectionId='string',
        FaceIds=[
            'string',
        ]
    )
    
  :type CollectionId: string
  :param CollectionId: **[REQUIRED]** 

    Collection from which to remove the specific faces.

    

  
  :type FaceIds: list
  :param FaceIds: **[REQUIRED]** 

    An array of face IDs to delete.

    

  
    - *(string) --* 

    

  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'DeletedFaces': [
              'string',
          ],
          'UnsuccessfulFaceDeletions': [
              {
                  'FaceId': 'string',
                  'UserId': 'string',
                  'Reasons': [
                      'ASSOCIATED_TO_AN_EXISTING_USER'|'FACE_NOT_FOUND',
                  ]
              },
          ]
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **DeletedFaces** *(list) --* 

        An array of strings (face IDs) of the faces that were deleted.

        
        

        - *(string) --* 
    
      

      - **UnsuccessfulFaceDeletions** *(list) --* 

        An array of any faces that weren't deleted.

        
        

        - *(dict) --* 

          Contains metadata like FaceId, UserID, and Reasons, for a face that was unsuccessfully deleted.

          
          

          - **FaceId** *(string) --* 

            A unique identifier assigned to the face.

            
          

          - **UserId** *(string) --* 

            A provided ID for the UserID. Unique within the collection.

            
          

          - **Reasons** *(list) --* 

            The reason why the deletion was unsuccessful.

            
            

            - *(string) --* 
        
      
    
  
  **Exceptions**
  
  *   :py:class:`Rekognition.Client.exceptions.InvalidParameterException`

  
  *   :py:class:`Rekognition.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`Rekognition.Client.exceptions.InternalServerError`

  
  *   :py:class:`Rekognition.Client.exceptions.ThrottlingException`

  
  *   :py:class:`Rekognition.Client.exceptions.ProvisionedThroughputExceededException`

  
  *   :py:class:`Rekognition.Client.exceptions.ResourceNotFoundException`

  

  **Examples**

  This operation deletes one or more faces from a Rekognition collection.
  ::

    response = client.delete_faces(
        CollectionId='myphotos',
        FaceIds=[
            'ff43d742-0c13-5d16-a3e8-03d3f58e980b',
        ],
    )
    
    print(response)

  
  Expected Output:
  ::

    {
        'DeletedFaces': [
            'ff43d742-0c13-5d16-a3e8-03d3f58e980b',
        ],
        'ResponseMetadata': {
            '...': '...',
        },
    }

  