Sample - GitHub REST API
GET/orgs/{org}/teams/{team_slug}/memberships/{username}

Get team membership for a user

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.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

3 parameters
orgstringrequired
The organization name. The name is not case sensitive.
team_slugstringrequired
The slug of the team name.
usernamestringrequired
The handle for the GitHub user account.

2 status codes
200Response
urlstringrequired
rolestringrequired
The role of the user in the team.
Allowed:membermaintainerDefault:member
statestringrequired
The state of the user's membership in the team.
Allowed:activepending
404if user has no team membership

Error handling

A 404 is returned: if user has no team membership.