---
title: "POST /api/v{version}/workgroup/setroles"
method: POST
path: "/api/v{version}/workgroup/setroles"
tags: ["Workgroup"]
---

# POST /api/v{version}/workgroup/setroles

`POST /api/v{version}/workgroup/setroles`

## Path parameters

- `version` string, required

## Request body

- UserWorkgroupRole[]
  - `userId` integer, required — Gets or sets the foreign key to the BDMS.Models.UserWorkgroupRole.User entity.
  - `user` User — Represents a user entity in the database.
    - `id` integer, required
    - `name` string — Gets or sets the BDMS.Models.User name.
    - `subjectId` string — Gets or sets the BDMS.Models.Users subject id provided by oidc.
    - `firstName` string — Gets or sets the BDMS.Models.Users firstname.
    - `lastName` string — Gets or sets the BDMS.Models.Users lastname.
    - `email` string — Gets or sets the BDMS.Models.Users email.
    - `isAdmin` boolean — Gets or sets whether the BDMS.Models.User has admin privileges.
    - `isDisabled` boolean — Gets the value whether the BDMS.Models.User is disabled or not.
    - `disabledAt` string, date-time, nullable — Gets or sets the timestamp from the moment a BDMS.Models.User got disabled.
    - `createdAt` string, date-time, nullable — Gets or sets the timestamp from the moment a BDMS.Models.User got disabled.
    - `settings` string, nullable — Gets or sets the BDMS.Models.Users settings.
    - `workgroupRoles` UserWorkgroupRole[] — Gets the WorkgroupRoles.
    - `termsAccepted` TermsAccepted[] — Gets the TermsAccepted.
      - `userId` integer, required — Gets or sets the foreign key to the BDMS.Models.TermsAccepted.User entity.
      - `user` User — recursive
      - `termId` integer, required — Gets or sets the foreign key to the BDMS.Models.TermsAccepted.Term entity.
      - `term` Term — Represents a term entity in the database.
        - `id` integer, required
        - `isDraft` boolean — Gets or sets whetther the BDMS.Models.Term is a draft.
        - `textEn` string — Gets or sets the BDMS.Models.Term's english text.
        - `textDe` string, nullable — Gets or sets the BDMS.Models.Term's german text.
        - `textFr` string, nullable — Gets or sets the BDMS.Models.Term's french text.
        - `textIt` string, nullable — Gets or sets the BDMS.Models.Term's italian text.
        - `textRo` string, nullable — Gets or sets the BDMS.Models.Term's romansch text.
        - `creation` string, date-time — Gets or sets the BDMS.Models.Term's creation date.
        - `expiration` string, date-time, nullable — Gets or sets the BDMS.Models.Term's expiration date.
      - `acceptedAt` string, date-time — Gets or sets the timestamp from the moment the terms got accepted.
    - `deletable` boolean, nullable — Gets or sets whether this user can be deleted.
  - `workgroupId` integer, required — Gets or sets the foreign key to the BDMS.Models.UserWorkgroupRole.Workgroup entity.
  - `workgroup` Workgroup — Represents a workgroup entity in the database.
    - `id` integer, required
    - `name` string, required — Gets or sets the name of the workgroup.
    - `createdAt` string, date-time, nullable — Gets or sets the BDMS.Models.Workgroup created date.
    - `disabledAt` string, date-time, nullable — Gets or sets the BDMS.Models.Workgroup disabled date.
    - `isDisabled` boolean — Gets the value whether the BDMS.Models.Workgroup is disabled or not.
    - `settings` string, nullable — Gets or sets the Settings for the BDMS.Models.Workgroup.
    - `boreholeCount` integer — Number of boreholes in the workgroup.
  - `role` 'View' | 'Editor' | 'Controller' | 'Validator' | 'Publisher' — Represents a role entity in the database.
  - `isActive` boolean, nullable — Gets or sets whether the role is active or not.

## Response `200`

The roles were set successfully.

## Other responses

- `400` — The roles could not be set due to invalid input.
- `401` — The current user is not authorized to set roles.
- `404` — The user or workgroup could not be found.
- `500` — The server encountered an unexpected condition that prevented it from fulfilling the request.

---

[API](https://skmtc.net/geoadmin/apis/boreholes-rest-api-v2.md) · [All operations](https://skmtc.net/geoadmin/apis/boreholes-rest-api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/geoadmin/boreholes-rest-api-v2/versions/e6d0b4ee0f52/schema)
