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

Obtaining the Latest Commit Statistics for a Repository

Function

This API is used to obtain the latest member commit statistics for a repository. The 100 most recent committers are shown, from latest to earliest.

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/stats/last-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 body parameters

Parameter

Type

Description

event

StatisticEventsDto object

Latest statistics record.

total

Integer

Definition

Number of statistics records.

Range

Min: 0

Default Value

0

Value range:

0~2147483647

statistics

Array of StatisticDto objects

Statistics information.

codelines

Array of CodelineDto objects

Number of daily added and deleted lines of code in the last 15 days.

count

Integer

Definition

Total number of branch commits.

Range

Min: 0

Default Value

0

Value range:

0~2147483647

all_branch_commits_count

Integer

Definition

Total number of commits in a repository.

Range

Min: 0

Default Value

0

Value range:

0~2147483647

Table 5 StatisticEventsDto

Parameter

Type

Description

id

Integer

Definition

Statistics ID.

Default Value

N/A

Value range:

1~2147483647

user_id

Integer

Definition

User ID.

Default Value

N/A

Value range:

1~2147483647

project_id

Integer

Definition

Repository ID.

Default Value

N/A

Value range:

1~2147483647

branch

String

Definition

Branch name.

Range

1 to 200 bytes.

Default Value

N/A

status

String

Definition

Statistics status.

Default Value

0

stat_date

String

Definition

Statistics time.

created_at

String

Definition

Statistics creation time.

updated_at

String

Definition

Statistics update time.

Table 6 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.

Table 7 CodelineDto

Parameter

Type

Description

additions

Integer

Definition

Number of added lines.

Range

Min: 0

Default Value

0

Value range:

0~2147483647

deletions

Integer

Definition

Number of deleted lines.

Range

Min: 0

Default Value

0

Value range:

0~2147483647

date

String

Definition

Date, in the format of yyyyMMdd. For example, 20251030.

Range

N/A

Default Value

N/A

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.

Example Requests

GET https://{endpoint}/v4/repositories/2112029050/repository/stats/last-statistics?branch_name=main

Example Responses

Status code: 200

OK

{
  "event" : {
    "id" : 0,
    "user_id" : 0,
    "project_id" : 0,
    "branch" : "master",
    "status" : "finished",
    "stat_date" : "20250926",
    "created_at" : "2025-09-26T11:22:01+08:00",
    "updated_at" : "2025-09-26T11:22:01+08:00"
  },
  "total" : 2,
  "statistics" : [ {
    "id" : 1,
    "project_id" : 0,
    "branch" : "master",
    "user_name" : "xx",
    "add_lines" : 1035,
    "delete_lines" : 77,
    "commit_count" : 120,
    "created_at" : "2025-09-26T11:22:02.000+08:00",
    "updated_at" : "2025-10-22T09:58:36.000+08:00"
  }, {
    "id" : 2,
    "project_id" : 0,
    "branch" : "master",
    "user_name" : "aa",
    "add_lines" : 4,
    "delete_lines" : 23,
    "commit_count" : 8,
    "created_at" : "2025-09-26T11:22:02.000+08:00",
    "updated_at" : "2025-10-15T14:38:33.000+08:00"
  } ],
  "codelines" : [ {
    "additions" : 742,
    "deletions" : 0,
    "date" : "20251022"
  }, {
    "additions" : 4,
    "deletions" : 20,
    "date" : "20251015"
  } ],
  "count" : 139,
  "all_branch_commits_count" : 158
}

Status code: 401

Unauthorized

{
  "error_code" : "DEV.00000003",
  "error_msg" : "Authentication information expired."
}

Status code: 403

Bad Request

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

Status Codes

Status Code

Description

200

OK

401

Unauthorized

403

Bad Request

Error Codes

See Error Codes.