Update Draft
Edit an existing draft before sending
Overview
Update an existing email draft. All fields are optional - only provide the fields you want to change.
Info
You can update drafts at any time before they are sent. Once sent, drafts are converted to messages and cannot be edited.
Authentication
AuthorizationstringpathrequiredInbox API Key
Path Parameters
idstringpathrequiredThe inbox ID (e.g., inb_abc123)
draftIdstringpathrequiredThe draft ID (e.g., dft_abc123)
Body Parameters
All parameters are optional. Only include fields you want to update.
tostringbodyRecipient email address
ccarraybodyArray of CC email addresses
bccarraybodyArray of BCC email addresses
subjectstringbodyEmail subject line
bodystringbodyPlain text email body
body_htmlstringbodyHTML email body
send_atstringbodyISO 8601 timestamp for scheduled sending. Set to null to unschedule a draft.
labelsarraybodyArray of label strings to apply to this draft
Request
curl -X PATCH https://api.daimon.email/v1/inboxes/inb_abc123/drafts/dft_abc123 \
-H "Authorization: Bearer dm_free_7d8a9b0c1d2e3f4g5h6i7j8k9l0m1n2o" \
-H "Content-Type: application/json" \
-d '{
"subject": "UPDATED: Your order is ready",
"body": "Hi there,\n\nYour order #12345 has been processed and is ready for pickup at our downtown location.\n\nBest,\nSupport Team"
}'import { DaimonClient } from 'daimon-email';
const client = new DaimonClient({
apiKey: 'dm_free_7d8a9b0c1d2e3f4g5h6i7j8k9l0m1n2o'
});
// Update subject and body
const draft = await client.inboxes.drafts.update('inb_abc123', 'dft_abc123', {
subject: 'UPDATED: Your order is ready',
body: 'Hi there,\n\nYour order #12345 has been processed and is ready for pickup at our downtown location.\n\nBest,\nSupport Team'
});
console.log('Draft updated:', draft.id);
// Schedule a draft
const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
tomorrow.setHours(9, 0, 0, 0);
await client.inboxes.drafts.update('inb_abc123', 'dft_abc123', {
send_at: tomorrow.toISOString()
});
// Unschedule a draft
await client.inboxes.drafts.update('inb_abc123', 'dft_abc123', {
send_at: null
});
// Add CC recipients
await client.inboxes.drafts.update('inb_abc123', 'dft_abc123', {
cc: ['manager@example.com', 'supervisor@example.com']
});from daimon_email import DaimonClient
from datetime import datetime, timedelta
client = DaimonClient(
api_key='dm_free_7d8a9b0c1d2e3f4g5h6i7j8k9l0m1n2o'
)
# Update subject and body
draft = client.inboxes.drafts.update('inb_abc123', 'dft_abc123', {
'subject': 'UPDATED: Your order is ready',
'body': 'Hi there,\n\nYour order #12345 has been processed and is ready for pickup at our downtown location.\n\nBest,\nSupport Team'
})
print(f"Draft updated: {draft['id']}")
# Schedule a draft
tomorrow = datetime.now() + timedelta(days=1)
tomorrow = tomorrow.replace(hour=9, minute=0, second=0, microsecond=0)
client.inboxes.drafts.update('inb_abc123', 'dft_abc123', {
'send_at': tomorrow.isoformat()
})
# Unschedule a draft
client.inboxes.drafts.update('inb_abc123', 'dft_abc123', {
'send_at': None
})
# Add CC recipients
client.inboxes.drafts.update('inb_abc123', 'dft_abc123', {
'cc': ['manager@example.com', 'supervisor@example.com']
})Response
{
"result": {
"id": "dft_abc123",
"inbox_id": "inb_abc123",
"to": "customer@example.com",
"cc": [],
"bcc": [],
"subject": "UPDATED: Your order is ready",
"body_text": "Hi there,\n\nYour order #12345 has been processed and is ready for pickup at our downtown location.\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-11T16:45:00Z"
},
"next_steps": [
"Use POST /v1/inboxes/{id}/drafts/{draftId}/send to send this updated draft",
"Use GET /v1/inboxes/{id}/drafts/{draftId} to verify your changes",
"Continue editing with PATCH /v1/inboxes/{id}/drafts/{draftId}"
]
}Response Fields
result.idstringUnique draft identifier
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 (reflects this update)
next_stepsarraySuggested actions the agent can take next
Partial Updates
You only need to send the fields you want to change:
// Just update the subject
await client.inboxes.drafts.update('inb_abc123', 'dft_abc123', {
subject: 'New Subject'
});
// Just add a label
await client.inboxes.drafts.update('inb_abc123', 'dft_abc123', {
labels: ['urgent', 'customer-service']
});Warning
When updating labels, you must provide the complete array. It replaces all existing labels, not appends to them.