# Update department Update the name or description of an existing department. Partially updates a department. Only the fields provided in the request body are modified. To move a department to a different parent, use the [Reparent Department](/docs/api-reference/departments/reparent) endpoint instead. #### Path Parameters **`organization_id`** string required The unique identifier of the organization (format: `org_*`). **`department_id`** string required The unique identifier of the department (format: `dept_*`). #### Request Body **`name`** string optional The new name for the department. Must be between 1 and 255 characters. **`description`** string | null optional The new description for the department. ## Returns The updated department object. Request ```bash cURL curl -X PATCH https://api.aitronos.com/v1/organizations/org_xyz789/departments/dept_abc123 \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Platform Engineering", "description": "Platform and infrastructure team" }' ``` ```python Python SDK from aitronos import Aitronos client = Aitronos(api_key="your-api-key") # Department endpoints coming to SDK soon # result = client.departments.update( # organization_id="org_xyz789", # department_id="dept_abc123", # name="Platform Engineering", # description="Platform and infrastructure team", # ) ``` ```python Python import requests org_id = "org_xyz789" dept_id = "dept_abc123" url = f"https://api.aitronos.com/v1/organizations/{org_id}/departments/{dept_id}" headers = { "Authorization": "Bearer YOUR_ACCESS_TOKEN", "Content-Type": "application/json", } data = { "name": "Platform Engineering", "description": "Platform and infrastructure team", } response = requests.patch(url, headers=headers, json=data) department = response.json() print(department) ``` ```javascript JavaScript const orgId = "org_xyz789"; const deptId = "dept_abc123"; const response = await fetch( `https://api.aitronos.com/v1/organizations/${orgId}/departments/${deptId}`, { method: "PATCH", headers: { "Authorization": `Bearer ${accessToken}`, "Content-Type": "application/json", }, body: JSON.stringify({ name: "Platform Engineering", description: "Platform and infrastructure team", }), } ); const department = await response.json(); console.log(department); ``` Response ```json 200 OK { "id": "dept_abc123", "name": "Platform Engineering", "description": "Platform and infrastructure team", "parent_id": null, "path": "/dept_abc123", "depth": 0, "organization_id": "org_xyz789", "member_count": 5, "is_active": true, "is_default": false, "color": null, "created_by": "usr_owner1", "created_at": "2025-01-15T10:00:00Z" } ``` ```json 404 Error { "success": false, "error": { "code": "DEPARTMENT_NOT_FOUND", "message": "The requested department could not be found.", "system_message": "Department not found", "type": "client_error", "status": 404, "details": { "department_id": "dept_xyz" }, "trace_id": "abc-123-def", "timestamp": "2025-11-02T08:21:45Z" } } ``` ## Related Resources - [Get Department Tree](/docs/api-reference/departments/tree) - [List Departments](/docs/api-reference/departments/list) - [Retrieve Department](/docs/api-reference/departments/retrieve) - [Create Department](/docs/api-reference/departments/create) - [Reparent Department](/docs/api-reference/departments/reparent) - [Delete Department](/docs/api-reference/departments/delete) - [List Department Members](/docs/api-reference/departments/list-members) - [Add Department Member](/docs/api-reference/departments/add-member) - [Remove Department Member](/docs/api-reference/departments/remove-member) - [Department Object](/docs/api-reference/objects/department-object)