Sample - GitHub REST API
PUT/orgs/{org}/organization-roles/users/{username}/{role_id}

Assign an organization role to a user

Assigns an organization role to a member of an organization. For more information on organization roles, see "Using organization roles."

The authenticated user must be an administrator for the organization to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

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

3 parameters
orgstringrequired
The organization name. The name is not case sensitive.
usernamestringrequired
The handle for the GitHub user account.
role_idintegerrequired
The unique identifier of the role.

3 status codes
204Response
404Response if the organization, user or role does not exist.
422Response if the organization roles feature is not enabled enabled for the organization, the validation failed, or the user is not an organization member.

Error handling

A 404 is returned: Response if the organization, user or role does not exist. A 422 is returned: Response if the organization roles feature is not enabled enabled for the organization, the validation failed, or the user is not an organization member.