{"files":{"SKILL.md":"---\nname: gmail-api\ndescription: \"Gmail API skill. Use when working with Gmail for gmail. Covers 79 endpoints.\"\nversion: 1.0.0\ngenerator: lapsh\n---\n\n# Gmail API\nAPI version: v1\n\n## Auth\nOAuth2 | OAuth2\n\n## Base URL\nhttps://gmail.googleapis.com/\n\n## Setup\n1. Configure auth: OAuth2 | OAuth2\n2. GET /gmail/v1/users/{userId}/drafts -- lists the drafts in the user's mailbox.\n3. POST /gmail/v1/users/{userId}/drafts -- create first draft\n\n## Endpoints\n79 endpoints across 1 group. See references/api-spec.lap for full details.\n\n### Gmail\n| Method | Path | Description |\n|--------|------|-------------|\n| GET | /gmail/v1/users/{userId}/drafts | Lists the drafts in the user's mailbox. |\n| POST | /gmail/v1/users/{userId}/drafts | Creates a new draft with the `DRAFT` label. |\n| POST | /gmail/v1/users/{userId}/drafts/send | Sends the specified, existing draft to the recipients in the `To`, `Cc`, and `Bcc` headers. |\n| DELETE | /gmail/v1/users/{userId}/drafts/{id} | Immediately and permanently deletes the specified draft. Does not simply trash it. |\n| GET | /gmail/v1/users/{userId}/drafts/{id} | Gets the specified draft. |\n| PUT | /gmail/v1/users/{userId}/drafts/{id} | Replaces a draft's content. |\n| GET | /gmail/v1/users/{userId}/history | Lists the history of all changes to the given mailbox. History results are returned in chronological order (increasing `historyId`). |\n| GET | /gmail/v1/users/{userId}/labels | Lists all labels in the user's mailbox. |\n| POST | /gmail/v1/users/{userId}/labels | Creates a new label. |\n| DELETE | /gmail/v1/users/{userId}/labels/{id} | Immediately and permanently deletes the specified label and removes it from any messages and threads that it is applied to. |\n| GET | /gmail/v1/users/{userId}/labels/{id} | Gets the specified label. |\n| PATCH | /gmail/v1/users/{userId}/labels/{id} | Patch the specified label. |\n| PUT | /gmail/v1/users/{userId}/labels/{id} | Updates the specified label. |\n| GET | /gmail/v1/users/{userId}/messages | Lists the messages in the user's mailbox. |\n| POST | /gmail/v1/users/{userId}/messages | Directly inserts a message into only this user's mailbox similar to `IMAP APPEND`, bypassing most scanning and classification. Does not send a message. |\n| POST | /gmail/v1/users/{userId}/messages/batchDelete | Deletes many messages by message ID. Provides no guarantees that messages were not already deleted or even existed at all. |\n| POST | /gmail/v1/users/{userId}/messages/batchModify | Modifies the labels on the specified messages. |\n| POST | /gmail/v1/users/{userId}/messages/import | 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. |\n| POST | /gmail/v1/users/{userId}/messages/send | Sends the specified message to the recipients in the `To`, `Cc`, and `Bcc` headers. For example usage, see [Sending email](https://developers.google.com/gmail/api/guides/sending). |\n| DELETE | /gmail/v1/users/{userId}/messages/{id} | Immediately and permanently deletes the specified message. This operation cannot be undone. Prefer `messages.trash` instead. |\n| GET | /gmail/v1/users/{userId}/messages/{id} | Gets the specified message. |\n| POST | /gmail/v1/users/{userId}/messages/{id}/modify | Modifies the labels on the specified message. |\n| POST | /gmail/v1/users/{userId}/messages/{id}/trash | Moves the specified message to the trash. |\n| POST | /gmail/v1/users/{userId}/messages/{id}/untrash | Removes the specified message from the trash. |\n| GET | /gmail/v1/users/{userId}/messages/{messageId}/attachments/{id} | Gets the specified message attachment. |\n| GET | /gmail/v1/users/{userId}/profile | Gets the current user's Gmail profile. |\n| GET | /gmail/v1/users/{userId}/settings/autoForwarding | Gets the auto-forwarding setting for the specified account. |\n| PUT | /gmail/v1/users/{userId}/settings/autoForwarding | 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. |\n| GET | /gmail/v1/users/{userId}/settings/cse/identities | Lists the client-side encrypted identities for an authenticated user. |\n| POST | /gmail/v1/users/{userId}/settings/cse/identities | Creates and configures a client-side encryption identity that's authorized to send mail from the user account. Google publishes the S/MIME certificate to a shared domain-wide directory so that people within a Google Workspace organization can encrypt and send mail to the identity. |\n| DELETE | /gmail/v1/users/{userId}/settings/cse/identities/{cseEmailAddress} | Deletes a client-side encryption identity. The authenticated user can no longer use the identity to send encrypted messages. You cannot restore the identity after you delete it. Instead, use the CreateCseIdentity method to create another identity with the same configuration. |\n| GET | /gmail/v1/users/{userId}/settings/cse/identities/{cseEmailAddress} | Retrieves a client-side encryption identity configuration. |\n| PATCH | /gmail/v1/users/{userId}/settings/cse/identities/{emailAddress} | Associates a different key pair with an existing client-side encryption identity. The updated key pair must validate against Google's [S/MIME certificate profiles](https://support.google.com/a/answer/7300887). |\n| GET | /gmail/v1/users/{userId}/settings/cse/keypairs | Lists client-side encryption key pairs for an authenticated user. |\n| POST | /gmail/v1/users/{userId}/settings/cse/keypairs | Creates and uploads a client-side encryption S/MIME public key certificate chain and private key metadata for the authenticated user. |\n| GET | /gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId} | Retrieves an existing client-side encryption key pair. |\n| POST | /gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}:disable | Turns off a client-side encryption key pair. The authenticated user can no longer use the key pair to decrypt incoming CSE message texts or sign outgoing CSE mail. To regain access, use the EnableCseKeyPair to turn on the key pair. After 30 days, you can permanently delete the key pair by using the ObliterateCseKeyPair method. |\n| POST | /gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}:enable | Turns on a client-side encryption key pair that was turned off. The key pair becomes active again for any associated client-side encryption identities. |\n| POST | /gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}:obliterate | Deletes a client-side encryption key pair permanently and immediately. You can only permanently delete key pairs that have been turned off for more than 30 days. To turn off a key pair, use the DisableCseKeyPair method. Gmail can't restore or decrypt any messages that were encrypted by an obliterated key. Authenticated users and Google Workspace administrators lose access to reading the encrypted messages. |\n| GET | /gmail/v1/users/{userId}/settings/delegates | Lists the delegates for the specified account. This method is only available to service account clients that have been delegated domain-wide authority. |\n| POST | /gmail/v1/users/{userId}/settings/delegates | 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 Google Workspace organization as the delegator user. Gmail imposes limitations on the number of delegates and delegators each user in a Google Workspace 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. |\n| DELETE | /gmail/v1/users/{userId}/settings/delegates/{delegateEmail} | 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. |\n| GET | /gmail/v1/users/{userId}/settings/delegates/{delegateEmail} | 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. |\n| GET | /gmail/v1/users/{userId}/settings/filters | Lists the message filters of a Gmail user. |\n| POST | /gmail/v1/users/{userId}/settings/filters | Creates a filter. Note: you can only create a maximum of 1,000 filters. |\n| DELETE | /gmail/v1/users/{userId}/settings/filters/{id} | Immediately and permanently deletes the specified filter. |\n| GET | /gmail/v1/users/{userId}/settings/filters/{id} | Gets a filter. |\n| GET | /gmail/v1/users/{userId}/settings/forwardingAddresses | Lists the forwarding addresses for the specified account. |\n| POST | /gmail/v1/users/{userId}/settings/forwardingAddresses | 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. |\n| DELETE | /gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail} | 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. |\n| GET | /gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail} | Gets the specified forwarding address. |\n| GET | /gmail/v1/users/{userId}/settings/imap | Gets IMAP settings. |\n| PUT | /gmail/v1/users/{userId}/settings/imap | Updates IMAP settings. |\n| GET | /gmail/v1/users/{userId}/settings/language | Gets language settings. |\n| PUT | /gmail/v1/users/{userId}/settings/language | 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. |\n| GET | /gmail/v1/users/{userId}/settings/pop | Gets POP settings. |\n| PUT | /gmail/v1/users/{userId}/settings/pop | Updates POP settings. |\n| GET | /gmail/v1/users/{userId}/settings/sendAs | 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. |\n| POST | /gmail/v1/users/{userId}/settings/sendAs | 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. |\n| DELETE | /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail} | 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. |\n| GET | /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail} | Gets the specified send-as alias. Fails with an HTTP 404 error if the specified address is not a member of the collection. |\n| PATCH | /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail} | Patch the specified send-as alias. |\n| PUT | /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail} | 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. |\n| GET | /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo | Lists S/MIME configs for the specified send-as alias. |\n| POST | /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo | Insert (upload) the given S/MIME config for the specified send-as alias. Note that pkcs12 format is required for the key. |\n| DELETE | /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id} | Deletes the specified S/MIME config for the specified send-as alias. |\n| GET | /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id} | Gets the specified S/MIME config for the specified send-as alias. |\n| POST | /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}/setDefault | Sets the default S/MIME config for the specified send-as alias. |\n| POST | /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/verify | 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. |\n| GET | /gmail/v1/users/{userId}/settings/vacation | Gets vacation responder settings. |\n| PUT | /gmail/v1/users/{userId}/settings/vacation | Updates vacation responder settings. |\n| POST | /gmail/v1/users/{userId}/stop | Stop receiving push notifications for the given user mailbox. |\n| GET | /gmail/v1/users/{userId}/threads | Lists the threads in the user's mailbox. |\n| DELETE | /gmail/v1/users/{userId}/threads/{id} | Immediately and permanently deletes the specified thread. Any messages that belong to the thread are also deleted. This operation cannot be undone. Prefer `threads.trash` instead. |\n| GET | /gmail/v1/users/{userId}/threads/{id} | Gets the specified thread. |\n| POST | /gmail/v1/users/{userId}/threads/{id}/modify | Modifies the labels applied to the thread. This applies to all messages in the thread. |\n| POST | /gmail/v1/users/{userId}/threads/{id}/trash | Moves the specified thread to the trash. Any messages that belong to the thread are also moved to the trash. |\n| POST | /gmail/v1/users/{userId}/threads/{id}/untrash | Removes the specified thread from the trash. Any messages that belong to the thread are also removed from the trash. |\n| POST | /gmail/v1/users/{userId}/watch | Set up or update a push notification watch on the given user mailbox. |\n\n## Common Questions\nMatch user requests to endpoints in references/api-spec.lap. Key patterns:\n- \"Search drafts?\" -> GET /gmail/v1/users/{userId}/drafts\n- \"Create a draft?\" -> POST /gmail/v1/users/{userId}/drafts\n- \"Create a send?\" -> POST /gmail/v1/users/{userId}/drafts/send\n- \"Delete a draft?\" -> DELETE /gmail/v1/users/{userId}/drafts/{id}\n- \"Get draft details?\" -> GET /gmail/v1/users/{userId}/drafts/{id}\n- \"Update a draft?\" -> PUT /gmail/v1/users/{userId}/drafts/{id}\n- \"List all history?\" -> GET /gmail/v1/users/{userId}/history\n- \"List all labels?\" -> GET /gmail/v1/users/{userId}/labels\n- \"Create a label?\" -> POST /gmail/v1/users/{userId}/labels\n- \"Delete a label?\" -> DELETE /gmail/v1/users/{userId}/labels/{id}\n- \"Get label details?\" -> GET /gmail/v1/users/{userId}/labels/{id}\n- \"Partially update a label?\" -> PATCH /gmail/v1/users/{userId}/labels/{id}\n- \"Update a label?\" -> PUT /gmail/v1/users/{userId}/labels/{id}\n- \"Search messages?\" -> GET /gmail/v1/users/{userId}/messages\n- \"Create a message?\" -> POST /gmail/v1/users/{userId}/messages\n- \"Create a batchDelete?\" -> POST /gmail/v1/users/{userId}/messages/batchDelete\n- \"Create a batchModify?\" -> POST /gmail/v1/users/{userId}/messages/batchModify\n- \"Create a import?\" -> POST /gmail/v1/users/{userId}/messages/import\n- \"Delete a message?\" -> DELETE /gmail/v1/users/{userId}/messages/{id}\n- \"Get message details?\" -> GET /gmail/v1/users/{userId}/messages/{id}\n- \"Create a modify?\" -> POST /gmail/v1/users/{userId}/messages/{id}/modify\n- \"Create a trash?\" -> POST /gmail/v1/users/{userId}/messages/{id}/trash\n- \"Create a untrash?\" -> POST /gmail/v1/users/{userId}/messages/{id}/untrash\n- \"Get attachment details?\" -> GET /gmail/v1/users/{userId}/messages/{messageId}/attachments/{id}\n- \"List all profile?\" -> GET /gmail/v1/users/{userId}/profile\n- \"List all autoForwarding?\" -> GET /gmail/v1/users/{userId}/settings/autoForwarding\n- \"List all identities?\" -> GET /gmail/v1/users/{userId}/settings/cse/identities\n- \"Create a identity?\" -> POST /gmail/v1/users/{userId}/settings/cse/identities\n- \"Delete a identity?\" -> DELETE /gmail/v1/users/{userId}/settings/cse/identities/{cseEmailAddress}\n- \"Get identity details?\" -> GET /gmail/v1/users/{userId}/settings/cse/identities/{cseEmailAddress}\n- \"Partially update a identity?\" -> PATCH /gmail/v1/users/{userId}/settings/cse/identities/{emailAddress}\n- \"List all keypairs?\" -> GET /gmail/v1/users/{userId}/settings/cse/keypairs\n- \"Create a keypair?\" -> POST /gmail/v1/users/{userId}/settings/cse/keypairs\n- \"Get keypair details?\" -> GET /gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}\n- \"List all delegates?\" -> GET /gmail/v1/users/{userId}/settings/delegates\n- \"Create a delegate?\" -> POST /gmail/v1/users/{userId}/settings/delegates\n- \"Delete a delegate?\" -> DELETE /gmail/v1/users/{userId}/settings/delegates/{delegateEmail}\n- \"Get delegate details?\" -> GET /gmail/v1/users/{userId}/settings/delegates/{delegateEmail}\n- \"List all filters?\" -> GET /gmail/v1/users/{userId}/settings/filters\n- \"Create a filter?\" -> POST /gmail/v1/users/{userId}/settings/filters\n- \"Delete a filter?\" -> DELETE /gmail/v1/users/{userId}/settings/filters/{id}\n- \"Get filter details?\" -> GET /gmail/v1/users/{userId}/settings/filters/{id}\n- \"List all forwardingAddresses?\" -> GET /gmail/v1/users/{userId}/settings/forwardingAddresses\n- \"Create a forwardingAddresse?\" -> POST /gmail/v1/users/{userId}/settings/forwardingAddresses\n- \"Delete a forwardingAddresse?\" -> DELETE /gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}\n- \"Get forwardingAddresse details?\" -> GET /gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}\n- \"List all imap?\" -> GET /gmail/v1/users/{userId}/settings/imap\n- \"List all language?\" -> GET /gmail/v1/users/{userId}/settings/language\n- \"List all pop?\" -> GET /gmail/v1/users/{userId}/settings/pop\n- \"List all sendAs?\" -> GET /gmail/v1/users/{userId}/settings/sendAs\n- \"Create a sendA?\" -> POST /gmail/v1/users/{userId}/settings/sendAs\n- \"Delete a sendA?\" -> DELETE /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}\n- \"Get sendA details?\" -> GET /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}\n- \"Partially update a sendA?\" -> PATCH /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}\n- \"Update a sendA?\" -> PUT /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}\n- \"List all smimeInfo?\" -> GET /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo\n- \"Create a smimeInfo?\" -> POST /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo\n- \"Delete a smimeInfo?\" -> DELETE /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}\n- \"Get smimeInfo details?\" -> GET /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}\n- \"Create a setDefault?\" -> POST /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}/setDefault\n- \"Create a verify?\" -> POST /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/verify\n- \"List all vacation?\" -> GET /gmail/v1/users/{userId}/settings/vacation\n- \"Create a stop?\" -> POST /gmail/v1/users/{userId}/stop\n- \"Search threads?\" -> GET /gmail/v1/users/{userId}/threads\n- \"Delete a thread?\" -> DELETE /gmail/v1/users/{userId}/threads/{id}\n- \"Get thread details?\" -> GET /gmail/v1/users/{userId}/threads/{id}\n- \"Create a watch?\" -> POST /gmail/v1/users/{userId}/watch\n- \"How to authenticate?\" -> See Auth section above\n\n## Response Tips\n- Check response schemas in references/api-spec.lap for field details\n- Create/update endpoints return the modified resource on success\n\n## References\n- Full spec: See references/api-spec.lap for complete endpoint details, parameter tables, and response schemas\n\n> Generated from the official API spec by [LAP](https://lap.sh)\n","references/api-spec.lap":"@lap v0.3\n# Machine-readable API spec. Each @endpoint block is one API call.\n@api Gmail API\n@base https://gmail.googleapis.com/\n@version v1\n@auth OAuth2 | OAuth2\n@common_fields {userId: str # The user's email address. The special value `me` can be used to indicate the authenticated user.}\n@endpoints 79\n@hint download_for_search\n@toc gmail(79)\n\n@endpoint GET /gmail/v1/users/{userId}/drafts\n@desc Lists the drafts in the user's mailbox.\n@optional {includeSpamTrash: bool # Include drafts from `SPAM` and `TRASH` in the results., maxResults: int # Maximum number of drafts to return. This field defaults to 100. The maximum allowed value for this field is 500., pageToken: str # Page token to retrieve a specific page of results in the list., q: str # 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\"`.}\n@returns(200) {drafts: [map], nextPageToken: str, resultSizeEstimate: int(uint32)} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/drafts\n@desc Creates a new draft with the `DRAFT` label.\n@returns(200) {id: str, message: map{historyId: str(uint64), id: str, internalDate: str(int64), labelIds: [str], payload: map{body: map{attachmentId: str, data: str(byte), size: int(int32)}, filename: str, headers: [map], mimeType: str, partId: str, parts: [map]}, raw: str(byte), sizeEstimate: int(int32), snippet: str, threadId: str}} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/drafts/send\n@desc Sends the specified, existing draft to the recipients in the `To`, `Cc`, and `Bcc` headers.\n@returns(200) {historyId: str(uint64), id: str, internalDate: str(int64), labelIds: [str], payload: map{body: map{attachmentId: str, data: str(byte), size: int(int32)}, filename: str, headers: [map], mimeType: str, partId: str, parts: [map]}, raw: str(byte), sizeEstimate: int(int32), snippet: str, threadId: str} # Successful response\n\n@endpoint DELETE /gmail/v1/users/{userId}/drafts/{id}\n@desc Immediately and permanently deletes the specified draft. Does not simply trash it.\n@required {id: str # The ID of the draft to delete.}\n@returns(200) Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/drafts/{id}\n@desc Gets the specified draft.\n@required {id: str # The ID of the draft to retrieve.}\n@optional {format: str(minimal/full/raw/metadata) # The format to return the draft in.}\n@returns(200) {id: str, message: map{historyId: str(uint64), id: str, internalDate: str(int64), labelIds: [str], payload: map{body: map{attachmentId: str, data: str(byte), size: int(int32)}, filename: str, headers: [map], mimeType: str, partId: str, parts: [map]}, raw: str(byte), sizeEstimate: int(int32), snippet: str, threadId: str}} # Successful response\n\n@endpoint PUT /gmail/v1/users/{userId}/drafts/{id}\n@desc Replaces a draft's content.\n@required {id: str # The ID of the draft to update.}\n@returns(200) {id: str, message: map{historyId: str(uint64), id: str, internalDate: str(int64), labelIds: [str], payload: map{body: map{attachmentId: str, data: str(byte), size: int(int32)}, filename: str, headers: [map], mimeType: str, partId: str, parts: [map]}, raw: str(byte), sizeEstimate: int(int32), snippet: str, threadId: str}} # Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/history\n@desc Lists the history of all changes to the given mailbox. History results are returned in chronological order (increasing `historyId`).\n@optional {historyTypes: [str] # History types to be returned by the function, labelId: str # Only return messages with a label matching the ID., maxResults: int # Maximum number of history records to return. This field defaults to 100. The maximum allowed value for this field is 500., pageToken: str # Page token to retrieve a specific page of results in the list., startHistoryId: str # 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.}\n@returns(200) {history: [map], historyId: str(uint64), nextPageToken: str} # Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/labels\n@desc Lists all labels in the user's mailbox.\n@returns(200) {labels: [map]} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/labels\n@desc Creates a new label.\n@optional {color: map{backgroundColor: str, textColor: str}, id: str # The immutable ID of the label., labelListVisibility: str(labelShow/labelShowIfUnread/labelHide) # The visibility of the label in the label list in the Gmail web interface., messageListVisibility: str(show/hide) # The visibility of messages with this label in the message list in the Gmail web interface., messagesTotal: int(int32) # The total number of messages with the label., messagesUnread: int(int32) # The number of unread messages with the label., name: str # The display name of the label., threadsTotal: int(int32) # The total number of threads with the label., threadsUnread: int(int32) # The number of unread threads with the label., type: str(system/user) # 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.}\n@returns(200) {color: map{backgroundColor: str, textColor: str}, id: str, labelListVisibility: str, messageListVisibility: str, messagesTotal: int(int32), messagesUnread: int(int32), name: str, threadsTotal: int(int32), threadsUnread: int(int32), type: str} # Successful response\n\n@endpoint DELETE /gmail/v1/users/{userId}/labels/{id}\n@desc Immediately and permanently deletes the specified label and removes it from any messages and threads that it is applied to.\n@required {id: str # The ID of the label to delete.}\n@returns(200) Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/labels/{id}\n@desc Gets the specified label.\n@required {id: str # The ID of the label to retrieve.}\n@returns(200) {color: map{backgroundColor: str, textColor: str}, id: str, labelListVisibility: str, messageListVisibility: str, messagesTotal: int(int32), messagesUnread: int(int32), name: str, threadsTotal: int(int32), threadsUnread: int(int32), type: str} # Successful response\n\n@endpoint PATCH /gmail/v1/users/{userId}/labels/{id}\n@desc Patch the specified label.\n@required {id: str # The ID of the label to update.}\n@optional {color: map{backgroundColor: str, textColor: str}, id: str # The immutable ID of the label., labelListVisibility: str(labelShow/labelShowIfUnread/labelHide) # The visibility of the label in the label list in the Gmail web interface., messageListVisibility: str(show/hide) # The visibility of messages with this label in the message list in the Gmail web interface., messagesTotal: int(int32) # The total number of messages with the label., messagesUnread: int(int32) # The number of unread messages with the label., name: str # The display name of the label., threadsTotal: int(int32) # The total number of threads with the label., threadsUnread: int(int32) # The number of unread threads with the label., type: str(system/user) # 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.}\n@returns(200) {color: map{backgroundColor: str, textColor: str}, id: str, labelListVisibility: str, messageListVisibility: str, messagesTotal: int(int32), messagesUnread: int(int32), name: str, threadsTotal: int(int32), threadsUnread: int(int32), type: str} # Successful response\n\n@endpoint PUT /gmail/v1/users/{userId}/labels/{id}\n@desc Updates the specified label.\n@required {id: str # The ID of the label to update.}\n@optional {color: map{backgroundColor: str, textColor: str}, id: str # The immutable ID of the label., labelListVisibility: str(labelShow/labelShowIfUnread/labelHide) # The visibility of the label in the label list in the Gmail web interface., messageListVisibility: str(show/hide) # The visibility of messages with this label in the message list in the Gmail web interface., messagesTotal: int(int32) # The total number of messages with the label., messagesUnread: int(int32) # The number of unread messages with the label., name: str # The display name of the label., threadsTotal: int(int32) # The total number of threads with the label., threadsUnread: int(int32) # The number of unread threads with the label., type: str(system/user) # 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.}\n@returns(200) {color: map{backgroundColor: str, textColor: str}, id: str, labelListVisibility: str, messageListVisibility: str, messagesTotal: int(int32), messagesUnread: int(int32), name: str, threadsTotal: int(int32), threadsUnread: int(int32), type: str} # Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/messages\n@desc Lists the messages in the user's mailbox.\n@optional {includeSpamTrash: bool # Include messages from `SPAM` and `TRASH` in the results., labelIds: [str] # Only return messages with labels that match all of the specified label IDs. Messages in a thread might have labels that other messages in the same thread don't have. To learn more, see [Manage labels on messages and threads](https://developers.google.com/gmail/api/guides/labels#manage_labels_on_messages_threads)., maxResults: int # Maximum number of messages to return. This field defaults to 100. The maximum allowed value for this field is 500., pageToken: str # Page token to retrieve a specific page of results in the list., q: str # 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.}\n@returns(200) {messages: [map], nextPageToken: str, resultSizeEstimate: int(uint32)} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/messages\n@desc Directly inserts a message into only this user's mailbox similar to `IMAP APPEND`, bypassing most scanning and classification. Does not send a message.\n@optional {deleted: bool # Mark the email as permanently deleted (not TRASH) and only visible in Google Vault to a Vault administrator. Only used for Google Workspace accounts., internalDateSource: str(receivedTime/dateHeader) # Source for Gmail's internal date of the message.}\n@returns(200) {historyId: str(uint64), id: str, internalDate: str(int64), labelIds: [str], payload: map{body: map{attachmentId: str, data: str(byte), size: int(int32)}, filename: str, headers: [map], mimeType: str, partId: str, parts: [map]}, raw: str(byte), sizeEstimate: int(int32), snippet: str, threadId: str} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/messages/batchDelete\n@desc Deletes many messages by message ID. Provides no guarantees that messages were not already deleted or even existed at all.\n@optional {ids: [str] # The IDs of the messages to delete.}\n@returns(200) Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/messages/batchModify\n@desc Modifies the labels on the specified messages.\n@optional {addLabelIds: [str] # A list of label IDs to add to messages., ids: [str] # The IDs of the messages to modify. There is a limit of 1000 ids per request., removeLabelIds: [str] # A list of label IDs to remove from messages.}\n@returns(200) Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/messages/import\n@desc 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.\n@optional {deleted: bool # Mark the email as permanently deleted (not TRASH) and only visible in Google Vault to a Vault administrator. Only used for Google Workspace accounts., internalDateSource: str(receivedTime/dateHeader) # Source for Gmail's internal date of the message., neverMarkSpam: bool # Ignore the Gmail spam classifier decision and never mark this email as SPAM in the mailbox., processForCalendar: bool # Process calendar invites in the email and add any extracted meetings to the Google Calendar for this user.}\n@returns(200) {historyId: str(uint64), id: str, internalDate: str(int64), labelIds: [str], payload: map{body: map{attachmentId: str, data: str(byte), size: int(int32)}, filename: str, headers: [map], mimeType: str, partId: str, parts: [map]}, raw: str(byte), sizeEstimate: int(int32), snippet: str, threadId: str} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/messages/send\n@desc Sends the specified message to the recipients in the `To`, `Cc`, and `Bcc` headers. For example usage, see [Sending email](https://developers.google.com/gmail/api/guides/sending).\n@returns(200) {historyId: str(uint64), id: str, internalDate: str(int64), labelIds: [str], payload: map{body: map{attachmentId: str, data: str(byte), size: int(int32)}, filename: str, headers: [map], mimeType: str, partId: str, parts: [map]}, raw: str(byte), sizeEstimate: int(int32), snippet: str, threadId: str} # Successful response\n\n@endpoint DELETE /gmail/v1/users/{userId}/messages/{id}\n@desc Immediately and permanently deletes the specified message. This operation cannot be undone. Prefer `messages.trash` instead.\n@required {id: str # The ID of the message to delete.}\n@returns(200) Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/messages/{id}\n@desc Gets the specified message.\n@required {id: str # 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`).}\n@optional {format: str(minimal/full/raw/metadata) # The format to return the message in., metadataHeaders: [str] # When given and format is `METADATA`, only include headers specified.}\n@returns(200) {historyId: str(uint64), id: str, internalDate: str(int64), labelIds: [str], payload: map{body: map{attachmentId: str, data: str(byte), size: int(int32)}, filename: str, headers: [map], mimeType: str, partId: str, parts: [map]}, raw: str(byte), sizeEstimate: int(int32), snippet: str, threadId: str} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/messages/{id}/modify\n@desc Modifies the labels on the specified message.\n@required {id: str # The ID of the message to modify.}\n@optional {addLabelIds: [str] # A list of IDs of labels to add to this message. You can add up to 100 labels with each update., removeLabelIds: [str] # A list IDs of labels to remove from this message. You can remove up to 100 labels with each update.}\n@returns(200) {historyId: str(uint64), id: str, internalDate: str(int64), labelIds: [str], payload: map{body: map{attachmentId: str, data: str(byte), size: int(int32)}, filename: str, headers: [map], mimeType: str, partId: str, parts: [map]}, raw: str(byte), sizeEstimate: int(int32), snippet: str, threadId: str} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/messages/{id}/trash\n@desc Moves the specified message to the trash.\n@required {id: str # The ID of the message to Trash.}\n@returns(200) {historyId: str(uint64), id: str, internalDate: str(int64), labelIds: [str], payload: map{body: map{attachmentId: str, data: str(byte), size: int(int32)}, filename: str, headers: [map], mimeType: str, partId: str, parts: [map]}, raw: str(byte), sizeEstimate: int(int32), snippet: str, threadId: str} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/messages/{id}/untrash\n@desc Removes the specified message from the trash.\n@required {id: str # The ID of the message to remove from Trash.}\n@returns(200) {historyId: str(uint64), id: str, internalDate: str(int64), labelIds: [str], payload: map{body: map{attachmentId: str, data: str(byte), size: int(int32)}, filename: str, headers: [map], mimeType: str, partId: str, parts: [map]}, raw: str(byte), sizeEstimate: int(int32), snippet: str, threadId: str} # Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/messages/{messageId}/attachments/{id}\n@desc Gets the specified message attachment.\n@required {messageId: str # The ID of the message containing the attachment., id: str # The ID of the attachment.}\n@returns(200) {attachmentId: str, data: str(byte), size: int(int32)} # Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/profile\n@desc Gets the current user's Gmail profile.\n@returns(200) {emailAddress: str, historyId: str(uint64), messagesTotal: int(int32), threadsTotal: int(int32)} # Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/settings/autoForwarding\n@desc Gets the auto-forwarding setting for the specified account.\n@returns(200) {disposition: str, emailAddress: str, enabled: bool} # Successful response\n\n@endpoint PUT /gmail/v1/users/{userId}/settings/autoForwarding\n@desc 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.\n@optional {disposition: str(dispositionUnspecified/leaveInInbox/archive/trash/markRead) # The state that a message should be left in after it has been forwarded., emailAddress: str # Email address to which all incoming messages are forwarded. This email address must be a verified member of the forwarding addresses., enabled: bool # Whether all incoming mail is automatically forwarded to another address.}\n@returns(200) {disposition: str, emailAddress: str, enabled: bool} # Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/settings/cse/identities\n@desc Lists the client-side encrypted identities for an authenticated user.\n@optional {pageSize: int # The number of identities to return. If not provided, the page size will default to 20 entries., pageToken: str # Pagination token indicating which page of identities to return. If the token is not supplied, then the API will return the first page of results.}\n@returns(200) {cseIdentities: [map], nextPageToken: str} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/settings/cse/identities\n@desc Creates and configures a client-side encryption identity that's authorized to send mail from the user account. Google publishes the S/MIME certificate to a shared domain-wide directory so that people within a Google Workspace organization can encrypt and send mail to the identity.\n@optional {emailAddress: str # The email address for the sending identity. The email address must be the primary email address of the authenticated user., primaryKeyPairId: str # If a key pair is associated, the identifier of the key pair, CseKeyPair.}\n@returns(200) {emailAddress: str, primaryKeyPairId: str} # Successful response\n\n@endpoint DELETE /gmail/v1/users/{userId}/settings/cse/identities/{cseEmailAddress}\n@desc Deletes a client-side encryption identity. The authenticated user can no longer use the identity to send encrypted messages. You cannot restore the identity after you delete it. Instead, use the CreateCseIdentity method to create another identity with the same configuration.\n@required {cseEmailAddress: str # The primary email address associated with the client-side encryption identity configuration that's removed.}\n@returns(200) Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/settings/cse/identities/{cseEmailAddress}\n@desc Retrieves a client-side encryption identity configuration.\n@required {cseEmailAddress: str # The primary email address associated with the client-side encryption identity configuration that's retrieved.}\n@returns(200) {emailAddress: str, primaryKeyPairId: str} # Successful response\n\n@endpoint PATCH /gmail/v1/users/{userId}/settings/cse/identities/{emailAddress}\n@desc Associates a different key pair with an existing client-side encryption identity. The updated key pair must validate against Google's [S/MIME certificate profiles](https://support.google.com/a/answer/7300887).\n@required {emailAddress: str # The email address of the client-side encryption identity to update.}\n@optional {emailAddress: str # The email address for the sending identity. The email address must be the primary email address of the authenticated user., primaryKeyPairId: str # If a key pair is associated, the identifier of the key pair, CseKeyPair.}\n@returns(200) {emailAddress: str, primaryKeyPairId: str} # Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/settings/cse/keypairs\n@desc Lists client-side encryption key pairs for an authenticated user.\n@optional {pageSize: int # The number of key pairs to return. If not provided, the page size will default to 20 entries., pageToken: str # Pagination token indicating which page of key pairs to return. If the token is not supplied, then the API will return the first page of results.}\n@returns(200) {cseKeyPairs: [map], nextPageToken: str} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/settings/cse/keypairs\n@desc Creates and uploads a client-side encryption S/MIME public key certificate chain and private key metadata for the authenticated user.\n@optional {disableTime: str(google-datetime) # Output only. If a key pair is set to `DISABLED`, the time that the key pair's state changed from `ENABLED` to `DISABLED`. This field is present only when the key pair is in state `DISABLED`., enablementState: str(stateUnspecified/enabled/disabled) # Output only. The current state of the key pair., keyPairId: str # Output only. The immutable ID for the client-side encryption S/MIME key pair., pem: str # Output only. The public key and its certificate chain, in [PEM](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail) format., pkcs7: str # Input only. The public key and its certificate chain. The chain must be in [PKCS#7](https://en.wikipedia.org/wiki/PKCS_7) format and use PEM encoding and ASCII armor., privateKeyMetadata: [map{kaclsKeyMetadata: map, privateKeyMetadataId: str}] # Metadata for instances of this key pair's private key., subjectEmailAddresses: [str] # Output only. The email address identities that are specified on the leaf certificate.}\n@returns(200) {disableTime: str(google-datetime), enablementState: str, keyPairId: str, pem: str, pkcs7: str, privateKeyMetadata: [map], subjectEmailAddresses: [str]} # Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}\n@desc Retrieves an existing client-side encryption key pair.\n@required {keyPairId: str # The identifier of the key pair to retrieve.}\n@returns(200) {disableTime: str(google-datetime), enablementState: str, keyPairId: str, pem: str, pkcs7: str, privateKeyMetadata: [map], subjectEmailAddresses: [str]} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}:disable\n@desc Turns off a client-side encryption key pair. The authenticated user can no longer use the key pair to decrypt incoming CSE message texts or sign outgoing CSE mail. To regain access, use the EnableCseKeyPair to turn on the key pair. After 30 days, you can permanently delete the key pair by using the ObliterateCseKeyPair method.\n@required {keyPairId: str # The identifier of the key pair to turn off.}\n@returns(200) {disableTime: str(google-datetime), enablementState: str, keyPairId: str, pem: str, pkcs7: str, privateKeyMetadata: [map], subjectEmailAddresses: [str]} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}:enable\n@desc Turns on a client-side encryption key pair that was turned off. The key pair becomes active again for any associated client-side encryption identities.\n@required {keyPairId: str # The identifier of the key pair to turn on.}\n@returns(200) {disableTime: str(google-datetime), enablementState: str, keyPairId: str, pem: str, pkcs7: str, privateKeyMetadata: [map], subjectEmailAddresses: [str]} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}:obliterate\n@desc Deletes a client-side encryption key pair permanently and immediately. You can only permanently delete key pairs that have been turned off for more than 30 days. To turn off a key pair, use the DisableCseKeyPair method. Gmail can't restore or decrypt any messages that were encrypted by an obliterated key. Authenticated users and Google Workspace administrators lose access to reading the encrypted messages.\n@required {keyPairId: str # The identifier of the key pair to obliterate.}\n@returns(200) Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/settings/delegates\n@desc Lists the delegates for the specified account. This method is only available to service account clients that have been delegated domain-wide authority.\n@returns(200) {delegates: [map]} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/settings/delegates\n@desc 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 Google Workspace organization as the delegator user. Gmail imposes limitations on the number of delegates and delegators each user in a Google Workspace 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.\n@optional {delegateEmail: str # The email address of the delegate., verificationStatus: str(verificationStatusUnspecified/accepted/pending/rejected/expired) # Indicates whether this address has been verified and can act as a delegate for the account. Read-only.}\n@returns(200) {delegateEmail: str, verificationStatus: str} # Successful response\n\n@endpoint DELETE /gmail/v1/users/{userId}/settings/delegates/{delegateEmail}\n@desc 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.\n@required {delegateEmail: str # The email address of the user to be removed as a delegate.}\n@returns(200) Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/settings/delegates/{delegateEmail}\n@desc 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.\n@required {delegateEmail: str # The email address of the user whose delegate relationship is to be retrieved.}\n@returns(200) {delegateEmail: str, verificationStatus: str} # Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/settings/filters\n@desc Lists the message filters of a Gmail user.\n@returns(200) {filter: [map]} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/settings/filters\n@desc Creates a filter. Note: you can only create a maximum of 1,000 filters.\n@optional {action: map{addLabelIds: [str], forward: str, removeLabelIds: [str]} # A set of actions to perform on a message., criteria: map{excludeChats: bool, from: str, hasAttachment: bool, negatedQuery: str, query: str, size: int(int32), sizeComparison: str, subject: str, to: str} # Message matching criteria., id: str # The server assigned ID of the filter.}\n@returns(200) {action: map{addLabelIds: [str], forward: str, removeLabelIds: [str]}, criteria: map{excludeChats: bool, from: str, hasAttachment: bool, negatedQuery: str, query: str, size: int(int32), sizeComparison: str, subject: str, to: str}, id: str} # Successful response\n\n@endpoint DELETE /gmail/v1/users/{userId}/settings/filters/{id}\n@desc Immediately and permanently deletes the specified filter.\n@required {id: str # The ID of the filter to be deleted.}\n@returns(200) Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/settings/filters/{id}\n@desc Gets a filter.\n@required {id: str # The ID of the filter to be fetched.}\n@returns(200) {action: map{addLabelIds: [str], forward: str, removeLabelIds: [str]}, criteria: map{excludeChats: bool, from: str, hasAttachment: bool, negatedQuery: str, query: str, size: int(int32), sizeComparison: str, subject: str, to: str}, id: str} # Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/settings/forwardingAddresses\n@desc Lists the forwarding addresses for the specified account.\n@returns(200) {forwardingAddresses: [map]} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/settings/forwardingAddresses\n@desc 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.\n@optional {forwardingEmail: str # An email address to which messages can be forwarded., verificationStatus: str(verificationStatusUnspecified/accepted/pending) # Indicates whether this address has been verified and is usable for forwarding. Read-only.}\n@returns(200) {forwardingEmail: str, verificationStatus: str} # Successful response\n\n@endpoint DELETE /gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}\n@desc 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.\n@required {forwardingEmail: str # The forwarding address to be deleted.}\n@returns(200) Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}\n@desc Gets the specified forwarding address.\n@required {forwardingEmail: str # The forwarding address to be retrieved.}\n@returns(200) {forwardingEmail: str, verificationStatus: str} # Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/settings/imap\n@desc Gets IMAP settings.\n@returns(200) {autoExpunge: bool, enabled: bool, expungeBehavior: str, maxFolderSize: int(int32)} # Successful response\n\n@endpoint PUT /gmail/v1/users/{userId}/settings/imap\n@desc Updates IMAP settings.\n@optional {autoExpunge: bool # 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., enabled: bool # Whether IMAP is enabled for the account., expungeBehavior: str(expungeBehaviorUnspecified/archive/trash/deleteForever) # The action that will be executed on a message when it is marked as deleted and expunged from the last visible IMAP folder., maxFolderSize: int(int32) # 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.}\n@returns(200) {autoExpunge: bool, enabled: bool, expungeBehavior: str, maxFolderSize: int(int32)} # Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/settings/language\n@desc Gets language settings.\n@returns(200) {displayLanguage: str} # Successful response\n\n@endpoint PUT /gmail/v1/users/{userId}/settings/language\n@desc 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.\n@optional {displayLanguage: str # 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).}\n@returns(200) {displayLanguage: str} # Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/settings/pop\n@desc Gets POP settings.\n@returns(200) {accessWindow: str, disposition: str} # Successful response\n\n@endpoint PUT /gmail/v1/users/{userId}/settings/pop\n@desc Updates POP settings.\n@optional {accessWindow: str(accessWindowUnspecified/disabled/fromNowOn/allMail) # The range of messages which are accessible via POP., disposition: str(dispositionUnspecified/leaveInInbox/archive/trash/markRead) # The action that will be executed on a message after it has been fetched via POP.}\n@returns(200) {accessWindow: str, disposition: str} # Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/settings/sendAs\n@desc 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.\n@returns(200) {sendAs: [map]} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/settings/sendAs\n@desc 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.\n@optional {displayName: str # 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., isDefault: bool # 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., isPrimary: bool # 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., replyToAddress: str # 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., sendAsEmail: str # The email address that appears in the \"From:\" header for mail sent using this alias. This is read-only for all operations except create., signature: str # 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., smtpMsa: map{host: str, password: str, port: int(int32), securityMode: str, username: str} # Configuration for communication with an SMTP service., treatAsAlias: bool # Whether Gmail should treat this address as an alias for the user's primary email address. This setting only applies to custom \"from\" aliases., verificationStatus: str(verificationStatusUnspecified/accepted/pending) # Indicates whether this address has been verified for use as a send-as alias. Read-only. This setting only applies to custom \"from\" aliases.}\n@returns(200) {displayName: str, isDefault: bool, isPrimary: bool, replyToAddress: str, sendAsEmail: str, signature: str, smtpMsa: map{host: str, password: str, port: int(int32), securityMode: str, username: str}, treatAsAlias: bool, verificationStatus: str} # Successful response\n\n@endpoint DELETE /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}\n@desc 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.\n@required {sendAsEmail: str # The send-as alias to be deleted.}\n@returns(200) Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}\n@desc Gets the specified send-as alias. Fails with an HTTP 404 error if the specified address is not a member of the collection.\n@required {sendAsEmail: str # The send-as alias to be retrieved.}\n@returns(200) {displayName: str, isDefault: bool, isPrimary: bool, replyToAddress: str, sendAsEmail: str, signature: str, smtpMsa: map{host: str, password: str, port: int(int32), securityMode: str, username: str}, treatAsAlias: bool, verificationStatus: str} # Successful response\n\n@endpoint PATCH /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}\n@desc Patch the specified send-as alias.\n@required {sendAsEmail: str # The send-as alias to be updated.}\n@optional {displayName: str # 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., isDefault: bool # 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., isPrimary: bool # 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., replyToAddress: str # 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., sendAsEmail: str # The email address that appears in the \"From:\" header for mail sent using this alias. This is read-only for all operations except create., signature: str # 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., smtpMsa: map{host: str, password: str, port: int(int32), securityMode: str, username: str} # Configuration for communication with an SMTP service., treatAsAlias: bool # Whether Gmail should treat this address as an alias for the user's primary email address. This setting only applies to custom \"from\" aliases., verificationStatus: str(verificationStatusUnspecified/accepted/pending) # Indicates whether this address has been verified for use as a send-as alias. Read-only. This setting only applies to custom \"from\" aliases.}\n@returns(200) {displayName: str, isDefault: bool, isPrimary: bool, replyToAddress: str, sendAsEmail: str, signature: str, smtpMsa: map{host: str, password: str, port: int(int32), securityMode: str, username: str}, treatAsAlias: bool, verificationStatus: str} # Successful response\n\n@endpoint PUT /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}\n@desc 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.\n@required {sendAsEmail: str # The send-as alias to be updated.}\n@optional {displayName: str # 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., isDefault: bool # 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., isPrimary: bool # 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., replyToAddress: str # 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., sendAsEmail: str # The email address that appears in the \"From:\" header for mail sent using this alias. This is read-only for all operations except create., signature: str # 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., smtpMsa: map{host: str, password: str, port: int(int32), securityMode: str, username: str} # Configuration for communication with an SMTP service., treatAsAlias: bool # Whether Gmail should treat this address as an alias for the user's primary email address. This setting only applies to custom \"from\" aliases., verificationStatus: str(verificationStatusUnspecified/accepted/pending) # Indicates whether this address has been verified for use as a send-as alias. Read-only. This setting only applies to custom \"from\" aliases.}\n@returns(200) {displayName: str, isDefault: bool, isPrimary: bool, replyToAddress: str, sendAsEmail: str, signature: str, smtpMsa: map{host: str, password: str, port: int(int32), securityMode: str, username: str}, treatAsAlias: bool, verificationStatus: str} # Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo\n@desc Lists S/MIME configs for the specified send-as alias.\n@required {sendAsEmail: str # The email address that appears in the \"From:\" header for mail sent using this alias.}\n@returns(200) {smimeInfo: [map]} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo\n@desc Insert (upload) the given S/MIME config for the specified send-as alias. Note that pkcs12 format is required for the key.\n@required {sendAsEmail: str # The email address that appears in the \"From:\" header for mail sent using this alias.}\n@optional {encryptedKeyPassword: str # Encrypted key password, when key is encrypted., expiration: str(int64) # When the certificate expires (in milliseconds since epoch)., id: str # The immutable ID for the SmimeInfo., isDefault: bool # Whether this SmimeInfo is the default one for this user's send-as address., issuerCn: str # The S/MIME certificate issuer's common name., pem: str # 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)., pkcs12: str(byte) # 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.}\n@returns(200) {encryptedKeyPassword: str, expiration: str(int64), id: str, isDefault: bool, issuerCn: str, pem: str, pkcs12: str(byte)} # Successful response\n\n@endpoint DELETE /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}\n@desc Deletes the specified S/MIME config for the specified send-as alias.\n@required {sendAsEmail: str # The email address that appears in the \"From:\" header for mail sent using this alias., id: str # The immutable ID for the SmimeInfo.}\n@returns(200) Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}\n@desc Gets the specified S/MIME config for the specified send-as alias.\n@required {sendAsEmail: str # The email address that appears in the \"From:\" header for mail sent using this alias., id: str # The immutable ID for the SmimeInfo.}\n@returns(200) {encryptedKeyPassword: str, expiration: str(int64), id: str, isDefault: bool, issuerCn: str, pem: str, pkcs12: str(byte)} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}/setDefault\n@desc Sets the default S/MIME config for the specified send-as alias.\n@required {sendAsEmail: str # The email address that appears in the \"From:\" header for mail sent using this alias., id: str # The immutable ID for the SmimeInfo.}\n@returns(200) Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/verify\n@desc 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.\n@required {sendAsEmail: str # The send-as alias to be verified.}\n@returns(200) Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/settings/vacation\n@desc Gets vacation responder settings.\n@returns(200) {enableAutoReply: bool, endTime: str(int64), responseBodyHtml: str, responseBodyPlainText: str, responseSubject: str, restrictToContacts: bool, restrictToDomain: bool, startTime: str(int64)} # Successful response\n\n@endpoint PUT /gmail/v1/users/{userId}/settings/vacation\n@desc Updates vacation responder settings.\n@optional {enableAutoReply: bool # Flag that controls whether Gmail automatically replies to messages., endTime: str(int64) # 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`., responseBodyHtml: str # 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., responseBodyPlainText: str # Response body in plain text format. If both `response_body_plain_text` and `response_body_html` are specified, `response_body_html` will be used., responseSubject: str # 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., restrictToContacts: bool # Flag that determines whether responses are sent to recipients who are not in the user's list of contacts., restrictToDomain: bool # Flag that determines whether responses are sent to recipients who are outside of the user's domain. This feature is only available for Google Workspace users., startTime: str(int64) # 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`.}\n@returns(200) {enableAutoReply: bool, endTime: str(int64), responseBodyHtml: str, responseBodyPlainText: str, responseSubject: str, restrictToContacts: bool, restrictToDomain: bool, startTime: str(int64)} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/stop\n@desc Stop receiving push notifications for the given user mailbox.\n@returns(200) Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/threads\n@desc Lists the threads in the user's mailbox.\n@optional {includeSpamTrash: bool # Include threads from `SPAM` and `TRASH` in the results., labelIds: [str] # Only return threads with labels that match all of the specified label IDs., maxResults: int # Maximum number of threads to return. This field defaults to 100. The maximum allowed value for this field is 500., pageToken: str # Page token to retrieve a specific page of results in the list., q: str # 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.}\n@returns(200) {nextPageToken: str, resultSizeEstimate: int(uint32), threads: [map]} # Successful response\n\n@endpoint DELETE /gmail/v1/users/{userId}/threads/{id}\n@desc Immediately and permanently deletes the specified thread. Any messages that belong to the thread are also deleted. This operation cannot be undone. Prefer `threads.trash` instead.\n@required {id: str # ID of the Thread to delete.}\n@returns(200) Successful response\n\n@endpoint GET /gmail/v1/users/{userId}/threads/{id}\n@desc Gets the specified thread.\n@required {id: str # The ID of the thread to retrieve.}\n@optional {format: str(full/metadata/minimal) # The format to return the messages in., metadataHeaders: [str] # When given and format is METADATA, only include headers specified.}\n@returns(200) {historyId: str(uint64), id: str, messages: [map], snippet: str} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/threads/{id}/modify\n@desc Modifies the labels applied to the thread. This applies to all messages in the thread.\n@required {id: str # The ID of the thread to modify.}\n@optional {addLabelIds: [str] # A list of IDs of labels to add to this thread. You can add up to 100 labels with each update., removeLabelIds: [str] # A list of IDs of labels to remove from this thread. You can remove up to 100 labels with each update.}\n@returns(200) {historyId: str(uint64), id: str, messages: [map], snippet: str} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/threads/{id}/trash\n@desc Moves the specified thread to the trash. Any messages that belong to the thread are also moved to the trash.\n@required {id: str # The ID of the thread to Trash.}\n@returns(200) {historyId: str(uint64), id: str, messages: [map], snippet: str} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/threads/{id}/untrash\n@desc Removes the specified thread from the trash. Any messages that belong to the thread are also removed from the trash.\n@required {id: str # The ID of the thread to remove from Trash.}\n@returns(200) {historyId: str(uint64), id: str, messages: [map], snippet: str} # Successful response\n\n@endpoint POST /gmail/v1/users/{userId}/watch\n@desc Set up or update a push notification watch on the given user mailbox.\n@optional {labelFilterAction: str(include/exclude) # Filtering behavior of labelIds list specified., labelIds: [str] # List of label_ids to restrict notifications about. By default, if unspecified, all changes are pushed out. If specified then dictates which labels are required for a push notification to be generated., topicName: str # 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).}\n@returns(200) {expiration: str(int64), historyId: str(uint64)} # Successful response\n\n@end\n"}}