message: unsubscribe

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported.

Submits a email request on behalf of the signed-in user to unsubscribe from an email distribution list. Uses the information in the List-Unsubscribe header.

Message senders can use mailing lists in a user-friendly way by including an option for recipients to opt out. They can do so by specifying the List-Unsubscribe header in each message following RFC-2369.

Note In particular, for the unsubscribe action to work, the sender must specify mailto: and not URL-based unsubscribe information.

Setting that header would also set the unsubscribeEnabled property of the message instance to true, and the unsubscribeData property to the header data.

If the unsubscribeEnabled property of a message is true, you can use the unsubscribe action to unsubscribe the user from similar future messages as managed by the message sender.

A successful unsubscribe action moves the message to the Deleted Items folder. The actual exclusion of the user from future mail distribution is managed by the sender.

Permissions

One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

Permission type Permissions (from least to most privileged)
Delegated (work or school account) Mail.Send
Delegated (personal Microsoft account) Mail.Send
Application Mail.Send

HTTP request

POST /users/{id | userPrincipalName}/messages/{id}/unsubscribe

Request headers

Name Type Description
Authorization string Bearer {token}. Required.

Request body

Do not supply a request body for this method.

Response

If successful, this method returns 202 Accepted response code. It does not return anything in the response body.

Example

Here is an example of how to call this API.

Request

Here is an example of the request.

POST https://graph.microsoft.com/beta/me/messages/{id}/unsubscribe
Response

Here is an example of the response.

HTTP/1.1 202 Accepted