Create or Replace Ticket Draft
POST/api/support/agent/tickets/:ticket/draft
Creates the ticket's shared draft, or replaces it — the endpoint for agents and automation writing a draft over the API. No version bookkeeping is needed: the caller may replace a draft it already holds, and the draft is attributed to the token's agent (it lights the ticket's Draft chip in the desk inbox and opens in the composer).
support:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Path parameters
ticket(integer) — the ticket id.
Request body
body_html(string, max 200000) — the draft as HTML, what the desk composer edits. Preferred. Required unlessbodyis sentbody(string, max 65000) — plain-text draft, used whenbody_htmlis absent. Required unlessbody_htmlis sentmode(optional, string, defaultreply) —reply(a public reply) ornote(an internal note)cc[](optional, array, max 20, each a valid email, max 255) — the addresses the reply would copystatus_after(optional, string, nullable) — the status to set when the draft is sent. One of: open, in_progress, waiting_on_customer, awaiting_release, resolved, closedattachments[](optional, array, max 10) — file metadata only, each{name (required, max 255), size (optional integer, min 0)}. The files themselves ride the send, never the draftversion(optional, integer, min 0) — omit it for create-or-replace. Pass it to opt into the strict optimistic lock the desk uses: the save is refused with 409 unless it matches the stored draft's versionforce(optional, boolean, default false) — take over a draft another agent holds
Responses
- 201 — the draft was created (
version1) - 200 — an existing draft was replaced (
versionincrements by one) - 409 — another agent holds the draft (or the passed
versionis stale). The body carriesmessagenaming the holder anddraft, the current draft with itsuser. Nothing is overwritten; retry withforce: trueto take it over - 422 — validation failed (e.g. neither
body_htmlnorbody) - 403 — the token lacks the
support:writescope, or the user is not a support agent who can see the ticket
The desk's own autosave uses PUT on the same path (versioned on every save). Sending a reply or an internal note on the ticket clears the draft automatically; DELETE discards it.
Authentication: Bearer token with the support:write scope, or an authenticated support agent session.
Request
Responses
- 200
- 201
- 401
- 403
- 404
- 409
- 422
- 429
OK
Response Headers
Created
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Not found — no record with the given identifier (or the route does not exist). Verify the ID before retrying.
Conflict
Response Headers
Unprocessable Content
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.