---
title: "Assign User to Role"
method: PUT
path: "/users/{userId}/site-roles"
tags: ["Users"]
---

# Assign User to Role

`PUT /users/{userId}/site-roles`

Use this endpoint to assign a Role to a User.

## Request body

- object
  - `site_id` string, required — Identifier of the site to grant the role at. Site roles scope permissions to a single site; the user only receives the role's permissions when acting on this site. The caller's API key must have access to it.
  - `role_id` string, required — Identifier of the role to assign. The role's permissions apply only when the user is operating in the context of the specified `site_id`.

## Response `201`

The role was successfully assigned.

## Other responses

- `401` — The user is unauthenticated
- `403` — The authenticated user does not have permission.
- `404` — The resource couldn't be found
- `422` — The request didn't pass validation

---

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