2020-10-28 11:08:49 -04:00
---
2021-04-23 11:09:37 -04:00
stage: Plan
group: Project Management
2022-09-21 17:13:33 -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-10-28 11:08:49 -04:00
---
2021-06-23 11:07:50 -04:00
# Notification settings API **(FREE)**
2016-08-02 16:52:55 -04:00
2021-06-23 11:07:50 -04:00
Change [notification settings ](../user/profile/notifications.md ) using the REST API.
2016-08-02 16:52:55 -04:00
2019-07-04 04:22:41 -04:00
## Valid notification levels
2016-08-02 16:52:55 -04:00
2016-11-02 04:19:25 -04:00
The notification levels are defined in the `NotificationSetting.level` model enumeration. Currently, these levels are recognized:
2016-08-02 16:52:55 -04:00
2021-06-23 11:07:50 -04:00
- `disabled`
- `participating`
- `watch`
- `global`
- `mention`
- `custom`
2016-08-02 16:52:55 -04:00
2018-07-22 22:42:19 -04:00
If the `custom` level is used, specific email events can be controlled. Available events are returned by `NotificationSetting.email_events` . Currently, these events are recognized:
2016-08-02 16:52:55 -04:00
2019-07-03 05:32:54 -04:00
- `new_note`
- `new_issue`
- `reopen_issue`
- `close_issue`
- `reassign_issue`
- `issue_due`
- `new_merge_request`
- `push_to_merge_request`
- `reopen_merge_request`
- `close_merge_request`
- `reassign_merge_request`
- `merge_merge_request`
- `failed_pipeline`
2020-02-27 13:09:21 -05:00
- `fixed_pipeline`
2019-07-03 05:32:54 -04:00
- `success_pipeline`
2020-07-27 23:09:35 -04:00
- `moved_project`
2021-02-19 07:11:06 -05:00
- `merge_when_pipeline_succeeds`
2019-07-08 04:50:38 -04:00
- `new_epic` ** (ULTIMATE)**
2019-07-03 05:32:54 -04:00
2016-08-02 16:52:55 -04:00
## Global notification settings
Get current notification settings and email address.
2020-02-27 04:09:01 -05:00
```plaintext
2016-08-02 16:52:55 -04:00
GET /notification_settings
```
2020-01-30 10:09:15 -05:00
```shell
2020-05-27 20:08:37 -04:00
curl --header "PRIVATE-TOKEN: < your_access_token > " "https://gitlab.example.com/api/v4/notification_settings"
2016-08-02 16:52:55 -04:00
```
Example response:
```json
{
"level": "participating",
"notification_email": "admin@example.com"
}
```
## Update global notification settings
Update current notification settings and email address.
2020-02-27 04:09:01 -05:00
```plaintext
2016-08-02 16:52:55 -04:00
PUT /notification_settings
```
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/notification_settings?level=watch"
2016-08-02 16:52:55 -04:00
```
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `level` | string | no | The global notification level |
| `notification_email` | string | no | The email address to send notifications |
| `new_note` | boolean | no | Enable/disable this notification |
| `new_issue` | boolean | no | Enable/disable this notification |
| `reopen_issue` | boolean | no | Enable/disable this notification |
| `close_issue` | boolean | no | Enable/disable this notification |
| `reassign_issue` | boolean | no | Enable/disable this notification |
2018-03-30 08:25:46 -04:00
| `issue_due` | boolean | no | Enable/disable this notification |
2016-08-02 16:52:55 -04:00
| `new_merge_request` | boolean | no | Enable/disable this notification |
2017-07-25 07:56:09 -04:00
| `push_to_merge_request` | boolean | no | Enable/disable this notification |
2016-08-02 16:52:55 -04:00
| `reopen_merge_request` | boolean | no | Enable/disable this notification |
| `close_merge_request` | boolean | no | Enable/disable this notification |
| `reassign_merge_request` | boolean | no | Enable/disable this notification |
| `merge_merge_request` | boolean | no | Enable/disable this notification |
2016-11-08 10:52:45 -05:00
| `failed_pipeline` | boolean | no | Enable/disable this notification |
2020-02-27 13:09:21 -05:00
| `fixed_pipeline` | boolean | no | Enable/disable this notification |
2016-11-08 10:52:45 -05:00
| `success_pipeline` | boolean | no | Enable/disable this notification |
2020-07-29 08:09:45 -04:00
| `moved_project` | boolean | no | Enable/disable this notification ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/30371) in GitLab 13.3) |
2021-02-19 07:11:06 -05:00
| `merge_when_pipeline_succeeds` | boolean | no | Enable/disable this notification ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/244840) in GitLab 13.9) |
2020-07-29 08:09:45 -04:00
| `new_epic` | boolean | no | Enable/disable this notification ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/5863) in GitLab 11.3) ** (ULTIMATE)** |
2016-08-02 16:52:55 -04:00
Example response:
```json
{
"level": "watch",
"notification_email": "admin@example.com"
}
```
## Group / project level notification settings
Get current group or project notification settings.
2020-02-27 04:09:01 -05:00
```plaintext
2016-08-02 16:52:55 -04:00
GET /groups/:id/notification_settings
GET /projects/:id/notification_settings
```
2020-01-30 10:09:15 -05:00
```shell
2020-05-27 20:08:37 -04:00
curl --header "PRIVATE-TOKEN: < your_access_token > " "https://gitlab.example.com/api/v4/groups/5/notification_settings"
curl --header "PRIVATE-TOKEN: < your_access_token > " "https://gitlab.example.com/api/v4/projects/8/notification_settings"
2016-08-02 16:52:55 -04:00
```
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
2021-06-28 11:08:03 -04:00
| `id` | integer or string | yes | The ID, or [URL-encoded path, of the group or project ](index.md#namespaced-path-encoding ). |
2016-08-02 16:52:55 -04:00
Example response:
```json
{
"level": "global"
}
```
## Update group/project level notification settings
Update current group/project notification settings.
2020-02-27 04:09:01 -05:00
```plaintext
2016-08-02 16:52:55 -04:00
PUT /groups/:id/notification_settings
PUT /projects/:id/notification_settings
```
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/groups/5/notification_settings?level=watch"
curl --request PUT --header "PRIVATE-TOKEN: < your_access_token > " "https://gitlab.example.com/api/v4/projects/8/notification_settings?level=custom& new_note=true"
2016-08-02 16:52:55 -04:00
```
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
2021-06-28 11:08:03 -04:00
| `id` | integer or string | yes | The ID, or [URL-encoded path, of the group or project ](index.md#namespaced-path-encoding ) |
2016-08-02 16:52:55 -04:00
| `level` | string | no | The global notification level |
| `new_note` | boolean | no | Enable/disable this notification |
| `new_issue` | boolean | no | Enable/disable this notification |
| `reopen_issue` | boolean | no | Enable/disable this notification |
| `close_issue` | boolean | no | Enable/disable this notification |
| `reassign_issue` | boolean | no | Enable/disable this notification |
2018-03-30 08:25:46 -04:00
| `issue_due` | boolean | no | Enable/disable this notification |
2016-08-02 16:52:55 -04:00
| `new_merge_request` | boolean | no | Enable/disable this notification |
2017-07-25 07:56:09 -04:00
| `push_to_merge_request` | boolean | no | Enable/disable this notification |
2016-08-02 16:52:55 -04:00
| `reopen_merge_request` | boolean | no | Enable/disable this notification |
| `close_merge_request` | boolean | no | Enable/disable this notification |
| `reassign_merge_request` | boolean | no | Enable/disable this notification |
| `merge_merge_request` | boolean | no | Enable/disable this notification |
2016-11-08 10:52:45 -05:00
| `failed_pipeline` | boolean | no | Enable/disable this notification |
2020-02-27 13:09:21 -05:00
| `fixed_pipeline` | boolean | no | Enable/disable this notification |
2016-11-08 10:52:45 -05:00
| `success_pipeline` | boolean | no | Enable/disable this notification |
2020-07-29 08:09:45 -04:00
| `moved_project` | boolean | no | Enable/disable this notification ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/30371) in GitLab 13.3) |
2021-02-19 07:11:06 -05:00
| `merge_when_pipeline_succeeds` | boolean | no | Enable/disable this notification ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/244840) in GitLab 13.9) |
2020-07-29 08:09:45 -04:00
| `new_epic` | boolean | no | Enable/disable this notification ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/5863) in GitLab 11.3) ** (ULTIMATE)** |
2016-08-02 16:52:55 -04:00
Example responses:
```json
{
"level": "watch"
}
2021-04-29 08:09:58 -04:00
```
2016-08-02 16:52:55 -04:00
2021-04-29 08:09:58 -04:00
```json
2016-08-02 16:52:55 -04:00
{
"level": "custom",
"events": {
"new_note": true,
"new_issue": false,
"reopen_issue": false,
"close_issue": false,
"reassign_issue": false,
2018-03-30 08:25:46 -04:00
"issue_due": false,
2016-08-02 16:52:55 -04:00
"new_merge_request": false,
2017-07-25 07:56:09 -04:00
"push_to_merge_request": false,
2016-08-02 16:52:55 -04:00
"reopen_merge_request": false,
"close_merge_request": false,
"reassign_merge_request": false,
2016-11-08 10:52:45 -05:00
"merge_merge_request": false,
"failed_pipeline": false,
2020-02-27 13:09:21 -05:00
"fixed_pipeline": false,
2016-11-08 10:52:45 -05:00
"success_pipeline": false
2016-08-02 16:52:55 -04:00
}
}
```
2021-09-09 17:09:36 -04:00
Users on [GitLab Ultimate ](https://about.gitlab.com/pricing/ ) also see the `new_epic`
2020-07-29 08:09:45 -04:00
parameter:
2019-07-03 05:32:54 -04:00
```json
{
"level": "custom",
"events": {
"new_note": true,
"new_issue": false,
"new_epic": false,
...
}
}
```