Help Center/ CodeArts Repo/ API Reference/ APIs/ V4/ MergeRequest/ Obtaining the Project MR List
Updated on 2026-01-27 GMT+08:00

Obtaining the Project MR List

Function

This API is used to obtain the project MR list.

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:getMergeRequest

Read

-

-

-

-

URI

GET https://{hostURL}/v4/projects/{project_id}/merge-requests

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

You can obtain the unique project identifier, 32-character project UUID, by calling the API used to query the project list.

Range

String length: 32 characters.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Definition

Offset, which starts from 0.

Value range:

0~2147483647

Default value:

0

limit

No

Integer

Definition

Number of returned records.

Value range:

1~100

Default value:

20

state

No

String

Definition

Returns MRs of the specified statuses.

Constraints

  • all: all statuses.

  • opened: open status

  • closed: closed status

  • merged: merged status

Default value:

all

Enumeration values:

  • all

  • opened

  • closed

  • merged

order_by

No

String

Definition

Sorting method.

Range

  • created_at: creation time.

  • updated_at: update time.

Default value:

created_at

Enumeration values:

  • created_at

  • updated_at

sort

No

String

Definition

Sorting method.

Constraints

  • asc: ascending order.

  • desc: descending order.

Default value:

desc

Enumeration values:

  • asc

  • desc

author_id

No

String

Definition

Returns the MR created by the users with the specified ID.

Multiple IDs are separated by commas (,). The union of MRs that meet the conditions is returned.

source_branch

No

String

Definition

Returns the MR of the specified source branch.

target_branch

No

String

Definition

Returns the MR of the specified target branch.

search

No

String

Definition

MR keyword search.

Return MRs whose titles or descriptions contain the keyword.

source_repository_id

No

Integer

Definition

Query the specified source repository data.

only_count

No

Boolean

Definition

Whether to only return the number of MRs.

Range

  • true: only the number of MRs is returned.

  • false: MR detailed information is returned.

Default value:

false

labels

No

String

Definition

Query MRs that contain the specified labels.

Value range:

1~2000

topic

No

String

Definition

MR subject.

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 MRs in a project.

Table 5 Response body parameters

Parameter

Type

Description

[items]

Array of MergeRequestListBasicDto objects

MR basic information

Table 6 MergeRequestListBasicDto

Parameter

Type

Description

id

Integer

Definition

MR ID.

iid

Integer

Definition

No. of the MR located in the current repository.

title

String

Definition

MR title.

source_branch

String

Definition

MR source branch.

target_branch

String

Definition

MR target branch.

state

String

Definition

MR status.

created_at

String

Definition

Time when an MR was created.

updated_at

String

Definition

MR update time.

source_repository_id

Integer

Definition

MR source repository ID.

review_mode

String

Definition

MR review mode.

author

UserBasicDto object

Definition

MR author.

closed_at

String

Definition

Time when an MR was closed.

closed_by

UserBasicDto object

Definition

MR closer.

merged_at

String

Definition

Time when an MR was merged.

merged_by

UserBasicDto object

Definition

MR merger.

pipeline_status

String

Definition

MR pipeline status.

codequality_status

String

Definition

MR code quality status.

pipeline_status_with_code_quality

String

Definition

MR pipeline status.

notes

Integer

Definition

MR review comment.

source_repository

ProjectSimpleDto object

Definition

MR source repository information.

target_repository

ProjectSimpleDto object

Definition

MR target repository information.

web_url

String

Definition

MR URL.

added_lines

Integer

Definition

Lines of code added in an MR.

removed_lines

Integer

Definition

Lines of code deleted in an MR.

merge_request_type

String

Definition

MR review mode.

source_git_url

String

Definition

MR Git address.

labels

Array of Map<String,Object> objects

Definition

MR label.

score

Integer

Definition

MR score.

min_merged_score

Integer

Definition

Minimum merge score of an MR.

source_product_id

String

Definition

MR source project ID.

target_product_id

String

Definition

MR target project ID.

product_name

String

Definition

MR project name.

notes_count

NotesCountDto object

Definition

Number of MR review comments.

moderation_result

Boolean

Definition

MR approving result.

moderation_time

Long

Definition

MR approving time.

moderation_status

Integer

Definition

MR approving status.

Table 7 UserBasicDto

Parameter

Type

Description

id

Integer

Definition

User ID.

Value range:

1~2147483647

name

String

Definition

Username.

username

String

Definition

Username.

state

String

Definition:

User status

Value range:

  • active: available account

  • blocked: locked user

  • error: The user is not found

Enumeration values:

  • active

  • blocked

  • error

service_license_status

Integer

Service-level permission status. 0: disabled; 1: enabled

avatar_url

String

User profile picture URL

avatar_path

String

User profile picture path

email

String

User email

name_cn

String

Username (CN)

web_url

String

User homepage

nick_name

String

User alias

tenant_name

String

Tenant name

error_message

String

Definition

When some query APIs detect that the user permission in the transfer parameter is insufficient or the user does not exist, the user is returned but the field is not empty for information.

Table 8 ProjectSimpleDto

Parameter

Type

Description

id

Integer

Repository ID.

description

String

Repository description

name

String

Repository name

name_with_namespace

String

Organization name/Organization name.../Repository name

path

String

Repository path

path_with_namespace

String

Complete repository path

created_at

String

Creation time

updated_at

String

Update time.

archived

Boolean

Archived or not

is_kia

Boolean

Confidential or not

ssh_url_to_repo

String

Repository SSH address

http_url_to_repo

String

Repository HTTP address

web_url

String

Repository page link

readme_url

String

Link to the readme file of the repository

project_id

String

Project ID

project_name

String

Project name

develop_mode

String

Repository development modes: normal and CR

moderation_result

Boolean

Approving status

Table 9 NotesCountDto

Parameter

Type

Description

notes_count

Integer

Total number of review comments

unresolved_notes_count

Integer

Number of unresolved review comments

already_resolved_count

Integer

Number of resolved review comments

need_resolved_count

Integer

Total number of review comments to be resolved

Status code: 401

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

error_msg

String

Definition

Error message.

Status code: 404

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

error_msg

String

Definition

Error message.

Example Requests

None

Example Responses

Status code: 200

Success.

{
  "id" : 72674,
  "iid" : 7,
  "title" : "Creating a File",
  "source_branch" : "ddd1",
  "target_branch" : "master",
  "state" : "opened",
  "created_at" : "2025-05-21T12:03:32.000+08:00",
  "updated_at" : "2025-06-17T15:30:02.000+08:00",
  "source_repository_id" : 2111983939,
  "review_mode" : "approval",
  "author" : {
    "id" : 9124,
    "name" : "test",
    "username" : "c369c68f1ff84679b5a8ed904d8bff1c",
    "state" : "active",
    "service_license_status" : null,
    "name_cn" : "test",
    "nick_name" : "beta_dv",
    "tenant_name" : "example_name",
    "error_message" : null
  },
  "closed_at" : "2025-05-21T12:03:32.000+08:00",
  "closed_by" : null,
  "merged_at" : null,
  "merged_by" : null,
  "pipeline_status" : "",
  "codequality_status" : null,
  "pipeline_status_with_code_quality" : "",
  "notes" : 0,
  "web_url" : "https://example.com/********/2111983939/7/mergedetail?source=ddd1&target=master",
  "added_lines" : 0,
  "removed_lines" : 0,
  "merge_request_type" : "MergeRequest",
  "source_git_url" : "git@example.com:3e1f6634946144c2b1ccb46fb8152b8f/dddd.git",
  "labels" : [ {
    "color" : "#000",
    "name" : "Bug",
    "description" : "456",
    "id" : 8,
    "title" : "Bug",
    "type" : null,
    "textColor" : "#FFFFFF"
  }, {
    "color" : "#000",
    "name" : "bug",
    "description" : "456",
    "id" : 7,
    "title" : "bug",
    "type" : null,
    "textColor" : "#FFFFFF"
  } ],
  "score" : 0,
  "min_merged_score" : null,
  "source_project_id" : "3e1f6634946144c2b1ccb46fb8152b8f",
  "target_project_id" : null,
  "product_name" : null,
  "notes_count" : null,
  "moderation_result" : null,
  "moderation_time" : null,
  "moderation_status" : null,
  "source_repository" : {
    "id" : 2111983939,
    "description" : "ddd",
    "name" : "dddd",
    "name_with_namespace" : "3e1f6634946144c2b1ccb46fb8152b8f/dddd",
    "path" : "dddd",
    "path_with_namespace" : "3e1f6634946144c2b1ccb46fb8152b8f/dddd",
    "created_at" : "2024-11-30T17:46:46.000+08:00",
    "updated_at" : "2024-11-30T17:46:46.000+08:00",
    "archived" : false,
    "ssh_url_to_repo" : "git@example.com:3e1f6634946144c2b1ccb46fb8152b8f/dddd.git",
    "http_url_to_repo" : "https://example.com/3e1f6634946144c2b1ccb46fb8152b8f/dddd.git",
    "project_id" : null,
    "project_name" : null,
    "develop_mode" : null,
    "moderation_result" : null
  },
  "target_repository" : {
    "id" : 2111983939,
    "description" : "ddd",
    "name" : "dddd",
    "name_with_namespace" : "3e1f6634946144c2b1ccb46fb8152b8f/dddd",
    "path" : "dddd",
    "path_with_namespace" : "3e1f6634946144c2b1ccb46fb8152b8f/dddd",
    "created_at" : "2024-11-30T17:46:46.000+08:00",
    "updated_at" : "2024-11-30T17:46:46.000+08:00",
    "archived" : false,
    "ssh_url_to_repo" : "git@example.com:3e1f6634946144c2b1ccb46fb8152b8f/dddd.git",
    "http_url_to_repo" : "https://example.com/3e1f6634946144c2b1ccb46fb8152b8f/dddd.git",
    "project_id" : null,
    "project_name" : null,
    "develop_mode" : null,
    "moderation_result" : null
  }
}

Status code: 401

Unauthenticated.

{
  "error_code" : "CH.00000002",
  "error_msg" : "Failed to verify authentication information."
}

Status code: 404

Not exist.

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

Status Codes

Status Code

Description

200

Success.

401

Unauthenticated.

404

Not exist.

Error Codes

See Error Codes.