---
title: "Assign Role To User"
method: POST
path: "/workspaces/{workspace_id}/roles"
tags: ["Workspaces"]
---

# Assign Role To User

`POST /workspaces/{workspace_id}/roles`

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.

## Path parameters

- `workspace_id` string, required

## Request body

- UserRole
  - `email` string, required
  - `role` string, nullable
  - `organization_id` string, required

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

## Changes

> 359 revisions in range; 45 could not be searched.

- **2025-06-27** `e3e84db47198` — 2 warning, 1 info
  - removed the optional property `detail/items/ctx` from the response with the `422` status
  - removed the optional property `detail/items/input` from the response with the `422` status
  - api tag `Workspaces` removed

[Change history](https://skmtc.dev/agenta-ai/apis/agenta-api/changes/workspaces/:workspace_id/roles/post.md)

---

[API](https://skmtc.dev/agenta-ai/apis/agenta-api.md) · [All operations](https://skmtc.dev/agenta-ai/apis/agenta-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/agenta-ai/agenta-api/revisions/713e4f3b7519/schema)
