What is interesting is that you CAN delete aliases that are currently referenced by those 'automation' rules.
hm..looks like it is. may be additional check (in Filter model) should be added at https://github.com/opnsense/core/blob/7601e9cab3badfd78673bee3f486f8cb9f092266/src/opnsense/mvc/app/models/OPNsense/Firewall/Alias.php#L129
If this project sticks to api-only and no XML hacking this sounds very promising
REQUEST: POST | HEADERS: '{'Content-Type': 'application/json'}' | DATA: {'rule': {'enabled': 1, 'sequence': 1, 'action': 'pass','quick': 1, 'interface': 'lan', 'direction': 'in', 'ip_protocol': 'inet6', 'protocol': 'TCP', 'source_not': 0, 'source_net': 'any', 'source_port': '', 'destination_not': 0, 'destination_net': 'any', 'destination_port': '443', 'log': 1, 'description': 'ANSIBLE_TEST_1_10'}}
RESPONSE: {'status_code': 200, ... '_content': b'{"result":"saved"...
'ip_protocol': 'inet6'
<type type="OptionField"> <Required>Y</Required> <default>dot</default> <OptionValues> <dot>DNS over TLS</dot> <forward>Forward</forward> </OptionValues></type>
"type":{"dot":{"value":"DNS over TLS","selected":0},"forward":{"value":"Forward","selected":1}
REQUEST: POST | HEADERS: '{'Content-Type': 'application/json'}' | URL: https://FW/api/unbound/settings/addForward | DATA: {'dot': {'type': 'forward', 'enabled': 1, 'domain': 'tmp.at', 'server': '1.1.1.1', 'port': 53}}RESPONSE: {'status_code': 200,... '_content': b'{"result":"saved","uuid":"..."}'}
REQUEST: POST | HEADERS: '{'Referer': 'https://FW/ui/unbound/forward', 'Content-Type': 'application/json'}' | URL: https://FW/api/unbound/settings/addForward | DATA: {'dot': {'type': 'forward', 'enabled': 1, 'domain': 'tmp.at', 'server': '1.1.1.1', 'port': 53}}