{"command":{"effect":"write","timeoutSeconds":30,"inputSchema":{"type":"object","description":"You can search for multiple tickets by the value of their attributes in order to fetch exactly which ones you want.\n\nTo search for tickets, you send a `POST` request to `https://api.intercom.io/tickets/search`.\n\nThis will accept a query object in the body which will define your filters.\n{% admonition type=\"warning\" name=\"Optimizing search queries\" %}\n  Search queries can be complex, so optimizing them can help the performance of your search.\n  Use the `AND` and `OR` operators to combine multiple filters to get the exact results you need and utilize\n  pagination to limit the number of results returned. The default is `20` results per page and maximum is `150`.\n  See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#example-search-conversations-request) for more details on how to use the `starting_after` param.\n{% /admonition %}\n\n### Nesting & Limitations\n\nYou can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4).\nThere are some limitations to the amount of multiples there can be:\n- There's a limit of max 2 nested filters\n- There's a limit of max 15 filters for each AND or OR group\n\n### Accepted Fields\n\nMost keys listed as part of the Ticket model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `\"foobar\"`).\nFields not in the table below, such as `source.body`, are rejected with a `400` error.\n\n| Field                                     | Type                                                                                     |\n| :---------------------------------------- | :--------------------------------------------------------------------------------------- |\n| id                                        | Integer                                                                                  |\n| created_at                                | Date (UNIX timestamp)                                                                    |\n| updated_at                                | Date (UNIX timestamp)                                                                    |\n| title                           | String                                                                                   |\n| description                     | String                                                                                   |\n| category                                  | String                                                                                   |\n| ticket_type_id                            | Integer                                                                                  |\n| contact_ids                               | String                                                                                   |\n| admin_assignee_id                         | Integer                                                                                  |\n| team_assignee_id                          | Integer                                                                                  |\n| open                                      | Boolean                                                                                  |\n| state                                     | String                                                                                   |\n| snoozed_until                             | Date (UNIX timestamp)                                                                    |\n| ticket_attribute.{id}                     | String or Boolean or Date (UNIX timestamp) or Float or Integer                           |\n\n{% admonition type=\"info\" name=\"Searching by Category\" %}\nWhen searching for tickets by the **`category`** field, specific terms must be used instead of the category names:\n* For **Customer** category tickets, use the term `request`.\n* For **Back-office** category tickets, use the term `task`.\n* For **Tracker** category tickets, use the term `tracker`.\n{% /admonition %}\n\n### Sorting\n\nYou can sort the results with a `sort` object, for example `{\"field\": \"created_at\", \"order\": \"ascending\"}`. `field` must be one of the fields in the table above, other than `ticket_attribute.{id}`, `title` and `description`. `order` is `ascending` or `descending`. Without `sort`, results are sorted by `updated_at`, newest first.\n\n### Accepted Operators\n\n{% admonition type=\"info\" name=\"Searching based on `created_at`\" %}\n  You may use the `<=` or `>=` operators to search by `created_at`.\n{% /admonition %}\n\nThe table below shows the operators you can use to define how you want to search for the value.  The operator should be put in as a string (`\"=\"`). The operator has to be compatible with the field's type  (eg. you cannot search with `>` for a given string value as it's only compatible for integer's and dates).\n\n| Operator | Valid Types                    | Description                                                  |\n| :------- | :----------------------------- | :----------------------------------------------------------- |\n| =        | All                            | Equals                                                       |\n| !=       | All                            | Doesn't Equal                                                |\n| IN       | All                            | In  Shortcut for `OR` queries  Values most be in Array       |\n| NIN      | All                            | Not In  Shortcut for `OR !` queries  Values must be in Array |\n| >        | Integer  Date (UNIX Timestamp) | Greater (or equal) than                                      |\n| <       | Integer  Date (UNIX Timestamp) | Lower (or equal) than                                        |\n| ~        | String                         | Contains                                                     |\n| !~       | String                         | Doesn't Contain                                              |\n| ^        | String                         | Starts With                                                  |\n| $        | String                         | Ends With                                                    |\n","properties":{"headers":{"type":"object","properties":{"Intercom-Version":{"$ref":"#/definitions/intercom_version","enum":["2.17"]}},"required":[],"additionalProperties":false},"body":{"$ref":"#/definitions/search_request","examples":[{"query":{"operator":"AND","value":[{"field":"created_at","operator":">","value":"1306054154"}]},"pagination":{"per_page":5}}]}},"required":[],"additionalProperties":false,"definitions":{"intercom_version":{"description":"Intercom API version.</br>If you omit the header, the API uses the version set in your app package, and 1.0 if none is set.","type":"string","enum":["1.0","1.1","1.2","1.3","1.4","2.0","2.1","2.2","2.3","2.4","2.5","2.6","2.7","2.8","2.9","2.10","2.11","2.12","2.13","2.14","2.15","2.16","2.17"],"examples":["2.17"]},"search_request":{"description":"Search using Intercoms Search APIs.","type":"object","title":"Search data","properties":{"query":{"oneOf":[{"$ref":"#/definitions/single_filter_search_request"},{"$ref":"#/definitions/multiple_filter_search_request"}]},"pagination":{"$ref":"#/definitions/starting_after_paging"},"sort":{"type":"object","description":"How to sort the results. Without it, the endpoint's default order is used.","properties":{"field":{"type":"string","description":"The field to sort by, one of the searchable fields listed for the endpoint. Some fields can't be sorted; the endpoint's Sorting section says which. A missing `field`, or one that isn't searchable, returns a `400` error with the code `invalid_field`.","examples":["updated_at"]},"order":{"type":"string","enum":["ascending","descending"],"default":"descending","description":"The sort order.","examples":["descending"]}},"required":["field"]}},"required":["query"]},"single_filter_search_request":{"title":"Single Filter Search Request","description":"Search using Intercoms Search APIs with a single filter.","type":"object","properties":{"field":{"type":"string","description":"The accepted field that you want to search on.","examples":["created_at"]},"operator":{"type":"string","enum":["=","!=","IN","NIN","<","<=",">",">=","~","!~","^","$"],"description":"The accepted operators you can use to define how you want to search for the value. Operator support depends on the field's data type. The breakdown below is for Contacts search; the other search endpoints that share this schema accept a different set per field:\n- `string` fields: `=`, `!=`, `IN`, `NIN`, `~`, `!~`, `^`, `$`\n- `tag_id`: `=` and `!=` only. Every other operator returns an error.\n- `boolean` fields: `=`, `!=`, `IN`, `NIN`\n- `integer` fields: `=`, `!=`, `IN`, `NIN`, `<`, `>`, `<=`, `>=`\n- `datetime` fields (standard contact timestamps such as `created_at` and `last_seen_at`): `=`, `!=`, `<`, `>`, `<=`, `>=`. Filtering is on the exact second, in UTC.\n- `date` fields (Date custom attributes): `=`, `<`, `>` only. `!=`, `<=`, and `>=` are not supported and return an error. Values are truncated to a whole UTC day.","examples":[">"]},"value":{"oneOf":[{"type":"string"},{"type":"integer"},{"type":"boolean"},{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"integer"}]}}],"description":"The value that you want to search on.","examples":["73732934"]}}},"multiple_filter_search_request":{"title":"Multiple Filter Search Request","description":"Search using Intercoms Search APIs with more than one filter.","type":"object","properties":{"operator":{"type":"string","enum":["AND","OR"],"description":"An operator to allow boolean inspection between multiple fields.","examples":["AND"]},"value":{"oneOf":[{"type":"array","description":"Add mutiple filters.","title":"multiple filter search request","items":{"$ref":"#/definitions/multiple_filter_search_request"}},{"type":"array","description":"Add a single filter field.","title":"single filter search request","items":{"$ref":"#/definitions/single_filter_search_request"}}]}}},"starting_after_paging":{"title":"Pagination: Starting After","type":["object","null"],"properties":{"per_page":{"type":"integer","description":"The number of results to fetch per page.","examples":[2]},"starting_after":{"type":["string","null"],"description":"The cursor to use in the next request to get the next page of results.","examples":["your-cursor-from-response"]}}}}},"name":"Search tickets","id":"intercom.searchtickets","example":{},"maxRequests":1,"summary":false}}