Skip to content
QwryAI
Documentation
Pages

Commands

CLI Tickets

List, search and read a QwryAI agent's Helpdesk tickets, and look up its ticket statuses and teams from the terminal

Use the ticket tools to triage your Helpdesk from a script: list tickets by status or assignee, search them, read a ticket with its comments, and look up the statuses and teams they use. They need the Manage conversations and helpdesk permission. Sign in first (see CLI Auth) and keep the agent's id in $AGENT (see CLI Agents).

List and search tickets

List the agent's tickets, newest first, twenty per page:

Bash
qwryai-cli tools:call query_tickets --args "{\"chatbotId\":\"$AGENT\",\"page\":1}"
JSON
{
  "success": true,
  "data": {
    "items": [
      {
        "_id": "<ticketRecordId>",
        "ticketId": "TKT-73",
        "source": "chat",
        "assignedAgentId": null,
        "assignedAgentName": null,
        "title": "Late delivery for order 1043",
        "category": "general",
        "priority": "medium",
        "status": "open",
        "timestamps": {
          "created": "2026-11-30T18:15:02.074Z",
          "updated": "2026-11-30T18:56:55.709Z",
          "assigned": null,
          "resolved": null,
          "closed": null
        },
        "respondedAt": null
      }
    ],
    "total": 270,
    "page": 1,
    "hasMore": true,
    "searchMode": "literal_title"
  }
}

Filter by status, assignee, channel or creation date:

Bash
qwryai-cli tools:call query_tickets --args "{\"chatbotId\":\"$AGENT\",\"page\":1,\"status\":\"open\",\"unassigned\":true,\"startDate\":\"2026-11-01\",\"endDate\":\"2026-11-30\"}"

status is one of open, in_progress, on_hold, waiting_on_customer, resolved or closed. Use assigneeId for one member's tickets, channel for one source, search to match titles, and view_id to apply a saved view from list_saved_views. Give both dates or neither.

Search tickets by ticket ID, title or description:

Bash
qwryai-cli tools:call search_tickets --args "{\"chatbotId\":\"$AGENT\",\"query\":\"order 1043\"}"

Add "filter":"customers" to search the people who opened tickets by name, email, phone or company instead.

Count tickets by status, with how many are unassigned:

Bash
qwryai-cli tools:call get_ticket_counts --args "{\"chatbotId\":\"$AGENT\"}"
JSON
{"success":true,"data":{"rows":[{"_id":"open","count":232,"unassigned":212},{"_id":"in_progress","count":2,"unassigned":0},{"_id":"resolved","count":28,"unassigned":12}]}}

Get a ticket and read comments

Show one ticket by its number, with its description and comments:

Bash
qwryai-cli tools:call get_ticket_detail --args "{\"chatbotId\":\"$AGENT\",\"ticketId\":\"TKT-73\",\"offset\":0}"
JSON
{
  "success": true,
  "data": {
    "ticketId": "TKT-73",
    "source": "chat",
    "title": "Late delivery for order 1043",
    "priority": "medium",
    "status": "open",
    "assignedAgentName": null,
    "timestamps": { "created": "2026-11-30T18:15:02.074Z", "updated": "2026-11-30T18:56:55.709Z" },
    "description": "Hello support team, my delivery for order 1043 is two weeks late. Please help me resolve this. Best regards, Sam Tester",
    "descriptionTruncated": false,
    "comments": [],
    "nextOffset": null
  }
}

Comments come in pages; when nextOffset isn't null, call again with that offset. Internal comments are included for members allowed to see them.

Look up statuses and teams

List the ticket statuses, with their names in the Helpdesk, the names customers see, and ticket counts:

Bash
qwryai-cli tools:call get_helpdesk_page --args "{\"chatbotId\":\"$AGENT\",\"page\":\"statuses\"}"
JSON
{
  "success": true,
  "data": {
    "page": "statuses",
    "settings": {
      "statuses": [
        { "id": "open", "category": "open", "name": "New", "customerName": "Submitted", "description": "", "isDefault": true, "archived": false },
        { "id": "in_progress", "category": "in_progress", "name": "On you", "customerName": "In progress", "description": "", "isDefault": true, "archived": false },
        { "id": "resolved", "category": "resolved", "name": "Closed", "customerName": "Resolved", "description": "", "isDefault": true, "archived": false }
      ],
      "ticketCounts": { "open": 232, "in_progress": 2, "resolved": 28 }
    }
  }
}

List the Helpdesk teams, including the default one:

Bash
qwryai-cli tools:call get_helpdesk_page --args "{\"chatbotId\":\"$AGENT\",\"page\":\"teams\"}"
JSON
{"success":true,"data":{"page":"teams","settings":[{"name":"General","strategy":"manual","maxTicketsPerAgent":null,"workloadCategories":["open","in_progress"],"unassignOnReply":false,"id":"<teamId>","isDefault":true,"memberIds":[],"lastAssignedId":null,"openTickets":25,"unassignedTickets":18}]}}

The same tool reads the other Settings › Helpdesk pages too: members, scheduling, triggers, automations, macros, ticket_reuse, translation, ai_draft and csat.

Commands

ToolPurpose
query_ticketsList tickets, with status, assignee, channel, date and title filters
search_ticketsSearch tickets by ID, title or description, or the customers who opened them
get_ticket_countsCount tickets by status, with unassigned counts
get_ticket_detailShow one ticket with its description and comments
list_saved_viewsList saved ticket views to use as view_id
get_helpdesk_pageRead ticket statuses, teams and other Helpdesk settings
get_ticket_resolution_analyticsCount resolved tickets per day and the average hours to resolve, for a date range

Explore the documentation