All Products
Search
Document Center

AI Coding Assistant Lingma:Get department usage data

Last Updated:Jun 12, 2025

Call this API to retrieve the usage data of Lingma in a department.

Supported editions

Enterprise Dedicated Edition

Service endpoints and authorization information

  • 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

Lingma

Department usage statistics

Read-Only

Request syntax

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

Request header

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

organizationId

string

path

Yes

The organization ID.

departmentId

string

query

Yes

The department ID.

startTime

string

query

Yes

The start date in the YYYY-MM-DD format.

endTime

string

query

Yes

The end date in the YYYY-MM-DD format.

page

integer

query

No

The page number. Default value: 1.

perPage

integer

query

No

The number of entries per page. Default value: 100.

Request example

curl -X 'GET' \
  'https://{domain}/oapi/v1/lingma/organizations/{organizationId}/departmentUsage?departmentId={departmentId}&startTime={startTime}&endTime={endTime}&page={page}&perPage={perPage}' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

Response parameters

Parameter

Type

Description

-

array

-

object

activeDeveloper

integer

The total number of active users.

activeDeveloperChat

integer

The number of active users who triggered Lingma's chat feature at least once on the specified date.

activeDeveloperCompletion

integer

The number of active users who triggered Lingma's code completion feature at least once on the specified date.

breakdown

object

A breakdown of Lingma's usage data. Valid values:

  • chatting

  • coding

  • completion

chatting

array

The detailed data about the chat feature.

-

object

activeDeveloper

integer

The number of active users.

chatTurns

integer

The number of chats.

chatTurnsAccepted

integer

The number of accepted chats.

chatType

string

The type of the chat. Valid values:

  • CODE_GENERATE_COMMENT: comment generation

  • GENERATE_TESTCASE: unit test generation

  • EXPLAIN_CODE: code explanation

  • OPTIMIZE_CODE: code optimization

  • FREE_INPUT: chat

  • Other non-uppercase strings: custom commands

ide

string

The integrated development environment (IDE), like jetbrains and vscode.

coding

array

The code change statistics, including the number of accepted and changed code changes in code completion and chat.

-

object

acceptAssistantNewlineCount

integer

The number of code lines accepted by the department on that day, including by chat and by language.

activeDeveloper

integer

The number of active users.

language

string

The language.

linesAccepted

integer

The number of accepted lines of code.

linesChanged

integer

The number of changed lines of code.

completion

array

The detailed data about the code completion feature.

-

object

activeDeveloper

integer

The number of active users.

countAccepted

integer

The code completions accepted by the department.

countSuggested

integer

The code completions suggested by Lingma.

ide

string

The integrated development environment (IDE), like jetbrains and vscode.

language

string

The language.

linesAccepted

integer

The number of accepted lines of code.

linesChanged

integer

The number of changed lines of code.

date

integer

The date.

departmentId

string

The department ID.

totalChatTurns

integer

The number of chats by the department on that day.

totalChatTurnsAccepted

integer

The number of chats accepted by the department on that day.

totalCountAcceptedCompletion

integer

The code completions accepted by the department on that day.

totalCountSuggestedCompletion

integer

The code completions suggested for the department on that day.

totalLinesAccepted

integer

The total number of accepted code lines by the department on that day through Ask, Edit, Agent modes and code completion.

totalLinesAcceptedChat

integer

The total number of lines of code accepted by the department through chat on that day.

totalLinesAcceptedCompletion

integer

The total number of code lines accepted through code completion by the department on that day.

totalLinesChanged

integer

The total number of lines of code changed by the department on that day through Ask, Edit, Agent modes and code completion.

totalLinesSuggestedCompletion

integer

The total number of lines of code suggested through code completion for the department on that day.

Response example

[
    {
        "activeDeveloper": 0,
        "activeDeveloperChat": 0,
        "activeDeveloperCompletion": 0,
        "breakdown": {
            "chatting": [
                {
                    "activeDeveloper": 0,
                    "chatTurns": 0,
                    "chatTurnsAccepted": 0,
                    "chatType": "",
                    "ide": ""
                }
            ],
            "coding": [
                {
                    "acceptAssistantNewlineCount": 0,
                    "activeDeveloper": 0,
                    "language": "",
                    "linesAccepted": 0,
                    "linesChanged": 0
                }
            ],
            "completion": [
                {
                    "activeDeveloper": 0,
                    "countAccepted": 0,
                    "countSuggested": 0,
                    "ide": "",
                    "language": "",
                    "linesAccepted": 0,
                    "linesChanged": 0
                }
            ]
        },
        "date": 0,
        "departmentId": "",
        "totalChatTurns": 0,
        "totalChatTurnsAccepted": 0,
        "totalCountAcceptedCompletion": 0,
        "totalCountSuggestedCompletion": 0,
        "totalLinesAccepted": 0,
        "totalLinesAcceptedChat": 0, 
        "totalLinesAcceptedCompletion": 0,
        "totalLinesChanged": 0
        "totalLinesSuggestedCompletion": 0
    }
]

Response header

Parameter

Description

Example

x-next-page

The next page.

1

x-per-page

The number of entries per page.

100

x-prev-page

The previous page.

1

x-total

The total number of entries.

2

x-total-pages

The total number of pages.

1

Error code

For more information, see Error codes.

References

For more information, see OpenAPI-related issues.