Authentication
Requires a valid session. Returns 401 if unauthorized.
Path Parameters
The unique identifier of the email thread
Request Body
All fields are optional. Only provided fields will be updated.
Draft email body in HTML format. Use semantic HTML tags like <p>, <strong>, <em>, <ol>, <ul>, <li>, <a>
Korean translation of the draft (plain text)
Draft status. One of:
pending - Draft generation in progress
ready - Draft is ready to send
sent - Draft has been sent
skipped - Draft was skipped
Behavior
- If no draft exists for the thread, a new one is created with ID
draft-{threadId}
- If a draft already exists, only the provided fields are updated
- The
updatedAt timestamp is automatically set to the current time
- Omitted fields retain their existing values
Response
Always returns true on success
Example Request
curl -X PUT https://api.delightbridge.com/api/drafts/thread-123 \
-H "Content-Type: application/json" \
-H "Cookie: session=your-session-token" \
-d '{
"content": "<p>Hi John,</p><p>Thank you for your patience...</p>",
"subject": "Re: Order status inquiry",
"status": "ready"
}'
Example Response
Partial Update Example
You can update just the status without touching other fields:
await fetch('/api/drafts/thread-123', {
method: 'PUT',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ status: 'sent' })
});
Creating a New Draft
If no draft exists, all fields will use their defaults:
{
"content": "",
"subject": "",
"translation": "",
"status": "ready"
}
Error Responses
Error message describing what went wrong
401 Unauthorized
{
"error": "Unauthorized"
}
Returned when the session is invalid or expired.
400 Bad Request
{
"error": "Invalid request body"
}
Returned when the request body is malformed or contains invalid data.