For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
contact@agentmail.ccDiscord
DocumentationAPI ReferenceKnowledge BaseChangelog
DocumentationAPI ReferenceKnowledge BaseChangelog
  • API Reference
      • GETList Inboxes
      • GETGet Inbox
      • POSTCreate Inbox
      • PATCHUpdate Inbox
      • DELDelete Inbox
        • GETList Drafts
        • GETGet Draft
        • GETGet Attachment
        • POSTCreate Draft
        • PATCHUpdate Draft
        • DELDelete Draft
        • POSTSend Draft
LogoLogo
contact@agentmail.ccDiscord
API ReferenceInboxesDrafts

Create Draft

POST
/v0/inboxes/:inbox_id/drafts
POST
/v0/inboxes/:inbox_id/drafts
1from agentmail import AgentMail
2
3client = AgentMail(
4 api_key="YOUR_TOKEN_HERE",
5)
6
7client.inboxes.drafts.create(
8 inbox_id="inbox_id",
9)
1{
2 "inbox_id": "inbox_id",
3 "draft_id": "draft_id",
4 "labels": [
5 "labels",
6 "labels"
7 ],
8 "updated_at": "2024-01-15T09:30:00Z",
9 "created_at": "2024-01-15T09:30:00Z",
10 "client_id": "client_id",
11 "reply_to": [
12 "reply_to",
13 "reply_to"
14 ],
15 "to": [
16 "to",
17 "to"
18 ],
19 "cc": [
20 "cc",
21 "cc"
22 ],
23 "bcc": [
24 "bcc",
25 "bcc"
26 ],
27 "subject": "subject",
28 "preview": "preview",
29 "text": "text",
30 "html": "html",
31 "attachments": [
32 {
33 "attachment_id": "attachment_id",
34 "size": 1,
35 "filename": "filename",
36 "content_type": "content_type",
37 "content_disposition": "inline",
38 "content_id": "content_id"
39 },
40 {
41 "attachment_id": "attachment_id",
42 "size": 1,
43 "filename": "filename",
44 "content_type": "content_type",
45 "content_disposition": "inline",
46 "content_id": "content_id"
47 }
48 ],
49 "in_reply_to": "in_reply_to",
50 "references": [
51 "references",
52 "references"
53 ],
54 "send_status": "scheduled",
55 "send_at": "2024-01-15T09:30:00Z"
56}
**CLI:** ```bash agentmail inboxes:drafts create --inbox-id <inbox_id> --to recipient@example.com --subject "Draft subject" --text "Draft body" ```
Was this page helpful?
Previous

Update Draft

Next
Built with

CLI:

$agentmail inboxes:drafts create --inbox-id <inbox_id> --to recipient@example.com --subject "Draft subject" --text "Draft body"

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Path parameters

inbox_idstringRequired
The ID of the inbox.

Request

This endpoint expects an object.
labelslist of stringsOptional
Labels of draft.
reply_tolist of stringsOptional

Reply-to addresses. In format username@domain.com or Display Name <username@domain.com>.

tolist of stringsOptional

Addresses of recipients. In format username@domain.com or Display Name <username@domain.com>.

cclist of stringsOptional

Addresses of CC recipients. In format username@domain.com or Display Name <username@domain.com>.

bcclist of stringsOptional

Addresses of BCC recipients. In format username@domain.com or Display Name <username@domain.com>.

subjectstringOptional
Subject of draft.
textstringOptional
Plain text body of draft.
htmlstringOptional
HTML body of draft.
attachmentslist of objectsOptional
Attachments to include in draft.
in_reply_tostringOptional
ID of message being replied to.
send_atdatetimeOptional
Time at which to schedule send draft.
client_idstringOptional
Client ID of draft.

Response

This endpoint returns an object.
inbox_idstring
The ID of the inbox.
draft_idstring
ID of draft.
labelslist of strings
Labels of draft.
updated_atdatetime
Time at which draft was last updated.
created_atdatetime
Time at which draft was created.
client_idstring
Client ID of draft.
reply_tolist of strings

Reply-to addresses. In format username@domain.com or Display Name <username@domain.com>.

tolist of strings

Addresses of recipients. In format username@domain.com or Display Name <username@domain.com>.

cclist of strings

Addresses of CC recipients. In format username@domain.com or Display Name <username@domain.com>.

bcclist of strings

Addresses of BCC recipients. In format username@domain.com or Display Name <username@domain.com>.

subjectstring
Subject of draft.
previewstring
Text preview of draft.
textstring
Plain text body of draft.
htmlstring
HTML body of draft.
attachmentslist of objects
Attachments in draft.
in_reply_tostring
ID of message being replied to.
referenceslist of strings
IDs of previous messages in thread.
send_statusenum
Schedule send status of draft.
Allowed values:
send_atdatetime
Time at which to schedule send draft.

Errors

404
Not Found Error