When salt master is connected to the RAAS with authentication method configured "username:password" you cannot delete salt masters with the following method "set_master_key_state" because there is no key to delete.
To delete salt master follow the steps from below:
curl --insecure --request POST https://localhost/rpc --user root:salt --data '{"resource": "master", "method": "get_master_presence"}' --cookie "_xsrf=fred" --header "X-Xsrftoken: fred" --header 'Content-Type: application/json'| jq . | grep 'master_id' | grep masterpatterntodelete
where:
curl -vv --insecure --request POST https://localhost/rpc --user root:salt --data '{"resource":"master","method":"delete_master","kwarg":{"master_id":"saltstack_enterprise_installer"}}' --cookie "_xsrf=fred" --header "X-Xsrftoken: fred" --header 'Content-Type: application/json'