Use this API to manage merge request approvals and the group and project approval settings that govern them. All endpoints require authentication.

Endpoints to approve, unapprove, reset approvals, and retrieve approval state are available on all tiers, including Free. All other endpoints require Premium or Ultimate, and each one shows its tier.

The merge_request_iid and id path parameters must each be a single value. Passing multiple space-separated values (for example, 451 454 458) is not supported and returns 400 Bad Request. To act on multiple merge requests, make one request per merge request IID.

Retrieve approval state for a merge request

GET /api/v4/projects/{id}/merge_requests/{merge_request_iid}/approvals

Retrieves the approval state for a specified merge request. In the response, approved_by contains information about all approvers of the merge request, regardless of whether those approvals satisfy any approval rule. In GitLab Community Edition, the response contains only approved, approved_by, user_can_approve, and user_has_approved, and approved is true only when at least one approval exists. Otherwise, approved is true when the approval rules are satisfied, including when no approval rules apply and approved_by is empty.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
merge_request_iid
Path, required
IntegerInternal ID of the merge request

Responses

CodeDescriptionSchema
200OKAPIEntitiesMergeRequestApprovals
400Bad Request—
404Not found—

Approve merge request

POST /api/v4/projects/{id}/merge_requests/{merge_request_iid}/approve

Approves a specified merge request. The currently authenticated user must be an eligible approver. The sha parameter ensures you are approving the current version of the merge request. If defined, the value must match the merge request’s HEAD commit SHA. A mismatch returns a 409 Conflict response. An approval sent immediately after the merge request is created can come before its commit is processed, and a new commit can then reset the approval. To avoid this, wait until detailed_merge_status is not checking or approvals_syncing and the merge request diff has a patch_id_sha, or send sha. With sha, GitLab records the approved version even before a diff exists, so a later push does not reset the approval. The response has the same attributes as retrieving the approval state, which depend on the edition.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
merge_request_iid
Path, required
IntegerInternal ID of the merge request

Request body (application/json)

PropertyTypeDescription
publish_reviewBooleanIf true, submits pending review comments
shaStringSHA at HEAD of the source branch of the merge request

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesMergeRequestApprovals
400Bad Request—
401Unauthorized—
404Not found—

Reset approvals for a merge request

PUT /api/v4/projects/{id}/merge_requests/{merge_request_iid}/reset_approvals

Resets all approvals for a specified merge request. Available only to bot users with a valid project or group token. Human users receive a 401 Unauthorized response.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
merge_request_iid
Path, required
IntegerInternal ID of the merge request

Responses

CodeDescriptionSchema
200OK—
400Bad Request—
401Unauthorized—
404Not found—

Unapprove a merge request

POST /api/v4/projects/{id}/merge_requests/{merge_request_iid}/unapprove

Unapproves a merge request. Removes the approval for the currently authenticated user from a specified merge request. The response has the same attributes as retrieving the approval state, which depend on the edition.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
merge_request_iid
Path, required
IntegerInternal ID of the merge request

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesMergeRequestApprovals
400Bad Request—
401Unauthorized—
404Not found—

Schemas

Objects returned by the operations above and objects nested in their request bodies.

APIEntitiesApprovals

PropertyTypeDescription
approved_atString (date-time)Timestamp of when the user approved the merge request
Example: 2025-01-01T10:00:00Z
userAPIEntitiesUserBasicUser who approved the merge request

APIEntitiesCustomAttribute

PropertyTypeDescription
keyStringExample: foo
valueStringExample: bar

APIEntitiesMergeRequestApprovals

PropertyTypeDescription
approvedBoolean—
approved_byArray of APIEntitiesApprovals—
user_can_approveBoolean—
user_has_approvedBoolean—

APIEntitiesUserBasic

PropertyTypeDescription
avatar_pathStringExample: /user/avatar/28/The-Big-Lebowski-400-400.png
avatar_urlStringURL of the user’s avatar
Example: https://gravatar.com/avatar/1
custom_attributesArray of APIEntitiesCustomAttribute—
idInteger (int64)ID of the user
Example: 1
lockedBooleanIf true, the user account is locked, and the user cannot sign in until the lock expires or an administrator unlocks the account
nameStringName of the user. For a bot user, **** if the current user cannot read the bot’s project or group
Example: Administrator
public_emailStringPublic email address of the user
Example: john@example.com
stateStringState of the user account. Possible values: active, blocked, ldap_blocked, blocked_pending_approval, banned, or deactivated
Example: active
usernameStringUsername of the user
Example: admin
web_urlStringURL of the user’s profile
Example: https://gitlab.example.com/root