---
title: "Set organization membership for a user"
method: PUT
path: "/orgs/{org}/memberships/{username}"
tags: ["orgs"]
---

# Set organization membership for a user

`PUT /orgs/{org}/memberships/{username}`

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/rest/orgs/members#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, organization owners are limited to creating 50 organization invitations for an organization within a 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.

## Path parameters

- `org` string, required
- `username` string, required

## Request body

- object
  - `role` 'admin' | 'member' — 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.

## Response `200`

Response

- OrgMembership — Org Membership
  - `url` string, uri, required
  - `state` 'active' | 'pending', required — The state of the member in the organization. The `pending` state indicates the user has not yet accepted an invitation.
  - `role` 'admin' | 'member' | 'billing_manager', required — The user's membership type in the organization.
  - `direct_membership` boolean — Whether the user has direct membership in the organization.
  - `enterprise_teams_providing_indirect_membership` string[] — 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_url` string, uri, required
  - `organization` OrganizationSimple, required — A GitHub organization.
    - `login` string, required
    - `id` integer, required
    - `node_id` string, required
    - `url` string, uri, required
    - `repos_url` string, uri, required
    - `events_url` string, uri, required
    - `hooks_url` string, required
    - `issues_url` string, required
    - `members_url` string, required
    - `public_members_url` string, required
    - `avatar_url` string, required
    - `description` string, nullable, required
  - `user` NullableSimpleUser, nullable, required — A GitHub user.
    - `name` string, nullable
    - `email` string, nullable
    - `login` string, required
    - `id` integer, required
    - `node_id` string, required
    - `avatar_url` string, uri, required
    - `gravatar_id` string, nullable, required
    - `url` string, uri, required
    - `html_url` string, uri, required
    - `followers_url` string, uri, required
    - `following_url` string, required
    - `gists_url` string, required
    - `starred_url` string, required
    - `subscriptions_url` string, uri, required
    - `organizations_url` string, uri, required
    - `repos_url` string, uri, required
    - `events_url` string, required
    - `received_events_url` string, uri, required
    - `type` string, required
    - `site_admin` boolean, required
    - `starred_at` string
    - `user_view_type` string
  - `permissions` object
    - `can_create_repository` boolean, required

## Other responses

- `403` — Forbidden
- `422` — Validation failed, or the endpoint has been spammed.

---

[API](https://skmtc.net/github/apis/rest-api.md) · [All operations](https://skmtc.net/github/apis/rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/rest-api/versions/80850db290cd/schema)
