Magento doesn't store Quote Id in session or in Local Storage. During checkout the quote id available with window.checkoutConfig.quoteId
.
The data is coming from \Magento\Checkout\Model\DefaultConfigProvider
If you want to pass quest cart from front to cookie or something else you can use following logic
// instances
$quoteIdMaskFactory = \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Quote\Model\QuoteIdMaskFactory');
$checkoutSession = \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Checkout\Model\Session');
$quote = $checkoutSession->getQuote();
if (!$quote->getCustomer()->getId()) {
$quoteIdMask = $quoteIdMaskFactory->create()
->load($quote->getId(), 'quote_id')
->getMaskedId();
}
If you want to create guest quote with API you can call
POST <host>/rest/<store_core_or_all>/V1/guest-carts
Manage Cart Items
-- List items that are assigned to a specified cart.
GET <host>/rest/<store_core_or_all>/V1/guest-carts/{cartId}/items
--- Add/update the specified cart item.
POST <host>/rest/<store_core_or_all>/V1/guest-carts/{cartId}/items
--- Add/update the specified cart item.
PUT <host>/rest/<store_core_or_all>/V1/guest-carts/{cartId}/items/{itemId}
-- Remove the specified item from the specified cart.
DELETE <host>/rest/<store_core_or_all>/V1/guest-carts/{cartId}/items/{itemId}
References: