# Assign Role To User

Source: https://agenta.ai/docs/reference/api/assign-role-to-user

`POST /workspaces/{workspace_id}/roles`

Base URL: `https://us.cloud.agenta.ai/api` (US cloud), `https://eu.cloud.agenta.ai/api` (EU cloud) or `$AGENTA_HOST/api` (self-hosted). Authentication: `Authorization: ApiKey YOUR_API_KEY`.

Assign a role to a user in a workspace.

Args:
    payload (UserRole): The organization id, user email, and role to assign.
    workspace_id (str): The ID of the workspace.

## Parameters

- `workspace_id` (in path, string, required)

## Request body schema

Content type: `application/json` (required)

- `email` (string, required)
- `role` (string, nullable)
- `organization_id` (string, required)

## Response schemas

### 200: Successful Response

- any

### 422: Validation Error

- `detail` (array of object)
  - `loc` (array of string | integer, required)
  - `msg` (string, required)
  - `type` (string, required)
  - `input` (any)
  - `ctx` (Context)
