Create Draft
Create a new email draft for later sending
Overview
Create a new email draft. Drafts can be edited, scheduled, or sent immediately. This is useful for composing emails that need review or approval before sending.
Info
Drafts are created instantly and can be sent later via POST /v1/inboxes/{id}/drafts/{draftId}/send
Authentication
AuthorizationstringpathrequiredInbox API Key
Path Parameters
idstringpathrequiredThe inbox ID (e.g., inb_abc123)
Body Parameters
tostringbodyrequiredRecipient email address
ccarraybodyArray of CC email addresses (optional)
bccarraybodyArray of BCC email addresses (optional)
subjectstringbodyrequiredEmail subject line
bodystringbodyrequiredPlain text email body
body_htmlstringbodyHTML email body (optional)
send_atstringbodyISO 8601 timestamp for scheduled sending (optional). If set, draft will be sent automatically at this time.
in_reply_tostringbodyMessage ID this draft is replying to (optional). Sets the In-Reply-To header.
thread_idstringbodyThread ID to attach this draft to (optional)
labelsarraybodyArray of label strings to apply to this draft (optional)
Request
curl -X POST https://api.daimon.email/v1/inboxes/inb_abc123/drafts \
-H "Authorization: Bearer dm_free_7d8a9b0c1d2e3f4g5h6i7j8k9l0m1n2o" \
-H "Content-Type: application/json" \
-d '{
"to": "customer@example.com",
"subject": "Your order is ready",
"body": "Hi there,\n\nYour order #12345 has been processed and is ready for pickup.\n\nBest,\nSupport Team",
"labels": ["customer-service", "order"]
}'import { DaimonClient } from 'daimon-email';
const client = new DaimonClient({
apiKey: 'dm_free_7d8a9b0c1d2e3f4g5h6i7j8k9l0m1n2o'
});
// Simple draft
const draft = await client.inboxes.drafts.create('inb_abc123', {
to: 'customer@example.com',
subject: 'Your order is ready',
body: 'Hi there,\n\nYour order #12345 has been processed and is ready for pickup.\n\nBest,\nSupport Team',
labels: ['customer-service', 'order']
});
console.log(`Draft created: ${draft.id}`);
// Scheduled draft (send tomorrow at 9am)
const tomorrow9am = new Date();
tomorrow9am.setDate(tomorrow9am.getDate() + 1);
tomorrow9am.setHours(9, 0, 0, 0);
const scheduledDraft = await client.inboxes.drafts.create('inb_abc123', {
to: 'newsletter@example.com',
subject: 'Weekly Update',
body: 'Here are this week\'s highlights...',
send_at: tomorrow9am.toISOString()
});
console.log(`Scheduled for: ${scheduledDraft.send_at}`);
// Reply draft
const replyDraft = await client.inboxes.drafts.create('inb_abc123', {
to: 'support@example.com',
subject: 'Re: Order Confirmation #12345',
body: 'Thank you for the update!',
in_reply_to: 'msg_abc123',
thread_id: 'thr_xyz789'
});from daimon_email import DaimonClient
from datetime import datetime, timedelta
client = DaimonClient(
api_key='dm_free_7d8a9b0c1d2e3f4g5h6i7j8k9l0m1n2o'
)
# Simple draft
draft = client.inboxes.drafts.create('inb_abc123', {
'to': 'customer@example.com',
'subject': 'Your order is ready',
'body': 'Hi there,\n\nYour order #12345 has been processed and is ready for pickup.\n\nBest,\nSupport Team',
'labels': ['customer-service', 'order']
})
print(f"Draft created: {draft['id']}")
# Scheduled draft (send tomorrow at 9am)
tomorrow_9am = datetime.now() + timedelta(days=1)
tomorrow_9am = tomorrow_9am.replace(hour=9, minute=0, second=0, microsecond=0)
scheduled_draft = client.inboxes.drafts.create('inb_abc123', {
'to': 'newsletter@example.com',
'subject': 'Weekly Update',
'body': 'Here are this week\'s highlights...',
'send_at': tomorrow_9am.isoformat()
})
print(f"Scheduled for: {scheduled_draft['send_at']}")
# Reply draft
reply_draft = client.inboxes.drafts.create('inb_abc123', {
'to': 'support@example.com',
'subject': 'Re: Order Confirmation #12345',
'body': 'Thank you for the update!',
'in_reply_to': 'msg_abc123',
'thread_id': 'thr_xyz789'
})Response
{
"result": {
"id": "dft_abc123",
"inbox_id": "inb_abc123",
"to": "customer@example.com",
"cc": [],
"bcc": [],
"subject": "Your order is ready",
"body_text": "Hi there,\n\nYour order #12345 has been processed and is ready for pickup.\n\nBest,\nSupport Team",
"body_html": null,
"send_at": null,
"thread_id": null,
"labels": ["customer-service", "order"],
"created_at": "2024-03-11T14:23:45Z",
"updated_at": "2024-03-11T14:23:45Z"
},
"next_steps": [
"Use POST /v1/inboxes/{id}/drafts/{draftId}/send to send this draft",
"Use PATCH /v1/inboxes/{id}/drafts/{draftId} to edit the draft before sending",
"Use DELETE /v1/inboxes/{id}/drafts/{draftId} to discard this draft"
]
}Response Fields
result.idstringUnique draft identifier (e.g., dft_abc123)
result.inbox_idstringThe inbox this draft belongs to
result.tostringRecipient email address
result.ccarrayArray of CC email addresses
result.bccarrayArray of BCC email addresses
result.subjectstringEmail subject line
result.body_textstringPlain text email body
result.body_htmlstringHTML email body (may be null)
result.send_atstringISO 8601 timestamp for scheduled sending (null if not scheduled)
result.thread_idstringThread ID this draft is attached to (null if not part of a thread)
result.labelsarrayArray of label strings applied to this draft
result.created_atstringISO 8601 timestamp when draft was created
result.updated_atstringISO 8601 timestamp when draft was last updated
next_stepsarraySuggested actions the agent can take next
Use Cases
Drafts are useful for:
- Review workflows: Create drafts for human review before sending
- Scheduled emails: Set
send_atfor automated sending at a future time - Template management: Store frequently used email templates
- Approval flows: Queue emails that need approval before delivery
- Batch operations: Create multiple drafts and send them together
Warning
Sending emails requires a paid tier. Free tier can create and manage drafts but cannot send them. See Magic Upgrade Flow for upgrade handling.