How can I programmatically bulk delete redirect entities based on their status code? I have a list of 3089 301 redirects URLs and want to delete them programmatically from the database.
E.g List of source URLs
/about/test/2013/page_61732.html
/about/test/additional/branches/page_38678.html
/about/test/additional/branches/page_38678.html
/about/test/additional/branches/page_38678.html
......
If I understand your question correctly, you want to delete all redirects with a status code of 301. That could be done like this:
$ids = \Drupal::entityQuery('redirect')
   -&gt;condition('status_code', '301')
   -&gt;execute();

$entities = Redirect::loadMultiple($ids);

\Drupal::entityTypeManager()-&gt;getStorage('redirect')-&gt;delete($entities);

If you only want to delete redirects that have a certain source URL, you should be able to add
-&gt;condition('redirect_source__path', $sources, 'IN')

to your query.