---
title: "Update department by id"
method: PATCH
path: "/company/v1/departments/{departmentId}"
tags: ["departments (usersService)"]
---

# Update department by id

`PATCH /company/v1/departments/{departmentId}`

## Request

- Base URL: `https://{domain}.uspacy.ua`
- URL: `https://{domain}.uspacy.ua/company/v1/departments/{departmentId}`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/uspacy/apis/uspacy-api-2/docs/company/v1/departments/:departmentId/patch.ts> (a function with typed inputs; its response is checked against the schema)

Update department data (set head department, move users, set parent department) Available only for head parent department or users with admin permissions. Returns updated department data

## Request body

- DepartmentPatch
  - `name` string
  - `headId` string
  - `description` string
  - `parentDepartmentId` string

## Response `200`

OK

- Department
  - `id` integer
  - `description` string
  - `name` string
  - `headId` string
  - `parentDepartmentId` string
  - `usersIds` string
  - `roles` string[]

## Other responses

- `401`: Access token is missing or invalid
- `404`: Resource not found

---

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