Notification settings API

  • Tier: Free, Premium, Ultimate
  • Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated

Use this API to manage notification settings in GitLab. For more information, see notification emails.

Notification levels

The notification levels are defined in the NotificationSetting.level model enumeration. These levels are recognized:

  • disabled: Turn off all notifications
  • participating: Receive notifications for threads you have participated in
  • watch: Receive notifications for most activity
  • global: Use your global notification settings
  • mention: Receive notifications when you are mentioned in a comment
  • custom: Receive notifications for selected events

If you use the custom level, you can control specific email events. Available events are returned by NotificationSetting.email_events. These events are recognized:

EventDescription
approverA merge request you’re eligible to approve is created
change_reviewer_merge_requestWhen a merge request’s reviewer is changed
close_issueWhen an issue is closed
close_merge_requestWhen a merge request is closed
failed_pipelineWhen a pipeline fails
fixed_pipelineWhen a previously failed pipeline is fixed
issue_dueWhen an issue is due tomorrow
merge_merge_requestWhen a merge request is merged
merge_when_pipeline_succeedsWhen a merge request is set to auto-merge
moved_projectWhen a project is moved
new_epicWhen a new epic is created (in the Premium and Ultimate tier)
new_issueWhen a new issue is created
new_merge_requestWhen a new merge request is created
new_noteWhen someone adds a comment
new_releaseWhen a new release is published
push_to_merge_requestWhen someone pushes to a merge request
reassign_issueWhen an issue is reassigned
reassign_merge_requestWhen a merge request is reassigned
reopen_issueWhen an issue is reopened
reopen_merge_requestWhen a merge request is reopened
success_pipelineWhen a pipeline completes successfully

Get global notification settings

Get current notification settings and email address.

Copy to clipboard
GET /notification_settings

Example request:

Shell Copy to clipboard
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/notification_settings"

If successful, returns 200 OK and the following response attributes:

AttributeTypeDescription
levelstringGlobal notification level
notification_emailstringEmail address where notifications are sent

Example response:

JSON Copy to clipboard
{
  "level": "participating",
  "notification_email": "admin@example.com"
}

Update global notification settings

Update notification settings and email address.

Copy to clipboard
PUT /notification_settings

Example request:

Shell Copy to clipboard
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/notification_settings?level=watch"

Supported attributes:

AttributeTypeRequiredDescription
approverbooleanNoTurn on notifications when a merge request you’re eligible to approve is created
change_reviewer_merge_requestbooleanNoTurn on notifications when a merge request’s reviewer is changed
close_issuebooleanNoTurn on notifications when an issue is closed
close_merge_requestbooleanNoTurn on notifications when a merge request is closed
failed_pipelinebooleanNoTurn on notifications when a pipeline fails
fixed_pipelinebooleanNoTurn on notifications when a previously failed pipeline is fixed
issue_duebooleanNoTurn on notifications when an issue is due tomorrow
levelstringNoGlobal notification level
merge_merge_requestbooleanNoTurn on notifications when a merge request is merged
merge_when_pipeline_succeedsbooleanNoTurn on notifications when a merge request is set to auto-merge
moved_projectbooleanNoTurn on notifications when a project is moved
new_epicbooleanNoTurn on notifications when a new epic is created (in the Premium and Ultimate tier)
new_issuebooleanNoTurn on notifications when a new issue is created
new_merge_requestbooleanNoTurn on notifications when a new merge request is created
new_notebooleanNoTurn on notifications when a new comment is added
new_releasebooleanNoTurn on notifications when a new release is published
notification_emailstringNoEmail address where notifications are sent
push_to_merge_requestbooleanNoTurn on notifications when someone pushes to a merge request
reassign_issuebooleanNoTurn on notifications when an issue is reassigned
reassign_merge_requestbooleanNoTurn on notifications when a merge request is reassigned
reopen_issuebooleanNoTurn on notifications when an issue is reopened
reopen_merge_requestbooleanNoTurn on notifications when a merge request is reopened
success_pipelinebooleanNoTurn on notifications when a pipeline completes successfully

If successful, returns 200 OK and the following response attributes:

AttributeTypeDescription
levelstringGlobal notification level
notification_emailstringEmail address where notifications are sent

Example response:

JSON Copy to clipboard
{
  "level": "watch",
  "notification_email": "admin@example.com"
}

Get group or project notification settings

Get notification settings for a group or project.

Copy to clipboard
GET /groups/:id/notification_settings
GET /projects/:id/notification_settings

Example request:

Shell Copy to clipboard
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/groups/5/notification_settings"
Shell Copy to clipboard
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/8/notification_settings"

Supported attributes:

AttributeTypeRequiredDescription
idinteger or stringYesID or URL-encoded path of the group or project

If successful, returns 200 OK and the following response attributes:

AttributeTypeDescription
levelstringNotification level

Example response for standard notification level:

JSON Copy to clipboard
{
  "level": "global"
}

Example response for a group with custom notification level:

JSON Copy to clipboard
{
  "level": "custom",
  "events": {
    "new_release": null,
    "new_note": null,
    "new_issue": null,
    "reopen_issue": null,
    "close_issue": null,
    "reassign_issue": null,
    "issue_due": null,
    "new_merge_request": null,
    "push_to_merge_request": null,
    "reopen_merge_request": null,
    "close_merge_request": null,
    "reassign_merge_request": null,
    "change_reviewer_merge_request": null,
    "merge_merge_request": null,
    "failed_pipeline": null,
    "fixed_pipeline": null,
    "success_pipeline": null,
    "moved_project": true,
    "merge_when_pipeline_succeeds": false,
    "new_epic": null
  }
}

In this response:

  • true indicates the notification is turned on.
  • false indicates the notification is turned off.
  • null indicates the notification uses the default setting.

The new_epic attribute is available only in the Premium and Ultimate tiers.

Update group or project notification settings

Update notification settings for a group or project.

Copy to clipboard
PUT /groups/:id/notification_settings
PUT /projects/:id/notification_settings

Example requests:

Shell Copy to clipboard
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/groups/5/notification_settings?level=watch"
Shell Copy to clipboard
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/8/notification_settings?level=custom&new_note=true"

Supported attributes:

AttributeTypeRequiredDescription
approverbooleanNoTurn on notifications when a merge request you’re eligible to approve is created
change_reviewer_merge_requestbooleanNoTurn on notifications when a merge request’s reviewer changes
close_issuebooleanNoTurn on notifications when an issue is closed
close_merge_requestbooleanNoTurn on notifications when a merge request is closed
failed_pipelinebooleanNoTurn on notifications when a pipeline fails
fixed_pipelinebooleanNoTurn on notifications when a previously failed pipeline is fixed
idinteger or stringYesID or URL-encoded path of the group or project
issue_duebooleanNoTurn on notifications when an issue is due tomorrow
levelstringNoNotification level for this group or project
merge_merge_requestbooleanNoTurn on notifications when a merge request is merged
merge_when_pipeline_succeedsbooleanNoTurn on notifications when a merge request is set to merge when its pipeline succeeds
moved_projectbooleanNoTurn on notifications when a project is moved
new_epicbooleanNoTurn on notifications when a new epic is created (in the Premium and Ultimate tier)
new_issuebooleanNoTurn on notifications when a new issue is created
new_merge_requestbooleanNoTurn on notifications when a new merge request is created
new_notebooleanNoTurn on notifications when a new comment is added
new_releasebooleanNoTurn on notifications when a new release is published
push_to_merge_requestbooleanNoTurn on notifications when someone pushes to a merge request
reassign_issuebooleanNoTurn on notifications when an issue is reassigned
reassign_merge_requestbooleanNoTurn on notifications when a merge request is reassigned
reopen_issuebooleanNoTurn on notifications when an issue is reopened
reopen_merge_requestbooleanNoTurn on notifications when a merge request is reopened
success_pipelinebooleanNoTurn on notifications when a pipeline completes successfully

If successful, returns 200 OK and one of the following response formats.

For a non-custom notification level:

JSON Copy to clipboard
{
  "level": "watch"
}

For a custom notification level, the response includes an events object showing the status of each notification:

JSON Copy to clipboard
{
  "level": "custom",
  "events": {
    "new_release": null,
    "new_note": true,
    "new_issue": false,
    "reopen_issue": null,
    "close_issue": null,
    "reassign_issue": null,
    "issue_due": null,
    "new_merge_request": null,
    "push_to_merge_request": null,
    "reopen_merge_request": null,
    "close_merge_request": null,
    "reassign_merge_request": null,
    "change_reviewer_merge_request": null,
    "merge_merge_request": null,
    "failed_pipeline": false,
    "fixed_pipeline": null,
    "success_pipeline": null,
    "moved_project": false,
    "merge_when_pipeline_succeeds": false,
    "new_epic": null
  }
}

In this response:

  • true indicates the notification is turned on.
  • false indicates the notification is turned off.
  • null indicates the notification uses the default setting.

The new_epic attribute is available only in the Premium and Ultimate tiers.