Members

Members list

List all users who are members of an organization. If the authenticated user is also a member of this organization then both concealed and public members will be returned.

GET /orgs/:org/members

Parameters

Name Type Description
filter string Filter members returned in the list. Can be one of:
* 2fa_disabled: Members without two-factor authentication enabled. Available for organization owners.
* all: All members the authenticated user can see.

Default: all
role string Filter members returned by their role. Can be one of:
* all: All members of the organization, regardless of role.
* admin: Organization owners.
* member: Non-owner organization members.

Default: all

Response

Status: 200 OK
Link: <https://api.github.com/resource?page=2>; rel="next",
      <https://api.github.com/resource?page=5>; rel="last"
[
  {
    "login": "octocat",
    "id": 1,
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "",
    "url": "https://api.github.com/users/octocat",
    "html_url": "https://github.com/octocat",
    "followers_url": "https://api.github.com/users/octocat/followers",
    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    "organizations_url": "https://api.github.com/users/octocat/orgs",
    "repos_url": "https://api.github.com/users/octocat/repos",
    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    "received_events_url": "https://api.github.com/users/octocat/received_events",
    "type": "User",
    "site_admin": false
  }
]

Response if requester is not an organization member

Status: 302 Found
Location: https://api.github.com/orgs/github/public_members

Check membership

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

GET /orgs/:org/members/:username

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

Status: 204 No Content

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

Status: 404 Not Found

Response if requester is not an organization member and is inquiring about themselves

Status: 404 Not Found

Response if requester is not an organization member

Status: 302 Found
Location: https://api.github.com/orgs/github/public_members/pezra

Add a member

To add someone as a member to an organization, you must invite them to the organization or invite them to a team.

Remove a 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 /orgs/:org/members/:username

Response

Status: 204 No Content

Public members list

Members of an organization can choose to have their membership publicized or not.

GET /orgs/:org/public_members

Response

Status: 200 OK
Link: <https://api.github.com/resource?page=2>; rel="next",
      <https://api.github.com/resource?page=5>; rel="last"
[
  {
    "login": "octocat",
    "id": 1,
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "",
    "url": "https://api.github.com/users/octocat",
    "html_url": "https://github.com/octocat",
    "followers_url": "https://api.github.com/users/octocat/followers",
    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    "organizations_url": "https://api.github.com/users/octocat/orgs",
    "repos_url": "https://api.github.com/users/octocat/repos",
    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    "received_events_url": "https://api.github.com/users/octocat/received_events",
    "type": "User",
    "site_admin": false
  }
]

Check public membership

GET /orgs/:org/public_members/:username

Response if user is a public member

Status: 204 No Content

Response if user is not a public member

Status: 404 Not Found

Publicize a user's membership

The user can publicize their own membership. (A user cannot publicize the membership for another user.)

PUT /orgs/:org/public_members/:username

Note that you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."

Response

Status: 204 No Content

Conceal a user's membership

DELETE /orgs/:org/public_members/:username

Response

Status: 204 No Content

Get organization membership

In order to get a user's membership with an organization, the authenticated user must be an organization member.

GET /orgs/:org/memberships/:username

Response if user has an active admin membership with organization

Status: 200 OK
{
  "url": "https://api.github.com/orgs/octocat/memberships/defunkt",
  "state": "active",
  "role": "admin",
  "organization_url": "https://api.github.com/orgs/octocat",
  "organization": {
    "login": "octocat",
    "url": "https://api.github.com/orgs/octocat",
    "id": 1,
    "repos_url": "https://api.github.com/users/octocat/repos",
    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    "members_url": "https://api.github.com/users/octocat/members{/member}",
    "public_members_url": "https://api.github/com/users/octocat/public_members{/member}",
    "avatar_url": "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"
  },
  "user": {
    "login": "defunkt",
    "id": 3,
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "",
    "url": "https://api.github.com/users/defunkt",
    "html_url": "https://github.com/defunkt",
    "followers_url": "https://api.github.com/users/defunkt/followers",
    "following_url": "https://api.github.com/users/defunkt/following{/other_user}",
    "gists_url": "https://api.github.com/users/defunkt/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/defunkt/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/defunkt/subscriptions",
    "organizations_url": "https://api.github.com/users/defunkt/orgs",
    "repos_url": "https://api.github.com/users/defunkt/repos",
    "events_url": "https://api.github.com/users/defunkt/events{/privacy}",
    "received_events_url": "https://api.github.com/users/defunkt/received_events",
    "type": "User",
    "site_admin": false
  }
}

Response if user has an active membership with organization

Status: 200 OK
{
  "url": "https://api.github.com/orgs/octocat/memberships/defunkt",
  "state": "active",
  "role": "limited_member",
  "organization_url": "https://api.github.com/orgs/octocat",
  "organization": {
    "login": "octocat",
    "url": "https://api.github.com/orgs/octocat",
    "id": 1,
    "repos_url": "https://api.github.com/users/octocat/repos",
    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    "members_url": "https://api.github.com/users/octocat/members{/member}",
    "public_members_url": "https://api.github/com/users/octocat/public_members{/member}",
    "avatar_url": "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"
  },
  "user": {
    "login": "defunkt",
    "id": 3,
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "",
    "url": "https://api.github.com/users/defunkt",
    "html_url": "https://github.com/defunkt",
    "followers_url": "https://api.github.com/users/defunkt/followers",
    "following_url": "https://api.github.com/users/defunkt/following{/other_user}",
    "gists_url": "https://api.github.com/users/defunkt/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/defunkt/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/defunkt/subscriptions",
    "organizations_url": "https://api.github.com/users/defunkt/orgs",
    "repos_url": "https://api.github.com/users/defunkt/repos",
    "events_url": "https://api.github.com/users/defunkt/events{/privacy}",
    "received_events_url": "https://api.github.com/users/defunkt/received_events",
    "type": "User",
    "site_admin": false
  }
}

Response if user has a pending membership with organization

Status: 200 OK
{
  "url": "https://api.github.com/orgs/invitocat/memberships/defunkt",
  "state": "pending",
  "role": "limited_member",
  "organization_url": "https://api.github.com/orgs/invitocat",
  "organization": {
    "login": "invitocat",
    "url": "https://api.github.com/orgs/invitocat",
    "id": 2,
    "repos_url": "https://api.github.com/users/invitocat/repos",
    "events_url": "https://api.github.com/users/invitocat/events{/privacy}",
    "members_url": "https://api.github.com/users/invitocat/members{/member}",
    "public_members_url": "https://api.github/com/users/invitocat/public_members{/member}",
    "avatar_url": "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"
  },
  "user": {
    "login": "defunkt",
    "id": 3,
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "",
    "url": "https://api.github.com/users/defunkt",
    "html_url": "https://github.com/defunkt",
    "followers_url": "https://api.github.com/users/defunkt/followers",
    "following_url": "https://api.github.com/users/defunkt/following{/other_user}",
    "gists_url": "https://api.github.com/users/defunkt/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/defunkt/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/defunkt/subscriptions",
    "organizations_url": "https://api.github.com/users/defunkt/orgs",
    "repos_url": "https://api.github.com/users/defunkt/repos",
    "events_url": "https://api.github.com/users/defunkt/events{/privacy}",
    "received_events_url": "https://api.github.com/users/defunkt/received_events",
    "type": "User",
    "site_admin": false
  }
}

Add or update organization membership

In order to create or update a user's membership with an organization, the authenticated user must be an organization owner.

PUT /orgs/:org/memberships/:username

Parameters

Name Type Description
role string 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.

Default: member

Response if user was previously unaffiliated with organization

Status: 200 OK
{
  "url": "https://api.github.com/orgs/invitocat/memberships/defunkt",
  "state": "pending",
  "role": "admin",
  "organization_url": "https://api.github.com/orgs/invitocat",
  "organization": {
    "login": "invitocat",
    "url": "https://api.github.com/orgs/invitocat",
    "id": 2,
    "repos_url": "https://api.github.com/users/invitocat/repos",
    "events_url": "https://api.github.com/users/invitocat/events{/privacy}",
    "members_url": "https://api.github.com/users/invitocat/members{/member}",
    "public_members_url": "https://api.github/com/users/invitocat/public_members{/member}",
    "avatar_url": "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"
  },
  "user": {
    "login": "defunkt",
    "id": 3,
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "",
    "url": "https://api.github.com/users/defunkt",
    "html_url": "https://github.com/defunkt",
    "followers_url": "https://api.github.com/users/defunkt/followers",
    "following_url": "https://api.github.com/users/defunkt/following{/other_user}",
    "gists_url": "https://api.github.com/users/defunkt/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/defunkt/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/defunkt/subscriptions",
    "organizations_url": "https://api.github.com/users/defunkt/orgs",
    "repos_url": "https://api.github.com/users/defunkt/repos",
    "events_url": "https://api.github.com/users/defunkt/events{/privacy}",
    "received_events_url": "https://api.github.com/users/defunkt/received_events",
    "type": "User",
    "site_admin": false
  }
}

Response if user already had membership with organization

Status: 200 OK
{
  "url": "https://api.github.com/orgs/octocat/memberships/defunkt",
  "state": "active",
  "role": "admin",
  "organization_url": "https://api.github.com/orgs/octocat",
  "organization": {
    "login": "octocat",
    "url": "https://api.github.com/orgs/octocat",
    "id": 1,
    "repos_url": "https://api.github.com/users/octocat/repos",
    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    "members_url": "https://api.github.com/users/octocat/members{/member}",
    "public_members_url": "https://api.github/com/users/octocat/public_members{/member}",
    "avatar_url": "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"
  },
  "user": {
    "login": "defunkt",
    "id": 3,
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "",
    "url": "https://api.github.com/users/defunkt",
    "html_url": "https://github.com/defunkt",
    "followers_url": "https://api.github.com/users/defunkt/followers",
    "following_url": "https://api.github.com/users/defunkt/following{/other_user}",
    "gists_url": "https://api.github.com/users/defunkt/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/defunkt/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/defunkt/subscriptions",
    "organizations_url": "https://api.github.com/users/defunkt/orgs",
    "repos_url": "https://api.github.com/users/defunkt/repos",
    "events_url": "https://api.github.com/users/defunkt/events{/privacy}",
    "received_events_url": "https://api.github.com/users/defunkt/received_events",
    "type": "User",
    "site_admin": false
  }
}

Remove organization membership

In order to remove a user's membership with an organization, the authenticated user must be an organization owner.

DELETE /orgs/:org/memberships/:username

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.

Response

Status: 204 No Content

List pending organization invitations

Note: The Organization Membership API on GitHub is currently available for developers to preview. To access the API you must provide a custom media type in the Accept header:

application/vnd.github.korra-preview

Warning: The API may change without advance notice during the preview period. Preview features are not supported for production use. If you experience any issues, contact GitHub support.

The return hash contains a role field which refers to the Organization Invitation role and will be one of the following values: direct_member, admin, billing_manager, hiring_manager, or reinstate. If the invitee is not a GitHub member, the login field in the return hash will be null.

GET /orgs/:org/invitations

Response

Status: 200 OK
Link: <https://api.github.com/resource?page=2>; rel="next",
      <https://api.github.com/resource?page=5>; rel="last"
[
  {
    "id": 1,
    "login": "monalisa",
    "email": "octocat@github.com",
    "role": "direct_member",
    "created_at": "2016-11-30T06:46:10-08:00"
  }
]

List your organization memberships

GET /user/memberships/orgs

Input

Name Type Description
state string Indicates the state of the memberships to return. Can be either active or pending. If not specified, both active and pending memberships are returned.

Response

Status: 200 OK
Link: <https://api.github.com/resource?page=2>; rel="next",
      <https://api.github.com/resource?page=5>; rel="last"
[
  {
    "url": "https://api.github.com/orgs/octocat/memberships/defunkt",
    "state": "active",
    "role": "admin",
    "organization_url": "https://api.github.com/orgs/octocat",
    "organization": {
      "login": "octocat",
      "url": "https://api.github.com/orgs/octocat",
      "id": 1,
      "repos_url": "https://api.github.com/users/octocat/repos",
      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
      "members_url": "https://api.github.com/users/octocat/members{/member}",
      "public_members_url": "https://api.github/com/users/octocat/public_members{/member}",
      "avatar_url": "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"
    },
    "user": {
      "login": "defunkt",
      "id": 3,
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "gravatar_id": "",
      "url": "https://api.github.com/users/defunkt",
      "html_url": "https://github.com/defunkt",
      "followers_url": "https://api.github.com/users/defunkt/followers",
      "following_url": "https://api.github.com/users/defunkt/following{/other_user}",
      "gists_url": "https://api.github.com/users/defunkt/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/defunkt/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/defunkt/subscriptions",
      "organizations_url": "https://api.github.com/users/defunkt/orgs",
      "repos_url": "https://api.github.com/users/defunkt/repos",
      "events_url": "https://api.github.com/users/defunkt/events{/privacy}",
      "received_events_url": "https://api.github.com/users/defunkt/received_events",
      "type": "User",
      "site_admin": false
    }
  },
  {
    "url": "https://api.github.com/orgs/invitocat/memberships/defunkt",
    "state": "pending",
    "role": "admin",
    "organization_url": "https://api.github.com/orgs/invitocat",
    "organization": {
      "login": "invitocat",
      "url": "https://api.github.com/orgs/invitocat",
      "id": 2,
      "repos_url": "https://api.github.com/users/invitocat/repos",
      "events_url": "https://api.github.com/users/invitocat/events{/privacy}",
      "members_url": "https://api.github.com/users/invitocat/members{/member}",
      "public_members_url": "https://api.github/com/users/invitocat/public_members{/member}",
      "avatar_url": "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"
    },
    "user": {
      "login": "defunkt",
      "id": 3,
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "gravatar_id": "",
      "url": "https://api.github.com/users/defunkt",
      "html_url": "https://github.com/defunkt",
      "followers_url": "https://api.github.com/users/defunkt/followers",
      "following_url": "https://api.github.com/users/defunkt/following{/other_user}",
      "gists_url": "https://api.github.com/users/defunkt/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/defunkt/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/defunkt/subscriptions",
      "organizations_url": "https://api.github.com/users/defunkt/orgs",
      "repos_url": "https://api.github.com/users/defunkt/repos",
      "events_url": "https://api.github.com/users/defunkt/events{/privacy}",
      "received_events_url": "https://api.github.com/users/defunkt/received_events",
      "type": "User",
      "site_admin": false
    }
  }
]

Get your organization membership

GET /user/memberships/orgs/:org

Response

Status: 200 OK
{
  "url": "https://api.github.com/orgs/invitocat/memberships/defunkt",
  "state": "pending",
  "role": "admin",
  "organization_url": "https://api.github.com/orgs/invitocat",
  "organization": {
    "login": "invitocat",
    "url": "https://api.github.com/orgs/invitocat",
    "id": 2,
    "repos_url": "https://api.github.com/users/invitocat/repos",
    "events_url": "https://api.github.com/users/invitocat/events{/privacy}",
    "members_url": "https://api.github.com/users/invitocat/members{/member}",
    "public_members_url": "https://api.github/com/users/invitocat/public_members{/member}",
    "avatar_url": "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"
  },
  "user": {
    "login": "defunkt",
    "id": 3,
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "",
    "url": "https://api.github.com/users/defunkt",
    "html_url": "https://github.com/defunkt",
    "followers_url": "https://api.github.com/users/defunkt/followers",
    "following_url": "https://api.github.com/users/defunkt/following{/other_user}",
    "gists_url": "https://api.github.com/users/defunkt/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/defunkt/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/defunkt/subscriptions",
    "organizations_url": "https://api.github.com/users/defunkt/orgs",
    "repos_url": "https://api.github.com/users/defunkt/repos",
    "events_url": "https://api.github.com/users/defunkt/events{/privacy}",
    "received_events_url": "https://api.github.com/users/defunkt/received_events",
    "type": "User",
    "site_admin": false
  }
}

Edit your organization membership

PATCH /user/memberships/orgs/:org

Input

Name Type Description
state string Required. The state that the membership should be in. Only "active" will be accepted.

Example

{
  "state": "active"
}

Response

Status: 200 OK
{
  "url": "https://api.github.com/orgs/octocat/memberships/defunkt",
  "state": "active",
  "role": "admin",
  "organization_url": "https://api.github.com/orgs/octocat",
  "organization": {
    "login": "octocat",
    "url": "https://api.github.com/orgs/octocat",
    "id": 1,
    "repos_url": "https://api.github.com/users/octocat/repos",
    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    "members_url": "https://api.github.com/users/octocat/members{/member}",
    "public_members_url": "https://api.github/com/users/octocat/public_members{/member}",
    "avatar_url": "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"
  },
  "user": {
    "login": "defunkt",
    "id": 3,
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "",
    "url": "https://api.github.com/users/defunkt",
    "html_url": "https://github.com/defunkt",
    "followers_url": "https://api.github.com/users/defunkt/followers",
    "following_url": "https://api.github.com/users/defunkt/following{/other_user}",
    "gists_url": "https://api.github.com/users/defunkt/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/defunkt/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/defunkt/subscriptions",
    "organizations_url": "https://api.github.com/users/defunkt/orgs",
    "repos_url": "https://api.github.com/users/defunkt/repos",
    "events_url": "https://api.github.com/users/defunkt/events{/privacy}",
    "received_events_url": "https://api.github.com/users/defunkt/received_events",
    "type": "User",
    "site_admin": false
  }
}