Skip to the documentation
API

Drafts

Every operation in this group: what it accepts, what it returns and the errors it can answer with.

Operations

GET/drafts

List drafts

Scopesdrafts:readReads

Requires the drafts:read scope.

Query parameters

querystring

The same search syntax as GET /threads, read against each draft's subject, sender and the first 4,000 characters of its body. Plain words match loosely and a quoted phrase has to appear as written, filler words are dropped when something else is left to search for, and a value the search cannot use is ignored rather than narrowing. Recipients are not searched, so to:, cc: and bcc: match nothing here. The drafts folder always applies, so in: and folder is: operators cannot widen the search beyond drafts, in:anywhere included. A draft saved with no subject is stored as (no subject), so subject:"no subject" finds it.

limitinteger

Drafts per page, a whole number from 1 to 100. Defaults to 25.

At least 1At most 100
pageTokenstring

Opaque. Pass back what you were given, never construct one.

Returns

A page of drafts.

Errors

The errors every operation can return400401403404422429500Error catalog

Also available in

TypeScript
nextmail.drafts.list()nextmail.drafts.listAll()nextmail.drafts.iterate()
Python
drafts.list()drafts.list_all()drafts.iterate()
Ruby
drafts.listdrafts.list_alldrafts.iterate
PHP
drafts->listdrafts->listAlldrafts->iterate
Go
Drafts.ListDrafts.ListAllDrafts.Iterate
Java
drafts().listdrafts().listAlldrafts().iterate
C#
Drafts.ListAsyncDrafts.ListAllAsyncDrafts.IterateAsync
CLI
openemail drafts list
MCP
listDrafts

POST/drafts

Create a draft

Scopesdrafts:writeChanges data

Saves a draft without sending it, as the composer does when you close it. Every field is optional, and html wins over text when both are given.

To forward an email, pass threadId and forwardOf, the id of a message in that thread from GET /threads/{id}. The draft takes the names of that message's files and, unless you give a subject, the message's subject with Fwd: in front. Sending it with draftId on POST /emails quotes the message below the body, attaches its files and threads it the way forwarding in the app does. forwardOf without threadId, or naming no message of that thread, is a 422 invalid_parameter.

Requires the drafts:write scope.

Request body

tostring[]

Recipient addresses, bare or with a display name.

Default[]
ccstring[]

Copy recipients, bare or with a display name.

Default[]
bccstring[]

Blind copy recipients, bare or with a display name.

Default[]
subjectstring

At most 998 characters. Empty is stored as (no subject).

Up to 998 charactersDefault""
htmlstring

Body markup, at most 1,000,000 characters. Kept over text when both are set.

Up to 1000000 characters
textstring

Body used only when html is absent, at most 1,000,000 characters. Stored as is and read back in html.

Up to 1000000 characters
fromstring

The address it will be sent from. A key or an app limited to particular addresses has to name one of them, and one it may send as.

threadIdstring

The conversation it replies to, when it is a reply, or the one holding the message forwardOf names.

forwardOfstring

The id of the message in threadId to forward. Sending the draft quotes it below the body and attaches its files.

1 to 998 characters

Returns

Created.

Errors

The errors every operation can return400401403404422429500Error catalog

Also available in

TypeScript
nextmail.drafts.create()
Python
drafts.create()
Ruby
drafts.create
PHP
drafts->create
Go
Drafts.Create
Java
drafts().create
C#
Drafts.CreateAsync
CLI
openemail drafts create
MCP
createDraftupdateDraft

PATCH/drafts/{id}

Update a draft

Scopesdrafts:writeChanges data

A partial update, not an upsert. An unknown id, or the id of a thread that is not a draft, is a 404. The draft keeps the id you passed, and the response echoes it. Its attachments stay as they are, and a draft that forwards a message keeps forwarding it unless threadId moves it to another conversation.

Requires the drafts:write scope.

Path parameters

idstringRequired

Draft id, which starts with draft-.

Request body

tostring[]

Replacement recipients. An empty array clears them.

ccstring[]

Replacement copy recipients.

bccstring[]

Replacement blind copy recipients.

subjectstring

Replacement subject, at most 998 characters.

Up to 998 characters
htmlstring

Replacement body markup, at most 1,000,000 characters.

Up to 1000000 characters
textstring

Replacement body used only when html is absent.

Up to 1000000 characters
fromstring

The address it will be sent from, or null to clear it. A key or an app limited to particular addresses has to name one of them.

Can be null
threadIdstring

The conversation it replies to.

Returns

Errors

The errors every operation can return400401403404422429500Error catalog

Also available in

TypeScript
nextmail.drafts.update()
Python
drafts.update()
Ruby
drafts.update
PHP
drafts->update
Go
Drafts.Update
Java
drafts().update
C#
Drafts.UpdateAsync
CLI
openemail drafts update
MCP
createDraftupdateDraft

Objects

DeletedDraftobject

objectstringRequired
One of"draft"
idstringRequired
deletedbooleanRequired
One oftrue

Draftobject

objectstringRequired
One of"draft"
idstringRequired
tostring[]Required
ccstring[]Required
bccstring[]Required
subjectstringRequired
htmlstringRequired

The body as saved.

threadIdstringRequired

The conversation it replies to, when it is a reply.

Can be null
forwardOfstringRequired

The message in threadId this draft forwards, or null. Sending the draft quotes that message below the body and attaches its files, one for each file the draft lists.

Can be null
fromstringRequired

The sending address. Null when none is set or it is not one this workspace can send as.

Can be null
attachmentsobject[]Required
filenamestringRequired
Can be null
contentTypestringRequired
Can be null
sizeintegerRequired

Size in bytes, when known.

Can be null

DraftListobject

objectstringRequired
One of"list"
dataDraftReference[]Required
nextPageTokenstringRequired

Pass it back as pageToken for the next page. Null on the last page.

Can be null

DraftReferenceobject

objectstringRequired
One of"draft"
idstringRequired