All Products
Search
Document Center

:Retrieve department usage data

Last Updated:Mar 27, 2026

Retrieves department-level usage data for Lingma via OpenAPI.

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

Lingma

Department usage statistics

read-only

Request syntax

GET https://{domain}/oapi/v1/lingma/organizations/{organizationId}/departmentUsage

Request details

Query department usage data

curl -X 'GET' \
  'https://test-domain-***.rdc.aliyuncs.com/oapi/v1/lingma/organizations/c7655445-143f-4466-9724-8b371a21****/departmentUsage?departmentId=7b58e90a-063f-475b-ad6d-32d1f438****&startTime=2025-06-10&endTime=2025-06-10&page=1&perPage=100' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

Request header

x-yunxiao-token string (Required)

Your personal access token. For details on how to get this token, see Personal access tokens.

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

Request parameters

organizationId string (Required)

The ID of your organization. Go to the Basic Information page in the Organization Management console to obtain the organization ID.

departmentId string (Required)

The department ID. To get this ID, see List departments in an organization.

startTime string (Required)

The start date of the query range, in YYYY-MM-DD format.

endTime string (Required)

The end date of the query range, in YYYY-MM-DD format.

page integer (Optional) Default: 1

The page number to return.

perPage integer (Optional) Default: 100

The maximum number of entries to return on each page. Valid values: [1, 100].

Response parameters

Response example

[
    {
        "activeDeveloper": 1,
        "activeDeveloperChat": 1,
        "activeDeveloperCompletion": 1,
        "breakdown": {
            "chatting": [
                {
                    "activeDeveloper": 1,
                    "chatTurns": 1,
                    "chatTurnsAccepted": 1,
                    "chatType": "GENERATE_TESTCASE",
                    "ide": "jetbrains"
                }
            ],
            "coding": [
                {
                    "acceptAssistantNewlineCount": 0,
                    "activeDeveloper": 1,
                    "language": "java",
                    "linesAccepted": 95,
                    "linesChanged": 95
                }
            ],
            "completion": [
                {
                    "activeDeveloper": 1,
                    "countAccepted": 3,
                    "countSuggested": 3,
                    "ide": "jetbrains",
                    "language": "java",
                    "linesAccepted": 5,
                    "linesSuggested": 5
                }
            ]
        },
        "date": 1749571200000,
        "departmentId": "68491a3e0dc52b6c963b****",
        "totalChatTurns": 1,
        "totalChatTurnsAccepted": 1,
        "totalCountAcceptedCompletion": 3,
        "totalCountSuggestedCompletion": 3,
        "totalLinesAccepted": 95,
        "totalLinesAcceptedChat": 0,
        "totalLinesAcceptedCompletion": 5,
        "totalLinesChanged": 95,
        "totalLinesSuggestedCompletion": 5
    }
]

activeDeveloper integer

The number of active developers.

activeDeveloperChat integer

The number of active developers who used the chat feature.

activeDeveloperCompletion integer

The number of active developers who used code completion.

breakdown Object

The detailed usage data.

Properties

chatting array

Detailed data for the chat feature.

Properties

activeDeveloper integer

The number of active users.

chatTurns integer

The number of chat turns.

chatTurnsAccepted integer

The number of accepted chat turns.

chatType string

The type of chat interaction:

  • CODE_GENERATE_COMMENT: Code comment generation.

  • GENERATE_TESTCASE: Unit test generation.

  • EXPLAIN_CODE: Code explanation.

  • OPTIMIZE_CODE: Code optimization.

  • FREE_INPUT: Chat. Lowercase strings represent custom commands.

ide string

The IDE type, such as jetbrains or vscode.

coding array

Detailed data on code changes, which aggregates acceptance details from both chat and code completion.

Properties

acceptAssistantNewlineCount integer

The number of accepted lines of code generated by chat features on the specified day, broken down by language.

activeDeveloper integer

The number of active users.

language string

The programming language.

linesAccepted integer

The number of accepted lines of code.

linesChanged integer

The number of changed lines of code.

completion array

Detailed data for code completion suggestions and acceptances.

Properties

activeDeveloper integer

The number of active users.

countAccepted integer

The number of accepted completions.

countSuggested integer

The number of code completion suggestions.

ide string

The IDE type, such as jetbrains or vscode.

language string

The programming language.

linesAccepted integer

The number of accepted lines of code.

linesSuggested integer

The number of suggested lines of code.

date integer

The date of the statistics, represented as a Unix timestamp in milliseconds.

departmentId string

The department ID.

totalChatTurns integer

The total number of chat turns for the department on the specified day.

totalChatTurnsAccepted integer

The total number of accepted chat turns for the department on the specified day.

totalCountAcceptedCompletion integer

The total number of accepted code completion suggestions for the department on the specified day.

totalCountSuggestedCompletion integer

The total number of code completion suggestions for the department on the specified day.

totalLinesAccepted integer

The total number of accepted lines of code for the department on the specified day. This includes code from all features, such as chat and code completion.

totalLinesAcceptedChat integer

The total number of accepted lines of code generated by chat features for the department on the specified day.

totalLinesAcceptedCompletion integer

The total number of accepted lines of code from code completion for the department on the specified day.

totalLinesChanged integer

The total number of changed lines of code for the department on the specified day. This includes changes from all features, such as chat and code completion.

totalLinesSuggestedCompletion integer

The total number of suggested lines of code from code completion for the department on the specified day.

Response headers

Parameter

Description

Example value

x-next-page

The next page

2

x-page

The current page

1

x-per-page

The number of entries per page

100

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.

References

If you have questions about this API, see OpenAPI-related issues.