When I try via UI, all documentation I find tells me it should be possible, however the UI only suggests email addresses to me. When I forcibly enter a group name, it still doesn't work.

I also tried via REST API, but it just tells me my project key is not found.
I can do GET requests via browser like so:
https://xxx.atlassian.net/rest/api/2/project/xxx/role
and that works, but in order to post I need curl, which I tried like this:
curl -X POST "https://xxx.atlassian.net/rest/api/3/project/xxx/role/10010" \
-H "Content-Type: application/json" \
-d '{
"group": ["jira-admins"]
}'
but I get:
"project key 'xxx' is not found"