GET
/api/v1/tickets/[ticketId]/comments
List all comments for a ticket in ascending time order.
Authentication: API key required
Behavior
- The route first verifies that the ticket exists in the authenticated shop.
- Messages are returned ordered by time ascending.
- Each message includes selected Customer and User data when available.
- The response wraps the list in comments and adds totalCount.
Route parameters
- ticketId (required)
Ticket identifier used to fetch the parent conversation and its messages.
Response
GET response example
{
"success": true,
"comments": [
{
"id": "555111222333",
"text": "Hello, I need a refund.",
"time": "2026-04-28T00:00:00.000Z",
"Channel": "Mail",
"isFromShop": false,
"Customer": {
"id": 123,
"email": "dev@example.com",
"first_name": "Ada",
"last_name": "Lovelace",
"full_name": "Ada Lovelace"
},
"User": null
}
],
"totalCount": 1
}POST
/api/v1/tickets/[ticketId]/comments
Create a new message inside an existing conversation.
Authentication: API key required
Behavior
- text is required and must not be empty after trimming.
- If isFromShop is omitted, the handler defaults it to true.
- The string value 'false' is explicitly recognized and converted to boolean false.
- Channel defaults to the conversation channel when omitted.
- toEmails defaults to an empty array unless an array is provided.
- After the message is created, the conversation lastMessage and lastMessageTime are updated.
- When isFromShop is false, unReadChatCount is reset to 1 in the conversation update.
Body parameters
- text (required)
Message content.
- time (optional)
Message timestamp as an ISO string. Defaults to now.
- subject (optional)
Message subject.
- fromEmail (optional)
Sender email address.
- toEmails (optional)
Array of recipient email addresses.
- attachments (optional)
Attachments JSON payload.
- tags (optional)
Array of tags.
- Channel (optional)
Overrides the conversation channel.
- isFromShop (optional)
Boolean or the string 'false'. Defaults to true.
POST body
{
"text": "We have started reviewing your refund request.",
"subject": "Refund request update",
"fromEmail": "support@example.com",
"toEmails": ["dev@example.com"],
"tags": ["refund"],
"Channel": "Mail",
"isFromShop": true
}Response
POST response example
{
"success": true,
"comment": {
"id": "555111222334",
"text": "We have started reviewing your refund request.",
"time": "2026-04-28T00:05:00.000Z",
"Channel": "Mail",
"isFromShop": true,
"subject": "Refund request update",
"fromEmail": "support@example.com",
"toEmails": ["dev@example.com"],
"tags": ["refund"]
}
}