By Magento default, we don't have API for remove all quote items, so we have to extend to create an custom API with required access privilege and get the quote repository by request cartId and loop through all of the items and delete it.
$quote = $this->quoteRepository->getActive($cartId);
foreach ($quote->getAllItems() as $item) {
$itemId = $item->getItemId();
$quoteItem = $quote->getItemById($itemId);
if (!$quoteItem) {
throw new NoSuchEntityException(
__('The %1 Cart doesn\'t contain the %2 item.', $cartId, $itemId)
);
}
try {
$quote->removeItem($itemId);
} catch (\Exception $e) {
throw new CouldNotSaveException(__("The item couldn't be removed from the quote."));
}
}
$this->quoteRepository->save($quote);