2020-07-30 08:09:33 -04:00
---
stage: Create
group: Source Code
2022-09-21 20:11:23 -04:00
info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments"
2020-07-30 08:09:33 -04:00
type: reference, api
---
2021-02-09 13:09:59 -05:00
# Suggest Changes API **(FREE)**
2018-12-18 03:59:50 -05:00
2021-05-21 14:11:01 -04:00
This page describes the API for [suggesting changes ](../user/project/merge_requests/reviews/suggestions.md ).
2018-12-18 03:59:50 -05:00
Every API call to suggestions must be authenticated.
## Applying suggestions
2022-01-30 19:14:49 -05:00
Applies a suggested patch in a merge request. Users must have
at least the Developer role to perform such action.
2018-12-18 03:59:50 -05:00
2020-02-28 22:07:51 -05:00
```plaintext
2018-12-18 03:59:50 -05:00
PUT /suggestions/:id/apply
```
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `id` | integer/string | yes | The ID of a suggestion |
2021-01-26 10:08:58 -05:00
| `commit_message` | string | no | A custom commit message to use instead of the default generated message or the project's default message |
2018-12-18 03:59:50 -05:00
2020-01-30 10:09:15 -05:00
```shell
2020-05-27 20:08:37 -04:00
curl --request PUT --header "PRIVATE-TOKEN: < your_access_token > " "https://gitlab.example.com/api/v4/suggestions/5/apply"
2018-12-18 03:59:50 -05:00
```
Example response:
```json
{
"id": 36,
"from_line": 10,
"to_line": 10,
2022-05-31 11:09:02 -04:00
"applicable": false,
2018-12-18 03:59:50 -05:00
"applied": true,
"from_content": " \"--talk-name=org.freedesktop.\",\n",
"to_content": " \"--talk-name=org.free.\",\n \"--talk-name=org.desktop.\",\n"
}
```