Endpoints
List tickets
Page through an agent's tickets, newest first, filtered by status, assignee, channel, dates or title
The query_tickets tool returns the agent's Helpdesk tickets 20 at a time, newest first, the same tickets your team works on under Tickets. Filters combine with AND. Pass a saved view's view_id to get that view's tickets in its own order.
POST
https://api.qwryai.com/public/v1/tools/query_ticketsAuthentication
Send your API key as Authorization: Bearer YOUR_API_KEY. The key needs Manage conversations and helpdesk. See Authentication.
Body parameters
| Name | Type | Required | Description |
|---|---|---|---|
chatbotId | string | Yes | The agent's id, from list_agents. |
page | integer | Yes | Page number, starting at 1 (up to 10000). Each page holds 20 tickets. |
status | string | No | One status category: open, in_progress, on_hold, waiting_on_customer, resolved or closed. |
search | string | No | Text to find in ticket titles, up to 200 characters. A literal, case-insensitive match. |
assigneeId | string | No | Only tickets assigned to this team member. list_helpdesk_agents lists member ids. |
unassigned | boolean | No | true for tickets nobody is assigned to. Don't send it with assigneeId. |
channel | string | No | Only tickets from this source, such as chat or email. |
startDate | string | No | First creation day to include, YYYY-MM-DD (UTC). Send it with endDate. |
endDate | string | No | Last creation day to include, YYYY-MM-DD (UTC). The range can span at most 184 days. |
view_id | string | No | A saved view's id from list_saved_views. Applies that view's conditions and sort as well as your filters. |
Request example
curl -X POST 'https://api.qwryai.com/public/v1/tools/query_tickets' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"chatbotId": "YOUR_AGENT_ID",
"page": 1,
"status": "open",
"startDate": "2026-11-01",
"endDate": "2026-11-30"
}'const response = await fetch("https://api.qwryai.com/public/v1/tools/query_tickets", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
chatbotId: "YOUR_AGENT_ID",
page: 1,
status: "open",
startDate: "2026-11-01",
endDate: "2026-11-30",
}),
});
const { data } = await response.json();
console.log(data.total, data.items);import requests
response = requests.post(
"https://api.qwryai.com/public/v1/tools/query_tickets",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"chatbotId": "YOUR_AGENT_ID",
"page": 1,
"status": "open",
"startDate": "2026-11-01",
"endDate": "2026-11-30",
},
)
data = response.json()["data"]
print(data["total"], data["items"])Response
{
"success": true,
"data": {
"items": [
{
"_id": "<recordId>",
"ticketId": "TKT-73",
"title": "Late delivery for order 1043",
"status": "open",
"priority": "medium",
"category": "general",
"source": "chat",
"assignedAgentId": null,
"assignedAgentName": null,
"timestamps": {
"created": "2026-11-30T18:15:02.074Z",
"updated": "2026-11-30T18:56:55.709Z",
"assigned": null,
"resolved": null,
"closed": null
},
"respondedAt": null,
"createdAt": "2026-11-30T18:15:02.074Z",
"updatedAt": "2026-11-30T18:56:55.709Z"
}
],
"total": 1,
"page": 1,
"hasMore": false,
"searchMode": "literal_title"
}
}| Field | Type | Description |
|---|---|---|
items | array | Up to 20 tickets. ticketId is the ticket's number, such as TKT-73; status is its category; source is where it started. |
total | integer | How many tickets match the filters. |
page | integer | The page you asked for. |
hasMore | boolean | true while there are more pages. Ask for page + 1. |
view | object | Only with view_id: the view's id, name and sort. |
searchMode | string | Always literal_title: search is a plain text match on titles. |
Read one ticket with its description and comments with Get a ticket. See Pagination for paging loops.
Errors
| HTTP status | code | When |
|---|---|---|
| 400 | INVALID_ARGUMENTS | page is missing, or an argument fails the schema, such as an unknown status or a badly written date. issues lists each one. |
| 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. |
| 409 | VALIDATION_INVALID_BODY | Only one of startDate and endDate was sent, the range is over 184 days, both assigneeId and unassigned were sent, or view_id doesn't match a saved view. |
| 413 | RESULT_TOO_LARGE | The page is over 40,000 bytes. Add filters. |
See Error Handling for authentication and rate-limit errors.