Help Center/ Identity and Access Management/ API Reference/ API/ Enterprise Project Management/ Granting Permissions to a User Associated with an Enterprise Project - AssociateRoleToUserOnEnterpriseProject
Updated on 2025-12-27 GMT+08:00

Granting Permissions to a User Associated with an Enterprise Project - AssociateRoleToUserOnEnterpriseProject

Function

This API is used to grant permissions to a user associated with an enterprise project.

This API can be called using both the global endpoint and region-specific endpoints. For IAM endpoints, see Regions and Endpoints.

Debugging

You can debug this API in API Explorer.

Authorization Information

Each account is authorized to call all APIs, but its IAM users must obtain the required permissions. For details, see Permissions and Supported Actions.

URI

PUT /v3.0/OS-PERMISSION/enterprise-projects/{enterprise_project_id}/users/{user_id}/roles/{role_id}

Table 1 URI parameters

Parameter

Mandatory

Type

Description

enterprise_project_id

Yes

String

Enterprise project ID.

user_id

Yes

String

User ID.

role_id

Yes

String

Permission ID.

Request Parameters

Table 2 Parameters in the request header

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Authenticated token with iam:permissions:grantRoleToUserOnEnterpriseProject or Security Administrator permissions.

Response Parameters

None

Example Request

Request for granting permissions to a user associated with an enterprise project

PUT https://iam.myhuaweicloud.com/v3.0/OS-PERMISSION/enterprise-projects/{enterprise_project_id}/users/{user_id}/roles/{role_id}

Example Response

Status code: 400

Parameter error.

{
  "error" : {
    "message" : "Illegal request",
    "code" : 400,
    "title" : "Bad Request"
  }
}

Status code: 401

Authentication failed.

{
  "error" : {
    "message" : "Authentication failed",
    "code" : 401,
    "title" : "Unauthorized"
  }
}

Status code: 403

Access denied.

{
  "error" : {
    "message" : "Forbidden operation",
    "code" : 403,
    "title" : "Forbidden"
  }
}

Status Codes

Status Code

Description

204

The request is successful.

400

Parameter error.

401

Authentication failed.

403

Access denied.

500

The system is abnormal.