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](https://docs.github.com/[email protected]/rest/reference/orgs#get-organization-membership-for-a-user) 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.
/orgs/{org}/memberships/{username}- Source
github-v3-rest.json- Revision
f5f067c1e6f6- Active snapshot
85e53e3d0d65
Request
Path Parameters
- org stringrequired
- username stringrequired
Body Params
optionalThe 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.
Responses
Response
organization Organization Simple objectrequiredOrganization Simple
Organization Simple
Example: https://github.com/images/error/octocat_happy.gif
Example: A great organization
Example: https://api.github.com/orgs/github/events
Example: https://api.github.com/orgs/github/hooks
Example: 1
Example: https://api.github.com/orgs/github/issues
Example: github
Example: https://api.github.com/orgs/github/members{/member}
Example: MDEyOk9yZ2FuaXphdGlvbjE=
Example: https://api.github.com/orgs/github/public_members{/member}
Example: https://api.github.com/orgs/github/repos
Example: https://api.github.com/orgs/github
Example: https://api.github.com/orgs/octocat
permissions objectoptional
The user's membership type in the organization.
Example: admin
The state of the member in the organization. The `pending` state indicates the user has not yet accepted an invitation.
Example: active
Example: https://api.github.com/orgs/octocat/memberships/defunkt
user Simple User objectrequirednullable Simple User
Simple User
Example: https://github.com/images/error/octocat_happy.gif
Example: https://api.github.com/users/octocat/events{/privacy}
Example: https://api.github.com/users/octocat/followers
Example: https://api.github.com/users/octocat/following{/other_user}
Example: https://api.github.com/users/octocat/gists{/gist_id}
Example: 41d064eb2195891e12d0413f63227ea7
Example: https://github.com/octocat
Example: 1
Example: octocat
Example: MDQ6VXNlcjE=
Example: https://api.github.com/users/octocat/orgs
Example: https://api.github.com/users/octocat/received_events
Example: https://api.github.com/users/octocat/repos
Example: "2020-07-09T00:17:55Z"
Example: https://api.github.com/users/octocat/starred{/owner}{/repo}
Example: https://api.github.com/users/octocat/subscriptions
Example: User
Example: https://api.github.com/users/octocat
Forbidden
Validation failed