Skip to main content

memberships

Overview

Namememberships
TypeResource
Idgithub.orgs.memberships

Fields

NameDatatypeDescription
organizationobjectA GitHub organization.
organization_urlstring
permissionsobject
rolestringThe user's membership type in the organization.
statestringThe state of the member in the organization. The pending state indicates the user has not yet accepted an invitation.
urlstring
userobjectA GitHub user.

Methods

NameAccessible byRequired ParamsDescription
get_membership_for_authenticated_userSELECTorgIf the authenticated user is an active or pending member of the organization, this endpoint will return the user's membership. If the authenticated user is not affiliated with the organization, a 404 is returned. This endpoint will return a 403 if the request is made by a GitHub App that is blocked by the organization.
get_membership_for_userSELECTorg, usernameIn order to get a user's membership with an organization, the authenticated user must be an organization member. The state parameter in the response can be used to identify the user's membership status.
list_memberships_for_authenticated_userSELECTLists all of the authenticated user's organization memberships.
remove_membership_for_userDELETEorg, usernameIn order to remove a user's membership with an organization, the authenticated user must be an organization owner.

If the specified user is an active member of the organization, this will remove them from the organization. If the specified user has been invited to the organization, this will cancel their invitation. The specified user will receive an email notification in both cases.
check_membership_for_userEXECorg, usernameCheck if a user is, publicly or privately, a member of the organization.
check_public_membership_for_userEXECorg, usernameCheck if the provided user is a public member of the organization.
remove_public_membership_for_authenticated_userEXECorg, usernameRemoves the public membership for the authenticated user from the specified organization, unless public visibility is enforced by default.
set_membership_for_userEXECorg, usernameOnly authenticated organization owners can add a member to the organization or update the member's role.

If the authenticated user is adding a member to the organization, the invited user will receive an email inviting them to the organization. The user's membership status will be pending until they accept the invitation.

Authenticated users can update a user's membership by passing the role parameter. If the authenticated user changes a member's role to admin, the affected user will receive an email notifying them that they've been made an organization owner. If the authenticated user changes an owner's role to member, no email will be sent.

Rate limits

To prevent abuse, the authenticated user is limited to 50 organization invitations per 24 hour period. If the organization is more than one month old or on a paid plan, the limit is 500 invitations per 24 hour period.
set_public_membership_for_authenticated_userEXECorg, usernameThe user can publicize their own membership. (A user cannot publicize the membership for another user.)

Note that you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."
update_membership_for_authenticated_userEXECorg, data__stateConverts the authenticated user to an active member of the organization, if that user has a pending invitation from the organization.