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.threads.html">threads</a></h1> 76<h2>Instance Methods</h2> 77<p class="toc_element"> 78 <code><a href="#delete">delete(userId, id)</a></code></p> 79<p class="firstline">Immediately and permanently deletes the specified thread. This operation cannot be undone. Prefer threads.trash instead.</p> 80<p class="toc_element"> 81 <code><a href="#get">get(userId, id, format=None, metadataHeaders=None)</a></code></p> 82<p class="firstline">Gets the specified thread.</p> 83<p class="toc_element"> 84 <code><a href="#list">list(userId, labelIds=None, q=None, pageToken=None, maxResults=None, includeSpamTrash=None)</a></code></p> 85<p class="firstline">Lists the threads in the user's mailbox.</p> 86<p class="toc_element"> 87 <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p> 88<p class="firstline">Retrieves the next page of results.</p> 89<p class="toc_element"> 90 <code><a href="#modify">modify(userId, id, body)</a></code></p> 91<p class="firstline">Modifies the labels applied to the thread. This applies to all messages in the thread.</p> 92<p class="toc_element"> 93 <code><a href="#trash">trash(userId, id)</a></code></p> 94<p class="firstline">Moves the specified thread to the trash.</p> 95<p class="toc_element"> 96 <code><a href="#untrash">untrash(userId, id)</a></code></p> 97<p class="firstline">Removes the specified thread from the trash.</p> 98<h3>Method Details</h3> 99<div class="method"> 100 <code class="details" id="delete">delete(userId, id)</code> 101 <pre>Immediately and permanently deletes the specified thread. This operation cannot be undone. Prefer threads.trash instead. 102 103Args: 104 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required) 105 id: string, ID of the Thread to delete. (required) 106</pre> 107</div> 108 109<div class="method"> 110 <code class="details" id="get">get(userId, id, format=None, metadataHeaders=None)</code> 111 <pre>Gets the specified thread. 112 113Args: 114 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required) 115 id: string, The ID of the thread to retrieve. (required) 116 format: string, The format to return the messages in. 117 Allowed values 118 full - 119 metadata - 120 minimal - 121 metadataHeaders: string, When given and format is METADATA, only include headers specified. (repeated) 122 123Returns: 124 An object of the form: 125 126 { # A collection of messages representing a conversation. 127 "snippet": "A String", # A short part of the message text. 128 "messages": [ # The list of messages in the thread. 129 { # An email message. 130 "internalDate": "A String", # 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. 131 "historyId": "A String", # The ID of the last history record that modified this message. 132 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 133 "body": { # 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 "data": "A String", # 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. 135 "attachmentId": "A String", # 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. 136 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 137 }, 138 "mimeType": "A String", # The MIME type of the message part. 139 "partId": "A String", # The immutable ID of the message part. 140 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 141 "headers": [ # 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. 142 { 143 "name": "A String", # The name of the header before the : separator. For example, To. 144 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com. 145 }, 146 ], 147 "parts": [ # 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 "snippet": "A String", # A short part of the message text. 152 "raw": "A String", # 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. 153 "sizeEstimate": 42, # Estimated size in bytes of the message. 154 "threadId": "A String", # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 155 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request. 156 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard. 157 # - The Subject headers must match. 158 "labelIds": [ # List of IDs of labels applied to this message. 159 "A String", 160 ], 161 "id": "A String", # The immutable ID of the message. 162 }, 163 ], 164 "id": "A String", # The unique ID of the thread. 165 "historyId": "A String", # The ID of the last history record that modified this thread. 166 }</pre> 167</div> 168 169<div class="method"> 170 <code class="details" id="list">list(userId, labelIds=None, q=None, pageToken=None, maxResults=None, includeSpamTrash=None)</code> 171 <pre>Lists the threads in the user's mailbox. 172 173Args: 174 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required) 175 labelIds: string, Only return threads with labels that match all of the specified label IDs. (repeated) 176 q: string, Only return threads matching the specified query. Supports the same query format as the Gmail search box. For example, "from:someuser@example.com rfc822msgid: is:unread". Parameter cannot be used when accessing the api using the gmail.metadata scope. 177 pageToken: string, Page token to retrieve a specific page of results in the list. 178 maxResults: integer, Maximum number of threads to return. 179 includeSpamTrash: boolean, Include threads from SPAM and TRASH in the results. 180 181Returns: 182 An object of the form: 183 184 { 185 "nextPageToken": "A String", # Page token to retrieve the next page of results in the list. 186 "resultSizeEstimate": 42, # Estimated total number of results. 187 "threads": [ # List of threads. 188 { # A collection of messages representing a conversation. 189 "snippet": "A String", # A short part of the message text. 190 "messages": [ # The list of messages in the thread. 191 { # An email message. 192 "internalDate": "A String", # 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. 193 "historyId": "A String", # The ID of the last history record that modified this message. 194 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 195 "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. 196 "data": "A String", # 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. 197 "attachmentId": "A String", # 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. 198 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 199 }, 200 "mimeType": "A String", # The MIME type of the message part. 201 "partId": "A String", # The immutable ID of the message part. 202 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 203 "headers": [ # 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. 204 { 205 "name": "A String", # The name of the header before the : separator. For example, To. 206 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com. 207 }, 208 ], 209 "parts": [ # 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. 210 # Object with schema name: MessagePart 211 ], 212 }, 213 "snippet": "A String", # A short part of the message text. 214 "raw": "A String", # 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. 215 "sizeEstimate": 42, # Estimated size in bytes of the message. 216 "threadId": "A String", # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 217 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request. 218 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard. 219 # - The Subject headers must match. 220 "labelIds": [ # List of IDs of labels applied to this message. 221 "A String", 222 ], 223 "id": "A String", # The immutable ID of the message. 224 }, 225 ], 226 "id": "A String", # The unique ID of the thread. 227 "historyId": "A String", # The ID of the last history record that modified this thread. 228 }, 229 ], 230 }</pre> 231</div> 232 233<div class="method"> 234 <code class="details" id="list_next">list_next(previous_request, previous_response)</code> 235 <pre>Retrieves the next page of results. 236 237Args: 238 previous_request: The request for the previous page. (required) 239 previous_response: The response from the request for the previous page. (required) 240 241Returns: 242 A request object that you can call 'execute()' on to request the next 243 page. Returns None if there are no more items in the collection. 244 </pre> 245</div> 246 247<div class="method"> 248 <code class="details" id="modify">modify(userId, id, body)</code> 249 <pre>Modifies the labels applied to the thread. This applies to all messages in the thread. 250 251Args: 252 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required) 253 id: string, The ID of the thread to modify. (required) 254 body: object, The request body. (required) 255 The object takes the form of: 256 257{ 258 "removeLabelIds": [ # A list of IDs of labels to remove from this thread. 259 "A String", 260 ], 261 "addLabelIds": [ # A list of IDs of labels to add to this thread. 262 "A String", 263 ], 264 } 265 266 267Returns: 268 An object of the form: 269 270 { # A collection of messages representing a conversation. 271 "snippet": "A String", # A short part of the message text. 272 "messages": [ # The list of messages in the thread. 273 { # An email message. 274 "internalDate": "A String", # 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. 275 "historyId": "A String", # The ID of the last history record that modified this message. 276 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 277 "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. 278 "data": "A String", # 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. 279 "attachmentId": "A String", # 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. 280 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 281 }, 282 "mimeType": "A String", # The MIME type of the message part. 283 "partId": "A String", # The immutable ID of the message part. 284 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 285 "headers": [ # 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. 286 { 287 "name": "A String", # The name of the header before the : separator. For example, To. 288 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com. 289 }, 290 ], 291 "parts": [ # 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. 292 # Object with schema name: MessagePart 293 ], 294 }, 295 "snippet": "A String", # A short part of the message text. 296 "raw": "A String", # 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. 297 "sizeEstimate": 42, # Estimated size in bytes of the message. 298 "threadId": "A String", # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 299 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request. 300 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard. 301 # - The Subject headers must match. 302 "labelIds": [ # List of IDs of labels applied to this message. 303 "A String", 304 ], 305 "id": "A String", # The immutable ID of the message. 306 }, 307 ], 308 "id": "A String", # The unique ID of the thread. 309 "historyId": "A String", # The ID of the last history record that modified this thread. 310 }</pre> 311</div> 312 313<div class="method"> 314 <code class="details" id="trash">trash(userId, id)</code> 315 <pre>Moves the specified thread to the trash. 316 317Args: 318 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required) 319 id: string, The ID of the thread to Trash. (required) 320 321Returns: 322 An object of the form: 323 324 { # A collection of messages representing a conversation. 325 "snippet": "A String", # A short part of the message text. 326 "messages": [ # The list of messages in the thread. 327 { # An email message. 328 "internalDate": "A String", # 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. 329 "historyId": "A String", # The ID of the last history record that modified this message. 330 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 331 "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. 332 "data": "A String", # 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. 333 "attachmentId": "A String", # 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. 334 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 335 }, 336 "mimeType": "A String", # The MIME type of the message part. 337 "partId": "A String", # The immutable ID of the message part. 338 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 339 "headers": [ # 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. 340 { 341 "name": "A String", # The name of the header before the : separator. For example, To. 342 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com. 343 }, 344 ], 345 "parts": [ # 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. 346 # Object with schema name: MessagePart 347 ], 348 }, 349 "snippet": "A String", # A short part of the message text. 350 "raw": "A String", # 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. 351 "sizeEstimate": 42, # Estimated size in bytes of the message. 352 "threadId": "A String", # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 353 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request. 354 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard. 355 # - The Subject headers must match. 356 "labelIds": [ # List of IDs of labels applied to this message. 357 "A String", 358 ], 359 "id": "A String", # The immutable ID of the message. 360 }, 361 ], 362 "id": "A String", # The unique ID of the thread. 363 "historyId": "A String", # The ID of the last history record that modified this thread. 364 }</pre> 365</div> 366 367<div class="method"> 368 <code class="details" id="untrash">untrash(userId, id)</code> 369 <pre>Removes the specified thread from the trash. 370 371Args: 372 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required) 373 id: string, The ID of the thread to remove from Trash. (required) 374 375Returns: 376 An object of the form: 377 378 { # A collection of messages representing a conversation. 379 "snippet": "A String", # A short part of the message text. 380 "messages": [ # The list of messages in the thread. 381 { # An email message. 382 "internalDate": "A String", # 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. 383 "historyId": "A String", # The ID of the last history record that modified this message. 384 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 385 "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. 386 "data": "A String", # 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. 387 "attachmentId": "A String", # 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. 388 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 389 }, 390 "mimeType": "A String", # The MIME type of the message part. 391 "partId": "A String", # The immutable ID of the message part. 392 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 393 "headers": [ # 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. 394 { 395 "name": "A String", # The name of the header before the : separator. For example, To. 396 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com. 397 }, 398 ], 399 "parts": [ # 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. 400 # Object with schema name: MessagePart 401 ], 402 }, 403 "snippet": "A String", # A short part of the message text. 404 "raw": "A String", # 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. 405 "sizeEstimate": 42, # Estimated size in bytes of the message. 406 "threadId": "A String", # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 407 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request. 408 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard. 409 # - The Subject headers must match. 410 "labelIds": [ # List of IDs of labels applied to this message. 411 "A String", 412 ], 413 "id": "A String", # The immutable ID of the message. 414 }, 415 ], 416 "id": "A String", # The unique ID of the thread. 417 "historyId": "A String", # The ID of the last history record that modified this thread. 418 }</pre> 419</div> 420 421</body></html>