All Products
Search
Document Center

AI Coding Assistant Lingma:ListSysDepts

Last Updated:May 27, 2025

Call this API to query the list of departments in an organization.

Supported editions

Enterprise Dedicated Edition

Service endpoints and authorization

  • Get the service endpoint to replace <domain> in the API request syntax with your endpoint.

  • Obtain the access token.

  • Obtain the organizationId. Go to the Lingma console and view the organization ID on the Basic Information page under Enterprise settings > Organization.

Product

Resource

Required permission

Organization settings

Departments

Read-Only

Request syntax

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

Request headers

Parameter

Type

Required

Description

Example

x-yunxiao-token

string

Yes

The access token.

pt-0fh3****0fbG_35af****0484

Request parameters

Parameter

Type

Position

Required

Description

Example

parentId

string

query

No

The parent department ID.

99d1****6124

page

integer

query

No

The page number. Default value: 1.

1

perPage

integer

query

No

The number of entries per page.

Valid values: 1 to 100.

Default value: 100.

10

Sample request

curl -X 'GET' \
  'https://<domain>/oapi/v1/platform/departments?parentId={parentId}&page={page}&perPage={perPage}' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

Response parameters

Parameter

Type

Description

Example

-

array

-

object

creatorId

string

The ID of the user who created the department list.

99d1****6124

hasSub

boolean

Indicates whether the department has subdepartments.

true

id

string

The department ID.

99d1****6124

name

string

The department name.

Example Name

parentId

string

The ID of the parent department under which the subdepartments are created.

99d1****6124

type

string

The type of the department. For example, ROOT indicates it's a top-level department without a parent.

ROOT

Sample success responses

[
    {
        "creatorId": "99d1****6124",
        "hasSub": true,
        "id": "99d1****6124",
        "name": "Example Name",
        "parentId": "99d1****6124",
        "type": "ROOT"
    }
]

Response headers

Parameter

Description

Example

x-next-page

The next page.

2

x-page

The page number.

1

x-per-page

The number of entries returned per page.

20

x-prev-page

The previous page.

0

x-request-id

The request ID.

37294673-00CA-5B8B-914F-A8B35511E90A

x-total

The total number of entries.

10

x-total-pages

The total number of pages.

1

Error codes

For more information, see Error codes.