# Search Suggestions

Lets you get suggestions for the currently entered search query.
|  Resource  |     ```GENERIC /api/search/assist ```    |
| --- | --- |
|  Returned entity  |  [SearchSuggestions](api-entity-SearchSuggestions.html). For the description of the entity attributes, see [Supported Fields](#SearchSuggestions-supported-fields) section.  |
|  Supported methods  |      * `POST`: [Search Suggestions](#create-SearchSuggestions-method).    |

## SearchSuggestions attributes

Represents the list of search suggestions for the currently entered search query.

### Related Resources

Below you can find the list of resources that let you work with this entity.

* [Search Suggestions]()

### Attributes

This table describes attributes of the `SearchSuggestions` entity.

* To receive an attribute in the response from the server, specify it explicitly in the `fields` request parameter.

* To update an attribute, provide it in the body of a POST request.

|  Field  |  Type  |  Description  |
| --- | --- | --- |
|  id  |  String  |  The ID of the list of search suggestions. `Read-only`.  |
|  caret  |  Int  |  The current caret position. The end of the current search query by default.  |
|  ignoreUnresolvedSetting  |  Boolean  |  When false, the Hide unresolved issues setting is taken into account for creating search suggestions. When true, this setting is ignored. True when the currently entered search query concerns a state-type field.  |
|  query  |  String  |  The current search query for which the suggestions are being requested. `Can be null`.  |
|  suggestions  |  [Array of Suggestions](api-entity-Suggestion.html)  |  The list of search suggestions for the currently entered search query. `Read-only`.  |
|  folders  |  [Array of IssueFolders](api-entity-IssueFolder.html)  |  The current search context.  |

## Read Search Query Suggestions

Get search query suggestions for the currently entered search query.

Required fields: `query`.

### Request syntax

```GENERIC
POST /api/search/assist?{fields}
```

|  null  |  The database ID of SearchSuggestions  |
| --- | --- |

### Request parameters

|  Parameter  |  Type  |  Description  |
| --- | --- | --- |
|  fields  |  String  |  A list of SearchSuggestions attributes that should be returned in the response. If no field is specified, only the `entityID` is returned.  |

### Sample

#### Sample request

```CURL
https://example.youtrack.cloud/api/search/assist?fields=caret,query,suggestions(caret,completionEnd,completionStart,description,group,matchingEnd,matchingStart,option)
```

#### Sample request body

```JSON
{
"query": "tag: "
}
```

#### Sample response body

```JSON
{
  "caret": 5,
  "suggestions": [
    {
      "group": null,
      "completionStart": 5,
      "completionEnd": 5,
      "matchingStart": 0,
      "matchingEnd": 0,
      "caret": 6,
      "description": "exclude value",
      "option": "-",
      "$type": "Suggestion"
    },
    {
      "group": null,
      "completionStart": 5,
      "completionEnd": 5,
      "matchingStart": 0,
      "matchingEnd": 0,
      "caret": 29,
      "description": "tag",
      "option": "Blocked by dependency",
      "$type": "Suggestion"
    },
    {
      "group": null,
      "completionStart": 5,
      "completionEnd": 5,
      "matchingStart": 0,
      "matchingEnd": 0,
      "caret": 14,
      "description": "empty list of tags",
      "option": "no tag",
      "$type": "Suggestion"
    },
    {
      "group": null,
      "completionStart": 5,
      "completionEnd": 5,
      "matchingStart": 0,
      "matchingEnd": 0,
      "caret": 10,
      "description": "tag",
      "option": "Star",
      "$type": "Suggestion"
    },
    {
      "group": null,
      "completionStart": 5,
      "completionEnd": 5,
      "matchingStart": 0,
      "matchingEnd": 0,
      "caret": 9,
      "description": "tag",
      "option": "tip",
      "$type": "Suggestion"
    },
    {
      "group": "Recent Searches",
      "completionStart": 0,
      "completionEnd": 5,
      "matchingStart": 0,
      "matchingEnd": 5,
      "caret": 10,
      "description": " ",
      "option": "tag: Star",
      "$type": "Suggestion"
    }
  ],
  "query": "tag: ",
  "$type": "SearchSuggestions"
}
```

