Create a draft
POST
/draftsWrites a message without sending it. Sending is a second call, Send a draft, so that retrying a send can never send twice.
Needs the permissiondrafts:create
What comes back is what will be sent: the HTML has been sanitised and the mailbox’s signature added. Retrying a create is harmless; at worst it makes a second draft, which sends nothing.
To answer a message, use Reply or forward instead. It threads the reply and quotes the original, which this doesn’t.
Body
mailboxIdstringrequired- The mailbox to send from. See List mailboxes.
tolist of stringsoptional- The recipients. It needs at least one by the time you send it.
cclist of stringsoptional- Copied, and
bcc, copied without showing. subjectstringoptional- The subject.
bodyHtmlstringoptional- The message, as HTML.
Returns
idstring- The draft. It keeps this id once it’s sent.
threadIdstring- The conversation it’s in.
mailboxIdstring- The mailbox it will go from, and
from, its address. tolist of strings- With
ccandbcc: its recipients. subjectstring- Its subject.
bodyHtmlstring- Sanitised, with the mailbox’s signature: what will be sent.
updatedAtstring- When it last changed.
Errors
400mailbox_required- There’s no
mailboxId. 400invalid_draft- The draft couldn’t be made. The message says why.
401invalid_key- The key is wrong, expired or revoked. With no Authorization header at all, the code is
missing_credentials. 403missing_scope- The key doesn’t have
drafts:create. TheX-Required-Scopeheader names what’s missing. 404mailbox_not_found- There’s no such mailbox, or the key’s owner can’t see it.
429rate_limited- More than 120 requests a minute from this key. Wait for
Retry-Afterseconds.