CreateSysDept - Create a department

Updated at:

Creates a department in your organization. By default, the system creates two top-level departments: "Enterprise Department" and "Other Department". You can use this API to create sub-departments under these two departments. Creating additional top-level departments is not supported.

Important

The new Qoder CN documentation site is now available. Content on this site may not reflect the latest product features and changes. Visit docs.qoder.cn for the latest product documentation.

Supported editions

Enterprise Dedicated Edition

Service endpoints

Get the service endpoint and replace {domain} in the API request syntax with your endpoint.

Authorization

Product

Resource

Required permission

organization settings

departments

Read and write

Request syntax

POST  https://{domain}/oapi/v1/platform/departments

Request details

Sample request

curl -X 'POST' \
  'https://test-domain-***.rdc.aliyuncs.com/oapi/v1/platform/departments' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "name": "Example Name",
        "parentId": "ebeb5a64-c98c-478a-9d9d-513841da****"
    }'

Request headers

x-yunxiao-token string (Required)

The access token. See Access token for details.

Example: pt-0fh3****0fbG_35af****0484.

Request parameters

name string (Required)

The department name.

parentId string (Required)

The parent department ID. You can get this ID by calling the ListSysDepts API.

By default, the system creates two top-level departments: "Enterprise Department" and "Other Department". You can only create descendant departments under these top-level departments. Creating new top-level departments is not supported.

Response parameters

Sample success response

{
    "id": "c113337e-a1e2-473d-9682-99da771c****",
    "name": "Example Name",
    "creatorId": "bf2fce4f-7048-4017-a734-1c346e68****",
    "parentId": "ebeb5a64-c98c-478a-9d9d-513841da****"
}

id string

The department ID.

name string

The department name.

creatorId string

The ID of the user who created the department.

parentId string

The parent department ID.

Error codes

For more information, see Error code center.