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.
POST
https://api.qwryai.com/public/v1/tools/search_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. |
query | string | Yes | What to look for, 2 to 200 characters. A literal, case-insensitive match, not a semantic search. |
filter | string | No | tickets (default) searches ticket numbers, titles and descriptions. customers searches the people who opened tickets. |
Request example
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"}'const response = await fetch("https://api.qwryai.com/public/v1/tools/search_tickets", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({ chatbotId: "YOUR_AGENT_ID", query: "order 1043" }),
});
const { data } = await response.json();import requests
response = requests.post(
"https://api.qwryai.com/public/v1/tools/search_tickets",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"chatbotId": "YOUR_AGENT_ID", "query": "order 1043"},
)
data = response.json()["data"]Response
{
"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"
}
}{
"success": true,
"data": {
"filter": "customers",
"items": [
{
"name": "Sam Tester",
"email": "sam.tester@example.com",
"phone": null,
"tickets": 2,
"latestTicketId": "TKT-73",
"latestTicketAt": "2026-11-30T18:15:02.074Z"
}
],
"hasMore": false,
"searchMode": "literal_contact_or_requester"
}
}| Field | Type | Description |
|---|---|---|
filter | string | tickets or customers, as searched. |
items | array | Up to 20 matches. Tickets carry the same fields as List tickets plus requester. Customers carry how many tickets they opened and their latest ticket. |
hasMore | boolean | true when there were more than 20 matches. Narrow the query to see them. |
searchMode | string | Which fields were matched. |
Errors
| HTTP status | code | When |
|---|---|---|
| 400 | INVALID_ARGUMENTS | query is missing or under 2 characters, or filter isn't tickets or customers. |
| 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. |
See Error Handling for authentication and rate-limit errors.