Skip to content

Retrieve a merge request diff version

GET
/api/v4/projects/{id}/merge_requests/{merge_request_iid}/versions/{version_id}

Retrieves a merge request diff version.

id
required
One of:
string

The ID or URL-encoded path of the project

merge_request_iid
required
integer

The internal ID of the merge request

version_id
required
integer

The ID of the merge request diff version

unidiff
boolean
nullable

A diff in a Unified diff format

OK

Media type application/json
object
id
integer format: int64
head_commit_sha
string
base_commit_sha
string
start_commit_sha
string
created_at
string format: date-time
merge_request_id
integer format: int64
state
string
real_size
string
patch_id_sha
string
commits
Array<object>
object
id
string
short_id
string
created_at
string format: date-time
parent_ids
Array<string>
title
string
message
string
author_name
string
author_email
string
authored_date
string format: date-time
committer_name
string
committer_email
string
committed_date
string format: date-time
trailers
object
extended_trailers
object
web_url
string
diffs
Array<object>
object
diff
string
collapsed
boolean
too_large
boolean
new_path
string
old_path
string
a_mode
string
b_mode
string
new_file
boolean
renamed_file
boolean
deleted_file
boolean
generated_file
boolean
Example
{
"id": 1,
"head_commit_sha": "1234abcd",
"base_commit_sha": "1234abcd",
"start_commit_sha": "1234abcd",
"created_at": "2022-01-31T15:10:45.080Z",
"merge_request_id": 1,
"state": "collected",
"real_size": "1",
"patch_id_sha": "1234abcd",
"commits": [
{
"id": "2695effb5807a22ff3d138d593fd856244e155e7",
"short_id": "2695effb",
"created_at": "2017-07-26T11:08:53.000+02:00",
"parent_ids": [
"2a4b78934375d7f53875269ffd4f45fd83a84ebe"
],
"title": "Initial commit",
"message": "Initial commit",
"author_name": "John Smith",
"author_email": "john@example.com",
"authored_date": "2012-05-28T04:42:42-07:00",
"committer_name": "Jack Smith",
"committer_email": "jack@example.com",
"committed_date": "2012-05-28T04:42:42-07:00",
"trailers": {
"Merged-By": "Jane Doe janedoe@gitlab.com"
},
"extended_trailers": {
"Signed-off-by": [
"John Doe <johndoe@gitlab.com>",
"Jane Doe <janedoe@gitlab.com>"
]
},
"web_url": "https://gitlab.example.com/janedoe/gitlab-foss/-/commit/ed899a2f4b50b4370feeea94676502b42383c746"
}
],
"diffs": [
{
"diff": "@@ -71,6 +71,8 @@\\n...",
"new_path": "doc/update/5.4-to-6.0.md",
"old_path": "doc/update/5.4-to-6.0.md",
"a_mode": "100755",
"b_mode": "100644"
}
]
}

Bad Request

Not Found