Delete Company by company id programmatically B2B Magento 2.

You can delete company data by company id in B2B version of Magento Commerce or Magento Cloud Edition.

For Delete, Company you required company id to delete the company. use Magento\Company\Api\CompanyRepositoryInterface interface and use deleteById() method from the interface.

use Psr\Log\LoggerInterface;
use Magento\Company\Api\CompanyRepositoryInterface;
use Magento\Framework\Exception\NoSuchEntityException;

class Company
	public function __construct(
        CompanyRepositoryInterface $companyRepository,
        LoggerInterface $logger
    ) {
        $this->companyRepository = $companyRepository;
        $this->logger = $logger;

    public function deleteCompany()
        $companyId = 3; // company id
        try {
            $company = $this->companyRepository->deleteById($companyId);
        } catch (NoSuchEntityException $e) {
        } catch (\Exception $e) {
        return $company;

You need to call deleteCompany() function from above class with pass your company Id.