daimon.email
Api referenceDrafts

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

Authorizationstringpathrequired

Inbox API Key

Path Parameters

idstringpathrequired

The inbox ID (e.g., inb_abc123)

draftIdstringpathrequired

The draft ID (e.g., dft_abc123)

Body Parameters

All parameters are optional. Only include fields you want to update.

tostringbody

Recipient email address

ccarraybody

Array of CC email addresses

bccarraybody

Array of BCC email addresses

subjectstringbody

Email subject line

bodystringbody

Plain text email body

body_htmlstringbody

HTML email body

send_atstringbody

ISO 8601 timestamp for scheduled sending. Set to null to unschedule a draft.

labelsarraybody

Array 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.idstring

Unique draft identifier

result.inbox_idstring

The inbox this draft belongs to

result.tostring

Recipient email address

result.ccarray

Array of CC email addresses

result.bccarray

Array of BCC email addresses

result.subjectstring

Email subject line

result.body_textstring

Plain text email body

result.body_htmlstring

HTML email body (may be null)

result.send_atstring

ISO 8601 timestamp for scheduled sending (null if not scheduled)

result.thread_idstring

Thread ID this draft is attached to (null if not part of a thread)

result.labelsarray

Array of label strings applied to this draft

result.created_atstring

ISO 8601 timestamp when draft was created

result.updated_atstring

ISO 8601 timestamp when draft was last updated (reflects this update)

next_stepsarray

Suggested 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.