Insert Messages

POST {{baseUrl}}/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.

Request Params

KeyDatatypeRequiredDescription
internalDateSourcestring
deletedstring
access_tokenstringOAuth access token.
altstringData format for response.
callbackstringJSONP
fieldsstringSelector specifying which fields to include in a partial response.
keystringAPI 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.
oauth_tokenstringOAuth 2.0 token for the current user.
prettyPrintstringReturns response with indentations and line breaks.
quotaUserstringAvailable to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
upload_protocolstringUpload protocol for media (e.g. "raw", "multipart").
uploadTypestringLegacy upload protocol for media (e.g. "media", "multipart").
$.xgafvstringV1 error format.

Request Body

{"id"=>"eu incididunt laborum irure", "threadId"=>"magna Ut officia", "labelIds"=>["mollit amet dolore cupidatat", "cupidatat deserunt mollit"], "snippet"=>"ut dolor", "historyId"=>"nisi tempor do", "internalDate"=>"cupidatat officia anim", "payload"=>{"partId"=>"dolore velit incididunt est a", "mimeType"=>"sit dolor mollit", "filename"=>"ea commodo dolor nisi", "headers"=>[{"name"=>"quis id velit laborum", "value"=>"et voluptate dolor ea"}, {"name"=>"sit nostrud", "value"=>"deserunt fugiat ex"}], "body"=>{"attachmentId"=>"id nulla consequat", "size"=>-93837667, "data"=>"ad in occaecat"}, "parts"=>[{"value"=>"<Circular reference to #/components/schemas/MessagePart detected>"}, {"value"=>"<Circular reference to #/components/schemas/MessagePart detected>"}]}, "sizeEstimate"=>21128811, "raw"=>"do laboris"}

HEADERS

KeyDatatypeRequiredDescription
Content-Typestring
Acceptstring

RESPONSES

status: OK

{&quot;id&quot;:&quot;eu incididunt laborum irure&quot;,&quot;threadId&quot;:&quot;magna Ut officia&quot;,&quot;labelIds&quot;:[&quot;mollit amet dolore cupidatat&quot;,&quot;cupidatat deserunt mollit&quot;],&quot;snippet&quot;:&quot;ut dolor&quot;,&quot;historyId&quot;:&quot;nisi tempor do&quot;,&quot;internalDate&quot;:&quot;cupidatat officia anim&quot;,&quot;payload&quot;:{&quot;partId&quot;:&quot;dolore velit incididunt est a&quot;,&quot;mimeType&quot;:&quot;sit dolor mollit&quot;,&quot;filename&quot;:&quot;ea commodo dolor nisi&quot;,&quot;headers&quot;:[{&quot;name&quot;:&quot;quis id velit laborum&quot;,&quot;value&quot;:&quot;et voluptate dolor ea&quot;},{&quot;name&quot;:&quot;sit nostrud&quot;,&quot;value&quot;:&quot;deserunt fugiat ex&quot;}],&quot;body&quot;:{&quot;attachmentId&quot;:&quot;id nulla consequat&quot;,&quot;size&quot;:-93837667,&quot;data&quot;:&quot;ad in occaecat&quot;},&quot;parts&quot;:[{&quot;value&quot;:&quot;\u003cCircular reference to #/components/schemas/MessagePart detected\u003e&quot;},{&quot;value&quot;:&quot;\u003cCircular reference to #/components/schemas/MessagePart detected\u003e&quot;}]},&quot;sizeEstimate&quot;:21128811,&quot;raw&quot;:&quot;do laboris&quot;}