Hello Roni Lev,
Thank you for reaching out to Microsoft Support!
The Graph API provides endpoints that can list all the groups, but it does not fully implement your requirements, see the documentation for details:
https://learn.microsoft.com/en-us/graph/api/group-list?view=graph-rest-1.0&tabs=http
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.