> ## Documentation Index
> Fetch the complete documentation index at: https://docs.thena.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Tickets search

The ticket search API lets you find, filter, and analyze support tickets using flexible Typesense-powered queries. You can search by text, filter by any ticket property, and select exactly which fields you want in the response.

## Example use cases

* **Get recent tickets assigned to me that are open**

  ```json theme={null}
  {
    "query_by": "title,description",
    "filter_by": "assignedAgentName:=john.doe@company.com&&statusName:=open",
    "sort_by": "createdAt:desc",
    "per_page": "10",
    "q": "*"
  }
  ```

* **Get all tickets from customer A that are high priority in the last 30 days**

  ```json theme={null}
  {
    "query_by": "title,description",
    "filter_by": "accountName:=CustomerA&&priorityName:=high&&createdAt:>2024-04-01",
    "sort_by": "createdAt:desc",
    "q": "*"
  }
  ```

* **Find tickets with the word 'refund' that are unresolved**

  ```json theme={null}
  {
    "query_by": "title,description",
    "q": "refund",
    "filter_by": "statusName:!=resolved"
  }
  ```

* **List all escalated tickets for a specific team**

  ```json theme={null}
  {
    "query_by": "title",
    "filter_by": "teamUid:=T88S900BHN&&isEscalated:=true",
    "q": "*"
  }
  ```

* **Get tickets created by a specific requestor in the last week**

  ```json theme={null}
  {
    "query_by": "title,description",
    "filter_by": "requestorEmail:=user@company.com&&createdAt:>2024-05-01",
    "q": "*"
  }
  ```

***

## Ticket search response fields

Below are all the fields you may see in a ticket search result. Many are optional and will only appear if included in your `include_fields` parameter.

| Field                | Type   | Description                                                                |
| -------------------- | ------ | -------------------------------------------------------------------------- |
| id                   | string | Unique identifier of the ticket                                            |
| ticketIdentifier     | string | Ticket identifier (e.g. SPO-42260)                                         |
| title                | string | Title of the ticket                                                        |
| description          | string | Description of the ticket                                                  |
| teamUid              | string | Team UID                                                                   |
| organizationUid      | string | Organization UID                                                           |
| statusName           | string | Status name (e.g. Resolved)                                                |
| priorityName         | string | Priority name (e.g. Medium)                                                |
| createdAt            | string | Creation timestamp (ISO8601)                                               |
| updatedAt            | string | Last update timestamp (ISO8601)                                            |
| assignedAgentName    | string | Name of the assigned agent                                                 |
| accountName          | string | Name of the associated account                                             |
| accountPrimaryDomain | string | Primary domain of the account                                              |
| accountWebsite       | string | Website of the account                                                     |
| accountAnnualRevenue | string | Annual revenue of the account                                              |
| accountEmployees     | string | Number of employees in the account                                         |
| accountOwnerId       | string | Account owner ID                                                           |
| accountOwnerEmail    | string | Account owner email                                                        |
| accountOwnerName     | string | Account owner name                                                         |
| accountOwnerUserType | string | Account owner user type                                                    |
| accountOwnerStatus   | string | Account owner status                                                       |
| accountOwnerTimezone | string | Account owner timezone                                                     |
| contactEmail         | string | Contact email                                                              |
| contactName          | string | Contact name                                                               |
| contactPhone         | string | Contact phone                                                              |
| dueDate              | string | Due date                                                                   |
| teamIdentifier       | string | Team identifier                                                            |
| ...                  | ...    | \[Many more fields, including SLA fields, see API reference for full list] |

> For a full list, see the TicketSearchResponseDto in the API reference.

***

**Tip:** Use the `include_fields` parameter to limit the response to only the fields you need for performance and clarity.
