Sample - GitHub REST API
GET/orgs/{org}/memberships/{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.

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

2 parameters
orgstringrequired
The organization name. The name is not case sensitive.
usernamestringrequired
The handle for the GitHub user account.

3 status codes
200Response
urlstringrequired
statestringrequired
The state of the member in the organization. The `pending` state indicates the user has not yet accepted an invitation.
Allowed:activepending
rolestringrequired
The user's membership type in the organization.
Allowed:adminmemberbilling_manager
direct_membershipbooleanoptional
Whether the user has direct membership in the organization.
enterprise_teams_providing_indirect_membershiparray<string>optional
The slugs of the enterprise teams providing the user with indirect membership in the organization. A limit of 100 enterprise team slugs is returned.
organization_urlstringrequired
organizationobjectrequired
A GitHub organization.
userobjectrequired
A GitHub user.
permissionsobjectoptional
403Forbidden
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Resource not found
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional

Error handling

A 403 is returned: Forbidden. A 404 is returned: Resource not found.