Use this API to manage merge requests in a project, and to list the merge requests across a group or an entire instance. You can:
- Automate any part of the code review process.
- Connect code changes to external tools.
- Send merge request information to non-GitLab systems in your preferred format.
- Update, approve, merge, or block merge requests based on data from external systems.
- Add commits from previous merge requests to a merge request for more context.
All API calls to non-public information require authentication.
List all group merge requests
GET /api/v4/groups/{id}/merge_requests
Lists all merge requests for a specified group and any subgroups.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | The ID or URL- |
author_Query | Integer | Returns merge requests created by the given user id.scope=all or scope=assigned_.author_ |
author_Query | String | Returns merge requests created by the given username.author_ |
assignee_Query | Integer or string | Returns merge requests assigned to the given user id.None returns unassigned merge requests.Any returns merge requests with an assignee.assignee_ |
assignee_Query | Array of strings | Returns merge requests created by the given username.assignee_ |
reviewer_Query | String | Returns merge requests which have the user as a reviewer with the given username.None returns merge requests with no reviewers.Any returns merge requests with any reviewer.reviewer_ |
labelsQuery | Array of strings | Returns merge requests matching a comma-None lists all merge requests with no labels.Any lists all merge requests with at least one label. |
milestoneQuery | String | Returns merge requests for a specific milestone.None returns merge requests with no milestone.Any returns merge requests that have an assigned milestone |
my_Query | String | Returns merge requests reacted by the authenticated user by the given emoji.None returns issues not given a reaction.Any returns issues given at least one reaction |
reviewer_Query | Integer or string | Returns merge requests which have the user as a reviewer with the given user id.None returns merge requests with no reviewers.Any returns merge requests with any reviewer.reviewer_ |
stateQuery | String | Returns all merge requests or just those that are opened,closed,locked,mergedAllowed values: opened,closed,locked,merged,allDefault: all |
order_Query | String | Returns merge requests ordered by created_,label_,milestone_,popularity,priority,title,updated_ or merged_ fields.Allowed values: created_,label_,milestone_,popularity,priority,title,updated_,merged_Default: created_ |
sortQuery | String | Returns merge requests sorted in asc or desc orderAllowed values: asc,descDefault: desc |
with_Query | Boolean | If true,:,:,:,:,:Default: false |
with_Query | Boolean | If true,merge_ field be recalculated asynchronously.Default: false |
created_Query | String (date- | Returns merge requests created on or after the given time. Example: 2019- |
created_Query | String (date- | Returns merge requests created on or before the given time. Example: 2019- |
updated_Query | String (date- | Returns merge requests updated on or after the given time. Example: 2019- |
updated_Query | String (date- | Returns merge requests updated on or before the given time. Example: 2019- |
merged_Query | String (date- | Returns merge requests merged on or after the given time. Example: 2019- |
merged_Query | String (date- | Returns merge requests merged on or before the given time. Example: 2019- |
viewQuery | String | If simple,iid,Allowed values: simple |
scopeQuery | String | Returns merge requests for the given scope:created_,assigned_,reviews_ or allAllowed values: created-,assigned-,created_,assigned_,reviews_,all |
source_Query | String | Returns merge requests with the given source branch |
source_Query | Integer | Returns merge requests with the given source project id |
target_Query | String | Returns merge requests with the given target branch |
searchQuery | String | Search merge requests against their title and description |
inQuery | String | Modify the scope of the search attribute.title,description,Example: title, |
wipQuery | String | Deprecated.draft instead.wip status.yes to return only draft merge requests,no to return non-draftAllowed values: yes,no |
draftQuery | Boolean | Filter merge requests against their draft status.true to return only draft merge requests,false to return non-wip |
notQuery | Object | Returns merge requests that do not match the parameters supplied |
not[author_Query | Integer | <Negated> Returns merge requests created by the given user id.scope=all or scope=assigned_.not[author_ |
not[author_Query | String | <Negated> Returns merge requests created by the given username.not[author_ |
not[assignee_Query | Integer or string | <Negated> Returns merge requests assigned to the given user id.None returns unassigned merge requests.Any returns merge requests with an assignee.not[assignee_ |
not[assignee_Query | Array of strings | <Negated> Returns merge requests created by the given username.not[assignee_ |
not[reviewer_Query | String | <Negated> Returns merge requests which have the user as a reviewer with the given username.None returns merge requests with no reviewers.Any returns merge requests with any reviewer.not[reviewer_ |
not[labels]Query | Array of strings | <Negated> Returns merge requests matching a comma-None lists all merge requests with no labels.Any lists all merge requests with at least one label. |
not[milestone]Query | String | <Negated> Returns merge requests for a specific milestone.None returns merge requests with no milestone.Any returns merge requests that have an assigned milestone |
not[my_Query | String | <Negated> Returns merge requests reacted by the authenticated user by the given emoji.None returns issues not given a reaction.Any returns issues given at least one reaction |
not[reviewer_Query | Integer | <Negated> Returns merge requests which have the user as a reviewer with the given user id.None returns merge requests with no reviewers.Any returns merge requests with any reviewer.not[reviewer_ |
deployed_Query | String (date- | Returns merge requests deployed before the given date/ Example: 2019- |
deployed_Query | String (date- | Returns merge requests deployed after the given date/ Example: 2019- |
environmentQuery | String | Returns merge requests deployed to the given environment Example: production |
merge_Query | Integer | Returns merge requests which have been merged by the user with the given user id.merge_ |
merge_Query | String | Returns merge requests which have been merged by the user with the given username.merge_ |
pageQuery | Integer | Current page number Default: 1Example: 1 |
per_Query | Integer | Number of items per page Default: 20Example: 20 |
non_Query | Boolean | Returns merge requests from non archived projects only Default: true |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
422 | Unprocessable entity | — |
List all merge requests
GET /api/v4/merge_requests
Lists all merge requests accessible to the authenticated user. By default, returns only merge requests created by the current user. Use scope=all to get all merge requests.
Parameters
| Name | Type | Description |
|---|---|---|
author_Query | Integer | Returns merge requests created by the given user id.scope=all or scope=assigned_.author_ |
author_Query | String | Returns merge requests created by the given username.author_ |
assignee_Query | Integer or string | Returns merge requests assigned to the given user id.None returns unassigned merge requests.Any returns merge requests with an assignee.assignee_ |
assignee_Query | Array of strings | Returns merge requests created by the given username.assignee_ |
reviewer_Query | String | Returns merge requests which have the user as a reviewer with the given username.None returns merge requests with no reviewers.Any returns merge requests with any reviewer.reviewer_ |
labelsQuery | Array of strings | Returns merge requests matching a comma-None lists all merge requests with no labels.Any lists all merge requests with at least one label. |
milestoneQuery | String | Returns merge requests for a specific milestone.None returns merge requests with no milestone.Any returns merge requests that have an assigned milestone |
my_Query | String | Returns merge requests reacted by the authenticated user by the given emoji.None returns issues not given a reaction.Any returns issues given at least one reaction |
reviewer_Query | Integer or string | Returns merge requests which have the user as a reviewer with the given user id.None returns merge requests with no reviewers.Any returns merge requests with any reviewer.reviewer_ |
stateQuery | String | Returns all merge requests or just those that are opened,closed,locked,mergedAllowed values: opened,closed,locked,merged,allDefault: all |
order_Query | String | Returns merge requests ordered by created_,label_,milestone_,popularity,priority,title,updated_ or merged_ fields.Allowed values: created_,label_,milestone_,popularity,priority,title,updated_,merged_Default: created_ |
sortQuery | String | Returns merge requests sorted in asc or desc orderAllowed values: asc,descDefault: desc |
with_Query | Boolean | If true,:,:,:,:,:Default: false |
with_Query | Boolean | If true,merge_ field be recalculated asynchronously.Default: false |
created_Query | String (date- | Returns merge requests created on or after the given time. Example: 2019- |
created_Query | String (date- | Returns merge requests created on or before the given time. Example: 2019- |
updated_Query | String (date- | Returns merge requests updated on or after the given time. Example: 2019- |
updated_Query | String (date- | Returns merge requests updated on or before the given time. Example: 2019- |
merged_Query | String (date- | Returns merge requests merged on or after the given time. Example: 2019- |
merged_Query | String (date- | Returns merge requests merged on or before the given time. Example: 2019- |
viewQuery | String | If simple,iid,Allowed values: simple |
scopeQuery | String | Returns merge requests for the given scope:created_,assigned_,reviews_ or allAllowed values: created-,assigned-,created_,assigned_,reviews_,allDefault: created_ |
source_Query | String | Returns merge requests with the given source branch |
source_Query | Integer | Returns merge requests with the given source project id |
target_Query | String | Returns merge requests with the given target branch |
searchQuery | String | Search merge requests against their title and description |
inQuery | String | Modify the scope of the search attribute.title,description,Example: title, |
wipQuery | String | Deprecated.draft instead.wip status.yes to return only draft merge requests,no to return non-draftAllowed values: yes,no |
draftQuery | Boolean | Filter merge requests against their draft status.true to return only draft merge requests,false to return non-wip |
notQuery | Object | Returns merge requests that do not match the parameters supplied |
not[author_Query | Integer | <Negated> Returns merge requests created by the given user id.scope=all or scope=assigned_.not[author_ |
not[author_Query | String | <Negated> Returns merge requests created by the given username.not[author_ |
not[assignee_Query | Integer or string | <Negated> Returns merge requests assigned to the given user id.None returns unassigned merge requests.Any returns merge requests with an assignee.not[assignee_ |
not[assignee_Query | Array of strings | <Negated> Returns merge requests created by the given username.not[assignee_ |
not[reviewer_Query | String | <Negated> Returns merge requests which have the user as a reviewer with the given username.None returns merge requests with no reviewers.Any returns merge requests with any reviewer.not[reviewer_ |
not[labels]Query | Array of strings | <Negated> Returns merge requests matching a comma-None lists all merge requests with no labels.Any lists all merge requests with at least one label. |
not[milestone]Query | String | <Negated> Returns merge requests for a specific milestone.None returns merge requests with no milestone.Any returns merge requests that have an assigned milestone |
not[my_Query | String | <Negated> Returns merge requests reacted by the authenticated user by the given emoji.None returns issues not given a reaction.Any returns issues given at least one reaction |
not[reviewer_Query | Integer | <Negated> Returns merge requests which have the user as a reviewer with the given user id.None returns merge requests with no reviewers.Any returns merge requests with any reviewer.not[reviewer_ |
deployed_Query | String (date- | Returns merge requests deployed before the given date/ Example: 2019- |
deployed_Query | String (date- | Returns merge requests deployed after the given date/ Example: 2019- |
environmentQuery | String | Returns merge requests deployed to the given environment Example: production |
merge_Query | Integer | Returns merge requests which have been merged by the user with the given user id.merge_ |
merge_Query | String | Returns merge requests which have been merged by the user with the given username.merge_ |
pageQuery | Integer | Current page number Default: 1Example: 1 |
per_Query | Integer | Number of items per page Default: 20Example: 20 |
non_Query | Boolean | Returns merge requests from non archived projects only Default: false |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
422 | Unprocessable entity | — |
List all project merge requests
GET /api/v4/projects/{id}/merge_requests
Lists all project merge requests.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
author_Query | Integer | Returns merge requests created by the given user id.scope=all or scope=assigned_.author_ |
author_Query | String | Returns merge requests created by the given username.author_ |
assignee_Query | Integer or string | Returns merge requests assigned to the given user id.None returns unassigned merge requests.Any returns merge requests with an assignee.assignee_ |
assignee_Query | Array of strings | Returns merge requests created by the given username.assignee_ |
reviewer_Query | String | Returns merge requests which have the user as a reviewer with the given username.None returns merge requests with no reviewers.Any returns merge requests with any reviewer.reviewer_ |
labelsQuery | Array of strings | Returns merge requests matching a comma-None lists all merge requests with no labels.Any lists all merge requests with at least one label. |
milestoneQuery | String | Returns merge requests for a specific milestone.None returns merge requests with no milestone.Any returns merge requests that have an assigned milestone |
my_Query | String | Returns merge requests reacted by the authenticated user by the given emoji.None returns issues not given a reaction.Any returns issues given at least one reaction |
reviewer_Query | Integer or string | Returns merge requests which have the user as a reviewer with the given user id.None returns merge requests with no reviewers.Any returns merge requests with any reviewer.reviewer_ |
stateQuery | String | Returns all merge requests or just those that are opened,closed,locked,mergedAllowed values: opened,closed,locked,merged,allDefault: all |
order_Query | String | Returns merge requests ordered by created_,label_,milestone_,popularity,priority,title,updated_ or merged_ fields.Allowed values: created_,label_,milestone_,popularity,priority,title,updated_,merged_Default: created_ |
sortQuery | String | Returns merge requests sorted in asc or desc orderAllowed values: asc,descDefault: desc |
with_Query | Boolean | If true,:,:,:,:,:Default: false |
with_Query | Boolean | If true,merge_ field be recalculated asynchronously.Default: false |
created_Query | String (date- | Returns merge requests created on or after the given time. Example: 2019- |
created_Query | String (date- | Returns merge requests created on or before the given time. Example: 2019- |
updated_Query | String (date- | Returns merge requests updated on or after the given time. Example: 2019- |
updated_Query | String (date- | Returns merge requests updated on or before the given time. Example: 2019- |
merged_Query | String (date- | Returns merge requests merged on or after the given time. Example: 2019- |
merged_Query | String (date- | Returns merge requests merged on or before the given time. Example: 2019- |
viewQuery | String | If simple,iid,Allowed values: simple |
scopeQuery | String | Returns merge requests for the given scope:created_,assigned_,reviews_ or allAllowed values: created-,assigned-,created_,assigned_,reviews_,all |
source_Query | String | Returns merge requests with the given source branch |
source_Query | Integer | Returns merge requests with the given source project id |
target_Query | String | Returns merge requests with the given target branch |
searchQuery | String | Search merge requests against their title and description |
inQuery | String | Modify the scope of the search attribute.title,description,Example: title, |
wipQuery | String | Deprecated.draft instead.wip status.yes to return only draft merge requests,no to return non-draftAllowed values: yes,no |
draftQuery | Boolean | Filter merge requests against their draft status.true to return only draft merge requests,false to return non-wip |
notQuery | Object | Returns merge requests that do not match the parameters supplied |
not[author_Query | Integer | <Negated> Returns merge requests created by the given user id.scope=all or scope=assigned_.not[author_ |
not[author_Query | String | <Negated> Returns merge requests created by the given username.not[author_ |
not[assignee_Query | Integer or string | <Negated> Returns merge requests assigned to the given user id.None returns unassigned merge requests.Any returns merge requests with an assignee.not[assignee_ |
not[assignee_Query | Array of strings | <Negated> Returns merge requests created by the given username.not[assignee_ |
not[reviewer_Query | String | <Negated> Returns merge requests which have the user as a reviewer with the given username.None returns merge requests with no reviewers.Any returns merge requests with any reviewer.not[reviewer_ |
not[labels]Query | Array of strings | <Negated> Returns merge requests matching a comma-None lists all merge requests with no labels.Any lists all merge requests with at least one label. |
not[milestone]Query | String | <Negated> Returns merge requests for a specific milestone.None returns merge requests with no milestone.Any returns merge requests that have an assigned milestone |
not[my_Query | String | <Negated> Returns merge requests reacted by the authenticated user by the given emoji.None returns issues not given a reaction.Any returns issues given at least one reaction |
not[reviewer_Query | Integer | <Negated> Returns merge requests which have the user as a reviewer with the given user id.None returns merge requests with no reviewers.Any returns merge requests with any reviewer.not[reviewer_ |
deployed_Query | String (date- | Returns merge requests deployed before the given date/ Example: 2019- |
deployed_Query | String (date- | Returns merge requests deployed after the given date/ Example: 2019- |
environmentQuery | String | Returns merge requests deployed to the given environment Example: production |
merge_Query | Integer | Returns merge requests which have been merged by the user with the given user id.merge_ |
merge_Query | String | Returns merge requests which have been merged by the user with the given username.merge_ |
pageQuery | Integer | Current page number Default: 1Example: 1 |
per_Query | Integer | Number of items per page Default: 20Example: 20 |
iidsQuery | Array of integers | Returns the request having the given iid |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
422 | Unprocessable entity | — |
Create a merge request
POST /api/v4/projects/{id}/merge_requests
Creates a merge request for a project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
add_ | Array of strings | Comma- |
allow_ | Boolean | Allow commits from members who can merge to the target branch |
allow_ | Boolean | [deprecated] See allow_ |
assignee_ | Integer | Assignee user ID |
assignee_ | Array of integers | The IDs of the users to assign the merge request to, |
description | String | Description of the merge request. |
labels | Array of strings | Comma- |
merge_ | String | Date after which the merge request can be merged |
milestone | String | The title of a project or ancestor-milestone_Maximum length: 255 |
milestone_ | Integer | The global ID of a milestone to assign the merge request to.milestone |
remove_ | Array of strings | Comma- |
remove_ | Boolean | Flag indicating if a merge request should remove the source branch when merging |
reviewer_ | Array of integers | The IDs of the users to review the merge request, |
source_Required | String | The source branch |
squash | Boolean | Squash commits into a single commit when merging |
target_Required | String | The target branch |
target_ | Integer | The target project of the merge request defaults to the : |
titleRequired | String | The title of the merge request |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad request | — |
401 | Unauthorized | — |
404 | Not found | — |
409 | Conflict | — |
422 | Unprocessable entity | — |
Retrieve a merge request
GET /api/v4/projects/{id}/merge_requests/{merge_request_iid}
Retrieves a merge request for a specified project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of the merge request |
render_Query | Boolean | If true, |
include_Query | Boolean | If true, |
include_Query | Boolean | If true, |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not found | — |
Update a merge request
PUT /api/v4/projects/{id}/merge_requests/{merge_request_iid}
Updates a merge request for a specified project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of an issuable |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
add_ | Array of strings | Comma- |
allow_ | Boolean | Allow commits from members who can merge to the target branch |
allow_ | Boolean | [deprecated] See allow_ |
assignee_ | Integer | Assignee user ID |
assignee_ | Array of integers | The IDs of the users to assign the merge request to, |
description | String | Description of the merge request. |
discussion_ | Boolean | Flag indicating if the merge request’s discussion is locked. |
labels | Array of strings | Comma- |
merge_ | String | Date after which the merge request can be merged |
milestone | String | The title of a project or ancestor-milestone_Maximum length: 255 |
milestone_ | Integer | The global ID of a milestone to assign the merge request to.milestone |
remove_ | Array of strings | Comma- |
remove_ | Boolean | Flag indicating if a merge request should remove the source branch when merging |
reviewer_ | Array of integers | The IDs of the users to review the merge request, |
squash | Boolean | Squash commits into a single commit when merging |
state_ | String | New state (close/ Allowed values: close,reopen |
target_ | String | The target branch |
title | String | The title of the merge request |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad request | — |
404 | Not found | — |
409 | Conflict | — |
422 | Unprocessable entity | — |
Delete a merge request
DELETE /api/v4/projects/{id}/merge_requests/{merge_request_iid}
Deletes a specified merge request for a project. Administrators and project Owners only.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of the merge request |
Responses
| Code | Description | Schema |
|---|---|---|
204 | No Content | — |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
412 | Precondition failed | — |
Add spent time for a merge request
POST /api/v4/projects/{id}/merge_requests/{merge_request_iid}/add_spent_time
Adds spent time for a specified merge request.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of the merge_ |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
durationRequired | String | The duration in human format |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
Cancel merge when pipeline succeeds
POST /api/v4/projects/{id}/merge_requests/{merge_request_iid}/cancel_merge_when_pipeline_succeeds
Cancels an automatic merge for a merge request that has been set to merge when the pipeline succeeds.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of an issuable |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
405 | Method not allowed | — |
406 | Not acceptable | — |
Retrieve merge request changes
GET /api/v4/projects/{id}/merge_requests/{merge_request_iid}/changes
Retrieves changes for a specified merge request.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
unidiffQuery | Boolean | A diff in a Unified diff format Default: false |
merge_Path, | Integer | The internal ID of an issuable |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not found | — |
List all issues that close on merge
GET /api/v4/projects/{id}/merge_requests/{merge_request_iid}/closes_issues
Lists all issues that close on merge.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
pageQuery | Integer | Current page number Default: 1Example: 1 |
per_Query | Integer | Number of items per page Default: 20Example: 20 |
merge_Path, | Integer | The internal ID of an issuable |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
403 | Forbidden | — |
404 | Not found | — |
Retrieve merge request commits
GET /api/v4/projects/{id}/merge_requests/{merge_request_iid}/commits
Retrieves commits for a specified merge request.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of the merge request |
pageQuery | Integer | Current page number Default: 1Example: 1 |
per_Query | Integer | Number of items per page Default: 20Example: 20 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not found | — |
List all context commits for a merge request
GET /api/v4/projects/{id}/merge_requests/{merge_request_iid}/context_commits
Lists all context commits for a specified merge request.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of an issuable |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not found | — |
Create context commits for a merge request
POST /api/v4/projects/{id}/merge_requests/{merge_request_iid}/context_commits
Creates context commits for a specified merge request.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of an issuable |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
commitsRequired | Array of strings | The context commits’ SHA |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad request | — |
401 | Unauthorized | — |
404 | Not found | — |
Delete context commits from a merge request
DELETE /api/v4/projects/{id}/merge_requests/{merge_request_iid}/context_commits
Deletes specified context commits from a merge request.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
commitsQuery, | Array of strings | The context commits’ SHA |
merge_Path, | Integer | The internal ID of an issuable |
Responses
| Code | Description | Schema |
|---|---|---|
204 | No Content | — |
400 | Bad request | — |
401 | Unauthorized | — |
404 | Not found | — |
List all merge request diffs
GET /api/v4/projects/{id}/merge_requests/{merge_request_iid}/diffs
Lists all merge request diffs.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of the merge request |
pageQuery | Integer | Current page number Default: 1Example: 1 |
per_Query | Integer | Number of items per page Default: 20Example: 20 |
unidiffQuery | Boolean | A diff in a Unified diff format Default: false |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
403 | Forbidden | — |
404 | Not found | — |
Merge a merge request
PUT /api/v4/projects/{id}/merge_requests/{merge_request_iid}/merge
Merges a merge request. Accepts and merges changes submitted with the merge request.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of an issuable |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
auto_ | Boolean | If true, |
merge_ | String | Custom merge commit message |
merge_ | Boolean | Deprecated: |
sha | String | If present, |
should_ | Boolean | If true, |
skip_ | Boolean | If true, |
squash | Boolean | If true, |
squash_ | String | Custom squash commit message |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad request | — |
401 | Unauthorized | — |
404 | Not found | — |
405 | Method not allowed | — |
409 | Conflict | — |
422 | Unprocessable entity | — |
Merge to default merge ref path
GET /api/v4/projects/{id}/merge_requests/{merge_request_iid}/merge_ref
Merges the changes between the merge request source and target branches into the refs/merge-requests/:iid/merge ref, of the target project repository, if possible. This ref has the state the target branch would have if a regular merge action was taken.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of an issuable |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | — |
400 | Bad request | — |
404 | Not Found | — |
Retrieve merge request participants
GET /api/v4/projects/{id}/merge_requests/{merge_request_iid}/participants
Retrieves participants for a specified merge request.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of an issuable |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not found | — |
List all merge request pipelines
GET /api/v4/projects/{id}/merge_requests/{merge_request_iid}/pipelines
Lists all merge request pipelines.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of the merge request |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not found | — |
Create a merge request pipeline
POST /api/v4/projects/{id}/merge_requests/{merge_request_iid}/pipelines
Creates a merge request pipeline. Pipelines created with this operation must configure .gitlab-ci.yml with only: [merge_requests] to create jobs.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of an issuable |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
async | Boolean | Indicates if the merge request pipeline creation should be performed asynchronously.true,202 status code.202,Default: false |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad request | — |
404 | Not found | — |
405 | Method not allowed | — |
Retrieve merge request raw diffs
GET /api/v4/projects/{id}/merge_requests/{merge_request_iid}/raw_diffs
Retrieves the raw diffs of the files changed in a merge request.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of an issuable |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | — |
400 | Bad Request | — |
403 | Forbidden | — |
404 | Not found | — |
Rebase a merge request
PUT /api/v4/projects/{id}/merge_requests/{merge_request_iid}/rebase
Rebases a merge request. Automatically rebases the source_branch of the merge request against its target_branch.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of an issuable |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
skip_ | Boolean | Set to true to skip creating a CI pipeline |
Responses
| Code | Description | Schema |
|---|---|---|
202 | Accepted | — |
400 | Bad Request | — |
403 | Forbidden | — |
404 | Not found | — |
409 | Conflict | — |
List all issues related to the merge request
GET /api/v4/projects/{id}/merge_requests/{merge_request_iid}/related_issues
Lists all issues related to the merge request.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
pageQuery | Integer | Current page number Default: 1Example: 1 |
per_Query | Integer | Number of items per page Default: 20Example: 20 |
merge_Path, | Integer | The internal ID of an issuable |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | — |
400 | Bad Request | — |
403 | Forbidden | — |
404 | Not found | — |
Reset spent time for a merge request
POST /api/v4/projects/{id}/merge_requests/{merge_request_iid}/reset_spent_time
Resets the total spent time for a specified merge request to 0 seconds.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of the merge_ |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
Reset the estimated time for a merge request
POST /api/v4/projects/{id}/merge_requests/{merge_request_iid}/reset_time_estimate
Resets the estimated time for a specified merge request to 0 seconds.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of the merge_ |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
Retrieve merge request reviewers
GET /api/v4/projects/{id}/merge_requests/{merge_request_iid}/reviewers
Retrieves reviewers for a specified merge request.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of an issuable |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not found | — |
Set the estimated time for a merge request
POST /api/v4/projects/{id}/merge_requests/{merge_request_iid}/time_estimate
Sets an estimated time of work for a specified merge request.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of the merge_ |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
durationRequired | String | The duration in human format Example: 3h30m |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad request | — |
401 | Unauthorized | — |
404 | Not found | — |
Retrieve time tracking stats for a merge request
GET /api/v4/projects/{id}/merge_requests/{merge_request_iid}/time_stats
Retrieves time tracking stats for a specified merge request, including time estimate and time spent in seconds and human-readable format (for example, 1h 30m).
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of the merge_ |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
Retrieve merge request diff versions
GET /api/v4/projects/{id}/merge_requests/{merge_request_iid}/versions
Retrieves merge request diff versions.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of the merge request |
pageQuery | Integer | Current page number Default: 1Example: 1 |
per_Query | Integer | Number of items per page Default: 20Example: 20 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
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.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
merge_Path, | Integer | The internal ID of the merge request |
version_Path, | Integer | The ID of the merge request diff version |
unidiffQuery | Boolean | A diff in a Unified diff format Default: false |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Schemas
Objects returned by the operations above and objects nested in their request bodies.
APIEntitiesCiPipeline
| Property | Type | Description |
|---|---|---|
archived | Boolean | Example:false |
before_ | String | Example:a91957a858320c0e17f3 |
committed_ | String (date- | Example:2015- |
coverage | Number (float) | Example:98. |
created_ | String (date- | Example:2015- |
detailed_ | Detailed | — |
duration | Integer | Time spent running in seconds Example: 127 |
finished_ | String (date- | Example:2015- |
id | Integer (int64) | Example:1 |
iid | Integer | Example:2 |
project_ | Integer (int64) | Example:3 |
queued_ | Integer | Time spent enqueued in seconds Example: 63 |
ref | String | Example:feature- |
sha | String | Example:0ec9e58fdfca6cdd6652 |
source | String | Example:push |
started_ | String (date- | Example:2015- |
status | String | Example:success |
tag | Boolean | Example:false |
updated_ | String (date- | Example:2015- |
user | APIEntities | — |
web_ | String | Example:https: |
yaml_ | String | Example:widgets: |
APIEntitiesCiPipelineBasic
| Property | Type | Description |
|---|---|---|
created_ | String (date- | Example:2022- |
id | Integer (int64) | Example:1 |
iid | Integer | Example:2 |
project_ | Integer (int64) | Example:3 |
ref | String | Example:feature- |
sha | String | Example:0ec9e58fdfca6cdd6652 |
source | String | Example:push |
status | String | Example:success |
updated_ | String (date- | Example:2022- |
web_ | String | Example:https: |
APIEntitiesCommit
| Property | Type | Description |
|---|---|---|
author_ | String | Example:john@example. |
author_ | String | Example:John Smith |
authored_ | String (date- | Example:2012- |
committed_ | String (date- | Example:2012- |
committer_ | String | Example:jack@example. |
committer_ | String | Example:Jack Smith |
created_ | String (date- | Example:2017- |
extended_ | Object | Example:{"Signed- |
id | String | Example:2695effb5807a22ff3d1 |
message | String | Example:Initial commit |
parent_ | Array of strings | Example:["2a4b78934375d7f53875 |
short_ | String | Example:2695effb |
title | String | Example:Initial commit |
trailers | Object | Example:{"Merged- |
web_ | String | Example:https: |
APIEntitiesCustomAttribute
| Property | Type | Description |
|---|---|---|
key | String | Example:foo |
value | String | Example:bar |
APIEntitiesDiff
| Property | Type | Description |
|---|---|---|
a_ | String | Example:100755 |
b_ | String | Example:100644 |
collapsed | Boolean | — |
deleted_ | Boolean | — |
diff | String | Example:@@ - |
generated_ | Boolean | — |
new_ | Boolean | — |
new_ | String | Example:doc/ |
old_ | String | Example:doc/ |
renamed_ | Boolean | — |
too_ | Boolean | — |
APIEntitiesDiffRefs
| Property | Type | Description |
|---|---|---|
base_ | String | Example:b83d6e391c22777fca1e |
head_ | String | Example:b83d6e391c22777fca1e |
start_ | String | Example:b83d6e391c22777fca1e |
APIEntitiesIssuableReferences
| Property | Type | Description |
|---|---|---|
full | String | Example:test&6 |
relative | String | Example:&6 |
short | String | Example:&6 |
APIEntitiesIssuableTimeStats
| Property | Type | Description |
|---|---|---|
human_ | String | Example:3h 30m |
human_ | String | Example:1h |
time_ | Integer | Example:12600 |
total_ | Integer | Example:3600 |
APIEntitiesMergeRequest
| Property | Type | Description |
|---|---|---|
allow_ | Boolean | — |
allow_ | Boolean | — |
assignee | APIEntities | — |
assignees | APIEntities | — |
author | APIEntities | — |
blocking_ | Boolean | — |
changes_ | String | Example:1 |
closed_ | String (date- | Example:2022- |
closed_ | APIEntities | — |
created_ | String (date- | Example:2022- |
description | String | Example:Repellendus impedit et vel velit dignissimos. |
description_ | String | — |
detailed_ | String | Example:mergeable |
diff_ | APIEntities | — |
discussion_ | Boolean | — |
diverged_ | Integer | Example:0 |
downvotes | Integer | — |
draft | Boolean | — |
first_ | Boolean | — |
first_ | String (date- | Example:2022- |
force_ | Boolean | — |
has_ | Boolean | — |
head_ | APIEntities | — |
id | Integer (int64) | Example:84 |
iid | Integer | Example:14 |
imported | Boolean | — |
imported_ | String | Example:bitbucket |
labels | Array of strings | — |
latest_ | String (date- | Example:2022- |
latest_ | String (date- | Example:2022- |
merge_ | String (date- | Example:2022- |
merge_ | String | Example:1234abcd |
merge_ | String | Example:Merge error |
merge_ | String | Example:unchecked |
merge_ | APIEntities | — |
merge_ | Boolean | — |
merged_ | String (date- | Example:2022- |
merged_ | APIEntities | — |
milestone | APIEntities | — |
pipeline | APIEntities | — |
prepared_ | String (date- | Example:2022- |
project_ | Integer (int64) | Example:4 |
rebase_ | Boolean | — |
reference | String | Example:!1 |
references | APIEntities | — |
reviewers | APIEntities | — |
sha | String | Example:1234abcd |
should_ | Boolean | — |
source_ | String | — |
source_ | Integer (int64) | — |
squash | Boolean | — |
squash_ | String | Example:1234abcd |
squash_ | Boolean | — |
state | String | Example:closed |
subscribed | Boolean | — |
target_ | String | — |
target_ | Integer (int64) | — |
task_ | APIEntities | — |
time_ | APIEntities | — |
title | String | Example:Impedit et ut et dolores vero provident ullam est |
title_ | String | — |
updated_ | String (date- | Example:2022- |
upvotes | Integer | — |
user | Object | — |
user. | Boolean | — |
user_ | Integer | — |
web_ | String | Example:https: |
work_ | Boolean | — |
APIEntitiesMergeRequestBasic
| Property | Type | Description |
|---|---|---|
allow_ | Boolean | — |
allow_ | Boolean | — |
assignee | APIEntities | — |
assignees | APIEntities | — |
author | APIEntities | — |
blocking_ | Boolean | — |
closed_ | String (date- | Example:2022- |
closed_ | APIEntities | — |
created_ | String (date- | Example:2022- |
description | String | Example:Repellendus impedit et vel velit dignissimos. |
description_ | String | — |
detailed_ | String | Example:mergeable |
discussion_ | Boolean | — |
downvotes | Integer | — |
draft | Boolean | — |
force_ | Boolean | — |
has_ | Boolean | — |
id | Integer (int64) | Example:84 |
iid | Integer | Example:14 |
imported | Boolean | — |
imported_ | String | Example:bitbucket |
labels | Array of strings | — |
merge_ | String (date- | Example:2022- |
merge_ | String | Example:1234abcd |
merge_ | String | Example:unchecked |
merge_ | APIEntities | — |
merge_ | Boolean | — |
merged_ | String (date- | Example:2022- |
merged_ | APIEntities | — |
milestone | APIEntities | — |
prepared_ | String (date- | Example:2022- |
project_ | Integer (int64) | Example:4 |
reference | String | Example:!1 |
references | APIEntities | — |
reviewers | APIEntities | — |
sha | String | Example:1234abcd |
should_ | Boolean | — |
source_ | String | — |
source_ | Integer (int64) | — |
squash | Boolean | — |
squash_ | String | Example:1234abcd |
squash_ | Boolean | — |
state | String | Example:closed |
target_ | String | — |
target_ | Integer (int64) | — |
task_ | APIEntities | — |
time_ | APIEntities | — |
title | String | Example:Impedit et ut et dolores vero provident ullam est |
title_ | String | — |
updated_ | String (date- | Example:2022- |
upvotes | Integer | — |
user_ | Integer | — |
web_ | String | Example:https: |
work_ | Boolean | — |
APIEntitiesMergeRequestChanges
| Property | Type | Description |
|---|---|---|
allow_ | Boolean | — |
allow_ | Boolean | — |
assignee | APIEntities | — |
assignees | APIEntities | — |
author | APIEntities | — |
blocking_ | Boolean | — |
changes | Array of APIEntities | — |
changes_ | String | Example:1 |
closed_ | String (date- | Example:2022- |
closed_ | APIEntities | — |
created_ | String (date- | Example:2022- |
description | String | Example:Repellendus impedit et vel velit dignissimos. |
description_ | String | — |
detailed_ | String | Example:mergeable |
diff_ | APIEntities | — |
discussion_ | Boolean | — |
diverged_ | Integer | Example:0 |
downvotes | Integer | — |
draft | Boolean | — |
first_ | Boolean | — |
first_ | String (date- | Example:2022- |
force_ | Boolean | — |
has_ | Boolean | — |
head_ | APIEntities | — |
id | Integer (int64) | Example:84 |
iid | Integer | Example:14 |
imported | Boolean | — |
imported_ | String | Example:bitbucket |
labels | Array of strings | — |
latest_ | String (date- | Example:2022- |
latest_ | String (date- | Example:2022- |
merge_ | String (date- | Example:2022- |
merge_ | String | Example:1234abcd |
merge_ | String | Example:Merge error |
merge_ | String | Example:unchecked |
merge_ | APIEntities | — |
merge_ | Boolean | — |
merged_ | String (date- | Example:2022- |
merged_ | APIEntities | — |
milestone | APIEntities | — |
overflow | Boolean | — |
pipeline | APIEntities | — |
prepared_ | String (date- | Example:2022- |
project_ | Integer (int64) | Example:4 |
rebase_ | Boolean | — |
reference | String | Example:!1 |
references | APIEntities | — |
reviewers | APIEntities | — |
sha | String | Example:1234abcd |
should_ | Boolean | — |
source_ | String | — |
source_ | Integer (int64) | — |
squash | Boolean | — |
squash_ | String | Example:1234abcd |
squash_ | Boolean | — |
state | String | Example:closed |
subscribed | Boolean | — |
target_ | String | — |
target_ | Integer (int64) | — |
task_ | APIEntities | — |
time_ | APIEntities | — |
title | String | Example:Impedit et ut et dolores vero provident ullam est |
title_ | String | — |
updated_ | String (date- | Example:2022- |
upvotes | Integer | — |
user | Object | — |
user. | Boolean | — |
user_ | Integer | — |
web_ | String | Example:https: |
work_ | Boolean | — |
APIEntitiesMergeRequestDiff
| Property | Type | Description |
|---|---|---|
base_ | String | Example:1234abcd |
created_ | String (date- | Example:2022- |
head_ | String | Example:1234abcd |
id | Integer (int64) | Example:1 |
merge_ | Integer (int64) | Example:1 |
patch_ | String | Example:1234abcd |
real_ | String | Example:1 |
start_ | String | Example:1234abcd |
state | String | Example:collected |
APIEntitiesMergeRequestDiffFull
| Property | Type | Description |
|---|---|---|
base_ | String | Example:1234abcd |
commits | Array of APIEntities | — |
created_ | String (date- | Example:2022- |
diffs | Array of APIEntities | — |
head_ | String | Example:1234abcd |
id | Integer (int64) | Example:1 |
merge_ | Integer (int64) | Example:1 |
patch_ | String | Example:1234abcd |
real_ | String | Example:1 |
start_ | String | Example:1234abcd |
state | String | Example:collected |
APIEntitiesMergeRequestReviewer
| Property | Type | Description |
|---|---|---|
created_ | String (date- | Example:2022- |
state | String | Example:unreviewed |
user | APIEntities | — |
APIEntitiesMilestone
| Property | Type | Description |
|---|---|---|
created_ | String | — |
description | String | — |
due_ | String | — |
expired | Boolean | — |
group_ | String | — |
id | Integer (int64) | — |
iid | Integer (int64) | — |
project_ | Integer (int64) | — |
start_ | String | — |
state | String | — |
title | String | — |
updated_ | String | — |
web_ | String | — |
APIEntitiesMRNote
| Property | Type | Description |
|---|---|---|
author | APIEntities | — |
note | String | Example:LGTM! |
APIEntitiesTaskCompletionStatus
| Property | Type | Description |
|---|---|---|
completed_ | Integer | Example:3 |
count | Integer | Example:5 |
APIEntitiesUserBasic
| Property | Type | Description |
|---|---|---|
avatar_ | String | Example:/ |
avatar_ | String | Example:https: |
custom_ | Array of APIEntities | — |
id | Integer (int64) | Example:1 |
locked | Boolean | — |
name | String | Example:Administrator |
public_ | String | Example:john@example. |
state | String | Example:active |
username | String | Example:admin |
web_ | String | Example:https: |
DetailedStatusEntity
| Property | Type | Description |
|---|---|---|
action | Object | — |
action. | String | Example:Cancel this job |
action. | String | Example:Are you sure? |
action. | String | Example:cancel |
action. | String | Example:post |
action. | String | Example:/ |
action. | String | Example:Cancel |
details_ | String | Example:/ |
favicon | String | Example:/ |
group | String | Example:success |
has_ | Boolean | Example:true |
icon | String | Example:status_ |
illustration | Object | Example:{"content": |
label | String | Example:passed |
text | String | Example:passed |
tooltip | String | Example:passed |