Retrieve group membership to GitLab project via API

Hi,
I want to retrieve the direct assigned GitLab groups for a particular gitlab project. Using REST or GraphQL APIs.

From the docs List all members of a group or project including inherited and invited members I found this REST endpoint: {gitlab_domain}/api/v4/projects/:project_id/members/all
…but it only returns the Users that have access to the project. I want also the Groups.