# assignRoles

Audience: Developer

Assign one or more per-service roles to an existing user within a tenant.

Assign one or more per-service roles to an existing user within a tenant.
Additive: roles the user already holds are preserved. Only per-service
role keys are accepted; ladder roles (reader/writer/admin) are rejected.
Tenant-admin only. The Zitadel root organization is refused: it is not
a tenant, and its accounts are managed in the Zitadel console.

**Served by:** [management](https://docs.pyck.cloud/dev/api/services/management.md)

## Arguments

| Name | Type |
| --- | --- |
| `input` | [AssignRolesInput](https://docs.pyck.cloud/dev/api/inputs/assignrolesinput.md)! |

## Returns

[AssignRolesResponse](https://docs.pyck.cloud/dev/api/types/assignrolesresponse.md)!

## Example

Grants one or more per-service roles to an existing user within a tenant. Roles the user already holds are preserved, so the call is additive. Only per-service role keys are accepted (ladder roles reader/writer/admin are rejected). Tenant-admin only.

```graphql
mutation AssignRoles($input: AssignRolesInput!) {
  assignRoles(input: $input) {
    roles
    userId
  }
}
```

**Variables**

```json
{
  "input": {
    "roles": [
      "inventory_service"
    ],
    "tenantId": "<tenant UUID>",
    "userId": "<management user UUID>"
  }
}
```
