Skip to content

Draft a cited reply to the client's latest message

POST
/tickets/{id}/draft-reply
Code sample: Shell / cURL
curl --request POST \
--url https://example.com/api/v1/tickets/example/draft-reply \
--header 'Authorization: Bearer <token>'

Writes a proposed reply to the client’s latest public message on the ticket, in the voice of the calling member, from what the person who opened the ticket can reach in the portal (never the caller’s own reach), citing the tasks and requests it rests on. Nothing is posted or sent: review it, then post it with postTicketMessage. It runs the same review as a client answer, counts against the company’s AI spend limits and the caller’s own hourly allowance of drafts, and needs the client assistant to have a model. Answers 422 with a plain reason when no draft can be written, such as a ticket not opened by an active company contact, and 429 when the hourly allowance is spent. Requires the tickets.manage permission; a ticket outside your reach answers 404.

id
required

Resource identifier (CUID2).

string
>= 1 characters

Resource identifier (CUID2).

The draft and the records it rests on.

Media typeapplication/json
object
data
required
object
citations
required

The records the draft rests on, for the sender to check.

Array<object>
object
kind
required
string
Allowed values: task ticket
path
required

Where the team opens the record, or null when it cannot be placed.

string | null
reference
required

The task number or ticket code it names.

string
title
required
string
draft
required

The proposed reply as plain text, written in the voice of the person who sends it. Nothing is sent.

string
ticketId
required
string

Example

{
"data": {
"citations": [
{
"kind": "task"
}
]
}
}

Unauthorized.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Forbidden.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Not found.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Invalid input.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Rate limit exceeded. Wait for Retry-After before retrying.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}
RateLimit-Limit
string
/^\d+$/

Maximum requests in the current quota window.

RateLimit-Policy
string

Quota policy in requests and window seconds, for example 60;w=60.

RateLimit-Remaining
string
/^\d+$/

Requests left in this quota window (zero when blocked).

RateLimit-Reset
string
/^\d+$/

Seconds until the current quota window resets, when available from the rate-limit store.

Retry-After
string
/^\d+$/

Seconds until another request may be attempted.