Help Center/ CodeArts Repo/ API Reference/ APIs/ V4/ Repository/ Obtaining the Commit Statistics of a Specified Branch of a Repository
Updated on 2026-01-27 GMT+08:00

Obtaining the Commit Statistics of a Specified Branch of a Repository

Function

This API is used to obtain the commit statistics of a specified branch of the repository.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

Authorization Information

Each account root user has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.

Action

Access Level

Resource Type (*: required)

Condition Key

Alias

Dependencies

codeartsrepo:repository:getRepository

Read

-

-

-

-

URI

GET https://{hostURL}/v4/repositories/{repository_id}/repository/commit-statistics

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

repository_id

Yes

Integer

Definition

You can query the project list to obtain the repository ID by calling the API used to query user's all repositories.

Constraints

N/A

Default Value

N/A

Value range:

1~2147483647

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

branch_name

Yes

String

Definition

Branch name.

Constraints

N/A

Range

1–2,000 characters.

Default Value

N/A

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token. Obtain one by calling the IAM API Obtaining a User Token. The value of X-Subject-Token in the response header is a token.

Constraints

N/A

Range

1–100,000 characters.

Default Value

N/A

Response Parameters

Status code: 200

Table 4 Response header parameters

Parameter

Type

Description

X-Total

String

Definition

Total number of results of the current request.

Table 5 Response body parameters

Parameter

Type

Description

commits

Array of CommitStatisticsResultCommitDto objects

Definition

Commit statistics.

statistics

Array of StatisticDto objects

Definition

Committer statistics.

total

Integer

Definition

Total number.

Value range:

0~2147483647

Table 6 CommitStatisticsResultCommitDto

Parameter

Type

Description

author_name

String

Definition

Author name.

date

String

Definition

Commit date.

nick_name

String

Definition

Alias.

tenant_name

String

Definition

Tenant name.

user_name

String

Definition

Username.

is_merge

Boolean

Definition

Merged through merge or not.

Range

  • true: through merge.

  • false: not through merge.

Default value:

false

Table 7 StatisticDto

Parameter

Type

Description

id

Integer

Definition

Statistics ID.

Value range:

1~2147483647

project_id

Integer

Definition

Repository ID.

Value range:

1~2147483647

branch

String

Definition

Branch name.

Range

1 to 200 bytes

user_name

String

Username

add_lines

Integer

Definition

Number of added lines.

Value range:

0~2147483647

delete_lines

Integer

Definition

Number of deleted lines.

Value range:

0~2147483647

commit_count

Integer

Definition

Total number of commits.

Value range:

0~2147483647

created_at

String

Definition

Earliest commit time.

updated_at

String

Definition

Latest update time.

Status code: 401

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

error_msg

String

Definition

Error message.

Status code: 403

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

error_msg

String

Definition

Error message.

Status code: 404

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

error_msg

String

Definition

Error message.

Example Requests

GET https://{endpoint}/v4/repositories/2112016472/repository/commit-statistics?branch_name=master

Example Responses

Status code: 200

Obtain the commit statistics of a specified branch of the repository.

{
  "commits" : [ {
    "author_name" : "author_name_f4f97c9250c2",
    "date" : "2025-06-04",
    "nick_name" : "nick_name_317740f50a66",
    "tenant_name" : "tenant_name_11e88aeca457",
    "user_name" : "user_name_7606b467e7c4",
    "is_merge" : false
  } ],
  "statistics" : [ {
    "id" : 0,
    "project_id" : 0,
    "branch" : "branch_571d7c4b3fe1",
    "user_name" : "user_name_37e99c1492e0",
    "add_lines" : 0,
    "delete_lines" : 0,
    "commit_count" : 0,
    "created_at" : "2025-05-28T17:45:03.000+08:00",
    "updated_at" : "2025-06-04T16:37:18.000+08:00"
  } ],
  "total" : 1
}

Status code: 401

Unauthorized

{
  "error_code" : "CH.00000001",
  "error_msg" : "User authentication info not found."
}

Status code: 403

Bad Request

{
  "error_code" : "CH.00401008",
  "error_msg" : "Insufficient permissions. Apply for the required permissions and try again."
}

Status code: 404

Not Found

{
  "error_code" : "CH.00402000",
  "error_msg" : "The repository does not exist. Check and try again."
}

Status Codes

Status Code

Description

200

Obtain the commit statistics of a specified branch of the repository.

401

Unauthorized

403

Bad Request

404

Not Found

Error Codes

See Error Codes.