Gmail API
  1. users
Gmail API
  • users
    • /gmail/v1/users/{userId}/drafts
      GET
    • /gmail/v1/users/{userId}/drafts
      POST
    • /gmail/v1/users/{userId}/drafts/send
      POST
    • /gmail/v1/users/{userId}/drafts/{id}
      DELETE
    • /gmail/v1/users/{userId}/drafts/{id}
      GET
    • /gmail/v1/users/{userId}/drafts/{id}
      PUT
    • /gmail/v1/users/{userId}/history
      GET
    • /gmail/v1/users/{userId}/labels
      GET
    • /gmail/v1/users/{userId}/labels
      POST
    • /gmail/v1/users/{userId}/labels/{id}
      DELETE
    • /gmail/v1/users/{userId}/labels/{id}
      GET
    • /gmail/v1/users/{userId}/labels/{id}
      PATCH
    • /gmail/v1/users/{userId}/labels/{id}
      PUT
    • /gmail/v1/users/{userId}/messages
      GET
    • /gmail/v1/users/{userId}/messages
      POST
    • /gmail/v1/users/{userId}/messages/batchDelete
      POST
    • /gmail/v1/users/{userId}/messages/batchModify
      POST
    • /gmail/v1/users/{userId}/messages/import
      POST
    • /gmail/v1/users/{userId}/messages/send
      POST
    • /gmail/v1/users/{userId}/messages/{id}
      DELETE
    • /gmail/v1/users/{userId}/messages/{id}
      GET
    • /gmail/v1/users/{userId}/messages/{id}/modify
      POST
    • /gmail/v1/users/{userId}/messages/{id}/trash
      POST
    • /gmail/v1/users/{userId}/messages/{id}/untrash
      POST
    • /gmail/v1/users/{userId}/messages/{messageId}/attachments/{id}
      GET
    • /gmail/v1/users/{userId}/profile
      GET
    • /gmail/v1/users/{userId}/settings/autoForwarding
      GET
    • /gmail/v1/users/{userId}/settings/autoForwarding
      PUT
    • /gmail/v1/users/{userId}/settings/cse/identities
      GET
    • /gmail/v1/users/{userId}/settings/cse/identities
      POST
    • /gmail/v1/users/{userId}/settings/cse/identities/{cseEmailAddress}
      DELETE
    • /gmail/v1/users/{userId}/settings/cse/identities/{cseEmailAddress}
      GET
    • /gmail/v1/users/{userId}/settings/cse/identities/{emailAddress}
      PATCH
    • /gmail/v1/users/{userId}/settings/cse/keypairs
      GET
    • /gmail/v1/users/{userId}/settings/cse/keypairs
      POST
    • /gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}
      GET
    • /gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}:disable
      POST
    • /gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}:enable
      POST
    • /gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}:obliterate
      POST
    • /gmail/v1/users/{userId}/settings/delegates
      GET
    • /gmail/v1/users/{userId}/settings/delegates
      POST
    • /gmail/v1/users/{userId}/settings/delegates/{delegateEmail}
      DELETE
    • /gmail/v1/users/{userId}/settings/delegates/{delegateEmail}
      GET
    • /gmail/v1/users/{userId}/settings/filters
      GET
    • /gmail/v1/users/{userId}/settings/filters
      POST
    • /gmail/v1/users/{userId}/settings/filters/{id}
      DELETE
    • /gmail/v1/users/{userId}/settings/filters/{id}
      GET
    • /gmail/v1/users/{userId}/settings/forwardingAddresses
      GET
    • /gmail/v1/users/{userId}/settings/forwardingAddresses
      POST
    • /gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}
      DELETE
    • /gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}
      GET
    • /gmail/v1/users/{userId}/settings/imap
      GET
    • /gmail/v1/users/{userId}/settings/imap
      PUT
    • /gmail/v1/users/{userId}/settings/language
      GET
    • /gmail/v1/users/{userId}/settings/language
      PUT
    • /gmail/v1/users/{userId}/settings/pop
      GET
    • /gmail/v1/users/{userId}/settings/pop
      PUT
    • /gmail/v1/users/{userId}/settings/sendAs
      GET
    • /gmail/v1/users/{userId}/settings/sendAs
      POST
    • /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}
      DELETE
    • /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}
      GET
    • /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}
      PATCH
    • /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}
      PUT
    • /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo
      GET
    • /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo
      POST
    • /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}
      DELETE
    • /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}
      GET
    • /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}/setDefault
      POST
    • /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/verify
      POST
    • /gmail/v1/users/{userId}/settings/vacation
      GET
    • /gmail/v1/users/{userId}/settings/vacation
      PUT
    • /gmail/v1/users/{userId}/stop
      POST
    • /gmail/v1/users/{userId}/threads
      GET
    • /gmail/v1/users/{userId}/threads/{id}
      DELETE
    • /gmail/v1/users/{userId}/threads/{id}
      GET
    • /gmail/v1/users/{userId}/threads/{id}/modify
      POST
    • /gmail/v1/users/{userId}/threads/{id}/trash
      POST
    • /gmail/v1/users/{userId}/threads/{id}/untrash
      POST
    • /gmail/v1/users/{userId}/watch
      POST
  1. users

/gmail/v1/users/{userId}/watch

POST
/gmail/v1/users/{userId}/watch
users
Set up or update a push notification watch on the given user mailbox.
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://gmail.googleapis.com//gmail/v1/users//watch' \
--header 'Content-Type: application/json' \
--data-raw '{
    "labelFilterAction": "include",
    "labelIds": [
        "string"
    ],
    "topicName": "string"
}'
Response Response Example
{
  "expiration": "string",
  "historyId": "string"
}

Request

Path Params
userId
string 
required
The user's email address. The special value me can be used to indicate the authenticated user.
Body Params application/json
Set up or update a new push notification watch on this user's mailbox.
labelFilterAction
enum<string> 
optional
Filtering behavior of labelIds list specified.
Allowed values:
includeexclude
labelIds
array[string]
optional
List of label_ids to restrict notifications about. By default, if unspecified, all changes are pushed out. If specified then dictates which labels are required for a push notification to be generated.
topicName
string 
optional
A fully qualified Google Cloud Pub/Sub API topic name to publish the events to. This topic name must already exist in Cloud Pub/Sub and you must have already granted gmail "publish" permission on it. For example, "projects/my-project-identifier/topics/my-topic-name" (using the Cloud Pub/Sub "v1" topic naming format). Note that the "my-project-identifier" portion must exactly match your Google developer project id (the one executing this watch request).
Examples

Responses

🟢200Successful response
application/json
Body
Push notification watch response.
expiration
string <int64>
optional
When Gmail will stop sending notifications for mailbox updates (epoch millis). Call watch again before this time to renew the watch.
historyId
string <uint64>
optional
The ID of the mailbox's current history record.
Modified at 2023-08-15 05:40:23
Previous
/gmail/v1/users/{userId}/threads/{id}/untrash
Built with