Skip to content

delete_faces

delete_faces(
    collection_id: CollectionId,
    face_ids: FaceIdList,
    *,
    config_overrides: Optional[RekognitionClientConfig] = None,
) -> DeleteFacesResponse

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.

Parameters:

  • collection_id (CollectionId) –

    Collection from which to remove the specific faces.

  • face_ids (FaceIdList) –

    An array of face IDs to delete.

Raises:

Examples:

To delete a face This operation deletes one or more faces from a Rekognition collection.

>>> client.delete_faces(collection_id='myphotos', face_ids=['ff43d742-0c13-5d16-a3e8-03d3f58e980b'])
Source code in docs_src/capo_rekognition/_services/rekognition.py
def delete_faces(
    self,
    collection_id: "capo_rekognition.types.collection_id.CollectionId",
    face_ids: "capo_rekognition.types.face_id_list.FaceIdList",
    *,
    config_overrides: Optional[RekognitionClientConfig] = None,
) -> "capo_rekognition.types.delete_faces_response.DeleteFacesResponse":
    """<p>Deletes faces from a collection. You specify a collection ID and an array of face IDs to remove from the collection.</p> <p>This operation requires permissions to perform the <code>rekognition:DeleteFaces</code> action.</p>

    Args:
        collection_id: <p>Collection from which to remove the specific faces.</p>
        face_ids: <p>An array of face IDs to delete.</p>

    Raises:
        capo_rekognition.errors.access_denied_exception.AccessDeniedException: <p>You are not authorized to perform the action.</p>
        capo_rekognition.errors.internal_server_error.InternalServerError: <p>Amazon Rekognition experienced a service issue. Try your call again.</p>
        capo_rekognition.errors.invalid_parameter_exception.InvalidParameterException: <p>Input parameter violated a constraint. Validate your parameter before calling the API operation again.</p>
        capo_rekognition.errors.provisioned_throughput_exceeded_exception.ProvisionedThroughputExceededException: <p>The number of requests exceeded your throughput limit. If you want to increase this limit, contact Amazon Rekognition.</p>
        capo_rekognition.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request cannot be found.</p>
        capo_rekognition.errors.throttling_exception.ThrottlingException: <p>Amazon Rekognition is temporarily unable to process the request. Try your call again.</p>
        capo_rekognition.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To delete a face
        This operation deletes one or more faces from a Rekognition collection.

        >>> client.delete_faces(collection_id='myphotos', face_ids=['ff43d742-0c13-5d16-a3e8-03d3f58e980b'])
    """

    def _handler(
        req: "OperationRequest[capo_rekognition.types.delete_faces_request.DeleteFacesRequest]",
    ) -> OperationResponse[
        "capo_rekognition.types.delete_faces_response.DeleteFacesResponse"
    ]:
        import capo_rekognition._operations.rekognition_service.delete_faces

        output, http_response = (
            capo_rekognition._operations.rekognition_service.delete_faces.delete_faces(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteFaces")
    )
    input_: capo_rekognition.types.delete_faces_request.DeleteFacesRequest = {
        "collection_id": collection_id,
        "face_ids": face_ids,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output