Detect how user was assigned to group

In the Group screen at People tab - there is a list of users, in which in the Managed column it is specified how the user was assigned to the group:
Manually or By rule .
My question is which API retrieves this attribute - how a user was assigned to a group?

What do you see if you look in system log for the event where the user is assigned, eventType eq "group.user_membership.add"?

Thanks Andrea. I think the answer to my question is actually in the system log - i can get that info by checking the Actor