1<html><body>
2<style>
3
4body, h1, h2, h3, div, span, p, pre, a {
5  margin: 0;
6  padding: 0;
7  border: 0;
8  font-weight: inherit;
9  font-style: inherit;
10  font-size: 100%;
11  font-family: inherit;
12  vertical-align: baseline;
13}
14
15body {
16  font-size: 13px;
17  padding: 1em;
18}
19
20h1 {
21  font-size: 26px;
22  margin-bottom: 1em;
23}
24
25h2 {
26  font-size: 24px;
27  margin-bottom: 1em;
28}
29
30h3 {
31  font-size: 20px;
32  margin-bottom: 1em;
33  margin-top: 1em;
34}
35
36pre, code {
37  line-height: 1.5;
38  font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42  margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46  font-family: Arial, sans serif;
47}
48
49h1, h2, h3 {
50  border-bottom: solid #CCC 1px;
51}
52
53.toc_element {
54  margin-top: 0.5em;
55}
56
57.firstline {
58  margin-left: 2 em;
59}
60
61.method  {
62  margin-top: 1em;
63  border: solid 1px #CCC;
64  padding: 1em;
65  background: #EEE;
66}
67
68.details {
69  font-weight: bold;
70  font-size: 14px;
71}
72
73</style>
74
75<h1><a href="gmail_v1.html">Gmail API</a> . <a href="gmail_v1.users.html">users</a> . <a href="gmail_v1.users.history.html">history</a></h1>
76<h2>Instance Methods</h2>
77<p class="toc_element">
78  <code><a href="#close">close()</a></code></p>
79<p class="firstline">Close httplib2 connections.</p>
80<p class="toc_element">
81  <code><a href="#list">list(userId, historyTypes=None, labelId=None, maxResults=None, pageToken=None, startHistoryId=None, x__xgafv=None)</a></code></p>
82<p class="firstline">Lists the history of all changes to the given mailbox. History results are returned in chronological order (increasing `historyId`).</p>
83<p class="toc_element">
84  <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p>
85<p class="firstline">Retrieves the next page of results.</p>
86<h3>Method Details</h3>
87<div class="method">
88    <code class="details" id="close">close()</code>
89  <pre>Close httplib2 connections.</pre>
90</div>
91
92<div class="method">
93    <code class="details" id="list">list(userId, historyTypes=None, labelId=None, maxResults=None, pageToken=None, startHistoryId=None, x__xgafv=None)</code>
94  <pre>Lists the history of all changes to the given mailbox. History results are returned in chronological order (increasing `historyId`).
95
96Args:
97  userId: string, The user&#x27;s email address. The special value `me` can be used to indicate the authenticated user. (required)
98  historyTypes: string, History types to be returned by the function (repeated)
99    Allowed values
100      messageAdded -
101      messageDeleted -
102      labelAdded -
103      labelRemoved -
104  labelId: string, Only return messages with a label matching the ID.
105  maxResults: integer, Maximum number of history records to return. This field defaults to 100. The maximum allowed value for this field is 500.
106  pageToken: string, Page token to retrieve a specific page of results in the list.
107  startHistoryId: string, Required. Returns history records after the specified `startHistoryId`. The supplied `startHistoryId` should be obtained from the `historyId` of a message, thread, or previous `list` response. History IDs increase chronologically but are not contiguous with random gaps in between valid IDs. Supplying an invalid or out of date `startHistoryId` typically returns an `HTTP 404` error code. A `historyId` is typically valid for at least a week, but in some rare circumstances may be valid for only a few hours. If you receive an `HTTP 404` error response, your application should perform a full sync. If you receive no `nextPageToken` in the response, there are no updates to retrieve and you can store the returned `historyId` for a future request.
108  x__xgafv: string, V1 error format.
109    Allowed values
110      1 - v1 error format
111      2 - v2 error format
112
113Returns:
114  An object of the form:
115
116    {
117  &quot;history&quot;: [ # List of history records. Any `messages` contained in the response will typically only have `id` and `threadId` fields populated.
118    { # A record of a change to the user&#x27;s mailbox. Each history change may affect multiple messages in multiple ways.
119      &quot;id&quot;: &quot;A String&quot;, # The mailbox sequence ID.
120      &quot;labelsAdded&quot;: [ # Labels added to messages in this history record.
121        {
122          &quot;labelIds&quot;: [ # Label IDs added to the message.
123            &quot;A String&quot;,
124          ],
125          &quot;message&quot;: { # An email message.
126            &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
127            &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
128            &quot;internalDate&quot;: &quot;A String&quot;, # The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the `Date` header. However, for API-migrated mail, it can be configured by client to be based on the `Date` header.
129            &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
130              &quot;A String&quot;,
131            ],
132            &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
133              &quot;body&quot;: { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts.
134                &quot;attachmentId&quot;: &quot;A String&quot;, # When present, contains the ID of an external attachment that can be retrieved in a separate `messages.attachments.get` request. When not present, the entire content of the message part body is contained in the data field.
135                &quot;data&quot;: &quot;A String&quot;, # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment.
136                &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
137              },
138              &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
139              &quot;headers&quot;: [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as `To`, `From`, and `Subject`.
140                {
141                  &quot;name&quot;: &quot;A String&quot;, # The name of the header before the `:` separator. For example, `To`.
142                  &quot;value&quot;: &quot;A String&quot;, # The value of the header after the `:` separator. For example, `[email protected]`.
143                },
144              ],
145              &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
146              &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
147              &quot;parts&quot;: [ # The child MIME message parts of this part. This only applies to container MIME message parts, for example `multipart/*`. For non- container MIME message part types, such as `text/plain`, this field is empty. For more information, see RFC 1521.
148                # Object with schema name: MessagePart
149              ],
150            },
151            &quot;raw&quot;: &quot;A String&quot;, # The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in `messages.get` and `drafts.get` responses when the `format=RAW` parameter is supplied.
152            &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
153            &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
154            &quot;threadId&quot;: &quot;A String&quot;, # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested `threadId` must be specified on the `Message` or `Draft.Message` you supply with your request. 2. The `References` and `In-Reply-To` headers must be set in compliance with the [RFC 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` headers must match.
155          },
156        },
157      ],
158      &quot;labelsRemoved&quot;: [ # Labels removed from messages in this history record.
159        {
160          &quot;labelIds&quot;: [ # Label IDs removed from the message.
161            &quot;A String&quot;,
162          ],
163          &quot;message&quot;: { # An email message.
164            &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
165            &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
166            &quot;internalDate&quot;: &quot;A String&quot;, # The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the `Date` header. However, for API-migrated mail, it can be configured by client to be based on the `Date` header.
167            &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
168              &quot;A String&quot;,
169            ],
170            &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
171              &quot;body&quot;: { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts.
172                &quot;attachmentId&quot;: &quot;A String&quot;, # When present, contains the ID of an external attachment that can be retrieved in a separate `messages.attachments.get` request. When not present, the entire content of the message part body is contained in the data field.
173                &quot;data&quot;: &quot;A String&quot;, # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment.
174                &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
175              },
176              &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
177              &quot;headers&quot;: [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as `To`, `From`, and `Subject`.
178                {
179                  &quot;name&quot;: &quot;A String&quot;, # The name of the header before the `:` separator. For example, `To`.
180                  &quot;value&quot;: &quot;A String&quot;, # The value of the header after the `:` separator. For example, `[email protected]`.
181                },
182              ],
183              &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
184              &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
185              &quot;parts&quot;: [ # The child MIME message parts of this part. This only applies to container MIME message parts, for example `multipart/*`. For non- container MIME message part types, such as `text/plain`, this field is empty. For more information, see RFC 1521.
186                # Object with schema name: MessagePart
187              ],
188            },
189            &quot;raw&quot;: &quot;A String&quot;, # The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in `messages.get` and `drafts.get` responses when the `format=RAW` parameter is supplied.
190            &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
191            &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
192            &quot;threadId&quot;: &quot;A String&quot;, # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested `threadId` must be specified on the `Message` or `Draft.Message` you supply with your request. 2. The `References` and `In-Reply-To` headers must be set in compliance with the [RFC 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` headers must match.
193          },
194        },
195      ],
196      &quot;messages&quot;: [ # List of messages changed in this history record. The fields for specific change types, such as `messagesAdded` may duplicate messages in this field. We recommend using the specific change-type fields instead of this.
197        { # An email message.
198          &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
199          &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
200          &quot;internalDate&quot;: &quot;A String&quot;, # The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the `Date` header. However, for API-migrated mail, it can be configured by client to be based on the `Date` header.
201          &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
202            &quot;A String&quot;,
203          ],
204          &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
205            &quot;body&quot;: { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts.
206              &quot;attachmentId&quot;: &quot;A String&quot;, # When present, contains the ID of an external attachment that can be retrieved in a separate `messages.attachments.get` request. When not present, the entire content of the message part body is contained in the data field.
207              &quot;data&quot;: &quot;A String&quot;, # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment.
208              &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
209            },
210            &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
211            &quot;headers&quot;: [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as `To`, `From`, and `Subject`.
212              {
213                &quot;name&quot;: &quot;A String&quot;, # The name of the header before the `:` separator. For example, `To`.
214                &quot;value&quot;: &quot;A String&quot;, # The value of the header after the `:` separator. For example, `[email protected]`.
215              },
216            ],
217            &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
218            &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
219            &quot;parts&quot;: [ # The child MIME message parts of this part. This only applies to container MIME message parts, for example `multipart/*`. For non- container MIME message part types, such as `text/plain`, this field is empty. For more information, see RFC 1521.
220              # Object with schema name: MessagePart
221            ],
222          },
223          &quot;raw&quot;: &quot;A String&quot;, # The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in `messages.get` and `drafts.get` responses when the `format=RAW` parameter is supplied.
224          &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
225          &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
226          &quot;threadId&quot;: &quot;A String&quot;, # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested `threadId` must be specified on the `Message` or `Draft.Message` you supply with your request. 2. The `References` and `In-Reply-To` headers must be set in compliance with the [RFC 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` headers must match.
227        },
228      ],
229      &quot;messagesAdded&quot;: [ # Messages added to the mailbox in this history record.
230        {
231          &quot;message&quot;: { # An email message.
232            &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
233            &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
234            &quot;internalDate&quot;: &quot;A String&quot;, # The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the `Date` header. However, for API-migrated mail, it can be configured by client to be based on the `Date` header.
235            &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
236              &quot;A String&quot;,
237            ],
238            &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
239              &quot;body&quot;: { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts.
240                &quot;attachmentId&quot;: &quot;A String&quot;, # When present, contains the ID of an external attachment that can be retrieved in a separate `messages.attachments.get` request. When not present, the entire content of the message part body is contained in the data field.
241                &quot;data&quot;: &quot;A String&quot;, # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment.
242                &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
243              },
244              &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
245              &quot;headers&quot;: [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as `To`, `From`, and `Subject`.
246                {
247                  &quot;name&quot;: &quot;A String&quot;, # The name of the header before the `:` separator. For example, `To`.
248                  &quot;value&quot;: &quot;A String&quot;, # The value of the header after the `:` separator. For example, `[email protected]`.
249                },
250              ],
251              &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
252              &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
253              &quot;parts&quot;: [ # The child MIME message parts of this part. This only applies to container MIME message parts, for example `multipart/*`. For non- container MIME message part types, such as `text/plain`, this field is empty. For more information, see RFC 1521.
254                # Object with schema name: MessagePart
255              ],
256            },
257            &quot;raw&quot;: &quot;A String&quot;, # The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in `messages.get` and `drafts.get` responses when the `format=RAW` parameter is supplied.
258            &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
259            &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
260            &quot;threadId&quot;: &quot;A String&quot;, # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested `threadId` must be specified on the `Message` or `Draft.Message` you supply with your request. 2. The `References` and `In-Reply-To` headers must be set in compliance with the [RFC 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` headers must match.
261          },
262        },
263      ],
264      &quot;messagesDeleted&quot;: [ # Messages deleted (not Trashed) from the mailbox in this history record.
265        {
266          &quot;message&quot;: { # An email message.
267            &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
268            &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
269            &quot;internalDate&quot;: &quot;A String&quot;, # The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the `Date` header. However, for API-migrated mail, it can be configured by client to be based on the `Date` header.
270            &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
271              &quot;A String&quot;,
272            ],
273            &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
274              &quot;body&quot;: { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts.
275                &quot;attachmentId&quot;: &quot;A String&quot;, # When present, contains the ID of an external attachment that can be retrieved in a separate `messages.attachments.get` request. When not present, the entire content of the message part body is contained in the data field.
276                &quot;data&quot;: &quot;A String&quot;, # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment.
277                &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
278              },
279              &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
280              &quot;headers&quot;: [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as `To`, `From`, and `Subject`.
281                {
282                  &quot;name&quot;: &quot;A String&quot;, # The name of the header before the `:` separator. For example, `To`.
283                  &quot;value&quot;: &quot;A String&quot;, # The value of the header after the `:` separator. For example, `[email protected]`.
284                },
285              ],
286              &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
287              &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
288              &quot;parts&quot;: [ # The child MIME message parts of this part. This only applies to container MIME message parts, for example `multipart/*`. For non- container MIME message part types, such as `text/plain`, this field is empty. For more information, see RFC 1521.
289                # Object with schema name: MessagePart
290              ],
291            },
292            &quot;raw&quot;: &quot;A String&quot;, # The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in `messages.get` and `drafts.get` responses when the `format=RAW` parameter is supplied.
293            &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
294            &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
295            &quot;threadId&quot;: &quot;A String&quot;, # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested `threadId` must be specified on the `Message` or `Draft.Message` you supply with your request. 2. The `References` and `In-Reply-To` headers must be set in compliance with the [RFC 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` headers must match.
296          },
297        },
298      ],
299    },
300  ],
301  &quot;historyId&quot;: &quot;A String&quot;, # The ID of the mailbox&#x27;s current history record.
302  &quot;nextPageToken&quot;: &quot;A String&quot;, # Page token to retrieve the next page of results in the list.
303}</pre>
304</div>
305
306<div class="method">
307    <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
308  <pre>Retrieves the next page of results.
309
310Args:
311  previous_request: The request for the previous page. (required)
312  previous_response: The response from the request for the previous page. (required)
313
314Returns:
315  A request object that you can call &#x27;execute()&#x27; on to request the next
316  page. Returns None if there are no more items in the collection.
317    </pre>
318</div>
319
320</body></html>