create CMS static block store level programmatically in Magento 2.

Magento store with multiple store view having a feature like you can create multiple Static blocks with the same identifier with different store view.

Using multiple separate store view for the different store will helpful to display different content to the different store view.

You can add/create CMS Static block for only a specific store view using programmatically.

You can create/add any cms static block programmatically via Magento\Cms\Api\BlockRepositoryInterface interface and Magento\Cms\Model\BlockFactory Factory method with the use of above class set inside the __construct() method.

We will create our CMS Block as per store view level,

namespace Rbj\CmsBlockCreate\Model;

use Magento\Cms\Model\BlockFactory;
use Magento\Cms\Api\BlockRepositoryInterface;
use Magento\Framework\Api\SearchCriteriaBuilder;

class AddBlock
    protected $searchCriteriaBuilder;

    protected $blockRepository;

    protected $blockFactory;

    public function __construct(
        SearchCriteriaBuilder $searchCriteriaBuilder,
        BlockRepositoryInterface $blockRepository,
        BlockFactory $blockFactory
    ) {
        $this->searchCriteriaBuilder = $searchCriteriaBuilder;
        $this->blockRepository = $blockRepository;
        $this->blockFactory = $blockFactory;

    public function updateBlock()
       /** @var CoreCmsBlock $cmsBlock */
        $cmsBlock = $this->blockFactory->create();

        $data = [];
        $data['title'] = 'giftcard CMS Block';
        $data['identifier'] = 'giftcard';
        $data['content'] = 'giftcard long description';
        $data['_first_store_id'] = 0; // YOUR_STORE_ID
        $data['store_id'] = [0];
        try {
            $newCms = $this->blockRepository->save($cmsBlock);
        } catch (\Magento\Framework\Exception\LocalizedException $exception) {
            throw $exception->getMessage();
        return $newCms;