What is the parameter $instance_id in the function Block::setVisibilityConfig?
I got it. Example:

use Drupal\block\Entity\Block;

function mytheme_preprocess_html(&amp;$variables)
{
    $block = Block::load('sitebranding');
    $block-&gt;setRegion('content');

    $visibility = $block-&gt;getVisibility();

    if (isset($visibility['request_path']['pages']))
    {
       unset($visibility['request_path']['pages']);
       $visibility['request_path']['negate'] = 0; 
       // $visibility['request_path']['pages'] = '/node/2';
       $visibility['request_path']['pages'] = \Drupal::config('mymodule.settings')-&gt;get('services_block_path_visibility');
       $block-&gt;setVisibilityConfig('request_path', $visibility['request_path']);
       $block-&gt;save();
    }
}