Get list of ids bellow
curl "https://gitlab.com/api/v4/projects?private_token=<access_token>&simple=true&owned=true&pagination=keyset&per_page=100&order_by=id&sort=desc" | jq .[].id
Use jq .[].name to get the names if needed to match id to name
gitlab_ids=( xxxxxxxx yyyyyyyyy zzzzzzzzz )
for i in "${gitlab_ids[@]}" do
echo "Processing: $i"
curl --request DELETE --header "PRIVATE-TOKEN: <access_token>" "https://gitlab.com/api/v4/projects/$i/protected_branches/master"
curl --request DELETE --header "PRIVATE-TOKEN: <access_token>" "https://gitlab.com/api/v4/projects/$i/protected_branches/main"
curl --request POST --header "PRIVATE-TOKEN: <access_token>" "https://gitlab.com/api/v4/projects/$i/protected_branches?name=*&allow_force_push=true"
sleep 0.2
done
</code></pre>