Please check the below curl command example which invokes list-parents endpoint from the Groups API. It can be extended/modified based on the requirements.
It retrieves all groups in which a given user or group is a member.
This method is non-recursive; it returns all groups in which the given user or group is a member but not the groups in which those groups are members.
Example:
curl --netrc -X GET \
https://xxxxx.cloud.databricks.com/api/2.0/groups/list-parents \
--data '{ "user_name": "someone@example.com" }' \
| jq .
Reference documentation from more details:
https://docs.databricks.com/dev-tools/api/latest/groups.html#list-parents