Skip to content
QwryAI
Documentation
Pages

Endpoints

Search tickets

Find an agent's tickets by number, title or description, or find the customers who opened them

The search_tickets tool runs a plain-text search over the agent's Helpdesk tickets and returns up to 20 matches, newest first. Search for TKT-73, a word from the title, or a phrase the customer wrote. With "filter": "customers" it searches the people who opened tickets instead, by name, email, phone or company.

POSThttps://api.qwryai.com/public/v1/tools/search_tickets

Authentication

Send your API key as Authorization: Bearer YOUR_API_KEY. The key needs Manage conversations and helpdesk. See Authentication.

Body parameters

NameTypeRequiredDescription
chatbotIdstringYesThe agent's id, from list_agents.
querystringYesWhat to look for, 2 to 200 characters. A literal, case-insensitive match, not a semantic search.
filterstringNotickets (default) searches ticket numbers, titles and descriptions. customers searches the people who opened tickets.

Request example

Bash
curl -X POST 'https://api.qwryai.com/public/v1/tools/search_tickets' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"chatbotId": "YOUR_AGENT_ID", "query": "order 1043"}'

Response

JSON
{
  "success": true,
  "data": {
    "filter": "tickets",
    "items": [
      {
        "_id": "<recordId>",
        "ticketId": "TKT-73",
        "title": "Late delivery for order 1043",
        "status": "open",
        "priority": "medium",
        "category": "general",
        "source": "chat",
        "assignedAgentId": null,
        "assignedAgentName": null,
        "requester": { "name": "Sam Tester", "email": "sam.tester@example.com" },
        "timestamps": { "created": "2026-11-30T18:15:02.074Z", "updated": "2026-11-30T18:56:55.709Z" },
        "createdAt": "2026-11-30T18:15:02.074Z",
        "updatedAt": "2026-11-30T18:56:55.709Z"
      }
    ],
    "hasMore": false,
    "searchMode": "literal_id_title_description"
  }
}
FieldTypeDescription
filterstringtickets or customers, as searched.
itemsarrayUp to 20 matches. Tickets carry the same fields as List tickets plus requester. Customers carry how many tickets they opened and their latest ticket.
hasMorebooleantrue when there were more than 20 matches. Narrow the query to see them.
searchModestringWhich fields were matched.

Errors

HTTP statuscodeWhen
400INVALID_ARGUMENTSquery is missing or under 2 characters, or filter isn't tickets or customers.
400CHATBOT_ID_REQUIREDchatbotId is missing or isn't a valid agent id.
403INSUFFICIENT_PERMISSIONThe key doesn't hold Manage conversations and helpdesk.
404CHATBOT_NOT_FOUNDNo agent with that chatbotId in your workspace.

See Error Handling for authentication and rate-limit errors.

Explore the documentation