merge_requests

Retrieve a merge request

Retrieves a merge request for a specified project.

get/api/v4/projects/{id}/merge_requests/{merge_request_iid}

Request

  • Base URL
    https://gitlab.com
  • Auth
    none declared

Path parameters

idstring required

The ID or URL-encoded path of the project.

merge_request_iidinteger required

The internal ID of the merge request.

Query parameters

render_htmlboolean

If true, response includes rendered HTML for title and description.

include_diverged_commits_countboolean

If true, response includes the commits behind the target branch.

include_rebase_in_progressboolean

If true, response includes whether a rebase operation is in progress.

Response

Retrieve a merge request

idinteger required
iidinteger required
project_idinteger required
titlestring required
descriptionstring required
statestring required
created_atstring date-time required
updated_atstring date-time required
merged_atstring date-time required
closed_atstring date-time required
title_htmlstring
description_htmlstring
target_branchstring required
source_branchstring required
user_notes_countinteger required
upvotesinteger required
downvotesinteger required
source_project_idinteger required
target_project_idinteger required
labelsstring[] required
draftboolean required
importedboolean required
imported_fromstring required
work_in_progressboolean required
merge_when_pipeline_succeedsboolean required
merge_statusstring required
detailed_merge_statusstring required
merge_afterstring date-time required
shastring required
merge_commit_shastring required
squash_commit_shastring required
discussion_lockedboolean required
should_remove_source_branchboolean required
force_remove_source_branchboolean required
prepared_atstring date-time required
allow_collaborationboolean
allow_maintainer_to_pushboolean
referencestring required
web_urlstring required
squashboolean required
squash_on_mergeboolean required
has_conflictsboolean required
blocking_discussions_resolvedboolean required
approvals_before_mergeinteger required
subscribedboolean
changes_countstring required
latest_build_started_atstring date-time
latest_build_finished_atstring date-time
first_deployed_to_production_atstring date-time
merge_errorstring required
rebase_in_progressboolean
diverged_commits_countinteger
first_contributionboolean

Example response

{
  "id": 84,
  "iid": 14,
  "project_id": 4,
  "title": "Impedit et ut et dolores vero provident ullam est",
  "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",
  "merged_by": {
    "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"
  },
  "merge_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"
  },
  "merged_at": "2022-01-31T15:10:45.080Z",
  "closed_by": {
    "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"
  },
  "closed_at": "2022-01-31T15:10:45.080Z",
  "author": {
    "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"
  },
  "assignees": {
    "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"
  },
  "assignee": {
    "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"
  },
  "reviewers": {
    "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"
  },
  "imported_from": "bitbucket",
  "merge_status": "unchecked",
  "detailed_merge_status": "mergeable",
  "merge_after": "2022-01-31T15:10:45.080Z",
  "sha": "1234abcd",
  "merge_commit_sha": "1234abcd",
  "squash_commit_sha": "1234abcd",
  "prepared_at": "2022-01-31T15:10:45.080Z",
  "reference": "!1",
  "references": {
    "short": "&6",
    "relative": "&6",
    "full": "test&6"
  },
  "web_url": "https://gitlab.example.com/my-group/my-project/-/merge_requests/1",
  "time_stats": {
    "time_estimate": 12600,
    "total_time_spent": 3600,
    "human_time_estimate": "3h 30m",
    "human_total_time_spent": "1h"
  },
  "task_completion_status": {
    "count": 5,
    "completed_count": 3
  },
  "approvals_before_merge": 2,
  "changes_count": "1",
  "latest_build_started_at": "2022-01-31T15:10:45.080Z",
  "latest_build_finished_at": "2022-01-31T15:10:45.080Z",
  "first_deployed_to_production_at": "2022-01-31T15:10:45.080Z",
  "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"
  },
  "head_pipeline": {
    "id": 1,
    "iid": 2,
    "project_id": 3,
    "sha": "0ec9e58fdfca6cdd6652c083c9edb53abc0bad52",
    "ref": "feature-branch",
    "status": "success",
    "source": "push",
    "created_at": "2015-12-24T15:51:21.880Z",
    "updated_at": "2015-12-24T17:54:31.198Z",
    "web_url": "https://gitlab.example.com/gitlab-org/gitlab-foss/-/pipelines/61",
    "before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
    "yaml_errors": "widgets:build: needs 'widgets:test'",
    "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"
    },
    "started_at": "2015-12-24T17:54:30.733Z",
    "finished_at": "2015-12-24T17:54:31.198Z",
    "committed_at": "2015-12-24T15:51:21.880Z",
    "duration": 127,
    "queued_duration": 63,
    "coverage": 98.29,
    "detailed_status": {
      "icon": "status_success",
      "text": "passed",
      "label": "passed",
      "group": "success",
      "tooltip": "passed",
      "has_details": true,
      "details_path": "/test-group/test-project/-/pipelines/287",
      "illustration": {
        "image": "illustrations/empty-state/empty-job-not-triggered-md.svg",
        "size": "",
        "title": "This job has not been triggered yet",
        "content": "This job depends on upstream jobs that need to succeed in order for this job to be triggered"
      },
      "favicon": "/assets/ci_favicons/favicon_status_success.png",
      "action": {
        "icon": "cancel",
        "title": "Cancel",
        "path": "/namespace1/project1/-/jobs/2/cancel",
        "method": "post",
        "button_title": "Cancel this job",
        "confirmation_message": "Are you sure?"
      }
    }
  },
  "diff_refs": {
    "base_sha": "b83d6e391c22777fca1ed3012fce84f633d7fed0",
    "head_sha": "b83d6e391c22777fca1ed3012fce84f633d7fed0",
    "start_sha": "b83d6e391c22777fca1ed3012fce84f633d7fed0"
  },
  "merge_error": "Merge error"
}

Changes

No recorded changes to this operation across all 5 revisions of this API.