---
title: "assign roles"
method: POST
path: "/api/v{version}/users/{id}/roles"
tags: ["users"]
---

# assign roles

`POST /api/v{version}/users/{id}/roles`

## Request

- Base URL: `https://api.zrexpress.app`
- URL: `https://api.zrexpress.app/api/v{version}/users/{id}/roles`
- Auth: HTTP bearer and API key in header `X-Api-Key`
- TypeScript: <https://skmtc.dev/zrexpress/apis/zrexpress-api/docs/api/v:version/users/:id/roles/post.ts> (a function with typed inputs; its response is checked against the schema)

assign roles

## Path parameters

- `version` string, required
- `id` string, required

## Headers

- `X-Tenant` string, required

## Request body

- AssignUserRoleRequest
  - `userId` string, uuid
  - `userRoles` UserRole[], nullable
    - `roleName` string, nullable
    - `enabled` boolean

## Response `200`

OK

## Changes

- **2026-11-03** `652262902df9`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/zrexpress/apis/zrexpress-api/changes/api/v:version/users/:id/roles/post.md)

---

[API](https://skmtc.dev/zrexpress/apis/zrexpress-api.md) - [All operations](https://skmtc.dev/zrexpress/apis/zrexpress-api/llms.txt) - [OpenAPI document](https://skmtc.dev/zrexpress/apis/zrexpress-api/revisions/652262902df9?raw)
