Skip to content

Get team membership for a user

GET
/orgs/{org}/teams/{team_slug}/memberships/{username}

Team members will include the members of child teams.

To get a user’s membership with a team, the team must be visible to the authenticated user.

[!NOTE] You can also specify a team by org_id and team_id using the route GET /organizations/{org_id}/team/{team_id}/memberships/{username}.

[!NOTE] The response contains the state of the membership and the member’s role.

The role for organization owners is set to maintainer. For more information about maintainer roles, see Create a team.

API method documentation

org
required
string

The organization name. The name is not case sensitive.

team_slug
required
string

The slug of the team name.

username
required
string

The handle for the GitHub user account.

Response

Media type application/json
Team Membership

Team Membership

object
url
required
string format: uri
role
required

The role of the user in the team.

string
default: member
Allowed values: member maintainer
state
required

The state of the user’s membership in the team.

string
Allowed values: active pending
Examples
Example response-if-user-is-a-team-maintainer

Response if user is a team maintainer

{
"url": "https://api.github.com/teams/1/memberships/octocat",
"role": "maintainer",
"state": "active"
}

If user has no team membership