Skip to content

List all merge requests in a merge train

GET
/api/v4/projects/{id}/merge_trains/{target_branch}

Lists all merge requests in a merge train for a target branch.

id
required
One of:
string

The ID or URL-encoded path of the project

Example
11
target_branch
required
string

The target branch of the merge request

Example
main
scope
string
nullable
Allowed values: active complete

The scope of merge trains

Example
active
sort
string
default: desc nullable
Allowed values: asc desc

Sort by asc (ascending) or desc (descending)

page
integer
default: 1 nullable

Current page number

Example
1
per_page
integer
default: 20 nullable

Number of items per page

Example
20

OK

Media type application/json
object
id
integer format: int64
merge_request
object
id
integer format: int64
iid
integer
project_id
integer format: int64
title
string
description
string
state
string
created_at
string format: date-time
updated_at
string format: date-time
web_url
string
user
object
id
integer format: int64
username
string
public_email
string
name
string
state
string
locked
boolean
avatar_url
string
avatar_path
string
custom_attributes
Array<object>
object
key
string
value
string
web_url
string
pipeline
object
id
integer format: int64
iid
integer
project_id
integer format: int64
sha
string
ref
string
status
string
source
string
created_at
string format: date-time
updated_at
string format: date-time
web_url
string
created_at
string format: date-time
updated_at
string format: date-time
target_branch
string
status
string
merged_at
string format: date-time
duration

Time spent in seconds

integer
Example
{
"id": 38,
"merge_request": {
"id": 84,
"iid": 14,
"project_id": 4,
"title": "Test MR 1580978354",
"description": "Repellendus impedit et vel velit dignissimos.",
"state": "closed",
"created_at": "2022-08-17T12:46:35.053Z",
"updated_at": "2022-11-14T17:22:01.470Z",
"web_url": "http://local.gitlab.test:8181/root/merge-train-race-condition/-/merge_requests/59"
},
"user": {
"id": 1,
"username": "admin",
"public_email": "john@example.com",
"name": "Administrator",
"state": "active",
"avatar_url": "https://gravatar.com/avatar/1",
"avatar_path": "/user/avatar/28/The-Big-Lebowski-400-400.png",
"custom_attributes": [
{
"key": "foo",
"value": "bar"
}
],
"web_url": "https://gitlab.example.com/root"
},
"pipeline": {
"id": 1,
"iid": 2,
"project_id": 3,
"sha": "0ec9e58fdfca6cdd6652c083c9edb53abc0bad52",
"ref": "feature-branch",
"status": "success",
"source": "push",
"created_at": "2022-10-21T16:49:48.000+02:00",
"updated_at": "2022-10-21T16:49:48.000+02:00",
"web_url": "https://gitlab.example.com/gitlab-org/gitlab-foss/-/pipelines/61"
},
"created_at": "2015-12-24T15:51:21.880Z",
"updated_at": "2015-12-24T17:54:31.198Z",
"target_branch": "develop",
"status": "merging",
"merged_at": "2015-12-24T17:54:31.198Z",
"duration": 127
}

Bad Request

Unauthorized

Forbidden

Not found