GitHub v3 REST API

Check organization membership for a user

Check if a user is, publicly or privately, a member of the organization.

get
http://HOSTNAME/api/v3/orgs/{org}/members/{username}

Path Parameters

orgstringrequired
usernamestringrequired

Response

Response if requester is an organization member and user is a member

get/orgs/{org}/members/{username}
 

Remove an organization member

Removing a user from this list will remove them from all teams and they will no longer have any access to the organization’s repositories.

delete
http://HOSTNAME/api/v3/orgs/{org}/members/{username}

Path Parameters

orgstringrequired
usernamestringrequired

Response

Response

delete/orgs/{org}/members/{username}
 

Get organization membership for a user

In 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.

get
http://HOSTNAME/api/v3/orgs/{org}/memberships/{username}

Path Parameters

orgstringrequired
usernamestringrequired

Response

application/json

Response

Org Membership

Org Membership

urlstring(uri)required

Example:https://api.github.com/orgs/octocat/memberships/defunkt

statestringrequired

The state of the member in the organization. The pending state indicates the user has not yet accepted an invitation.

Allowed values:activepending

Example:active

rolestringrequired

The user’s membership type in the organization.

Allowed values:adminmemberbilling_manager

Example:admin

organization_urlstring(uri)required

Example:https://api.github.com/orgs/octocat

organizationobjectrequired

Organization Simple

Show Child Parameters
userobject | nullrequired

Simple User

Show Child Parameters
permissionsobject
Show Child Parameters
get/orgs/{org}/memberships/{username}
 
application/json

Set organization membership for a user

Only 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.

put
http://HOSTNAME/api/v3/orgs/{org}/memberships/{username}

Path Parameters

orgstringrequired
usernamestringrequired

Body

application/json
rolestring

The role to give the user in the organization. Can be one of:
* admin - The user will become an owner of the organization.
* member - The user will become a non-owner member of the organization.

Allowed values:adminmember

Default:member

Response

application/json

Response

Org Membership

Org Membership

urlstring(uri)required

Example:https://api.github.com/orgs/octocat/memberships/defunkt

statestringrequired

The state of the member in the organization. The pending state indicates the user has not yet accepted an invitation.

Allowed values:activepending

Example:active

rolestringrequired

The user’s membership type in the organization.

Allowed values:adminmemberbilling_manager

Example:admin

organization_urlstring(uri)required

Example:https://api.github.com/orgs/octocat

organizationobjectrequired

Organization Simple

Show Child Parameters
userobject | nullrequired

Simple User

Show Child Parameters
permissionsobject
Show Child Parameters
put/orgs/{org}/memberships/{username}

Body

{}
 
application/json

Remove organization membership for a user

In 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.

delete
http://HOSTNAME/api/v3/orgs/{org}/memberships/{username}

Path Parameters

orgstringrequired
usernamestringrequired

Response

Response

delete/orgs/{org}/memberships/{username}