---
title: "Update an existing department"
method: PUT
path: "/os/v1/departments/{externalCode}"
tags: ["Department", "Department"]
---

# Update an existing department

`PUT /os/v1/departments/{externalCode}`

Updates the provided department fields.

**Business Rules:**
- `name`: Required. Maximum 300 characters.
- `description`: Optional. Maximum 900 characters.
- `type`: Optional. Must be one of: DEPARTMENT, SECTOR, SECTIONS.
- `costCenterCode`: Optional. If provided, the cost center must exist. Set to null to remove cost center.
- `externalCode`: Not editable in this endpoint.

## Path parameters

- `externalCode` string, required

## Request body

- UpdateOrganizationUnitRequestDto
  - `name` string, required — Department name
  - `description` string — Department description
  - `type` 'DEPARTMENT' | 'SECTOR' | 'SECTIONS' — Department type
  - `costCenterCode` string, nullable — Cost center external code. Set to null to remove cost center.

## Response `200`

Department updated successfully

## Other responses

- `400` — Bad Request - Validation errors
- `401` — Unauthorized - Invalid or missing token
- `404` — Department not found
- `409` — Conflict - Cost center not found
- `500` — Internal Server Error - Unexpected failure

---

[API](https://skmtc.net/gupy/apis/gupy-public-api.md) · [All operations](https://skmtc.net/gupy/apis/gupy-public-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/gupy/gupy-public-api/revisions/3f26defa2a42/schema)
