users

POST /gmail/v1/users/{userId}/messages/batchModify

Changed on

Modifies the labels and the Classification Label values on the specified messages. For administrators modifying messages for users in their organization, requests require authorization with a service account that has domain-wide delegation authority to impersonate users with the https://www.googleapis.com/auth/gmail.modify.restricted scope.

Request

  • Base URL
    https://gmail.googleapis.com
  • Auth
    • OAuth 2 and OAuth 2
      Implicithttps://accounts.google.com/o/oauth2/auth
      Scopeshttps://mail.google.com/
      Authorization codehttps://accounts.google.com/o/oauth2/auth
      Token URLhttps://accounts.google.com/o/oauth2/token
      Scopeshttps://mail.google.com/
    • or OAuth 2 and OAuth 2
      Implicithttps://accounts.google.com/o/oauth2/auth
      Scopeshttps://www.googleapis.com/auth/gmail.messages
      Authorization codehttps://accounts.google.com/o/oauth2/auth
      Token URLhttps://accounts.google.com/o/oauth2/token
      Scopeshttps://www.googleapis.com/auth/gmail.messages
    • or OAuth 2 and OAuth 2
      Implicithttps://accounts.google.com/o/oauth2/auth
      Scopeshttps://www.googleapis.com/auth/gmail.messages.delete
      Authorization codehttps://accounts.google.com/o/oauth2/auth
      Token URLhttps://accounts.google.com/o/oauth2/token
      Scopeshttps://www.googleapis.com/auth/gmail.messages.delete
    • or OAuth 2 and OAuth 2
      Implicithttps://accounts.google.com/o/oauth2/auth
      Scopeshttps://www.googleapis.com/auth/gmail.messages.modify
      Authorization codehttps://accounts.google.com/o/oauth2/auth
      Token URLhttps://accounts.google.com/o/oauth2/token
      Scopeshttps://www.googleapis.com/auth/gmail.messages.modify
    • or OAuth 2 and OAuth 2
      Implicithttps://accounts.google.com/o/oauth2/auth
      Scopeshttps://www.googleapis.com/auth/gmail.modify
      Authorization codehttps://accounts.google.com/o/oauth2/auth
      Token URLhttps://accounts.google.com/o/oauth2/token
      Scopeshttps://www.googleapis.com/auth/gmail.modify

Path parameters

userId, string required

The user's email address. The special value me can be used to indicate the authenticated user.

Query parameters

$.xgafv, '1' | '2'

V1 error format.

access_token, string

OAuth access token.

alt, 'json' | 'media' | 'proto'

Data format for response.

callback, string

JSONP

fields, string

Selector specifying which fields to include in a partial response.

key, string

API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

oauth_token, string

OAuth 2.0 token for the current user.

prettyPrint, boolean

Returns response with indentations and line breaks.

quotaUser, string

Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

uploadType, string

Legacy upload protocol for media (e.g. "media", "multipart").

upload_protocol, string

Upload protocol for media (e.g. "raw", "multipart").

Request body

BatchModifyMessagesRequest required
addClassificationLabels, ClassificationLabelValue[]

A list of Classification Label values to add. If a Classification Label with the same label ID is already applied to the message, fields with existing field IDs will be updated and fields with new field IDs will be added. There's a limit of 20 Classification Label values per request. If the message is already classified and the final total number of Classification Label values exceeds the maximum allowed number of Classification Label values per message, the modification fails.

addLabelIds, string[]

A list of label IDs to add to messages.

ids, string[]

The IDs of the messages to modify. There is a limit of 1000 ids per request.

removeClassificationLabelIds, string[]

A list of Classification Label values to remove from messages.

removeLabelIds, string[]

A list of label IDs to remove from messages.

Response

Successful response

Changes

    • info

      the security scope https://mail.google.com/ was added to the endpoint's security scheme Oauth2

    • info

      the security scope https://mail.google.com/ was added to the endpoint's security scheme Oauth2c

    • info

      the security scope https://www.googleapis.com/auth/gmail.modify was removed from the endpoint's security scheme Oauth2

    1 more change in this revision