Update a department. PATCH /api/openapi/v1/departments/{departmentId}, scope admin.v1.user-directory.manage.
- Scope: admin.v1.user-directory.manage
- Permission: Manage users and departments (user-directory)
- Permission type: Manage
- Endpoint: PATCH/api/openapi/v1/departments/{departmentId}
Authentication and request headers
Call with an application API key. This endpoint checks only the scope above; read, manage and execute permissions do not imply one another.
| Name | Location | Type | Required | Description | Example |
|---|---|---|---|---|---|
| Authorization | header | string | Yes | Application API key, passed as a Bearer token. | Bearer qwk_*** |
| X-Request-Id | header | string | No | Optional request tracing identifier; generated by the server if omitted. | req-20260831-001 |
Request parameters
| Name | Location | Type | Required | Description | Example |
|---|---|---|---|---|---|
| departmentId | path | string · uuid | Required | Department ID | "<uuid>" |
| Idempotency-Key | header | string | Required | Idempotency key used to prevent duplicate submissions | "<string>" |
| external_id | body | string | No | External department ID | "<string>" |
| name | body | string | No | Department name | "<string>" |
| parent_id | body | string · uuid | No | Parent department (department ID) | "<uuid>" |
Request example
cURL
Responses
200 OK
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
| department_id | string · uuid | Yes | Department ID | "<uuid>" |
| external_id | string | No | External department ID | "<string>" |
| name | string | Yes | Department name | "<string>" |
| order | integer · int64 | Yes | Sort order | 0 |
| parent_id | string | null | Yes | Parent department (department ID) | "<string>" |
default Flat business error
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
| code | string | No | Stable business error code | "<string>" |
| detail | string | Yes | Human-readable error description | "<string>" |
| details | OpenapiErrorDetails | No | Error details | {"field":"<string>","reason":"<string>","suggestion":"<string>"} |
| details.field | string | No | Request field that failed validation | "<string>" |
| details.reason | string | No | Stable validation failure reason | "<string>" |
| details.suggestion | string | No | Suggested normalized value | "<string>" |
| error | string | Yes | Stable HTTP error type | "<string>" |