openapi: 3.0.0
info:
title: Gmail API
description: The Gmail API lets you view and manage Gmail mailbox data like threads, messages, and labels.
termsOfService: https://developers.google.com/terms/
contact:
name: Google
url: https://google.com
x-twitter: youtube
license:
name: Creative Commons Attribution 3.0
url: http://creativecommons.org/licenses/by/3.0/
version: v1
x-apiClientRegistration:
url: https://console.developers.google.com
x-apisguru-categories:
- analytics
- media
x-logo:
url: https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png
x-origin:
- format: google
url: https://gmail.googleapis.com/$discovery/rest?version=v1
version: v1
x-providerName: googleapis.com
x-serviceName: gmail
servers:
- url: https://gmail.googleapis.com/
paths:
/gmail/v1/users/{userId}/drafts:
get:
tags:
- users
description: Lists the drafts in the user's mailbox.
operationId: drafts.list
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: includeSpamTrash
description: Include drafts from `SPAM` and `TRASH` in the results.
schema:
type: boolean
in: query
style: form
- name: maxResults
description: Maximum number of drafts to return. This field defaults to 100. The maximum allowed value for this field is 500.
schema:
type: integer
in: query
style: form
- name: pageToken
description: Page token to retrieve a specific page of results in the list.
schema:
type: string
in: query
style: form
- name: q
description: 'Only return draft messages matching the specified query. Supports the same query format as the Gmail search box. For example, `"from:someuser@example.com rfc822msgid: is:unread"`.'
schema:
type: string
in: query
style: form
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/ListDraftsResponse'
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.compose
Oauth2c:
- https://www.googleapis.com/auth/gmail.compose
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
post:
tags:
- users
description: Creates a new draft with the `DRAFT` label.
operationId: drafts.create
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
message/cpim:
schema:
$ref: '#/components/schemas/Draft'
message/delivery-status:
schema:
$ref: '#/components/schemas/Draft'
message/disposition-notification:
schema:
$ref: '#/components/schemas/Draft'
message/external-body:
schema:
$ref: '#/components/schemas/Draft'
message/feedback-report:
schema:
$ref: '#/components/schemas/Draft'
message/global:
schema:
$ref: '#/components/schemas/Draft'
message/global-delivery-status:
schema:
$ref: '#/components/schemas/Draft'
message/global-disposition-notification:
schema:
$ref: '#/components/schemas/Draft'
message/global-headers:
schema:
$ref: '#/components/schemas/Draft'
message/http:
schema:
$ref: '#/components/schemas/Draft'
message/imdn+xml:
schema:
$ref: '#/components/schemas/Draft'
message/news:
schema:
$ref: '#/components/schemas/Draft'
message/partial:
schema:
$ref: '#/components/schemas/Draft'
message/rfc822:
schema:
$ref: '#/components/schemas/Draft'
message/s-http:
schema:
$ref: '#/components/schemas/Draft'
message/sip:
schema:
$ref: '#/components/schemas/Draft'
message/sipfrag:
schema:
$ref: '#/components/schemas/Draft'
message/tracking-status:
schema:
$ref: '#/components/schemas/Draft'
message/vnd.si.simp:
schema:
$ref: '#/components/schemas/Draft'
message/vnd.wfa.wsc:
schema:
$ref: '#/components/schemas/Draft'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Draft'
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.addons.current.action.compose
Oauth2c:
- https://www.googleapis.com/auth/gmail.addons.current.action.compose
- Oauth2:
- https://www.googleapis.com/auth/gmail.compose
Oauth2c:
- https://www.googleapis.com/auth/gmail.compose
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
/gmail/v1/users/{userId}/drafts/send:
post:
tags:
- users
description: Sends the specified, existing draft to the recipients in the `To`, `Cc`, and `Bcc` headers.
operationId: drafts.send
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
message/cpim:
schema:
$ref: '#/components/schemas/Draft'
message/delivery-status:
schema:
$ref: '#/components/schemas/Draft'
message/disposition-notification:
schema:
$ref: '#/components/schemas/Draft'
message/external-body:
schema:
$ref: '#/components/schemas/Draft'
message/feedback-report:
schema:
$ref: '#/components/schemas/Draft'
message/global:
schema:
$ref: '#/components/schemas/Draft'
message/global-delivery-status:
schema:
$ref: '#/components/schemas/Draft'
message/global-disposition-notification:
schema:
$ref: '#/components/schemas/Draft'
message/global-headers:
schema:
$ref: '#/components/schemas/Draft'
message/http:
schema:
$ref: '#/components/schemas/Draft'
message/imdn+xml:
schema:
$ref: '#/components/schemas/Draft'
message/news:
schema:
$ref: '#/components/schemas/Draft'
message/partial:
schema:
$ref: '#/components/schemas/Draft'
message/rfc822:
schema:
$ref: '#/components/schemas/Draft'
message/s-http:
schema:
$ref: '#/components/schemas/Draft'
message/sip:
schema:
$ref: '#/components/schemas/Draft'
message/sipfrag:
schema:
$ref: '#/components/schemas/Draft'
message/tracking-status:
schema:
$ref: '#/components/schemas/Draft'
message/vnd.si.simp:
schema:
$ref: '#/components/schemas/Draft'
message/vnd.wfa.wsc:
schema:
$ref: '#/components/schemas/Draft'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.addons.current.action.compose
Oauth2c:
- https://www.googleapis.com/auth/gmail.addons.current.action.compose
- Oauth2:
- https://www.googleapis.com/auth/gmail.compose
Oauth2c:
- https://www.googleapis.com/auth/gmail.compose
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
/gmail/v1/users/{userId}/drafts/{id}:
get:
tags:
- users
description: Gets the specified draft.
operationId: drafts.get
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: The ID of the draft to retrieve.
required: true
schema:
type: string
in: path
style: simple
- name: format
description: The format to return the draft in.
schema:
type: string
enum:
- minimal
- full
- raw
- metadata
in: query
style: form
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Draft'
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.compose
Oauth2c:
- https://www.googleapis.com/auth/gmail.compose
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
put:
tags:
- users
description: Replaces a draft's content.
operationId: drafts.update
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: The ID of the draft to update.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
message/cpim:
schema:
$ref: '#/components/schemas/Draft'
message/delivery-status:
schema:
$ref: '#/components/schemas/Draft'
message/disposition-notification:
schema:
$ref: '#/components/schemas/Draft'
message/external-body:
schema:
$ref: '#/components/schemas/Draft'
message/feedback-report:
schema:
$ref: '#/components/schemas/Draft'
message/global:
schema:
$ref: '#/components/schemas/Draft'
message/global-delivery-status:
schema:
$ref: '#/components/schemas/Draft'
message/global-disposition-notification:
schema:
$ref: '#/components/schemas/Draft'
message/global-headers:
schema:
$ref: '#/components/schemas/Draft'
message/http:
schema:
$ref: '#/components/schemas/Draft'
message/imdn+xml:
schema:
$ref: '#/components/schemas/Draft'
message/news:
schema:
$ref: '#/components/schemas/Draft'
message/partial:
schema:
$ref: '#/components/schemas/Draft'
message/rfc822:
schema:
$ref: '#/components/schemas/Draft'
message/s-http:
schema:
$ref: '#/components/schemas/Draft'
message/sip:
schema:
$ref: '#/components/schemas/Draft'
message/sipfrag:
schema:
$ref: '#/components/schemas/Draft'
message/tracking-status:
schema:
$ref: '#/components/schemas/Draft'
message/vnd.si.simp:
schema:
$ref: '#/components/schemas/Draft'
message/vnd.wfa.wsc:
schema:
$ref: '#/components/schemas/Draft'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Draft'
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.addons.current.action.compose
Oauth2c:
- https://www.googleapis.com/auth/gmail.addons.current.action.compose
- Oauth2:
- https://www.googleapis.com/auth/gmail.compose
Oauth2c:
- https://www.googleapis.com/auth/gmail.compose
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
delete:
tags:
- users
description: Immediately and permanently deletes the specified draft. Does not simply trash it.
operationId: drafts.delete
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: The ID of the draft to delete.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.addons.current.action.compose
Oauth2c:
- https://www.googleapis.com/auth/gmail.addons.current.action.compose
- Oauth2:
- https://www.googleapis.com/auth/gmail.compose
Oauth2c:
- https://www.googleapis.com/auth/gmail.compose
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
/gmail/v1/users/{userId}/history:
get:
tags:
- users
description: Lists the history of all changes to the given mailbox. History results are returned in chronological order (increasing `historyId`).
operationId: history.list
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: historyTypes
description: History types to be returned by the function
schema:
type: array
items:
type: string
enum:
- messageAdded
- messageDeleted
- labelAdded
- labelRemoved
explode: true
in: query
style: form
- name: labelId
description: Only return messages with a label matching the ID.
schema:
type: string
in: query
style: form
- name: maxResults
description: Maximum number of history records to return. This field defaults to 100. The maximum allowed value for this field is 500.
schema:
type: integer
in: query
style: form
- name: pageToken
description: Page token to retrieve a specific page of results in the list.
schema:
type: string
in: query
style: form
- name: startHistoryId
description: 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.
schema:
type: string
in: query
style: form
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/ListHistoryResponse'
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.metadata
Oauth2c:
- https://www.googleapis.com/auth/gmail.metadata
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
/gmail/v1/users/{userId}/labels:
get:
tags:
- users
description: Lists all labels in the user's mailbox.
operationId: labels.list
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
labels:
description: List of labels. Note that each label resource only contains an `id`, `name`, `messageListVisibility`, `labelListVisibility`, and `type`. The labels.get method can fetch additional label details.
type: array
items:
description: Labels are used to categorize messages and threads within the user's mailbox. The maximum number of labels supported for a user's mailbox is 10,000.
type: object
properties:
color:
description: The color to assign to the label. Color is only available for labels that have their `type` set to `user`.
type: object
properties:
backgroundColor:
description: 'The background color represented as hex string #RRGGBB (ex #000000). This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765'
type: string
textColor:
description: 'The text color of the label, represented as hex string. This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765'
type: string
id:
description: The immutable ID of the label.
type: string
labelListVisibility:
description: The visibility of the label in the label list in the Gmail web interface.
type: string
enum:
- labelShow
- labelShowIfUnread
- labelHide
messageListVisibility:
description: The visibility of messages with this label in the message list in the Gmail web interface.
type: string
enum:
- show
- hide
messagesTotal:
description: The total number of messages with the label.
type: integer
format: int32
messagesUnread:
description: The number of unread messages with the label.
type: integer
format: int32
name:
description: The display name of the label.
type: string
threadsTotal:
description: The total number of threads with the label.
type: integer
format: int32
threadsUnread:
description: The number of unread threads with the label.
type: integer
format: int32
type:
description: The owner type for the label. User labels are created by the user and can be modified and deleted by the user and can be applied to any message or thread. System labels are internally created and cannot be added, modified, or deleted. System labels may be able to be applied to or removed from messages and threads under some circumstances but this is not guaranteed. For example, users can apply and remove the `INBOX` and `UNREAD` labels from messages and threads, but cannot apply or remove the `DRAFTS` or `SENT` labels from messages or threads.
type: string
enum:
- system
- user
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.labels
Oauth2c:
- https://www.googleapis.com/auth/gmail.labels
- Oauth2:
- https://www.googleapis.com/auth/gmail.metadata
Oauth2c:
- https://www.googleapis.com/auth/gmail.metadata
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
post:
tags:
- users
description: Creates a new label.
operationId: labels.create
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
application/json:
schema:
description: Labels are used to categorize messages and threads within the user's mailbox. The maximum number of labels supported for a user's mailbox is 10,000.
type: object
properties:
color:
description: The color to assign to the label. Color is only available for labels that have their `type` set to `user`.
type: object
properties:
backgroundColor:
description: 'The background color represented as hex string #RRGGBB (ex #000000). This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765'
type: string
textColor:
description: 'The text color of the label, represented as hex string. This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765'
type: string
id:
description: The immutable ID of the label.
type: string
labelListVisibility:
description: The visibility of the label in the label list in the Gmail web interface.
type: string
enum:
- labelShow
- labelShowIfUnread
- labelHide
messageListVisibility:
description: The visibility of messages with this label in the message list in the Gmail web interface.
type: string
enum:
- show
- hide
messagesTotal:
description: The total number of messages with the label.
type: integer
format: int32
messagesUnread:
description: The number of unread messages with the label.
type: integer
format: int32
name:
description: The display name of the label.
type: string
threadsTotal:
description: The total number of threads with the label.
type: integer
format: int32
threadsUnread:
description: The number of unread threads with the label.
type: integer
format: int32
type:
description: The owner type for the label. User labels are created by the user and can be modified and deleted by the user and can be applied to any message or thread. System labels are internally created and cannot be added, modified, or deleted. System labels may be able to be applied to or removed from messages and threads under some circumstances but this is not guaranteed. For example, users can apply and remove the `INBOX` and `UNREAD` labels from messages and threads, but cannot apply or remove the `DRAFTS` or `SENT` labels from messages or threads.
type: string
enum:
- system
- user
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Labels are used to categorize messages and threads within the user's mailbox. The maximum number of labels supported for a user's mailbox is 10,000.
type: object
properties:
color:
description: The color to assign to the label. Color is only available for labels that have their `type` set to `user`.
type: object
properties:
backgroundColor:
description: 'The background color represented as hex string #RRGGBB (ex #000000). This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765'
type: string
textColor:
description: 'The text color of the label, represented as hex string. This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765'
type: string
id:
description: The immutable ID of the label.
type: string
labelListVisibility:
description: The visibility of the label in the label list in the Gmail web interface.
type: string
enum:
- labelShow
- labelShowIfUnread
- labelHide
messageListVisibility:
description: The visibility of messages with this label in the message list in the Gmail web interface.
type: string
enum:
- show
- hide
messagesTotal:
description: The total number of messages with the label.
type: integer
format: int32
messagesUnread:
description: The number of unread messages with the label.
type: integer
format: int32
name:
description: The display name of the label.
type: string
threadsTotal:
description: The total number of threads with the label.
type: integer
format: int32
threadsUnread:
description: The number of unread threads with the label.
type: integer
format: int32
type:
description: The owner type for the label. User labels are created by the user and can be modified and deleted by the user and can be applied to any message or thread. System labels are internally created and cannot be added, modified, or deleted. System labels may be able to be applied to or removed from messages and threads under some circumstances but this is not guaranteed. For example, users can apply and remove the `INBOX` and `UNREAD` labels from messages and threads, but cannot apply or remove the `DRAFTS` or `SENT` labels from messages or threads.
type: string
enum:
- system
- user
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.labels
Oauth2c:
- https://www.googleapis.com/auth/gmail.labels
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
/gmail/v1/users/{userId}/labels/{id}:
get:
tags:
- users
description: Gets the specified label.
operationId: labels.get
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: The ID of the label to retrieve.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Labels are used to categorize messages and threads within the user's mailbox. The maximum number of labels supported for a user's mailbox is 10,000.
type: object
properties:
color:
description: The color to assign to the label. Color is only available for labels that have their `type` set to `user`.
type: object
properties:
backgroundColor:
description: 'The background color represented as hex string #RRGGBB (ex #000000). This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765'
type: string
textColor:
description: 'The text color of the label, represented as hex string. This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765'
type: string
id:
description: The immutable ID of the label.
type: string
labelListVisibility:
description: The visibility of the label in the label list in the Gmail web interface.
type: string
enum:
- labelShow
- labelShowIfUnread
- labelHide
messageListVisibility:
description: The visibility of messages with this label in the message list in the Gmail web interface.
type: string
enum:
- show
- hide
messagesTotal:
description: The total number of messages with the label.
type: integer
format: int32
messagesUnread:
description: The number of unread messages with the label.
type: integer
format: int32
name:
description: The display name of the label.
type: string
threadsTotal:
description: The total number of threads with the label.
type: integer
format: int32
threadsUnread:
description: The number of unread threads with the label.
type: integer
format: int32
type:
description: The owner type for the label. User labels are created by the user and can be modified and deleted by the user and can be applied to any message or thread. System labels are internally created and cannot be added, modified, or deleted. System labels may be able to be applied to or removed from messages and threads under some circumstances but this is not guaranteed. For example, users can apply and remove the `INBOX` and `UNREAD` labels from messages and threads, but cannot apply or remove the `DRAFTS` or `SENT` labels from messages or threads.
type: string
enum:
- system
- user
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.labels
Oauth2c:
- https://www.googleapis.com/auth/gmail.labels
- Oauth2:
- https://www.googleapis.com/auth/gmail.metadata
Oauth2c:
- https://www.googleapis.com/auth/gmail.metadata
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
put:
tags:
- users
description: Updates the specified label.
operationId: labels.update
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: The ID of the label to update.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
application/json:
schema:
description: Labels are used to categorize messages and threads within the user's mailbox. The maximum number of labels supported for a user's mailbox is 10,000.
type: object
properties:
color:
description: The color to assign to the label. Color is only available for labels that have their `type` set to `user`.
type: object
properties:
backgroundColor:
description: 'The background color represented as hex string #RRGGBB (ex #000000). This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765'
type: string
textColor:
description: 'The text color of the label, represented as hex string. This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765'
type: string
id:
description: The immutable ID of the label.
type: string
labelListVisibility:
description: The visibility of the label in the label list in the Gmail web interface.
type: string
enum:
- labelShow
- labelShowIfUnread
- labelHide
messageListVisibility:
description: The visibility of messages with this label in the message list in the Gmail web interface.
type: string
enum:
- show
- hide
messagesTotal:
description: The total number of messages with the label.
type: integer
format: int32
messagesUnread:
description: The number of unread messages with the label.
type: integer
format: int32
name:
description: The display name of the label.
type: string
threadsTotal:
description: The total number of threads with the label.
type: integer
format: int32
threadsUnread:
description: The number of unread threads with the label.
type: integer
format: int32
type:
description: The owner type for the label. User labels are created by the user and can be modified and deleted by the user and can be applied to any message or thread. System labels are internally created and cannot be added, modified, or deleted. System labels may be able to be applied to or removed from messages and threads under some circumstances but this is not guaranteed. For example, users can apply and remove the `INBOX` and `UNREAD` labels from messages and threads, but cannot apply or remove the `DRAFTS` or `SENT` labels from messages or threads.
type: string
enum:
- system
- user
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Labels are used to categorize messages and threads within the user's mailbox. The maximum number of labels supported for a user's mailbox is 10,000.
type: object
properties:
color:
description: The color to assign to the label. Color is only available for labels that have their `type` set to `user`.
type: object
properties:
backgroundColor:
description: 'The background color represented as hex string #RRGGBB (ex #000000). This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765'
type: string
textColor:
description: 'The text color of the label, represented as hex string. This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765'
type: string
id:
description: The immutable ID of the label.
type: string
labelListVisibility:
description: The visibility of the label in the label list in the Gmail web interface.
type: string
enum:
- labelShow
- labelShowIfUnread
- labelHide
messageListVisibility:
description: The visibility of messages with this label in the message list in the Gmail web interface.
type: string
enum:
- show
- hide
messagesTotal:
description: The total number of messages with the label.
type: integer
format: int32
messagesUnread:
description: The number of unread messages with the label.
type: integer
format: int32
name:
description: The display name of the label.
type: string
threadsTotal:
description: The total number of threads with the label.
type: integer
format: int32
threadsUnread:
description: The number of unread threads with the label.
type: integer
format: int32
type:
description: The owner type for the label. User labels are created by the user and can be modified and deleted by the user and can be applied to any message or thread. System labels are internally created and cannot be added, modified, or deleted. System labels may be able to be applied to or removed from messages and threads under some circumstances but this is not guaranteed. For example, users can apply and remove the `INBOX` and `UNREAD` labels from messages and threads, but cannot apply or remove the `DRAFTS` or `SENT` labels from messages or threads.
type: string
enum:
- system
- user
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.labels
Oauth2c:
- https://www.googleapis.com/auth/gmail.labels
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
delete:
tags:
- users
description: Immediately and permanently deletes the specified label and removes it from any messages and threads that it is applied to.
operationId: labels.delete
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: The ID of the label to delete.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.labels
Oauth2c:
- https://www.googleapis.com/auth/gmail.labels
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
patch:
tags:
- users
description: Patch the specified label.
operationId: labels.patch
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: The ID of the label to update.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
application/json:
schema:
description: Labels are used to categorize messages and threads within the user's mailbox. The maximum number of labels supported for a user's mailbox is 10,000.
type: object
properties:
color:
description: The color to assign to the label. Color is only available for labels that have their `type` set to `user`.
type: object
properties:
backgroundColor:
description: 'The background color represented as hex string #RRGGBB (ex #000000). This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765'
type: string
textColor:
description: 'The text color of the label, represented as hex string. This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765'
type: string
id:
description: The immutable ID of the label.
type: string
labelListVisibility:
description: The visibility of the label in the label list in the Gmail web interface.
type: string
enum:
- labelShow
- labelShowIfUnread
- labelHide
messageListVisibility:
description: The visibility of messages with this label in the message list in the Gmail web interface.
type: string
enum:
- show
- hide
messagesTotal:
description: The total number of messages with the label.
type: integer
format: int32
messagesUnread:
description: The number of unread messages with the label.
type: integer
format: int32
name:
description: The display name of the label.
type: string
threadsTotal:
description: The total number of threads with the label.
type: integer
format: int32
threadsUnread:
description: The number of unread threads with the label.
type: integer
format: int32
type:
description: The owner type for the label. User labels are created by the user and can be modified and deleted by the user and can be applied to any message or thread. System labels are internally created and cannot be added, modified, or deleted. System labels may be able to be applied to or removed from messages and threads under some circumstances but this is not guaranteed. For example, users can apply and remove the `INBOX` and `UNREAD` labels from messages and threads, but cannot apply or remove the `DRAFTS` or `SENT` labels from messages or threads.
type: string
enum:
- system
- user
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Labels are used to categorize messages and threads within the user's mailbox. The maximum number of labels supported for a user's mailbox is 10,000.
type: object
properties:
color:
description: The color to assign to the label. Color is only available for labels that have their `type` set to `user`.
type: object
properties:
backgroundColor:
description: 'The background color represented as hex string #RRGGBB (ex #000000). This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765'
type: string
textColor:
description: 'The text color of the label, represented as hex string. This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765'
type: string
id:
description: The immutable ID of the label.
type: string
labelListVisibility:
description: The visibility of the label in the label list in the Gmail web interface.
type: string
enum:
- labelShow
- labelShowIfUnread
- labelHide
messageListVisibility:
description: The visibility of messages with this label in the message list in the Gmail web interface.
type: string
enum:
- show
- hide
messagesTotal:
description: The total number of messages with the label.
type: integer
format: int32
messagesUnread:
description: The number of unread messages with the label.
type: integer
format: int32
name:
description: The display name of the label.
type: string
threadsTotal:
description: The total number of threads with the label.
type: integer
format: int32
threadsUnread:
description: The number of unread threads with the label.
type: integer
format: int32
type:
description: The owner type for the label. User labels are created by the user and can be modified and deleted by the user and can be applied to any message or thread. System labels are internally created and cannot be added, modified, or deleted. System labels may be able to be applied to or removed from messages and threads under some circumstances but this is not guaranteed. For example, users can apply and remove the `INBOX` and `UNREAD` labels from messages and threads, but cannot apply or remove the `DRAFTS` or `SENT` labels from messages or threads.
type: string
enum:
- system
- user
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.labels
Oauth2c:
- https://www.googleapis.com/auth/gmail.labels
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
/gmail/v1/users/{userId}/messages:
get:
tags:
- users
description: Lists the messages in the user's mailbox.
operationId: messages.list
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: includeSpamTrash
description: Include messages from `SPAM` and `TRASH` in the results.
schema:
type: boolean
in: query
style: form
- name: labelIds
description: Only return messages with labels that match all of the specified label IDs.
schema:
type: array
items:
type: string
explode: true
in: query
style: form
- name: maxResults
description: Maximum number of messages to return. This field defaults to 100. The maximum allowed value for this field is 500.
schema:
type: integer
in: query
style: form
- name: pageToken
description: Page token to retrieve a specific page of results in the list.
schema:
type: string
in: query
style: form
- name: q
description: 'Only return messages 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.'
schema:
type: string
in: query
style: form
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/ListMessagesResponse'
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.metadata
Oauth2c:
- https://www.googleapis.com/auth/gmail.metadata
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
post:
tags:
- users
description: Directly inserts a message into only this user's mailbox similar to `IMAP APPEND`, bypassing most scanning and classification. Does not send a message.
operationId: messages.insert
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: deleted
description: Mark the email as permanently deleted (not TRASH) and only visible in Google Vault to a Vault administrator. Only used for G Suite accounts.
schema:
type: boolean
in: query
style: form
- name: internalDateSource
description: Source for Gmail's internal date of the message.
schema:
type: string
enum:
- receivedTime
- dateHeader
in: query
style: form
requestBody:
content:
message/cpim:
schema:
$ref: '#/components/schemas/Message'
message/delivery-status:
schema:
$ref: '#/components/schemas/Message'
message/disposition-notification:
schema:
$ref: '#/components/schemas/Message'
message/external-body:
schema:
$ref: '#/components/schemas/Message'
message/feedback-report:
schema:
$ref: '#/components/schemas/Message'
message/global:
schema:
$ref: '#/components/schemas/Message'
message/global-delivery-status:
schema:
$ref: '#/components/schemas/Message'
message/global-disposition-notification:
schema:
$ref: '#/components/schemas/Message'
message/global-headers:
schema:
$ref: '#/components/schemas/Message'
message/http:
schema:
$ref: '#/components/schemas/Message'
message/imdn+xml:
schema:
$ref: '#/components/schemas/Message'
message/news:
schema:
$ref: '#/components/schemas/Message'
message/partial:
schema:
$ref: '#/components/schemas/Message'
message/rfc822:
schema:
$ref: '#/components/schemas/Message'
message/s-http:
schema:
$ref: '#/components/schemas/Message'
message/sip:
schema:
$ref: '#/components/schemas/Message'
message/sipfrag:
schema:
$ref: '#/components/schemas/Message'
message/tracking-status:
schema:
$ref: '#/components/schemas/Message'
message/vnd.si.simp:
schema:
$ref: '#/components/schemas/Message'
message/vnd.wfa.wsc:
schema:
$ref: '#/components/schemas/Message'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.insert
Oauth2c:
- https://www.googleapis.com/auth/gmail.insert
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
/gmail/v1/users/{userId}/messages/batchDelete:
post:
tags:
- users
description: Deletes many messages by message ID. Provides no guarantees that messages were not already deleted or even existed at all.
operationId: messages.batchDelete
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
application/json:
schema:
type: object
properties:
ids:
description: The IDs of the messages to delete.
type: array
items:
type: string
responses:
'200':
description: Successful response
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
/gmail/v1/users/{userId}/messages/batchModify:
post:
tags:
- users
description: Modifies the labels on the specified messages.
operationId: messages.batchModify
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
application/json:
schema:
type: object
properties:
addLabelIds:
description: A list of label IDs to add to messages.
type: array
items:
type: string
ids:
description: The IDs of the messages to modify. There is a limit of 1000 ids per request.
type: array
items:
type: string
removeLabelIds:
description: A list of label IDs to remove from messages.
type: array
items:
type: string
responses:
'200':
description: Successful response
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
/gmail/v1/users/{userId}/messages/import:
post:
tags:
- users
description: 'Imports a message into only this user''s mailbox, with standard email delivery scanning and classification similar to receiving via SMTP. This method doesn''t perform SPF checks, so it might not work for some spam messages, such as those attempting to perform domain spoofing. This method does not send a message. Note: This function doesn''t trigger forwarding rules or filters set up by the user.'
operationId: messages.import
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: deleted
description: Mark the email as permanently deleted (not TRASH) and only visible in Google Vault to a Vault administrator. Only used for G Suite accounts.
schema:
type: boolean
in: query
style: form
- name: internalDateSource
description: Source for Gmail's internal date of the message.
schema:
type: string
enum:
- receivedTime
- dateHeader
in: query
style: form
- name: neverMarkSpam
description: Ignore the Gmail spam classifier decision and never mark this email as SPAM in the mailbox.
schema:
type: boolean
in: query
style: form
- name: processForCalendar
description: Process calendar invites in the email and add any extracted meetings to the Google Calendar for this user.
schema:
type: boolean
in: query
style: form
requestBody:
content:
message/cpim:
schema:
$ref: '#/components/schemas/Message'
message/delivery-status:
schema:
$ref: '#/components/schemas/Message'
message/disposition-notification:
schema:
$ref: '#/components/schemas/Message'
message/external-body:
schema:
$ref: '#/components/schemas/Message'
message/feedback-report:
schema:
$ref: '#/components/schemas/Message'
message/global:
schema:
$ref: '#/components/schemas/Message'
message/global-delivery-status:
schema:
$ref: '#/components/schemas/Message'
message/global-disposition-notification:
schema:
$ref: '#/components/schemas/Message'
message/global-headers:
schema:
$ref: '#/components/schemas/Message'
message/http:
schema:
$ref: '#/components/schemas/Message'
message/imdn+xml:
schema:
$ref: '#/components/schemas/Message'
message/news:
schema:
$ref: '#/components/schemas/Message'
message/partial:
schema:
$ref: '#/components/schemas/Message'
message/rfc822:
schema:
$ref: '#/components/schemas/Message'
message/s-http:
schema:
$ref: '#/components/schemas/Message'
message/sip:
schema:
$ref: '#/components/schemas/Message'
message/sipfrag:
schema:
$ref: '#/components/schemas/Message'
message/tracking-status:
schema:
$ref: '#/components/schemas/Message'
message/vnd.si.simp:
schema:
$ref: '#/components/schemas/Message'
message/vnd.wfa.wsc:
schema:
$ref: '#/components/schemas/Message'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.insert
Oauth2c:
- https://www.googleapis.com/auth/gmail.insert
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
/gmail/v1/users/{userId}/messages/send:
post:
tags:
- users
description: Sends the specified message to the recipients in the `To`, `Cc`, and `Bcc` headers.
operationId: messages.send
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
message/cpim:
schema:
$ref: '#/components/schemas/Message'
message/delivery-status:
schema:
$ref: '#/components/schemas/Message'
message/disposition-notification:
schema:
$ref: '#/components/schemas/Message'
message/external-body:
schema:
$ref: '#/components/schemas/Message'
message/feedback-report:
schema:
$ref: '#/components/schemas/Message'
message/global:
schema:
$ref: '#/components/schemas/Message'
message/global-delivery-status:
schema:
$ref: '#/components/schemas/Message'
message/global-disposition-notification:
schema:
$ref: '#/components/schemas/Message'
message/global-headers:
schema:
$ref: '#/components/schemas/Message'
message/http:
schema:
$ref: '#/components/schemas/Message'
message/imdn+xml:
schema:
$ref: '#/components/schemas/Message'
message/news:
schema:
$ref: '#/components/schemas/Message'
message/partial:
schema:
$ref: '#/components/schemas/Message'
message/rfc822:
schema:
$ref: '#/components/schemas/Message'
message/s-http:
schema:
$ref: '#/components/schemas/Message'
message/sip:
schema:
$ref: '#/components/schemas/Message'
message/sipfrag:
schema:
$ref: '#/components/schemas/Message'
message/tracking-status:
schema:
$ref: '#/components/schemas/Message'
message/vnd.si.simp:
schema:
$ref: '#/components/schemas/Message'
message/vnd.wfa.wsc:
schema:
$ref: '#/components/schemas/Message'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.addons.current.action.compose
Oauth2c:
- https://www.googleapis.com/auth/gmail.addons.current.action.compose
- Oauth2:
- https://www.googleapis.com/auth/gmail.compose
Oauth2c:
- https://www.googleapis.com/auth/gmail.compose
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.send
Oauth2c:
- https://www.googleapis.com/auth/gmail.send
/gmail/v1/users/{userId}/messages/{id}:
get:
tags:
- users
description: Gets the specified message.
operationId: messages.get
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: The ID of the message to retrieve. This ID is usually retrieved using `messages.list`. The ID is also contained in the result when a message is inserted (`messages.insert`) or imported (`messages.import`).
required: true
schema:
type: string
in: path
style: simple
- name: format
description: The format to return the message in.
schema:
type: string
enum:
- minimal
- full
- raw
- metadata
in: query
style: form
- name: metadataHeaders
description: When given and format is `METADATA`, only include headers specified.
schema:
type: array
items:
type: string
explode: true
in: query
style: form
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.addons.current.message.action
Oauth2c:
- https://www.googleapis.com/auth/gmail.addons.current.message.action
- Oauth2:
- https://www.googleapis.com/auth/gmail.addons.current.message.metadata
Oauth2c:
- https://www.googleapis.com/auth/gmail.addons.current.message.metadata
- Oauth2:
- https://www.googleapis.com/auth/gmail.addons.current.message.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.addons.current.message.readonly
- Oauth2:
- https://www.googleapis.com/auth/gmail.metadata
Oauth2c:
- https://www.googleapis.com/auth/gmail.metadata
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
delete:
tags:
- users
description: Immediately and permanently deletes the specified message. This operation cannot be undone. Prefer `messages.trash` instead.
operationId: messages.delete
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: The ID of the message to delete.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
/gmail/v1/users/{userId}/messages/{id}/modify:
post:
tags:
- users
description: Modifies the labels on the specified message.
operationId: messages.modify
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: The ID of the message to modify.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
application/json:
schema:
type: object
properties:
addLabelIds:
description: A list of IDs of labels to add to this message.
type: array
items:
type: string
removeLabelIds:
description: A list IDs of labels to remove from this message.
type: array
items:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
/gmail/v1/users/{userId}/messages/{id}/trash:
post:
tags:
- users
description: Moves the specified message to the trash.
operationId: messages.trash
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: The ID of the message to Trash.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
/gmail/v1/users/{userId}/messages/{id}/untrash:
post:
tags:
- users
description: Removes the specified message from the trash.
operationId: messages.untrash
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: The ID of the message to remove from Trash.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
/gmail/v1/users/{userId}/messages/{messageId}/attachments/{id}:
get:
tags:
- users
description: Gets the specified message attachment.
operationId: messages.attachments.get
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: messageId
description: The ID of the message containing the attachment.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: The ID of the attachment.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: The body of a single MIME message part.
type: object
properties:
attachmentId:
description: 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.
type: string
data:
description: 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.
type: string
format: byte
size:
description: Number of bytes for the message part data (encoding notwithstanding).
type: integer
format: int32
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.addons.current.message.action
Oauth2c:
- https://www.googleapis.com/auth/gmail.addons.current.message.action
- Oauth2:
- https://www.googleapis.com/auth/gmail.addons.current.message.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.addons.current.message.readonly
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
/gmail/v1/users/{userId}/profile:
get:
tags:
- users
description: Gets the current user's Gmail profile.
operationId: getProfile
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Profile for a Gmail user.
type: object
properties:
emailAddress:
description: The user's email address.
type: string
historyId:
description: The ID of the mailbox's current history record.
type: string
format: uint64
messagesTotal:
description: The total number of messages in the mailbox.
type: integer
format: int32
threadsTotal:
description: The total number of threads in the mailbox.
type: integer
format: int32
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.compose
Oauth2c:
- https://www.googleapis.com/auth/gmail.compose
- Oauth2:
- https://www.googleapis.com/auth/gmail.metadata
Oauth2c:
- https://www.googleapis.com/auth/gmail.metadata
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
/gmail/v1/users/{userId}/settings/autoForwarding:
get:
tags:
- users
description: Gets the auto-forwarding setting for the specified account.
operationId: settings.getAutoForwarding
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Auto-forwarding settings for an account.
type: object
properties:
disposition:
description: The state that a message should be left in after it has been forwarded.
type: string
enum:
- dispositionUnspecified
- leaveInInbox
- archive
- trash
- markRead
emailAddress:
description: Email address to which all incoming messages are forwarded. This email address must be a verified member of the forwarding addresses.
type: string
enabled:
description: Whether all incoming mail is automatically forwarded to another address.
type: boolean
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
put:
tags:
- users
description: Updates the auto-forwarding setting for the specified account. A verified forwarding address must be specified when auto-forwarding is enabled. This method is only available to service account clients that have been delegated domain-wide authority.
operationId: settings.updateAutoForwarding
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
application/json:
schema:
description: Auto-forwarding settings for an account.
type: object
properties:
disposition:
description: The state that a message should be left in after it has been forwarded.
type: string
enum:
- dispositionUnspecified
- leaveInInbox
- archive
- trash
- markRead
emailAddress:
description: Email address to which all incoming messages are forwarded. This email address must be a verified member of the forwarding addresses.
type: string
enabled:
description: Whether all incoming mail is automatically forwarded to another address.
type: boolean
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Auto-forwarding settings for an account.
type: object
properties:
disposition:
description: The state that a message should be left in after it has been forwarded.
type: string
enum:
- dispositionUnspecified
- leaveInInbox
- archive
- trash
- markRead
emailAddress:
description: Email address to which all incoming messages are forwarded. This email address must be a verified member of the forwarding addresses.
type: string
enabled:
description: Whether all incoming mail is automatically forwarded to another address.
type: boolean
security:
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.sharing
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.sharing
/gmail/v1/users/{userId}/settings/delegates:
get:
tags:
- users
description: Lists the delegates for the specified account. This method is only available to service account clients that have been delegated domain-wide authority.
operationId: settings.delegates.list
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Response for the ListDelegates method.
type: object
properties:
delegates:
description: List of the user's delegates (with any verification status). If an account doesn't have delegates, this field doesn't appear.
type: array
items:
description: Settings for a delegate. Delegates can read, send, and delete messages, as well as view and add contacts, for the delegator's account. See "Set up mail delegation" for more information about delegates.
type: object
properties:
delegateEmail:
description: The email address of the delegate.
type: string
verificationStatus:
description: Indicates whether this address has been verified and can act as a delegate for the account. Read-only.
type: string
enum:
- verificationStatusUnspecified
- accepted
- pending
- rejected
- expired
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
post:
tags:
- users
description: Adds a delegate with its verification status set directly to `accepted`, without sending any verification email. The delegate user must be a member of the same G Suite organization as the delegator user. Gmail imposes limitations on the number of delegates and delegators each user in a G Suite organization can have. These limits depend on your organization, but in general each user can have up to 25 delegates and up to 10 delegators. Note that a delegate user must be referred to by their primary email address, and not an email alias. Also note that when a new delegate is created, there may be up to a one minute delay before the new delegate is available for use. This method is only available to service account clients that have been delegated domain-wide authority.
operationId: settings.delegates.create
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
application/json:
schema:
description: Settings for a delegate. Delegates can read, send, and delete messages, as well as view and add contacts, for the delegator's account. See "Set up mail delegation" for more information about delegates.
type: object
properties:
delegateEmail:
description: The email address of the delegate.
type: string
verificationStatus:
description: Indicates whether this address has been verified and can act as a delegate for the account. Read-only.
type: string
enum:
- verificationStatusUnspecified
- accepted
- pending
- rejected
- expired
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Settings for a delegate. Delegates can read, send, and delete messages, as well as view and add contacts, for the delegator's account. See "Set up mail delegation" for more information about delegates.
type: object
properties:
delegateEmail:
description: The email address of the delegate.
type: string
verificationStatus:
description: Indicates whether this address has been verified and can act as a delegate for the account. Read-only.
type: string
enum:
- verificationStatusUnspecified
- accepted
- pending
- rejected
- expired
security:
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.sharing
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.sharing
/gmail/v1/users/{userId}/settings/delegates/{delegateEmail}:
get:
tags:
- users
description: Gets the specified delegate. Note that a delegate user must be referred to by their primary email address, and not an email alias. This method is only available to service account clients that have been delegated domain-wide authority.
operationId: settings.delegates.get
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: delegateEmail
description: The email address of the user whose delegate relationship is to be retrieved.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Settings for a delegate. Delegates can read, send, and delete messages, as well as view and add contacts, for the delegator's account. See "Set up mail delegation" for more information about delegates.
type: object
properties:
delegateEmail:
description: The email address of the delegate.
type: string
verificationStatus:
description: Indicates whether this address has been verified and can act as a delegate for the account. Read-only.
type: string
enum:
- verificationStatusUnspecified
- accepted
- pending
- rejected
- expired
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
delete:
tags:
- users
description: Removes the specified delegate (which can be of any verification status), and revokes any verification that may have been required for using it. Note that a delegate user must be referred to by their primary email address, and not an email alias. This method is only available to service account clients that have been delegated domain-wide authority.
operationId: settings.delegates.delete
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: delegateEmail
description: The email address of the user to be removed as a delegate.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
security:
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.sharing
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.sharing
/gmail/v1/users/{userId}/settings/filters:
get:
tags:
- users
description: Lists the message filters of a Gmail user.
operationId: settings.filters.list
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Response for the ListFilters method.
type: object
properties:
filter:
description: List of a user's filters.
type: array
items:
description: Resource definition for Gmail filters. Filters apply to specific messages instead of an entire email thread.
type: object
properties:
action:
description: Action that the filter performs.
type: object
properties:
addLabelIds:
description: List of labels to add to the message.
type: array
items:
type: string
forward:
description: Email address that the message should be forwarded to.
type: string
removeLabelIds:
description: List of labels to remove from the message.
type: array
items:
type: string
criteria:
description: Matching criteria for the filter.
type: object
properties:
excludeChats:
description: Whether the response should exclude chats.
type: boolean
from:
description: The sender's display name or email address.
type: string
hasAttachment:
description: Whether the message has any attachment.
type: boolean
negatedQuery:
description: 'Only return messages not matching the specified query. Supports the same query format as the Gmail search box. For example, `"from:someuser@example.com rfc822msgid: is:unread"`.'
type: string
query:
description: 'Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, `"from:someuser@example.com rfc822msgid: is:unread"`.'
type: string
size:
description: The size of the entire RFC822 message in bytes, including all headers and attachments.
type: integer
format: int32
sizeComparison:
description: How the message size in bytes should be in relation to the size field.
type: string
enum:
- unspecified
- smaller
- larger
subject:
description: Case-insensitive phrase found in the message's subject. Trailing and leading whitespace are be trimmed and adjacent spaces are collapsed.
type: string
to:
description: The recipient's display name or email address. Includes recipients in the "to", "cc", and "bcc" header fields. You can use simply the local part of the email address. For example, "example" and "example@" both match "example@gmail.com". This field is case-insensitive.
type: string
id:
description: The server assigned ID of the filter.
type: string
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
post:
tags:
- users
description: 'Creates a filter. Note: you can only create a maximum of 1,000 filters.'
operationId: settings.filters.create
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
application/json:
schema:
description: Resource definition for Gmail filters. Filters apply to specific messages instead of an entire email thread.
type: object
properties:
action:
description: Action that the filter performs.
type: object
properties:
addLabelIds:
description: List of labels to add to the message.
type: array
items:
type: string
forward:
description: Email address that the message should be forwarded to.
type: string
removeLabelIds:
description: List of labels to remove from the message.
type: array
items:
type: string
criteria:
description: Matching criteria for the filter.
type: object
properties:
excludeChats:
description: Whether the response should exclude chats.
type: boolean
from:
description: The sender's display name or email address.
type: string
hasAttachment:
description: Whether the message has any attachment.
type: boolean
negatedQuery:
description: 'Only return messages not matching the specified query. Supports the same query format as the Gmail search box. For example, `"from:someuser@example.com rfc822msgid: is:unread"`.'
type: string
query:
description: 'Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, `"from:someuser@example.com rfc822msgid: is:unread"`.'
type: string
size:
description: The size of the entire RFC822 message in bytes, including all headers and attachments.
type: integer
format: int32
sizeComparison:
description: How the message size in bytes should be in relation to the size field.
type: string
enum:
- unspecified
- smaller
- larger
subject:
description: Case-insensitive phrase found in the message's subject. Trailing and leading whitespace are be trimmed and adjacent spaces are collapsed.
type: string
to:
description: The recipient's display name or email address. Includes recipients in the "to", "cc", and "bcc" header fields. You can use simply the local part of the email address. For example, "example" and "example@" both match "example@gmail.com". This field is case-insensitive.
type: string
id:
description: The server assigned ID of the filter.
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Resource definition for Gmail filters. Filters apply to specific messages instead of an entire email thread.
type: object
properties:
action:
description: Action that the filter performs.
type: object
properties:
addLabelIds:
description: List of labels to add to the message.
type: array
items:
type: string
forward:
description: Email address that the message should be forwarded to.
type: string
removeLabelIds:
description: List of labels to remove from the message.
type: array
items:
type: string
criteria:
description: Matching criteria for the filter.
type: object
properties:
excludeChats:
description: Whether the response should exclude chats.
type: boolean
from:
description: The sender's display name or email address.
type: string
hasAttachment:
description: Whether the message has any attachment.
type: boolean
negatedQuery:
description: 'Only return messages not matching the specified query. Supports the same query format as the Gmail search box. For example, `"from:someuser@example.com rfc822msgid: is:unread"`.'
type: string
query:
description: 'Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, `"from:someuser@example.com rfc822msgid: is:unread"`.'
type: string
size:
description: The size of the entire RFC822 message in bytes, including all headers and attachments.
type: integer
format: int32
sizeComparison:
description: How the message size in bytes should be in relation to the size field.
type: string
enum:
- unspecified
- smaller
- larger
subject:
description: Case-insensitive phrase found in the message's subject. Trailing and leading whitespace are be trimmed and adjacent spaces are collapsed.
type: string
to:
description: The recipient's display name or email address. Includes recipients in the "to", "cc", and "bcc" header fields. You can use simply the local part of the email address. For example, "example" and "example@" both match "example@gmail.com". This field is case-insensitive.
type: string
id:
description: The server assigned ID of the filter.
type: string
security:
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
/gmail/v1/users/{userId}/settings/filters/{id}:
get:
tags:
- users
description: Gets a filter.
operationId: settings.filters.get
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: The ID of the filter to be fetched.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Resource definition for Gmail filters. Filters apply to specific messages instead of an entire email thread.
type: object
properties:
action:
description: Action that the filter performs.
type: object
properties:
addLabelIds:
description: List of labels to add to the message.
type: array
items:
type: string
forward:
description: Email address that the message should be forwarded to.
type: string
removeLabelIds:
description: List of labels to remove from the message.
type: array
items:
type: string
criteria:
description: Matching criteria for the filter.
type: object
properties:
excludeChats:
description: Whether the response should exclude chats.
type: boolean
from:
description: The sender's display name or email address.
type: string
hasAttachment:
description: Whether the message has any attachment.
type: boolean
negatedQuery:
description: 'Only return messages not matching the specified query. Supports the same query format as the Gmail search box. For example, `"from:someuser@example.com rfc822msgid: is:unread"`.'
type: string
query:
description: 'Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, `"from:someuser@example.com rfc822msgid: is:unread"`.'
type: string
size:
description: The size of the entire RFC822 message in bytes, including all headers and attachments.
type: integer
format: int32
sizeComparison:
description: How the message size in bytes should be in relation to the size field.
type: string
enum:
- unspecified
- smaller
- larger
subject:
description: Case-insensitive phrase found in the message's subject. Trailing and leading whitespace are be trimmed and adjacent spaces are collapsed.
type: string
to:
description: The recipient's display name or email address. Includes recipients in the "to", "cc", and "bcc" header fields. You can use simply the local part of the email address. For example, "example" and "example@" both match "example@gmail.com". This field is case-insensitive.
type: string
id:
description: The server assigned ID of the filter.
type: string
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
delete:
tags:
- users
description: Deletes a filter.
operationId: settings.filters.delete
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: The ID of the filter to be deleted.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
security:
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
/gmail/v1/users/{userId}/settings/forwardingAddresses:
get:
tags:
- users
description: Lists the forwarding addresses for the specified account.
operationId: settings.forwardingAddresses.list
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Response for the ListForwardingAddresses method.
type: object
properties:
forwardingAddresses:
description: List of addresses that may be used for forwarding.
type: array
items:
description: Settings for a forwarding address.
type: object
properties:
forwardingEmail:
description: An email address to which messages can be forwarded.
type: string
verificationStatus:
description: Indicates whether this address has been verified and is usable for forwarding. Read-only.
type: string
enum:
- verificationStatusUnspecified
- accepted
- pending
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
post:
tags:
- users
description: Creates a forwarding address. If ownership verification is required, a message will be sent to the recipient and the resource's verification status will be set to `pending`; otherwise, the resource will be created with verification status set to `accepted`. This method is only available to service account clients that have been delegated domain-wide authority.
operationId: settings.forwardingAddresses.create
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
application/json:
schema:
description: Settings for a forwarding address.
type: object
properties:
forwardingEmail:
description: An email address to which messages can be forwarded.
type: string
verificationStatus:
description: Indicates whether this address has been verified and is usable for forwarding. Read-only.
type: string
enum:
- verificationStatusUnspecified
- accepted
- pending
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Settings for a forwarding address.
type: object
properties:
forwardingEmail:
description: An email address to which messages can be forwarded.
type: string
verificationStatus:
description: Indicates whether this address has been verified and is usable for forwarding. Read-only.
type: string
enum:
- verificationStatusUnspecified
- accepted
- pending
security:
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.sharing
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.sharing
/gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}:
get:
tags:
- users
description: Gets the specified forwarding address.
operationId: settings.forwardingAddresses.get
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: forwardingEmail
description: The forwarding address to be retrieved.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Settings for a forwarding address.
type: object
properties:
forwardingEmail:
description: An email address to which messages can be forwarded.
type: string
verificationStatus:
description: Indicates whether this address has been verified and is usable for forwarding. Read-only.
type: string
enum:
- verificationStatusUnspecified
- accepted
- pending
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
delete:
tags:
- users
description: Deletes the specified forwarding address and revokes any verification that may have been required. This method is only available to service account clients that have been delegated domain-wide authority.
operationId: settings.forwardingAddresses.delete
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: forwardingEmail
description: The forwarding address to be deleted.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
security:
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.sharing
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.sharing
/gmail/v1/users/{userId}/settings/imap:
get:
tags:
- users
description: Gets IMAP settings.
operationId: settings.getImap
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: IMAP settings for an account.
type: object
properties:
autoExpunge:
description: If this value is true, Gmail will immediately expunge a message when it is marked as deleted in IMAP. Otherwise, Gmail will wait for an update from the client before expunging messages marked as deleted.
type: boolean
enabled:
description: Whether IMAP is enabled for the account.
type: boolean
expungeBehavior:
description: The action that will be executed on a message when it is marked as deleted and expunged from the last visible IMAP folder.
type: string
enum:
- expungeBehaviorUnspecified
- archive
- trash
- deleteForever
maxFolderSize:
description: An optional limit on the number of messages that an IMAP folder may contain. Legal values are 0, 1000, 2000, 5000 or 10000. A value of zero is interpreted to mean that there is no limit.
type: integer
format: int32
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
put:
tags:
- users
description: Updates IMAP settings.
operationId: settings.updateImap
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
application/json:
schema:
description: IMAP settings for an account.
type: object
properties:
autoExpunge:
description: If this value is true, Gmail will immediately expunge a message when it is marked as deleted in IMAP. Otherwise, Gmail will wait for an update from the client before expunging messages marked as deleted.
type: boolean
enabled:
description: Whether IMAP is enabled for the account.
type: boolean
expungeBehavior:
description: The action that will be executed on a message when it is marked as deleted and expunged from the last visible IMAP folder.
type: string
enum:
- expungeBehaviorUnspecified
- archive
- trash
- deleteForever
maxFolderSize:
description: An optional limit on the number of messages that an IMAP folder may contain. Legal values are 0, 1000, 2000, 5000 or 10000. A value of zero is interpreted to mean that there is no limit.
type: integer
format: int32
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: IMAP settings for an account.
type: object
properties:
autoExpunge:
description: If this value is true, Gmail will immediately expunge a message when it is marked as deleted in IMAP. Otherwise, Gmail will wait for an update from the client before expunging messages marked as deleted.
type: boolean
enabled:
description: Whether IMAP is enabled for the account.
type: boolean
expungeBehavior:
description: The action that will be executed on a message when it is marked as deleted and expunged from the last visible IMAP folder.
type: string
enum:
- expungeBehaviorUnspecified
- archive
- trash
- deleteForever
maxFolderSize:
description: An optional limit on the number of messages that an IMAP folder may contain. Legal values are 0, 1000, 2000, 5000 or 10000. A value of zero is interpreted to mean that there is no limit.
type: integer
format: int32
security:
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
/gmail/v1/users/{userId}/settings/language:
get:
tags:
- users
description: Gets language settings.
operationId: settings.getLanguage
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Language settings for an account. These settings correspond to the "Language settings" feature in the web interface.
type: object
properties:
displayLanguage:
description: The language to display Gmail in, formatted as an RFC 3066 Language Tag (for example `en-GB`, `fr` or `ja` for British English, French, or Japanese respectively). The set of languages supported by Gmail evolves over time, so please refer to the "Language" dropdown in the Gmail settings for all available options, as described in the language settings help article. A table of sample values is also provided in the Managing Language Settings guide Not all Gmail clients can display the same set of languages. In the case that a user's display language is not available for use on a particular client, said client automatically chooses to display in the closest supported variant (or a reasonable default).
type: string
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
put:
tags:
- users
description: Updates language settings. If successful, the return object contains the `displayLanguage` that was saved for the user, which may differ from the value passed into the request. This is because the requested `displayLanguage` may not be directly supported by Gmail but have a close variant that is, and so the variant may be chosen and saved instead.
operationId: settings.updateLanguage
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
application/json:
schema:
description: Language settings for an account. These settings correspond to the "Language settings" feature in the web interface.
type: object
properties:
displayLanguage:
description: The language to display Gmail in, formatted as an RFC 3066 Language Tag (for example `en-GB`, `fr` or `ja` for British English, French, or Japanese respectively). The set of languages supported by Gmail evolves over time, so please refer to the "Language" dropdown in the Gmail settings for all available options, as described in the language settings help article. A table of sample values is also provided in the Managing Language Settings guide Not all Gmail clients can display the same set of languages. In the case that a user's display language is not available for use on a particular client, said client automatically chooses to display in the closest supported variant (or a reasonable default).
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Language settings for an account. These settings correspond to the "Language settings" feature in the web interface.
type: object
properties:
displayLanguage:
description: The language to display Gmail in, formatted as an RFC 3066 Language Tag (for example `en-GB`, `fr` or `ja` for British English, French, or Japanese respectively). The set of languages supported by Gmail evolves over time, so please refer to the "Language" dropdown in the Gmail settings for all available options, as described in the language settings help article. A table of sample values is also provided in the Managing Language Settings guide Not all Gmail clients can display the same set of languages. In the case that a user's display language is not available for use on a particular client, said client automatically chooses to display in the closest supported variant (or a reasonable default).
type: string
security:
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
/gmail/v1/users/{userId}/settings/pop:
get:
tags:
- users
description: Gets POP settings.
operationId: settings.getPop
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: POP settings for an account.
type: object
properties:
accessWindow:
description: The range of messages which are accessible via POP.
type: string
enum:
- accessWindowUnspecified
- disabled
- fromNowOn
- allMail
disposition:
description: The action that will be executed on a message after it has been fetched via POP.
type: string
enum:
- dispositionUnspecified
- leaveInInbox
- archive
- trash
- markRead
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
put:
tags:
- users
description: Updates POP settings.
operationId: settings.updatePop
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
application/json:
schema:
description: POP settings for an account.
type: object
properties:
accessWindow:
description: The range of messages which are accessible via POP.
type: string
enum:
- accessWindowUnspecified
- disabled
- fromNowOn
- allMail
disposition:
description: The action that will be executed on a message after it has been fetched via POP.
type: string
enum:
- dispositionUnspecified
- leaveInInbox
- archive
- trash
- markRead
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: POP settings for an account.
type: object
properties:
accessWindow:
description: The range of messages which are accessible via POP.
type: string
enum:
- accessWindowUnspecified
- disabled
- fromNowOn
- allMail
disposition:
description: The action that will be executed on a message after it has been fetched via POP.
type: string
enum:
- dispositionUnspecified
- leaveInInbox
- archive
- trash
- markRead
security:
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
/gmail/v1/users/{userId}/settings/sendAs:
get:
tags:
- users
description: Lists the send-as aliases for the specified account. The result includes the primary send-as address associated with the account as well as any custom "from" aliases.
operationId: settings.sendAs.list
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Response for the ListSendAs method.
type: object
properties:
sendAs:
description: List of send-as aliases.
type: array
items:
description: Settings associated with a send-as alias, which can be either the primary login address associated with the account or a custom "from" address. Send-as aliases correspond to the "Send Mail As" feature in the web interface.
type: object
properties:
displayName:
description: A name that appears in the "From:" header for mail sent using this alias. For custom "from" addresses, when this is empty, Gmail will populate the "From:" header with the name that is used for the primary address associated with the account. If the admin has disabled the ability for users to update their name format, requests to update this field for the primary login will silently fail.
type: string
isDefault:
description: Whether this address is selected as the default "From:" address in situations such as composing a new message or sending a vacation auto-reply. Every Gmail account has exactly one default send-as address, so the only legal value that clients may write to this field is `true`. Changing this from `false` to `true` for an address will result in this field becoming `false` for the other previous default address.
type: boolean
isPrimary:
description: Whether this address is the primary address used to login to the account. Every Gmail account has exactly one primary address, and it cannot be deleted from the collection of send-as aliases. This field is read-only.
type: boolean
replyToAddress:
description: An optional email address that is included in a "Reply-To:" header for mail sent using this alias. If this is empty, Gmail will not generate a "Reply-To:" header.
type: string
sendAsEmail:
description: The email address that appears in the "From:" header for mail sent using this alias. This is read-only for all operations except create.
type: string
signature:
description: An optional HTML signature that is included in messages composed with this alias in the Gmail web UI. This signature is added to new emails only.
type: string
smtpMsa:
description: An optional SMTP service that will be used as an outbound relay for mail sent using this alias. If this is empty, outbound mail will be sent directly from Gmail's servers to the destination SMTP service. This setting only applies to custom "from" aliases.
type: object
properties:
host:
description: The hostname of the SMTP service. Required.
type: string
password:
description: The password that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses.
type: string
port:
description: The port of the SMTP service. Required.
type: integer
format: int32
securityMode:
description: The protocol that will be used to secure communication with the SMTP service. Required.
type: string
enum:
- securityModeUnspecified
- none
- ssl
- starttls
username:
description: The username that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses.
type: string
treatAsAlias:
description: Whether Gmail should treat this address as an alias for the user's primary email address. This setting only applies to custom "from" aliases.
type: boolean
verificationStatus:
description: Indicates whether this address has been verified for use as a send-as alias. Read-only. This setting only applies to custom "from" aliases.
type: string
enum:
- verificationStatusUnspecified
- accepted
- pending
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
post:
tags:
- users
description: Creates a custom "from" send-as alias. If an SMTP MSA is specified, Gmail will attempt to connect to the SMTP service to validate the configuration before creating the alias. If ownership verification is required for the alias, a message will be sent to the email address and the resource's verification status will be set to `pending`; otherwise, the resource will be created with verification status set to `accepted`. If a signature is provided, Gmail will sanitize the HTML before saving it with the alias. This method is only available to service account clients that have been delegated domain-wide authority.
operationId: settings.sendAs.create
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
application/json:
schema:
description: Settings associated with a send-as alias, which can be either the primary login address associated with the account or a custom "from" address. Send-as aliases correspond to the "Send Mail As" feature in the web interface.
type: object
properties:
displayName:
description: A name that appears in the "From:" header for mail sent using this alias. For custom "from" addresses, when this is empty, Gmail will populate the "From:" header with the name that is used for the primary address associated with the account. If the admin has disabled the ability for users to update their name format, requests to update this field for the primary login will silently fail.
type: string
isDefault:
description: Whether this address is selected as the default "From:" address in situations such as composing a new message or sending a vacation auto-reply. Every Gmail account has exactly one default send-as address, so the only legal value that clients may write to this field is `true`. Changing this from `false` to `true` for an address will result in this field becoming `false` for the other previous default address.
type: boolean
isPrimary:
description: Whether this address is the primary address used to login to the account. Every Gmail account has exactly one primary address, and it cannot be deleted from the collection of send-as aliases. This field is read-only.
type: boolean
replyToAddress:
description: An optional email address that is included in a "Reply-To:" header for mail sent using this alias. If this is empty, Gmail will not generate a "Reply-To:" header.
type: string
sendAsEmail:
description: The email address that appears in the "From:" header for mail sent using this alias. This is read-only for all operations except create.
type: string
signature:
description: An optional HTML signature that is included in messages composed with this alias in the Gmail web UI. This signature is added to new emails only.
type: string
smtpMsa:
description: An optional SMTP service that will be used as an outbound relay for mail sent using this alias. If this is empty, outbound mail will be sent directly from Gmail's servers to the destination SMTP service. This setting only applies to custom "from" aliases.
type: object
properties:
host:
description: The hostname of the SMTP service. Required.
type: string
password:
description: The password that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses.
type: string
port:
description: The port of the SMTP service. Required.
type: integer
format: int32
securityMode:
description: The protocol that will be used to secure communication with the SMTP service. Required.
type: string
enum:
- securityModeUnspecified
- none
- ssl
- starttls
username:
description: The username that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses.
type: string
treatAsAlias:
description: Whether Gmail should treat this address as an alias for the user's primary email address. This setting only applies to custom "from" aliases.
type: boolean
verificationStatus:
description: Indicates whether this address has been verified for use as a send-as alias. Read-only. This setting only applies to custom "from" aliases.
type: string
enum:
- verificationStatusUnspecified
- accepted
- pending
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Settings associated with a send-as alias, which can be either the primary login address associated with the account or a custom "from" address. Send-as aliases correspond to the "Send Mail As" feature in the web interface.
type: object
properties:
displayName:
description: A name that appears in the "From:" header for mail sent using this alias. For custom "from" addresses, when this is empty, Gmail will populate the "From:" header with the name that is used for the primary address associated with the account. If the admin has disabled the ability for users to update their name format, requests to update this field for the primary login will silently fail.
type: string
isDefault:
description: Whether this address is selected as the default "From:" address in situations such as composing a new message or sending a vacation auto-reply. Every Gmail account has exactly one default send-as address, so the only legal value that clients may write to this field is `true`. Changing this from `false` to `true` for an address will result in this field becoming `false` for the other previous default address.
type: boolean
isPrimary:
description: Whether this address is the primary address used to login to the account. Every Gmail account has exactly one primary address, and it cannot be deleted from the collection of send-as aliases. This field is read-only.
type: boolean
replyToAddress:
description: An optional email address that is included in a "Reply-To:" header for mail sent using this alias. If this is empty, Gmail will not generate a "Reply-To:" header.
type: string
sendAsEmail:
description: The email address that appears in the "From:" header for mail sent using this alias. This is read-only for all operations except create.
type: string
signature:
description: An optional HTML signature that is included in messages composed with this alias in the Gmail web UI. This signature is added to new emails only.
type: string
smtpMsa:
description: An optional SMTP service that will be used as an outbound relay for mail sent using this alias. If this is empty, outbound mail will be sent directly from Gmail's servers to the destination SMTP service. This setting only applies to custom "from" aliases.
type: object
properties:
host:
description: The hostname of the SMTP service. Required.
type: string
password:
description: The password that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses.
type: string
port:
description: The port of the SMTP service. Required.
type: integer
format: int32
securityMode:
description: The protocol that will be used to secure communication with the SMTP service. Required.
type: string
enum:
- securityModeUnspecified
- none
- ssl
- starttls
username:
description: The username that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses.
type: string
treatAsAlias:
description: Whether Gmail should treat this address as an alias for the user's primary email address. This setting only applies to custom "from" aliases.
type: boolean
verificationStatus:
description: Indicates whether this address has been verified for use as a send-as alias. Read-only. This setting only applies to custom "from" aliases.
type: string
enum:
- verificationStatusUnspecified
- accepted
- pending
security:
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.sharing
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.sharing
/gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}:
get:
tags:
- users
description: Gets the specified send-as alias. Fails with an HTTP 404 error if the specified address is not a member of the collection.
operationId: settings.sendAs.get
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: sendAsEmail
description: The send-as alias to be retrieved.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Settings associated with a send-as alias, which can be either the primary login address associated with the account or a custom "from" address. Send-as aliases correspond to the "Send Mail As" feature in the web interface.
type: object
properties:
displayName:
description: A name that appears in the "From:" header for mail sent using this alias. For custom "from" addresses, when this is empty, Gmail will populate the "From:" header with the name that is used for the primary address associated with the account. If the admin has disabled the ability for users to update their name format, requests to update this field for the primary login will silently fail.
type: string
isDefault:
description: Whether this address is selected as the default "From:" address in situations such as composing a new message or sending a vacation auto-reply. Every Gmail account has exactly one default send-as address, so the only legal value that clients may write to this field is `true`. Changing this from `false` to `true` for an address will result in this field becoming `false` for the other previous default address.
type: boolean
isPrimary:
description: Whether this address is the primary address used to login to the account. Every Gmail account has exactly one primary address, and it cannot be deleted from the collection of send-as aliases. This field is read-only.
type: boolean
replyToAddress:
description: An optional email address that is included in a "Reply-To:" header for mail sent using this alias. If this is empty, Gmail will not generate a "Reply-To:" header.
type: string
sendAsEmail:
description: The email address that appears in the "From:" header for mail sent using this alias. This is read-only for all operations except create.
type: string
signature:
description: An optional HTML signature that is included in messages composed with this alias in the Gmail web UI. This signature is added to new emails only.
type: string
smtpMsa:
description: An optional SMTP service that will be used as an outbound relay for mail sent using this alias. If this is empty, outbound mail will be sent directly from Gmail's servers to the destination SMTP service. This setting only applies to custom "from" aliases.
type: object
properties:
host:
description: The hostname of the SMTP service. Required.
type: string
password:
description: The password that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses.
type: string
port:
description: The port of the SMTP service. Required.
type: integer
format: int32
securityMode:
description: The protocol that will be used to secure communication with the SMTP service. Required.
type: string
enum:
- securityModeUnspecified
- none
- ssl
- starttls
username:
description: The username that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses.
type: string
treatAsAlias:
description: Whether Gmail should treat this address as an alias for the user's primary email address. This setting only applies to custom "from" aliases.
type: boolean
verificationStatus:
description: Indicates whether this address has been verified for use as a send-as alias. Read-only. This setting only applies to custom "from" aliases.
type: string
enum:
- verificationStatusUnspecified
- accepted
- pending
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
put:
tags:
- users
description: Updates a send-as alias. If a signature is provided, Gmail will sanitize the HTML before saving it with the alias. Addresses other than the primary address for the account can only be updated by service account clients that have been delegated domain-wide authority.
operationId: settings.sendAs.update
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: sendAsEmail
description: The send-as alias to be updated.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
application/json:
schema:
description: Settings associated with a send-as alias, which can be either the primary login address associated with the account or a custom "from" address. Send-as aliases correspond to the "Send Mail As" feature in the web interface.
type: object
properties:
displayName:
description: A name that appears in the "From:" header for mail sent using this alias. For custom "from" addresses, when this is empty, Gmail will populate the "From:" header with the name that is used for the primary address associated with the account. If the admin has disabled the ability for users to update their name format, requests to update this field for the primary login will silently fail.
type: string
isDefault:
description: Whether this address is selected as the default "From:" address in situations such as composing a new message or sending a vacation auto-reply. Every Gmail account has exactly one default send-as address, so the only legal value that clients may write to this field is `true`. Changing this from `false` to `true` for an address will result in this field becoming `false` for the other previous default address.
type: boolean
isPrimary:
description: Whether this address is the primary address used to login to the account. Every Gmail account has exactly one primary address, and it cannot be deleted from the collection of send-as aliases. This field is read-only.
type: boolean
replyToAddress:
description: An optional email address that is included in a "Reply-To:" header for mail sent using this alias. If this is empty, Gmail will not generate a "Reply-To:" header.
type: string
sendAsEmail:
description: The email address that appears in the "From:" header for mail sent using this alias. This is read-only for all operations except create.
type: string
signature:
description: An optional HTML signature that is included in messages composed with this alias in the Gmail web UI. This signature is added to new emails only.
type: string
smtpMsa:
description: An optional SMTP service that will be used as an outbound relay for mail sent using this alias. If this is empty, outbound mail will be sent directly from Gmail's servers to the destination SMTP service. This setting only applies to custom "from" aliases.
type: object
properties:
host:
description: The hostname of the SMTP service. Required.
type: string
password:
description: The password that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses.
type: string
port:
description: The port of the SMTP service. Required.
type: integer
format: int32
securityMode:
description: The protocol that will be used to secure communication with the SMTP service. Required.
type: string
enum:
- securityModeUnspecified
- none
- ssl
- starttls
username:
description: The username that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses.
type: string
treatAsAlias:
description: Whether Gmail should treat this address as an alias for the user's primary email address. This setting only applies to custom "from" aliases.
type: boolean
verificationStatus:
description: Indicates whether this address has been verified for use as a send-as alias. Read-only. This setting only applies to custom "from" aliases.
type: string
enum:
- verificationStatusUnspecified
- accepted
- pending
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Settings associated with a send-as alias, which can be either the primary login address associated with the account or a custom "from" address. Send-as aliases correspond to the "Send Mail As" feature in the web interface.
type: object
properties:
displayName:
description: A name that appears in the "From:" header for mail sent using this alias. For custom "from" addresses, when this is empty, Gmail will populate the "From:" header with the name that is used for the primary address associated with the account. If the admin has disabled the ability for users to update their name format, requests to update this field for the primary login will silently fail.
type: string
isDefault:
description: Whether this address is selected as the default "From:" address in situations such as composing a new message or sending a vacation auto-reply. Every Gmail account has exactly one default send-as address, so the only legal value that clients may write to this field is `true`. Changing this from `false` to `true` for an address will result in this field becoming `false` for the other previous default address.
type: boolean
isPrimary:
description: Whether this address is the primary address used to login to the account. Every Gmail account has exactly one primary address, and it cannot be deleted from the collection of send-as aliases. This field is read-only.
type: boolean
replyToAddress:
description: An optional email address that is included in a "Reply-To:" header for mail sent using this alias. If this is empty, Gmail will not generate a "Reply-To:" header.
type: string
sendAsEmail:
description: The email address that appears in the "From:" header for mail sent using this alias. This is read-only for all operations except create.
type: string
signature:
description: An optional HTML signature that is included in messages composed with this alias in the Gmail web UI. This signature is added to new emails only.
type: string
smtpMsa:
description: An optional SMTP service that will be used as an outbound relay for mail sent using this alias. If this is empty, outbound mail will be sent directly from Gmail's servers to the destination SMTP service. This setting only applies to custom "from" aliases.
type: object
properties:
host:
description: The hostname of the SMTP service. Required.
type: string
password:
description: The password that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses.
type: string
port:
description: The port of the SMTP service. Required.
type: integer
format: int32
securityMode:
description: The protocol that will be used to secure communication with the SMTP service. Required.
type: string
enum:
- securityModeUnspecified
- none
- ssl
- starttls
username:
description: The username that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses.
type: string
treatAsAlias:
description: Whether Gmail should treat this address as an alias for the user's primary email address. This setting only applies to custom "from" aliases.
type: boolean
verificationStatus:
description: Indicates whether this address has been verified for use as a send-as alias. Read-only. This setting only applies to custom "from" aliases.
type: string
enum:
- verificationStatusUnspecified
- accepted
- pending
security:
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.sharing
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.sharing
delete:
tags:
- users
description: Deletes the specified send-as alias. Revokes any verification that may have been required for using it. This method is only available to service account clients that have been delegated domain-wide authority.
operationId: settings.sendAs.delete
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: sendAsEmail
description: The send-as alias to be deleted.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
security:
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.sharing
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.sharing
patch:
tags:
- users
description: Patch the specified send-as alias.
operationId: settings.sendAs.patch
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: sendAsEmail
description: The send-as alias to be updated.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
application/json:
schema:
description: Settings associated with a send-as alias, which can be either the primary login address associated with the account or a custom "from" address. Send-as aliases correspond to the "Send Mail As" feature in the web interface.
type: object
properties:
displayName:
description: A name that appears in the "From:" header for mail sent using this alias. For custom "from" addresses, when this is empty, Gmail will populate the "From:" header with the name that is used for the primary address associated with the account. If the admin has disabled the ability for users to update their name format, requests to update this field for the primary login will silently fail.
type: string
isDefault:
description: Whether this address is selected as the default "From:" address in situations such as composing a new message or sending a vacation auto-reply. Every Gmail account has exactly one default send-as address, so the only legal value that clients may write to this field is `true`. Changing this from `false` to `true` for an address will result in this field becoming `false` for the other previous default address.
type: boolean
isPrimary:
description: Whether this address is the primary address used to login to the account. Every Gmail account has exactly one primary address, and it cannot be deleted from the collection of send-as aliases. This field is read-only.
type: boolean
replyToAddress:
description: An optional email address that is included in a "Reply-To:" header for mail sent using this alias. If this is empty, Gmail will not generate a "Reply-To:" header.
type: string
sendAsEmail:
description: The email address that appears in the "From:" header for mail sent using this alias. This is read-only for all operations except create.
type: string
signature:
description: An optional HTML signature that is included in messages composed with this alias in the Gmail web UI. This signature is added to new emails only.
type: string
smtpMsa:
description: An optional SMTP service that will be used as an outbound relay for mail sent using this alias. If this is empty, outbound mail will be sent directly from Gmail's servers to the destination SMTP service. This setting only applies to custom "from" aliases.
type: object
properties:
host:
description: The hostname of the SMTP service. Required.
type: string
password:
description: The password that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses.
type: string
port:
description: The port of the SMTP service. Required.
type: integer
format: int32
securityMode:
description: The protocol that will be used to secure communication with the SMTP service. Required.
type: string
enum:
- securityModeUnspecified
- none
- ssl
- starttls
username:
description: The username that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses.
type: string
treatAsAlias:
description: Whether Gmail should treat this address as an alias for the user's primary email address. This setting only applies to custom "from" aliases.
type: boolean
verificationStatus:
description: Indicates whether this address has been verified for use as a send-as alias. Read-only. This setting only applies to custom "from" aliases.
type: string
enum:
- verificationStatusUnspecified
- accepted
- pending
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Settings associated with a send-as alias, which can be either the primary login address associated with the account or a custom "from" address. Send-as aliases correspond to the "Send Mail As" feature in the web interface.
type: object
properties:
displayName:
description: A name that appears in the "From:" header for mail sent using this alias. For custom "from" addresses, when this is empty, Gmail will populate the "From:" header with the name that is used for the primary address associated with the account. If the admin has disabled the ability for users to update their name format, requests to update this field for the primary login will silently fail.
type: string
isDefault:
description: Whether this address is selected as the default "From:" address in situations such as composing a new message or sending a vacation auto-reply. Every Gmail account has exactly one default send-as address, so the only legal value that clients may write to this field is `true`. Changing this from `false` to `true` for an address will result in this field becoming `false` for the other previous default address.
type: boolean
isPrimary:
description: Whether this address is the primary address used to login to the account. Every Gmail account has exactly one primary address, and it cannot be deleted from the collection of send-as aliases. This field is read-only.
type: boolean
replyToAddress:
description: An optional email address that is included in a "Reply-To:" header for mail sent using this alias. If this is empty, Gmail will not generate a "Reply-To:" header.
type: string
sendAsEmail:
description: The email address that appears in the "From:" header for mail sent using this alias. This is read-only for all operations except create.
type: string
signature:
description: An optional HTML signature that is included in messages composed with this alias in the Gmail web UI. This signature is added to new emails only.
type: string
smtpMsa:
description: An optional SMTP service that will be used as an outbound relay for mail sent using this alias. If this is empty, outbound mail will be sent directly from Gmail's servers to the destination SMTP service. This setting only applies to custom "from" aliases.
type: object
properties:
host:
description: The hostname of the SMTP service. Required.
type: string
password:
description: The password that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses.
type: string
port:
description: The port of the SMTP service. Required.
type: integer
format: int32
securityMode:
description: The protocol that will be used to secure communication with the SMTP service. Required.
type: string
enum:
- securityModeUnspecified
- none
- ssl
- starttls
username:
description: The username that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses.
type: string
treatAsAlias:
description: Whether Gmail should treat this address as an alias for the user's primary email address. This setting only applies to custom "from" aliases.
type: boolean
verificationStatus:
description: Indicates whether this address has been verified for use as a send-as alias. Read-only. This setting only applies to custom "from" aliases.
type: string
enum:
- verificationStatusUnspecified
- accepted
- pending
security:
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.sharing
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.sharing
/gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo:
get:
tags:
- users
description: Lists S/MIME configs for the specified send-as alias.
operationId: settings.sendAs.smimeInfo.list
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: sendAsEmail
description: The email address that appears in the "From:" header for mail sent using this alias.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
smimeInfo:
description: List of SmimeInfo.
type: array
items:
description: An S/MIME email config.
type: object
properties:
encryptedKeyPassword:
description: Encrypted key password, when key is encrypted.
type: string
expiration:
description: When the certificate expires (in milliseconds since epoch).
type: string
format: int64
id:
description: The immutable ID for the SmimeInfo.
type: string
isDefault:
description: Whether this SmimeInfo is the default one for this user's send-as address.
type: boolean
issuerCn:
description: The S/MIME certificate issuer's common name.
type: string
pem:
description: PEM formatted X509 concatenated certificate string (standard base64 encoding). Format used for returning key, which includes public key as well as certificate chain (not private key).
type: string
pkcs12:
description: PKCS#12 format containing a single private/public key pair and certificate chain. This format is only accepted from client for creating a new SmimeInfo and is never returned, because the private key is not intended to be exported. PKCS#12 may be encrypted, in which case encryptedKeyPassword should be set appropriately.
type: string
format: byte
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.sharing
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.sharing
post:
tags:
- users
description: Insert (upload) the given S/MIME config for the specified send-as alias. Note that pkcs12 format is required for the key.
operationId: settings.sendAs.smimeInfo.insert
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: sendAsEmail
description: The email address that appears in the "From:" header for mail sent using this alias.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
application/json:
schema:
description: An S/MIME email config.
type: object
properties:
encryptedKeyPassword:
description: Encrypted key password, when key is encrypted.
type: string
expiration:
description: When the certificate expires (in milliseconds since epoch).
type: string
format: int64
id:
description: The immutable ID for the SmimeInfo.
type: string
isDefault:
description: Whether this SmimeInfo is the default one for this user's send-as address.
type: boolean
issuerCn:
description: The S/MIME certificate issuer's common name.
type: string
pem:
description: PEM formatted X509 concatenated certificate string (standard base64 encoding). Format used for returning key, which includes public key as well as certificate chain (not private key).
type: string
pkcs12:
description: PKCS#12 format containing a single private/public key pair and certificate chain. This format is only accepted from client for creating a new SmimeInfo and is never returned, because the private key is not intended to be exported. PKCS#12 may be encrypted, in which case encryptedKeyPassword should be set appropriately.
type: string
format: byte
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: An S/MIME email config.
type: object
properties:
encryptedKeyPassword:
description: Encrypted key password, when key is encrypted.
type: string
expiration:
description: When the certificate expires (in milliseconds since epoch).
type: string
format: int64
id:
description: The immutable ID for the SmimeInfo.
type: string
isDefault:
description: Whether this SmimeInfo is the default one for this user's send-as address.
type: boolean
issuerCn:
description: The S/MIME certificate issuer's common name.
type: string
pem:
description: PEM formatted X509 concatenated certificate string (standard base64 encoding). Format used for returning key, which includes public key as well as certificate chain (not private key).
type: string
pkcs12:
description: PKCS#12 format containing a single private/public key pair and certificate chain. This format is only accepted from client for creating a new SmimeInfo and is never returned, because the private key is not intended to be exported. PKCS#12 may be encrypted, in which case encryptedKeyPassword should be set appropriately.
type: string
format: byte
security:
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.sharing
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.sharing
/gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}:
get:
tags:
- users
description: Gets the specified S/MIME config for the specified send-as alias.
operationId: settings.sendAs.smimeInfo.get
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: sendAsEmail
description: The email address that appears in the "From:" header for mail sent using this alias.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: The immutable ID for the SmimeInfo.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: An S/MIME email config.
type: object
properties:
encryptedKeyPassword:
description: Encrypted key password, when key is encrypted.
type: string
expiration:
description: When the certificate expires (in milliseconds since epoch).
type: string
format: int64
id:
description: The immutable ID for the SmimeInfo.
type: string
isDefault:
description: Whether this SmimeInfo is the default one for this user's send-as address.
type: boolean
issuerCn:
description: The S/MIME certificate issuer's common name.
type: string
pem:
description: PEM formatted X509 concatenated certificate string (standard base64 encoding). Format used for returning key, which includes public key as well as certificate chain (not private key).
type: string
pkcs12:
description: PKCS#12 format containing a single private/public key pair and certificate chain. This format is only accepted from client for creating a new SmimeInfo and is never returned, because the private key is not intended to be exported. PKCS#12 may be encrypted, in which case encryptedKeyPassword should be set appropriately.
type: string
format: byte
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.sharing
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.sharing
delete:
tags:
- users
description: Deletes the specified S/MIME config for the specified send-as alias.
operationId: settings.sendAs.smimeInfo.delete
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: sendAsEmail
description: The email address that appears in the "From:" header for mail sent using this alias.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: The immutable ID for the SmimeInfo.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
security:
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.sharing
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.sharing
/gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}/setDefault:
post:
tags:
- users
description: Sets the default S/MIME config for the specified send-as alias.
operationId: settings.sendAs.smimeInfo.setDefault
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: sendAsEmail
description: The email address that appears in the "From:" header for mail sent using this alias.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: The immutable ID for the SmimeInfo.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
security:
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.sharing
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.sharing
/gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/verify:
post:
tags:
- users
description: Sends a verification email to the specified send-as alias address. The verification status must be `pending`. This method is only available to service account clients that have been delegated domain-wide authority.
operationId: settings.sendAs.verify
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: sendAsEmail
description: The send-as alias to be verified.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
security:
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.sharing
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.sharing
/gmail/v1/users/{userId}/settings/vacation:
get:
tags:
- users
description: Gets vacation responder settings.
operationId: settings.getVacation
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Vacation auto-reply settings for an account. These settings correspond to the "Vacation responder" feature in the web interface.
type: object
properties:
enableAutoReply:
description: Flag that controls whether Gmail automatically replies to messages.
type: boolean
endTime:
description: An optional end time for sending auto-replies (epoch ms). When this is specified, Gmail will automatically reply only to messages that it receives before the end time. If both `startTime` and `endTime` are specified, `startTime` must precede `endTime`.
type: string
format: int64
responseBodyHtml:
description: Response body in HTML format. Gmail will sanitize the HTML before storing it. If both `response_body_plain_text` and `response_body_html` are specified, `response_body_html` will be used.
type: string
responseBodyPlainText:
description: Response body in plain text format. If both `response_body_plain_text` and `response_body_html` are specified, `response_body_html` will be used.
type: string
responseSubject:
description: Optional text to prepend to the subject line in vacation responses. In order to enable auto-replies, either the response subject or the response body must be nonempty.
type: string
restrictToContacts:
description: Flag that determines whether responses are sent to recipients who are not in the user's list of contacts.
type: boolean
restrictToDomain:
description: Flag that determines whether responses are sent to recipients who are outside of the user's domain. This feature is only available for G Suite users.
type: boolean
startTime:
description: An optional start time for sending auto-replies (epoch ms). When this is specified, Gmail will automatically reply only to messages that it receives after the start time. If both `startTime` and `endTime` are specified, `startTime` must precede `endTime`.
type: string
format: int64
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
put:
tags:
- users
description: Updates vacation responder settings.
operationId: settings.updateVacation
parameters:
- name: userId
description: User's email address. The special value "me" can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
application/json:
schema:
description: Vacation auto-reply settings for an account. These settings correspond to the "Vacation responder" feature in the web interface.
type: object
properties:
enableAutoReply:
description: Flag that controls whether Gmail automatically replies to messages.
type: boolean
endTime:
description: An optional end time for sending auto-replies (epoch ms). When this is specified, Gmail will automatically reply only to messages that it receives before the end time. If both `startTime` and `endTime` are specified, `startTime` must precede `endTime`.
type: string
format: int64
responseBodyHtml:
description: Response body in HTML format. Gmail will sanitize the HTML before storing it. If both `response_body_plain_text` and `response_body_html` are specified, `response_body_html` will be used.
type: string
responseBodyPlainText:
description: Response body in plain text format. If both `response_body_plain_text` and `response_body_html` are specified, `response_body_html` will be used.
type: string
responseSubject:
description: Optional text to prepend to the subject line in vacation responses. In order to enable auto-replies, either the response subject or the response body must be nonempty.
type: string
restrictToContacts:
description: Flag that determines whether responses are sent to recipients who are not in the user's list of contacts.
type: boolean
restrictToDomain:
description: Flag that determines whether responses are sent to recipients who are outside of the user's domain. This feature is only available for G Suite users.
type: boolean
startTime:
description: An optional start time for sending auto-replies (epoch ms). When this is specified, Gmail will automatically reply only to messages that it receives after the start time. If both `startTime` and `endTime` are specified, `startTime` must precede `endTime`.
type: string
format: int64
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Vacation auto-reply settings for an account. These settings correspond to the "Vacation responder" feature in the web interface.
type: object
properties:
enableAutoReply:
description: Flag that controls whether Gmail automatically replies to messages.
type: boolean
endTime:
description: An optional end time for sending auto-replies (epoch ms). When this is specified, Gmail will automatically reply only to messages that it receives before the end time. If both `startTime` and `endTime` are specified, `startTime` must precede `endTime`.
type: string
format: int64
responseBodyHtml:
description: Response body in HTML format. Gmail will sanitize the HTML before storing it. If both `response_body_plain_text` and `response_body_html` are specified, `response_body_html` will be used.
type: string
responseBodyPlainText:
description: Response body in plain text format. If both `response_body_plain_text` and `response_body_html` are specified, `response_body_html` will be used.
type: string
responseSubject:
description: Optional text to prepend to the subject line in vacation responses. In order to enable auto-replies, either the response subject or the response body must be nonempty.
type: string
restrictToContacts:
description: Flag that determines whether responses are sent to recipients who are not in the user's list of contacts.
type: boolean
restrictToDomain:
description: Flag that determines whether responses are sent to recipients who are outside of the user's domain. This feature is only available for G Suite users.
type: boolean
startTime:
description: An optional start time for sending auto-replies (epoch ms). When this is specified, Gmail will automatically reply only to messages that it receives after the start time. If both `startTime` and `endTime` are specified, `startTime` must precede `endTime`.
type: string
format: int64
security:
- Oauth2:
- https://www.googleapis.com/auth/gmail.settings.basic
Oauth2c:
- https://www.googleapis.com/auth/gmail.settings.basic
/gmail/v1/users/{userId}/stop:
post:
tags:
- users
description: Stop receiving push notifications for the given user mailbox.
operationId: stop
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.metadata
Oauth2c:
- https://www.googleapis.com/auth/gmail.metadata
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
/gmail/v1/users/{userId}/threads:
get:
tags:
- users
description: Lists the threads in the user's mailbox.
operationId: threads.list
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: includeSpamTrash
description: Include threads from `SPAM` and `TRASH` in the results.
schema:
type: boolean
in: query
style: form
- name: labelIds
description: Only return threads with labels that match all of the specified label IDs.
schema:
type: array
items:
type: string
explode: true
in: query
style: form
- name: maxResults
description: Maximum number of threads to return. This field defaults to 100. The maximum allowed value for this field is 500.
schema:
type: integer
in: query
style: form
- name: pageToken
description: Page token to retrieve a specific page of results in the list.
schema:
type: string
in: query
style: form
- name: q
description: '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.'
schema:
type: string
in: query
style: form
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/ListThreadsResponse'
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.metadata
Oauth2c:
- https://www.googleapis.com/auth/gmail.metadata
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
/gmail/v1/users/{userId}/threads/{id}:
get:
tags:
- users
description: Gets the specified thread.
operationId: threads.get
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: The ID of the thread to retrieve.
required: true
schema:
type: string
in: path
style: simple
- name: format
description: The format to return the messages in.
schema:
type: string
enum:
- full
- metadata
- minimal
in: query
style: form
- name: metadataHeaders
description: When given and format is METADATA, only include headers specified.
schema:
type: array
items:
type: string
explode: true
in: query
style: form
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Thread'
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.addons.current.message.action
Oauth2c:
- https://www.googleapis.com/auth/gmail.addons.current.message.action
- Oauth2:
- https://www.googleapis.com/auth/gmail.addons.current.message.metadata
Oauth2c:
- https://www.googleapis.com/auth/gmail.addons.current.message.metadata
- Oauth2:
- https://www.googleapis.com/auth/gmail.addons.current.message.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.addons.current.message.readonly
- Oauth2:
- https://www.googleapis.com/auth/gmail.metadata
Oauth2c:
- https://www.googleapis.com/auth/gmail.metadata
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
delete:
tags:
- users
description: Immediately and permanently deletes the specified thread. This operation cannot be undone. Prefer `threads.trash` instead.
operationId: threads.delete
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: ID of the Thread to delete.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
/gmail/v1/users/{userId}/threads/{id}/modify:
post:
tags:
- users
description: Modifies the labels applied to the thread. This applies to all messages in the thread.
operationId: threads.modify
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: The ID of the thread to modify.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
application/json:
schema:
type: object
properties:
addLabelIds:
description: A list of IDs of labels to add to this thread.
type: array
items:
type: string
removeLabelIds:
description: A list of IDs of labels to remove from this thread.
type: array
items:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Thread'
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
/gmail/v1/users/{userId}/threads/{id}/trash:
post:
tags:
- users
description: Moves the specified thread to the trash.
operationId: threads.trash
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: The ID of the thread to Trash.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Thread'
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
/gmail/v1/users/{userId}/threads/{id}/untrash:
post:
tags:
- users
description: Removes the specified thread from the trash.
operationId: threads.untrash
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
- name: id
description: The ID of the thread to remove from Trash.
required: true
schema:
type: string
in: path
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Thread'
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
/gmail/v1/users/{userId}/watch:
post:
tags:
- users
description: Set up or update a push notification watch on the given user mailbox.
operationId: watch
parameters:
- name: userId
description: The user's email address. The special value `me` can be used to indicate the authenticated user.
required: true
schema:
type: string
in: path
style: simple
requestBody:
content:
application/json:
schema:
description: Set up or update a new push notification watch on this user's mailbox.
type: object
properties:
labelFilterAction:
description: Filtering behavior of labelIds list specified.
type: string
enum:
- include
- exclude
labelIds:
description: 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.
type: array
items:
type: string
topicName:
description: 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).
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
description: Push notification watch response.
type: object
properties:
expiration:
description: When Gmail will stop sending notifications for mailbox updates (epoch millis). Call `watch` again before this time to renew the watch.
type: string
format: int64
historyId:
description: The ID of the mailbox's current history record.
type: string
format: uint64
security:
- Oauth2:
- https://mail.google.com/
Oauth2c:
- https://mail.google.com/
- Oauth2:
- https://www.googleapis.com/auth/gmail.metadata
Oauth2c:
- https://www.googleapis.com/auth/gmail.metadata
- Oauth2:
- https://www.googleapis.com/auth/gmail.modify
Oauth2c:
- https://www.googleapis.com/auth/gmail.modify
- Oauth2:
- https://www.googleapis.com/auth/gmail.readonly
Oauth2c:
- https://www.googleapis.com/auth/gmail.readonly
components:
securitySchemes:
Oauth2:
type: oauth2
flows:
implicit:
authorizationUrl: https://accounts.google.com/o/oauth2/auth
scopes:
https://mail.google.com/: Read, compose, send, and permanently delete all your email from Gmail
https://www.googleapis.com/auth/gmail.addons.current.action.compose: Manage drafts and send emails when you interact with the add-on
https://www.googleapis.com/auth/gmail.addons.current.message.action: View your email messages when you interact with the add-on
https://www.googleapis.com/auth/gmail.addons.current.message.metadata: View your email message metadata when the add-on is running
https://www.googleapis.com/auth/gmail.addons.current.message.readonly: View your email messages when the add-on is running
https://www.googleapis.com/auth/gmail.compose: Manage drafts and send emails
https://www.googleapis.com/auth/gmail.insert: Add emails into your Gmail mailbox
https://www.googleapis.com/auth/gmail.labels: See and edit your email labels
https://www.googleapis.com/auth/gmail.metadata: View your email message metadata such as labels and headers, but not the email body
https://www.googleapis.com/auth/gmail.modify: Read, compose, and send emails from your Gmail account
https://www.googleapis.com/auth/gmail.readonly: View your email messages and settings
https://www.googleapis.com/auth/gmail.send: Send email on your behalf
https://www.googleapis.com/auth/gmail.settings.basic: See, edit, create, or change your email settings and filters in Gmail
https://www.googleapis.com/auth/gmail.settings.sharing: Manage your sensitive mail settings, including who can manage your mail
description: Oauth 2.0 implicit authentication
Oauth2c:
type: oauth2
flows:
authorizationCode:
authorizationUrl: https://accounts.google.com/o/oauth2/auth
tokenUrl: https://accounts.google.com/o/oauth2/token
scopes:
https://mail.google.com/: Read, compose, send, and permanently delete all your email from Gmail
https://www.googleapis.com/auth/gmail.addons.current.action.compose: Manage drafts and send emails when you interact with the add-on
https://www.googleapis.com/auth/gmail.addons.current.message.action: View your email messages when you interact with the add-on
https://www.googleapis.com/auth/gmail.addons.current.message.metadata: View your email message metadata when the add-on is running
https://www.googleapis.com/auth/gmail.addons.current.message.readonly: View your email messages when the add-on is running
https://www.googleapis.com/auth/gmail.compose: Manage drafts and send emails
https://www.googleapis.com/auth/gmail.insert: Add emails into your Gmail mailbox
https://www.googleapis.com/auth/gmail.labels: See and edit your email labels
https://www.googleapis.com/auth/gmail.metadata: View your email message metadata such as labels and headers, but not the email body
https://www.googleapis.com/auth/gmail.modify: Read, compose, and send emails from your Gmail account
https://www.googleapis.com/auth/gmail.readonly: View your email messages and settings
https://www.googleapis.com/auth/gmail.send: Send email on your behalf
https://www.googleapis.com/auth/gmail.settings.basic: See, edit, create, or change your email settings and filters in Gmail
https://www.googleapis.com/auth/gmail.settings.sharing: Manage your sensitive mail settings, including who can manage your mail
description: Oauth 2.0 authorizationCode authentication
parameters:
upload_protocol:
name: upload_protocol
description: Upload protocol for media (e.g. "raw", "multipart").
schema:
type: string
in: query
style: form
access_token:
name: access_token
description: OAuth access token.
schema:
type: string
in: query
style: form
alt:
name: alt
description: Data format for response.
schema:
type: string
enum:
- json
- media
- proto
in: query
style: form
callback:
name: callback
description: JSONP
schema:
type: string
in: query
style: form
fields:
name: fields
description: Selector specifying which fields to include in a partial response.
schema:
type: string
in: query
style: form
key:
name: key
description: 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.
schema:
type: string
in: query
style: form
oauth_token:
name: oauth_token
description: OAuth 2.0 token for the current user.
schema:
type: string
in: query
style: form
prettyPrint:
name: prettyPrint
description: Returns response with indentations and line breaks.
schema:
type: boolean
in: query
style: form
quotaUser:
name: quotaUser
description: 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.
schema:
type: string
in: query
style: form
uploadType:
name: uploadType
description: Legacy upload protocol for media (e.g. "media", "multipart").
schema:
type: string
in: query
style: form
schemas:
AutoForwarding:
description: Auto-forwarding settings for an account.
type: object
properties:
disposition:
description: The state that a message should be left in after it has been forwarded.
type: string
enum:
- dispositionUnspecified
- leaveInInbox
- archive
- trash
- markRead
emailAddress:
description: Email address to which all incoming messages are forwarded. This email address must be a verified member of the forwarding addresses.
type: string
enabled:
description: Whether all incoming mail is automatically forwarded to another address.
type: boolean
BatchDeleteMessagesRequest:
type: object
properties:
ids:
description: The IDs of the messages to delete.
type: array
items:
type: string
BatchModifyMessagesRequest:
type: object
properties:
addLabelIds:
description: A list of label IDs to add to messages.
type: array
items:
type: string
ids:
description: The IDs of the messages to modify. There is a limit of 1000 ids per request.
type: array
items:
type: string
removeLabelIds:
description: A list of label IDs to remove from messages.
type: array
items:
type: string
Delegate:
description: Settings for a delegate. Delegates can read, send, and delete messages, as well as view and add contacts, for the delegator's account. See "Set up mail delegation" for more information about delegates.
type: object
properties:
delegateEmail:
description: The email address of the delegate.
type: string
verificationStatus:
description: Indicates whether this address has been verified and can act as a delegate for the account. Read-only.
type: string
enum:
- verificationStatusUnspecified
- accepted
- pending
- rejected
- expired
Draft:
description: A draft email in the user's mailbox.
type: object
properties:
id:
description: The immutable ID of the draft.
type: string
message:
$ref: '#/components/schemas/Message'
Filter:
description: Resource definition for Gmail filters. Filters apply to specific messages instead of an entire email thread.
type: object
properties:
action:
description: Action that the filter performs.
type: object
properties:
addLabelIds:
description: List of labels to add to the message.
type: array
items:
type: string
forward:
description: Email address that the message should be forwarded to.
type: string
removeLabelIds:
description: List of labels to remove from the message.
type: array
items:
type: string
criteria:
description: Matching criteria for the filter.
type: object
properties:
excludeChats:
description: Whether the response should exclude chats.
type: boolean
from:
description: The sender's display name or email address.
type: string
hasAttachment:
description: Whether the message has any attachment.
type: boolean
negatedQuery:
description: 'Only return messages not matching the specified query. Supports the same query format as the Gmail search box. For example, `"from:someuser@example.com rfc822msgid: is:unread"`.'
type: string
query:
description: 'Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, `"from:someuser@example.com rfc822msgid: is:unread"`.'
type: string
size:
description: The size of the entire RFC822 message in bytes, including all headers and attachments.
type: integer
format: int32
sizeComparison:
description: How the message size in bytes should be in relation to the size field.
type: string
enum:
- unspecified
- smaller
- larger
subject:
description: Case-insensitive phrase found in the message's subject. Trailing and leading whitespace are be trimmed and adjacent spaces are collapsed.
type: string
to:
description: The recipient's display name or email address. Includes recipients in the "to", "cc", and "bcc" header fields. You can use simply the local part of the email address. For example, "example" and "example@" both match "example@gmail.com". This field is case-insensitive.
type: string
id:
description: The server assigned ID of the filter.
type: string
FilterAction:
description: A set of actions to perform on a message.
type: object
properties:
addLabelIds:
description: List of labels to add to the message.
type: array
items:
type: string
forward:
description: Email address that the message should be forwarded to.
type: string
removeLabelIds:
description: List of labels to remove from the message.
type: array
items:
type: string
FilterCriteria:
description: Message matching criteria.
type: object
properties:
excludeChats:
description: Whether the response should exclude chats.
type: boolean
from:
description: The sender's display name or email address.
type: string
hasAttachment:
description: Whether the message has any attachment.
type: boolean
negatedQuery:
description: 'Only return messages not matching the specified query. Supports the same query format as the Gmail search box. For example, `"from:someuser@example.com rfc822msgid: is:unread"`.'
type: string
query:
description: 'Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, `"from:someuser@example.com rfc822msgid: is:unread"`.'
type: string
size:
description: The size of the entire RFC822 message in bytes, including all headers and attachments.
type: integer
format: int32
sizeComparison:
description: How the message size in bytes should be in relation to the size field.
type: string
enum:
- unspecified
- smaller
- larger
subject:
description: Case-insensitive phrase found in the message's subject. Trailing and leading whitespace are be trimmed and adjacent spaces are collapsed.
type: string
to:
description: The recipient's display name or email address. Includes recipients in the "to", "cc", and "bcc" header fields. You can use simply the local part of the email address. For example, "example" and "example@" both match "example@gmail.com". This field is case-insensitive.
type: string
ForwardingAddress:
description: Settings for a forwarding address.
type: object
properties:
forwardingEmail:
description: An email address to which messages can be forwarded.
type: string
verificationStatus:
description: Indicates whether this address has been verified and is usable for forwarding. Read-only.
type: string
enum:
- verificationStatusUnspecified
- accepted
- pending
History:
description: A record of a change to the user's mailbox. Each history change may affect multiple messages in multiple ways.
type: object
properties:
id:
description: The mailbox sequence ID.
type: string
format: uint64
labelsAdded:
description: Labels added to messages in this history record.
type: array
items:
$ref: '#/components/schemas/HistoryLabelAdded'
labelsRemoved:
description: Labels removed from messages in this history record.
type: array
items:
$ref: '#/components/schemas/HistoryLabelRemoved'
messages:
description: 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.
type: array
items:
$ref: '#/components/schemas/Message'
messagesAdded:
description: Messages added to the mailbox in this history record.
type: array
items:
$ref: '#/components/schemas/HistoryMessageAdded'
messagesDeleted:
description: Messages deleted (not Trashed) from the mailbox in this history record.
type: array
items:
$ref: '#/components/schemas/HistoryMessageDeleted'
HistoryLabelAdded:
type: object
properties:
labelIds:
description: Label IDs added to the message.
type: array
items:
type: string
message:
$ref: '#/components/schemas/Message'
HistoryLabelRemoved:
type: object
properties:
labelIds:
description: Label IDs removed from the message.
type: array
items:
type: string
message:
$ref: '#/components/schemas/Message'
HistoryMessageAdded:
type: object
properties:
message:
$ref: '#/components/schemas/Message'
HistoryMessageDeleted:
type: object
properties:
message:
$ref: '#/components/schemas/Message'
ImapSettings:
description: IMAP settings for an account.
type: object
properties:
autoExpunge:
description: If this value is true, Gmail will immediately expunge a message when it is marked as deleted in IMAP. Otherwise, Gmail will wait for an update from the client before expunging messages marked as deleted.
type: boolean
enabled:
description: Whether IMAP is enabled for the account.
type: boolean
expungeBehavior:
description: The action that will be executed on a message when it is marked as deleted and expunged from the last visible IMAP folder.
type: string
enum:
- expungeBehaviorUnspecified
- archive
- trash
- deleteForever
maxFolderSize:
description: An optional limit on the number of messages that an IMAP folder may contain. Legal values are 0, 1000, 2000, 5000 or 10000. A value of zero is interpreted to mean that there is no limit.
type: integer
format: int32
Label:
description: Labels are used to categorize messages and threads within the user's mailbox. The maximum number of labels supported for a user's mailbox is 10,000.
type: object
properties:
color:
description: The color to assign to the label. Color is only available for labels that have their `type` set to `user`.
type: object
properties:
backgroundColor:
description: 'The background color represented as hex string #RRGGBB (ex #000000). This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765'
type: string
textColor:
description: 'The text color of the label, represented as hex string. This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765'
type: string
id:
description: The immutable ID of the label.
type: string
labelListVisibility:
description: The visibility of the label in the label list in the Gmail web interface.
type: string
enum:
- labelShow
- labelShowIfUnread
- labelHide
messageListVisibility:
description: The visibility of messages with this label in the message list in the Gmail web interface.
type: string
enum:
- show
- hide
messagesTotal:
description: The total number of messages with the label.
type: integer
format: int32
messagesUnread:
description: The number of unread messages with the label.
type: integer
format: int32
name:
description: The display name of the label.
type: string
threadsTotal:
description: The total number of threads with the label.
type: integer
format: int32
threadsUnread:
description: The number of unread threads with the label.
type: integer
format: int32
type:
description: The owner type for the label. User labels are created by the user and can be modified and deleted by the user and can be applied to any message or thread. System labels are internally created and cannot be added, modified, or deleted. System labels may be able to be applied to or removed from messages and threads under some circumstances but this is not guaranteed. For example, users can apply and remove the `INBOX` and `UNREAD` labels from messages and threads, but cannot apply or remove the `DRAFTS` or `SENT` labels from messages or threads.
type: string
enum:
- system
- user
LabelColor:
type: object
properties:
backgroundColor:
description: 'The background color represented as hex string #RRGGBB (ex #000000). This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765'
type: string
textColor:
description: 'The text color of the label, represented as hex string. This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765'
type: string
LanguageSettings:
description: Language settings for an account. These settings correspond to the "Language settings" feature in the web interface.
type: object
properties:
displayLanguage:
description: The language to display Gmail in, formatted as an RFC 3066 Language Tag (for example `en-GB`, `fr` or `ja` for British English, French, or Japanese respectively). The set of languages supported by Gmail evolves over time, so please refer to the "Language" dropdown in the Gmail settings for all available options, as described in the language settings help article. A table of sample values is also provided in the Managing Language Settings guide Not all Gmail clients can display the same set of languages. In the case that a user's display language is not available for use on a particular client, said client automatically chooses to display in the closest supported variant (or a reasonable default).
type: string
ListDelegatesResponse:
description: Response for the ListDelegates method.
type: object
properties:
delegates:
description: List of the user's delegates (with any verification status). If an account doesn't have delegates, this field doesn't appear.
type: array
items:
description: Settings for a delegate. Delegates can read, send, and delete messages, as well as view and add contacts, for the delegator's account. See "Set up mail delegation" for more information about delegates.
type: object
properties:
delegateEmail:
description: The email address of the delegate.
type: string
verificationStatus:
description: Indicates whether this address has been verified and can act as a delegate for the account. Read-only.
type: string
enum:
- verificationStatusUnspecified
- accepted
- pending
- rejected
- expired
ListDraftsResponse:
type: object
properties:
drafts:
description: List of drafts. Note that the `Message` property in each `Draft` resource only contains an `id` and a `threadId`. The messages.get method can fetch additional message details.
type: array
items:
$ref: '#/components/schemas/Draft'
nextPageToken:
description: Token to retrieve the next page of results in the list.
type: string
resultSizeEstimate:
description: Estimated total number of results.
type: integer
format: uint32
ListFiltersResponse:
description: Response for the ListFilters method.
type: object
properties:
filter:
description: List of a user's filters.
type: array
items:
description: Resource definition for Gmail filters. Filters apply to specific messages instead of an entire email thread.
type: object
properties:
action:
description: Action that the filter performs.
type: object
properties:
addLabelIds:
description: List of labels to add to the message.
type: array
items:
type: string
forward:
description: Email address that the message should be forwarded to.
type: string
removeLabelIds:
description: List of labels to remove from the message.
type: array
items:
type: string
criteria:
description: Matching criteria for the filter.
type: object
properties:
excludeChats:
description: Whether the response should exclude chats.
type: boolean
from:
description: The sender's display name or email address.
type: string
hasAttachment:
description: Whether the message has any attachment.
type: boolean
negatedQuery:
description: 'Only return messages not matching the specified query. Supports the same query format as the Gmail search box. For example, `"from:someuser@example.com rfc822msgid: is:unread"`.'
type: string
query:
description: 'Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, `"from:someuser@example.com rfc822msgid: is:unread"`.'
type: string
size:
description: The size of the entire RFC822 message in bytes, including all headers and attachments.
type: integer
format: int32
sizeComparison:
description: How the message size in bytes should be in relation to the size field.
type: string
enum:
- unspecified
- smaller
- larger
subject:
description: Case-insensitive phrase found in the message's subject. Trailing and leading whitespace are be trimmed and adjacent spaces are collapsed.
type: string
to:
description: The recipient's display name or email address. Includes recipients in the "to", "cc", and "bcc" header fields. You can use simply the local part of the email address. For example, "example" and "example@" both match "example@gmail.com". This field is case-insensitive.
type: string
id:
description: The server assigned ID of the filter.
type: string
ListForwardingAddressesResponse:
description: Response for the ListForwardingAddresses method.
type: object
properties:
forwardingAddresses:
description: List of addresses that may be used for forwarding.
type: array
items:
description: Settings for a forwarding address.
type: object
properties:
forwardingEmail:
description: An email address to which messages can be forwarded.
type: string
verificationStatus:
description: Indicates whether this address has been verified and is usable for forwarding. Read-only.
type: string
enum:
- verificationStatusUnspecified
- accepted
- pending
ListHistoryResponse:
type: object
properties:
history:
description: List of history records. Any `messages` contained in the response will typically only have `id` and `threadId` fields populated.
type: array
items:
$ref: '#/components/schemas/History'
historyId:
description: The ID of the mailbox's current history record.
type: string
format: uint64
nextPageToken:
description: Page token to retrieve the next page of results in the list.
type: string
ListLabelsResponse:
type: object
properties:
labels:
description: List of labels. Note that each label resource only contains an `id`, `name`, `messageListVisibility`, `labelListVisibility`, and `type`. The labels.get method can fetch additional label details.
type: array
items:
description: Labels are used to categorize messages and threads within the user's mailbox. The maximum number of labels supported for a user's mailbox is 10,000.
type: object
properties:
color:
description: The color to assign to the label. Color is only available for labels that have their `type` set to `user`.
type: object
properties:
backgroundColor:
description: 'The background color represented as hex string #RRGGBB (ex #000000). This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765'
type: string
textColor:
description: 'The text color of the label, represented as hex string. This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765'
type: string
id:
description: The immutable ID of the label.
type: string
labelListVisibility:
description: The visibility of the label in the label list in the Gmail web interface.
type: string
enum:
- labelShow
- labelShowIfUnread
- labelHide
messageListVisibility:
description: The visibility of messages with this label in the message list in the Gmail web interface.
type: string
enum:
- show
- hide
messagesTotal:
description: The total number of messages with the label.
type: integer
format: int32
messagesUnread:
description: The number of unread messages with the label.
type: integer
format: int32
name:
description: The display name of the label.
type: string
threadsTotal:
description: The total number of threads with the label.
type: integer
format: int32
threadsUnread:
description: The number of unread threads with the label.
type: integer
format: int32
type:
description: The owner type for the label. User labels are created by the user and can be modified and deleted by the user and can be applied to any message or thread. System labels are internally created and cannot be added, modified, or deleted. System labels may be able to be applied to or removed from messages and threads under some circumstances but this is not guaranteed. For example, users can apply and remove the `INBOX` and `UNREAD` labels from messages and threads, but cannot apply or remove the `DRAFTS` or `SENT` labels from messages or threads.
type: string
enum:
- system
- user
ListMessagesResponse:
type: object
properties:
messages:
description: List of messages. Note that each message resource contains only an `id` and a `threadId`. Additional message details can be fetched using the messages.get method.
type: array
items:
$ref: '#/components/schemas/Message'
nextPageToken:
description: Token to retrieve the next page of results in the list.
type: string
resultSizeEstimate:
description: Estimated total number of results.
type: integer
format: uint32
ListSendAsResponse:
description: Response for the ListSendAs method.
type: object
properties:
sendAs:
description: List of send-as aliases.
type: array
items:
description: Settings associated with a send-as alias, which can be either the primary login address associated with the account or a custom "from" address. Send-as aliases correspond to the "Send Mail As" feature in the web interface.
type: object
properties:
displayName:
description: A name that appears in the "From:" header for mail sent using this alias. For custom "from" addresses, when this is empty, Gmail will populate the "From:" header with the name that is used for the primary address associated with the account. If the admin has disabled the ability for users to update their name format, requests to update this field for the primary login will silently fail.
type: string
isDefault:
description: Whether this address is selected as the default "From:" address in situations such as composing a new message or sending a vacation auto-reply. Every Gmail account has exactly one default send-as address, so the only legal value that clients may write to this field is `true`. Changing this from `false` to `true` for an address will result in this field becoming `false` for the other previous default address.
type: boolean
isPrimary:
description: Whether this address is the primary address used to login to the account. Every Gmail account has exactly one primary address, and it cannot be deleted from the collection of send-as aliases. This field is read-only.
type: boolean
replyToAddress:
description: An optional email address that is included in a "Reply-To:" header for mail sent using this alias. If this is empty, Gmail will not generate a "Reply-To:" header.
type: string
sendAsEmail:
description: The email address that appears in the "From:" header for mail sent using this alias. This is read-only for all operations except create.
type: string
signature:
description: An optional HTML signature that is included in messages composed with this alias in the Gmail web UI. This signature is added to new emails only.
type: string
smtpMsa:
description: An optional SMTP service that will be used as an outbound relay for mail sent using this alias. If this is empty, outbound mail will be sent directly from Gmail's servers to the destination SMTP service. This setting only applies to custom "from" aliases.
type: object
properties:
host:
description: The hostname of the SMTP service. Required.
type: string
password:
description: The password that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses.
type: string
port:
description: The port of the SMTP service. Required.
type: integer
format: int32
securityMode:
description: The protocol that will be used to secure communication with the SMTP service. Required.
type: string
enum:
- securityModeUnspecified
- none
- ssl
- starttls
username:
description: The username that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses.
type: string
treatAsAlias:
description: Whether Gmail should treat this address as an alias for the user's primary email address. This setting only applies to custom "from" aliases.
type: boolean
verificationStatus:
description: Indicates whether this address has been verified for use as a send-as alias. Read-only. This setting only applies to custom "from" aliases.
type: string
enum:
- verificationStatusUnspecified
- accepted
- pending
ListSmimeInfoResponse:
type: object
properties:
smimeInfo:
description: List of SmimeInfo.
type: array
items:
description: An S/MIME email config.
type: object
properties:
encryptedKeyPassword:
description: Encrypted key password, when key is encrypted.
type: string
expiration:
description: When the certificate expires (in milliseconds since epoch).
type: string
format: int64
id:
description: The immutable ID for the SmimeInfo.
type: string
isDefault:
description: Whether this SmimeInfo is the default one for this user's send-as address.
type: boolean
issuerCn:
description: The S/MIME certificate issuer's common name.
type: string
pem:
description: PEM formatted X509 concatenated certificate string (standard base64 encoding). Format used for returning key, which includes public key as well as certificate chain (not private key).
type: string
pkcs12:
description: PKCS#12 format containing a single private/public key pair and certificate chain. This format is only accepted from client for creating a new SmimeInfo and is never returned, because the private key is not intended to be exported. PKCS#12 may be encrypted, in which case encryptedKeyPassword should be set appropriately.
type: string
format: byte
ListThreadsResponse:
type: object
properties:
nextPageToken:
description: Page token to retrieve the next page of results in the list.
type: string
resultSizeEstimate:
description: Estimated total number of results.
type: integer
format: uint32
threads:
description: List of threads. Note that each thread resource does not contain a list of `messages`. The list of `messages` for a given thread can be fetched using the threads.get method.
type: array
items:
$ref: '#/components/schemas/Thread'
required:
- resultSizeEstimate
- threads
Message:
description: An email message.
type: object
properties:
historyId:
description: The ID of the last history record that modified this message.
type: string
format: uint64
id:
description: The immutable ID of the message.
type: string
internalDate:
description: 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.
type: string
format: int64
labelIds:
description: List of IDs of labels applied to this message.
type: array
items:
type: string
payload:
$ref: '#/components/schemas/MessagePart'
raw:
description: 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.
type: string
format: byte
sizeEstimate:
description: Estimated size in bytes of the message.
type: integer
format: int32
snippet:
description: A short part of the message text.
type: string
threadId:
description: '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. '
type: string
required:
- historyId
- id
- internalDate
- labelIds
- payload
- sizeEstimate
- snippet
- threadId
MessagePart:
description: A single MIME message part.
type: object
properties:
body:
description: The message part body for this part, which may be empty for container MIME message parts.
type: object
properties:
attachmentId:
description: 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.
type: string
data:
description: 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.
type: string
format: byte
size:
description: Number of bytes for the message part data (encoding notwithstanding).
type: integer
format: int32
filename:
description: The filename of the attachment. Only present if this message part represents an attachment.
type: string
headers:
type: array
items:
$ref: '#/components/schemas/Header'
mimeType:
description: The MIME type of the message part.
type: string
partId:
description: The immutable ID of the message part.
type: string
parts:
description: 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.
type: array
items:
$ref: '#/components/schemas/MessagePart'
required:
- body
- filename
- headers
- mimeType
- partId
- parts
MessagePartBody:
description: The body of a single MIME message part.
type: object
properties:
attachmentId:
description: 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.
type: string
data:
description: 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.
type: string
format: byte
size:
description: Number of bytes for the message part data (encoding notwithstanding).
type: integer
format: int32
MessagePartHeader:
type: object
properties:
name:
description: The name of the header before the `:` separator. For example, `To`.
type: string
value:
description: The value of the header after the `:` separator. For example, `someuser@example.com`.
type: string
ModifyMessageRequest:
type: object
properties:
addLabelIds:
description: A list of IDs of labels to add to this message.
type: array
items:
type: string
removeLabelIds:
description: A list IDs of labels to remove from this message.
type: array
items:
type: string
ModifyThreadRequest:
type: object
properties:
addLabelIds:
description: A list of IDs of labels to add to this thread.
type: array
items:
type: string
removeLabelIds:
description: A list of IDs of labels to remove from this thread.
type: array
items:
type: string
PopSettings:
description: POP settings for an account.
type: object
properties:
accessWindow:
description: The range of messages which are accessible via POP.
type: string
enum:
- accessWindowUnspecified
- disabled
- fromNowOn
- allMail
disposition:
description: The action that will be executed on a message after it has been fetched via POP.
type: string
enum:
- dispositionUnspecified
- leaveInInbox
- archive
- trash
- markRead
Profile:
description: Profile for a Gmail user.
type: object
properties:
emailAddress:
description: The user's email address.
type: string
historyId:
description: The ID of the mailbox's current history record.
type: string
format: uint64
messagesTotal:
description: The total number of messages in the mailbox.
type: integer
format: int32
threadsTotal:
description: The total number of threads in the mailbox.
type: integer
format: int32
SendAs:
description: Settings associated with a send-as alias, which can be either the primary login address associated with the account or a custom "from" address. Send-as aliases correspond to the "Send Mail As" feature in the web interface.
type: object
properties:
displayName:
description: A name that appears in the "From:" header for mail sent using this alias. For custom "from" addresses, when this is empty, Gmail will populate the "From:" header with the name that is used for the primary address associated with the account. If the admin has disabled the ability for users to update their name format, requests to update this field for the primary login will silently fail.
type: string
isDefault:
description: Whether this address is selected as the default "From:" address in situations such as composing a new message or sending a vacation auto-reply. Every Gmail account has exactly one default send-as address, so the only legal value that clients may write to this field is `true`. Changing this from `false` to `true` for an address will result in this field becoming `false` for the other previous default address.
type: boolean
isPrimary:
description: Whether this address is the primary address used to login to the account. Every Gmail account has exactly one primary address, and it cannot be deleted from the collection of send-as aliases. This field is read-only.
type: boolean
replyToAddress:
description: An optional email address that is included in a "Reply-To:" header for mail sent using this alias. If this is empty, Gmail will not generate a "Reply-To:" header.
type: string
sendAsEmail:
description: The email address that appears in the "From:" header for mail sent using this alias. This is read-only for all operations except create.
type: string
signature:
description: An optional HTML signature that is included in messages composed with this alias in the Gmail web UI. This signature is added to new emails only.
type: string
smtpMsa:
description: An optional SMTP service that will be used as an outbound relay for mail sent using this alias. If this is empty, outbound mail will be sent directly from Gmail's servers to the destination SMTP service. This setting only applies to custom "from" aliases.
type: object
properties:
host:
description: The hostname of the SMTP service. Required.
type: string
password:
description: The password that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses.
type: string
port:
description: The port of the SMTP service. Required.
type: integer
format: int32
securityMode:
description: The protocol that will be used to secure communication with the SMTP service. Required.
type: string
enum:
- securityModeUnspecified
- none
- ssl
- starttls
username:
description: The username that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses.
type: string
treatAsAlias:
description: Whether Gmail should treat this address as an alias for the user's primary email address. This setting only applies to custom "from" aliases.
type: boolean
verificationStatus:
description: Indicates whether this address has been verified for use as a send-as alias. Read-only. This setting only applies to custom "from" aliases.
type: string
enum:
- verificationStatusUnspecified
- accepted
- pending
SmimeInfo:
description: An S/MIME email config.
type: object
properties:
encryptedKeyPassword:
description: Encrypted key password, when key is encrypted.
type: string
expiration:
description: When the certificate expires (in milliseconds since epoch).
type: string
format: int64
id:
description: The immutable ID for the SmimeInfo.
type: string
isDefault:
description: Whether this SmimeInfo is the default one for this user's send-as address.
type: boolean
issuerCn:
description: The S/MIME certificate issuer's common name.
type: string
pem:
description: PEM formatted X509 concatenated certificate string (standard base64 encoding). Format used for returning key, which includes public key as well as certificate chain (not private key).
type: string
pkcs12:
description: PKCS#12 format containing a single private/public key pair and certificate chain. This format is only accepted from client for creating a new SmimeInfo and is never returned, because the private key is not intended to be exported. PKCS#12 may be encrypted, in which case encryptedKeyPassword should be set appropriately.
type: string
format: byte
SmtpMsa:
description: Configuration for communication with an SMTP service.
type: object
properties:
host:
description: The hostname of the SMTP service. Required.
type: string
password:
description: The password that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses.
type: string
port:
description: The port of the SMTP service. Required.
type: integer
format: int32
securityMode:
description: The protocol that will be used to secure communication with the SMTP service. Required.
type: string
enum:
- securityModeUnspecified
- none
- ssl
- starttls
username:
description: The username that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses.
type: string
Thread:
description: A collection of messages representing a conversation.
type: object
properties:
historyId:
description: The ID of the last history record that modified this thread.
type: string
format: uint64
id:
description: The unique ID of the thread.
type: string
messages:
description: The list of messages in the thread.
type: array
items:
$ref: '#/components/schemas/Message'
snippet:
description: A short part of the message text.
type: string
required:
- historyId
- id
- messages
VacationSettings:
description: Vacation auto-reply settings for an account. These settings correspond to the "Vacation responder" feature in the web interface.
type: object
properties:
enableAutoReply:
description: Flag that controls whether Gmail automatically replies to messages.
type: boolean
endTime:
description: An optional end time for sending auto-replies (epoch ms). When this is specified, Gmail will automatically reply only to messages that it receives before the end time. If both `startTime` and `endTime` are specified, `startTime` must precede `endTime`.
type: string
format: int64
responseBodyHtml:
description: Response body in HTML format. Gmail will sanitize the HTML before storing it. If both `response_body_plain_text` and `response_body_html` are specified, `response_body_html` will be used.
type: string
responseBodyPlainText:
description: Response body in plain text format. If both `response_body_plain_text` and `response_body_html` are specified, `response_body_html` will be used.
type: string
responseSubject:
description: Optional text to prepend to the subject line in vacation responses. In order to enable auto-replies, either the response subject or the response body must be nonempty.
type: string
restrictToContacts:
description: Flag that determines whether responses are sent to recipients who are not in the user's list of contacts.
type: boolean
restrictToDomain:
description: Flag that determines whether responses are sent to recipients who are outside of the user's domain. This feature is only available for G Suite users.
type: boolean
startTime:
description: An optional start time for sending auto-replies (epoch ms). When this is specified, Gmail will automatically reply only to messages that it receives after the start time. If both `startTime` and `endTime` are specified, `startTime` must precede `endTime`.
type: string
format: int64
WatchRequest:
description: Set up or update a new push notification watch on this user's mailbox.
type: object
properties:
labelFilterAction:
description: Filtering behavior of labelIds list specified.
type: string
enum:
- include
- exclude
labelIds:
description: 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.
type: array
items:
type: string
topicName:
description: 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).
type: string
WatchResponse:
description: Push notification watch response.
type: object
properties:
expiration:
description: When Gmail will stop sending notifications for mailbox updates (epoch millis). Call `watch` again before this time to renew the watch.
type: string
format: int64
historyId:
description: The ID of the mailbox's current history record.
type: string
format: uint64
Header:
type: object
properties:
name:
type: string
value:
type: string
required:
- name
- value
security:
- Oauth2c: []
tags:
- name: users
externalDocs:
url: https://developers.google.com/gmail/api/