---
title: "Assign an enterprise role to an enterprise user"
method: PUT
path: "/enterprises/{enterprise}/enterprise-roles/users/{username}/{role_id}"
tags: ["enterprise-admin"]
---

# Assign an enterprise role to an enterprise user

`PUT /enterprises/{enterprise}/enterprise-roles/users/{username}/{role_id}`

Assigns an enterprise role to a user in an enterprise.

To use this endpoint, the authenticated user must be one of:

  - An administrator for the enterprise.
  - A user, or a user on a team, with the fine-grained permission `write_enterprise_custom_enterprise_role` in the enterprise.

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

## Path parameters

- `enterprise` string, required
- `username` string, required
- `role_id` integer, required

## Response `204`

Response

## Other responses

- `403` — Forbidden
- `404` — Resource not found
- `422` — Response if the enterprise roles feature is not enabled for the enterprise, or validation failed.

---

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