# List ticket messages > Read a ticket's comments ten at a time, oldest first, including internal notes A ticket's comments come back with the ticket from the `get_ticket_detail` tool, ten per call. Start with `"offset": 0`, then send each response's `nextOffset` as the next `offset` until it's `null`. Comments come oldest first. Internal comments are included and marked `isInternal: true`. ```http POST https://api.qwryai.com/public/v1/tools/get_ticket_detail ``` ## Authentication Send your API key as `Authorization: Bearer YOUR_API_KEY`. The key needs **Manage conversations and helpdesk**. See [Authentication](/docs/api-reference/v2/authentication). ## Body parameters | Name | Type | Required | Description | | - | - | - | - | | `chatbotId` | string | Yes | The agent's id, from `list_agents`. | | `ticketId` | string | Yes | The ticket's number, such as `TKT-73`. | | `offset` | integer | Yes | The first comment to return, counting from `0`. Use the previous response's `nextOffset`. | ## Request example > [tab] cURL > > ```bash > curl -X POST 'https://api.qwryai.com/public/v1/tools/get_ticket_detail' \ > -H 'Authorization: Bearer YOUR_API_KEY' \ > -H 'Content-Type: application/json' \ > -d '{"chatbotId": "YOUR_AGENT_ID", "ticketId": "TKT-73", "offset": 0}' > ``` > [tab] JavaScript > > ```javascript > async function ticketComments(ticketId) { > const comments = []; > let offset = 0; > while (offset !== null) { > const response = await fetch("https://api.qwryai.com/public/v1/tools/get_ticket_detail", { > method: "POST", > headers: { > Authorization: "Bearer YOUR_API_KEY", > "Content-Type": "application/json", > }, > body: JSON.stringify({ chatbotId: "YOUR_AGENT_ID", ticketId, offset }), > }); > const { data } = await response.json(); > comments.push(...data.comments); > offset = data.nextOffset; > } > return comments; > } > ``` > [tab] Python > > ```python > import requests > > def ticket_comments(ticket_id): > comments, offset = [], 0 > while offset is not None: > response = requests.post( > "https://api.qwryai.com/public/v1/tools/get_ticket_detail", > headers={"Authorization": "Bearer YOUR_API_KEY"}, > json={"chatbotId": "YOUR_AGENT_ID", "ticketId": ticket_id, "offset": offset}, > ) > data = response.json()["data"] > comments.extend(data["comments"]) > offset = data["nextOffset"] > return comments > ``` ## Response The ticket's own fields are the same as in [Get a ticket](/docs/api-reference/v2/helpdesk/get-a-ticket); the comment fields are below. ```json { "success": true, "data": { "ticketId": "TKT-73", "title": "Late delivery for order 1043", "status": "in_progress", "description": "My delivery for order 1043 is two weeks late. Please help me resolve this.", "descriptionTruncated": false, "comments": [ { "id": "c-1", "authorType": "agent", "timestamp": "2026-11-30T19:02:11.508Z", "isInternal": false, "content": "Sorry about the wait, Sam. I've asked the courier for an update and will write back today.", "truncated": false }, { "id": "c-2", "authorType": "agent", "timestamp": "2026-11-30T19:03:40.112Z", "isInternal": true, "content": "Courier ticket opened. Refund if not delivered by Friday.", "truncated": false } ], "nextOffset": null } } ``` | Field | Type | Description | | - | - | - | | `comments[].id` | string | The comment's id. | | `comments[].authorType` | string | Who wrote it: `agent` (a team member), `user` (the customer) or `system`. | | `comments[].timestamp` | string | When it was written. | | `comments[].isInternal` | boolean | `true` for an internal note the customer never sees. | | `comments[].content` | string | The comment's text, up to 1,000 characters. | | `comments[].truncated` | boolean | `true` when the comment was longer and was cut. | | `nextOffset` | integer or null | The `offset` for the next ten comments; `null` after the last one. | > [!NOTE] > > The conversation that opened the ticket isn't part of its comments. Read the chat itself with [Get a conversation](/docs/api-reference/v2/conversations/get-a-conversation). ## Errors | HTTP status | code | When | | - | - | - | | 400 | `INVALID_ARGUMENTS` | `ticketId` or `offset` is missing, or `offset` isn't a whole number from 0. | | 400 | `CHATBOT_ID_REQUIRED` | `chatbotId` is missing or isn't a valid agent id. | | 403 | `INSUFFICIENT_PERMISSION` | The key doesn't hold **Manage conversations and helpdesk**. | | 404 | `CHATBOT_NOT_FOUND` | No agent with that `chatbotId` in your workspace. | | 500 | `TOOL_FAILED` | No ticket with that number belongs to this agent, or the read failed. | See [Error Handling](/docs/api-reference/v2/error-handling) for authentication and rate-limit errors.