For clean Markdown of any page, append .md to the page URL. For a complete documentation index, see https://api-doc-new.gideononline.com/gideon-api-1-0/search/llms.txt. For full documentation content, see https://api-doc-new.gideononline.com/gideon-api-1-0/search/llms-full.txt.

# /query/suggestions

GET https://api.gideononline.com/query/suggestions

Returns **type-ahead suggestions** for an incomplete query, using the same search backend as `POST /query`. Each item includes display text and an optional category.

#### **Query parameters**

| Name | Required | Description |
| --- | --- | --- |
| `q` | **Yes** | Prefix or partial term to match. |
| `limit` | No | Default **10**; values above **20** are capped at **20**; invalid values fall back to **10**. |
| `cache` | No | `true` or `false`; if omitted, follows the server’s default caching behavior. |

#### **Response**

`{ "data": [ { "text": "...", "category": "..." } ] }` — `category` may be null.

#### **Errors**

- **400** — `q` is missing or empty.
- **503** — Search service is not configured.
- **502** — Search service request failed.

Reference: https://api-doc-new.gideononline.com/gideon-api-1-0/search/query-suggestions

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /query/suggestions:
    get:
      operationId: query-suggestions
      summary: /query/suggestions
      description: >-
        Returns **type-ahead suggestions** for an incomplete query, using the
        same search backend as `POST /query`. Each item includes display text
        and an optional category.


        #### **Query parameters**


        | Name | Required | Description |

        | --- | --- | --- |

        | `q` | **Yes** | Prefix or partial term to match. |

        | `limit` | No | Default **10**; values above **20** are capped at
        **20**; invalid values fall back to **10**. |

        | `cache` | No | `true` or `false`; if omitted, follows the server’s
        default caching behavior. |


        #### **Response**


        `{ "data": [ { "text": "...", "category": "..." } ] }` — `category` may
        be null.


        #### **Errors**


        - **400** — `q` is missing or empty.

        - **503** — Search service is not configured.

        - **502** — Search service request failed.
      tags:
        - subpackage_search
      parameters:
        - name: q
          in: query
          description: Partial search text (required).
          required: false
          schema:
            type: string
        - name: limit
          in: query
          description: Max suggestions (default 10, maximum 20).
          required: false
          schema:
            type: integer
        - name: cache
          in: query
          description: >-
            Optional. When true, a cached response may be returned if server
            caching is enabled.
          required: false
          schema:
            type: boolean
        - name: Authorization
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Search_/query/suggestions_Response_200'
servers:
  - url: https://api.gideononline.com
  - url: https://api-test.gideononline.com
components:
  schemas:
    QuerySuggestionsGetResponsesContentApplicationJsonSchemaDataItems:
      type: object
      properties:
        text:
          type: string
        category:
          type: string
      required:
        - text
        - category
      title: QuerySuggestionsGetResponsesContentApplicationJsonSchemaDataItems
    Search_/query/suggestions_Response_200:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: >-
              #/components/schemas/QuerySuggestionsGetResponsesContentApplicationJsonSchemaDataItems
      required:
        - data
      title: Search_/query/suggestions_Response_200
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

```

## SDK Code Examples

```python Search_/query/suggestions_example
import requests

url = "https://api.gideononline.com/query/suggestions"

querystring = {"q":"deng","limit":"10","cache":"true"}

headers = {"Authorization": "<apiKey>"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript Search_/query/suggestions_example
const url = 'https://api.gideononline.com/query/suggestions?q=deng&limit=10&cache=true';
const options = {method: 'GET', headers: {Authorization: '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Search_/query/suggestions_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.gideononline.com/query/suggestions?q=deng&limit=10&cache=true"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Search_/query/suggestions_example
require 'uri'
require 'net/http'

url = URI("https://api.gideononline.com/query/suggestions?q=deng&limit=10&cache=true")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java Search_/query/suggestions_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.gideononline.com/query/suggestions?q=deng&limit=10&cache=true")
  .header("Authorization", "<apiKey>")
  .asString();
```

```php Search_/query/suggestions_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.gideononline.com/query/suggestions?q=deng&limit=10&cache=true', [
  'headers' => [
    'Authorization' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Search_/query/suggestions_example
using RestSharp;

var client = new RestClient("https://api.gideononline.com/query/suggestions?q=deng&limit=10&cache=true");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Search_/query/suggestions_example
import Foundation

let headers = ["Authorization": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.gideononline.com/query/suggestions?q=deng&limit=10&cache=true")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```