# Create or update permissions assignment

Launch stage: GA

`PUT /api/2.0/accounts/{account_id}/workspaces/{workspace_id}/permissionassignments/principals/{principal_id}`

`PUT /api/2.0/preview/accounts/{account_id}/workspaces/{workspace_id}/permissionassignments/principals/{principal_id}`

Creates or updates the workspace permissions assignment in a given account and workspace for the specified principal.

API scopes: access-management

## Path parameters

- `account_id` (string, required)
  The account ID.
- `workspace_id` (int64, required)
  The workspace ID.
- `principal_id` (int64, required)
  The ID of the user, service principal, or group.

## Request body

- `permissions` (array of string, optional)
  Array of permissions assignments to update on the workspace.
   Valid values are "USER" and "ADMIN" (case-sensitive).
   If both "USER" and "ADMIN" are provided, "ADMIN" takes precedence.
   Other values will be ignored.
   Note that excluding this field, or providing unsupported values, will have the same effect as providing an empty list, which will result in the deletion of all permissions for the principal.
  Possible values:
  - `UNKNOWN`
  - `USER`
  - `ADMIN`

## Returns

Returns the WorkspacePermissionAssignmentOutput object.

## Response

```json
{
  "principal": {
    "user_name": "string",
    "group_name": "string",
    "service_principal_name": "string",
    "principal_id": 0,
    "display_name": "string"
  },
  "permissions": [
    "UNKNOWN"
  ],
  "error": "string"
}
```

