Skip to content

Set the draft reply for a thread

PUT
/openapi/thread/draft/{threadId}
curl --request PUT \
--url https://open-api.replyco.com/openapi/thread/draft/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json-patch+json' \
--data '{ "text": "Hi Jane,\n\nThanks for the photo. We have sent a replacement today." }'

Saves a draft reply on the thread. Agents see it pre-filled in the reply editor the next time they open the thread, and agents who already have the thread open see it straight away. The draft is not sent to the customer.

Draft content - send one of:

  • htmlBody - HTML, sanitized the same way as a sent message
  • text - plain text, converted to HTML. Line breaks are kept and blank lines start a new paragraph

If both are sent, htmlBody is used and text is ignored.

Notes:

  • A thread has one draft shared by all agents, so this replaces any existing draft
  • Send both fields null or empty to clear the draft
  • The draft is cleared when a reply is sent, and expires after 24 hours

Sample request with HTML:

PUT /thread/draft/3fa85f64-5717-4562-b3fc-2c963f66afa6
{
   "htmlBody": "<p>Hi John, your order has been shipped.</p>"
}
        

Sample request with plain text:

PUT /thread/draft/3fa85f64-5717-4562-b3fc-2c963f66afa6
{
   "text": "Hi John,\n\nYour order has been shipped."
}
threadId
required
string format: uuid

Thread ID to set the draft for

Request containing the draft as HTML or plain text

object
htmlBody

The draft reply as HTML. Takes priority over Text when both are sent.

string
nullable
text

The draft reply as plain text. Converted to HTML, with line breaks and paragraphs kept. Used when HtmlBody is empty.

string
nullable

Example

{
"text": "Hi Jane,\n\nThanks for the photo. We have sent a replacement today."
}

Draft was saved or cleared

Invalid request body

User is not authenticated or authorized

Thread with the specified ID was not found