---
schema_version: "1"
id: a67799206b1cbd9f571c3040c0ec07fba7be16ff857215a2639ff1c537519452
title: Search Suggested Queries
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/service-cloud/knowledge/guides/resources-search-suggest-queries.md
canonical_url: https://developer.salesforce.com/docs/service/salesforce-knowledge-dev-guide/guide/resources-search-suggest-queries.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: e5fb1b9c457dbd2d2c93302e940e619cd2b77015dd016df8e0c4c1038dfcc973
products:
  - Salesforce Knowledge Developer Guide
  - Service Cloud Developer Content
---

# Search Suggested Queries

Returns a list of suggested searches based on the user's query string text matching searches that other users have performed in Salesforce Knowledge. Provides a way to improve search effectiveness, before the user performs a search. This resource is available in REST API version 30.0 and later.

Salesforce Knowledge must be enabled in your organization.

Queries are suggested if they exactly match the query string text. The text string must be a prefix within the query; it's not considered a match if it appears within a word. For example, the text string `app` would return suggested queries _apple banana_ and _banana apples_ but not _pineapple_.

If the number of suggestions returned exceeds the limit specified in the request, the end of the response contains a field called hasMoreResults. Its value is `true` if the suggestions returned are only a subset of the suggestions available, and `false` otherwise.

If the user's search query contains quotation marks or wildcards, those symbols are automatically removed from the query string in the URI.

## URI

`/services/data/v{XX.X}/search/suggestSearchQueries?q={searchString}&language={languageOfQuery}`

## Formats

JSON, XML

## HTTP Methods

GET

## Authentication

`Authorization: Bearer {token}`

## Request Body

None required

## Request Parameters

| Parameter | Description                                                                                                                                                                                                                                                                                                                                             |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| channel   | Optional. Specifies the Salesforce Knowledge channel where the article can be viewed. See the [channel parameter details](#channel-parameter) below.                                                                                                                                                                                                    |
| language  | Required. The language of the user's query.                                                                                                                                                                                                                                                                                                             |
| limit     | Optional. Specifies the maximum number of suggested searches to return. If there are more suggested queries than the limit specified, the response body's hasMoreResults property is `true`.                                                                                                                                                            |
| q         | Required. The user's search query string, properly URL-encoded. Suggestions are returned only if the user's query string meets the minimum length requirements: one character for queries in Chinese, Japanese, and Korean, and three characters for all other languages. Query strings exceeding the maximum length of 250 characters return an error. |

## channel Parameter

Optional. Specifies the Salesforce Knowledge channel where the article can be viewed. Valid values:

- `AllChannels`–Visible in all channels the user has access to
- `App`–Visible in the internal Salesforce Knowledge application
- `Pkb`–Visible in the public knowledge base
- `Csp`–Visible in the Customer Portal
- `Prm`–Visible in the Partner Portal

If channel isn't specified, the default value is determined by the type of user:

- `Pkb` for a guest user
- `Csp` for a Customer Portal user
- `Prm` for a Partner Portal user
- `App` for any other type of user

If channel is specified, the specified value may not be the actual value requested, because of certain requirements:

- For guest, Customer Portal, and Partner Portal users, the specified value must match the default value for each user type. If the values don't match or `AllChannels` is specified, then `App` replaces the specified value.
- For all users other than guest, Customer Portal, and Partner Portal users:
  - If `Pkb`, `Csp`, `Prm`, or `App` are specified, then the specified value is used.
  - If `AllChannels` is specified, then `App` replaces the specified value.

## Example Request

```nolang
curl https://MYDOMAINNAME.my.salesforce.com/services/data/v66.0/search/suggestSearchQueries?
q=app&language=en_US -H "Authorization: Bearer TOKEN"
```

## Example Response Body

```nolang
{
  "autoSuggestResults" : [ {
    "0" : "apple",
    "1" : "apple banana",
  } ],
  "hasMoreResults" : false
}

```
