# Get suggestion indices

- Operation ID: `GetSuggestionsIndices`
- HTTP method: `GET`
- Path: `/search/v2/suggestion-indices`
- [Human-readable API reference](https://hub.synerise.com/api-reference/ai-search#tag/Suggestions-Configuration/operation/GetSuggestionsIndices)

## Self-contained OpenAPI method

The fenced document below contains this method's documentation and all of its local references. It is self-contained; no category or master specification fetch is required.

```yaml
openapi: 3.0.0
info:
  title: Synerise Public API
  version: 1.9.1
paths:
  /search/v2/suggestion-indices:
    get:
      summary: Get suggestion indices
      description: |
        Retrieve a list of all suggestion index configurations in the workspace.

        ---

        **API consumers:** <a href="/api-reference/authorization?tag=Authorization&amp;operationId=profileLogin" target="_blank" rel="noopener">Workspace (Business Profile)</a>, <a href="/api-reference/authorization?tag=Authorization&amp;operationId=userLogin" target="_blank" rel="noopener">Synerise User</a>

        **API key permission required:** `ITEMS_SEARCH_CONFIG_SEARCH_READ`

        **User role permission required:** `assets_search: read`
      operationId: GetSuggestionsIndices
      tags:
        - Suggestions Configuration
      security:
        - JWT: []
      parameters:
        - name: page
          in: query
          description: Page number to return for pagination. The first page has the index `1`.
          required: false
          schema:
            type: integer
            format: int32
            example: 4
            default: 1
        - name: limit
          in: query
          description: The number of items to return per page
          required: false
          schema:
            type: integer
            format: int32
            example: 100
            default: 1000
            maximum: 1000
        - name: sortBy
          in: query
          required: false
          description: |
            Name of the attribute by which the data will be sorted, optionally with the sorting direction
            appended after a colon - `sortBy=createdAt:desc`. A direction given this way takes precedence
            over the `ordering` parameter.
          schema:
            type: string
            example: createdAt:desc
        - name: ordering
          in: query
          required: false
          description: Sorting order
          schema:
            type: string
            default: desc
            enum:
              - desc
              - asc
        - name: includeMeta
          in: query
          required: false
          description: |
            
            When `true`, pagination metadata is included in the response body.

            When `false`, the data is included in the response headers:

            - Link: links to neighbors, first, and last pages in pagination.

            - X-Pagination-Total-Count: total number of items on all pages

            - X-Pagination-Total-Pages: total number of pages

            - X-Pagination-Page: current page

            - X-Pagination-Limit: maximum number of items on a page

            - X-Pagination-Sorted-By: parameter that the items were sorted by

            - X-Pagination-Ordering: sorting direction
          schema:
            type: boolean
            default: false
        - name: name
          in: query
          required: false
          deprecated: true
          description: |
            Deprecated parameter. If `search` or `query` is provided, this parameter is ignored.
            If an index has an `id` equal to the value of this parameter, only that index will be retrieved. Otherwise, all indices containing this value in their `name` will be retrieved.
          schema:
            type: string
        - name: query
          in: query
          required: false
          deprecated: true
          description: |
            Deprecated parameter. If `search` is provided, this parameter is ignored.
            If an index has an `id` equal to the value of this parameter, only that index will be retrieved. Otherwise, all indices containing this value in their `name` will be retrieved.
          schema:
            type: string
        - name: search
          in: query
          required: false
          description: If an index has an `id` equal to the value of this parameter, only that index will be retrieved. Otherwise, all indices containing this value in their `name` will be retrieved. This parameter replaces the deprecated `query` and `name` parameters.
          schema:
            type: string
      responses:
        "200":
          description: List of suggestion index configurations
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    description: An array of suggestion indices
                    items:
                      type: object
                      properties:
                        indexId:
                          type: string
                          description: ID of the index
                        indexName:
                          type: string
                          description: Name of the suggestion index
                        description:
                          type: string
                          description: Description of the suggestion index
                        author:
                          type: integer
                          description: ID of the user who created the suggestion index
                        enabled:
                          type: boolean
                          description: When `true`, index is enabled and can be queried.
                        sources:
                          type: object
                          description: Sources for the suggestions
                          properties:
                            indices:
                              type: array
                              description: A list of search indices
                              items:
                                type: object
                                properties:
                                  indexId:
                                    type: string
                                    description: ID of the index
                                  minPopularity:
                                    type: integer
                                    description: Minimum popularity of a query to be used as a suggestion
                                    default: 5
                                  minHits:
                                    type: integer
                                    description: Minimum search hits of a query to be used as a suggestion
                                    default: 1
                                  minLetters:
                                    type: integer
                                    description: Minimum required number of letters for a suggestion to remain
                                    default: 2
                                  daysInterval:
                                    type: integer
                                    description: Suggestions will be created from search statistics from last `daysInterval` days
                                    default: 30
                                  validate:
                                    type: boolean
                                    description: When `true`, the suggestions presence in searchable attributes is verified
                                    default: false
                                required:
                                  - indexId
                            external:
                              type: array
                              description: An array of external queries that can be used as suggestions
                              items:
                                type: object
                                properties:
                                  query:
                                    type: string
                                    description: External query to be used as a suggestion
                                  count:
                                    type: integer
                                    description: Hits of the external query - used to create the weight of the suggested query.
                                required:
                                  - query
                                  - count
                            generate:
                              type: array
                              description: |
                                A group of attributes to use for generating suggestions.

                                If the group consists of single facet, all values of the facet are used as suggestions.

                                If the group consists of more than one facet, all combinations of the facets' values are used.

                                **Example 1:**
                                - Given the `["brand"]` group, the generated suggestions are: `["apple", "samsung", "nokia"]`

                                - Given the `["color"]` group, the generated suggestions are: `["red", "blue"]`

                                **Example 2:**

                                Given the `["color", "brand"]` group, the generated suggestions are:<br/>
                                `["red apple", "red samsung", "red nokia", "blue apple", "blue samsung", "blue nokia"]`
                              items:
                                type: object
                                properties:
                                  itemsCatalogId:
                                    type: string
                                    description: Id of a catalog from which attributes will be taken
                                  attributes:
                                    type: array
                                    items:
                                      type: string
                        denylist:
                          type: array
                          description: Suggestions that will be ignored and *not* shown
                          items:
                            type: object
                            properties:
                              pattern:
                                type: string
                                description: Pattern (text) to be used while denylisting suggestions. If the suggestion matches the pattern in a way defined by `matchingType`, it's not shown.
                              matchingType:
                                type: string
                                description: |
                                  
                                  <span style="color:red"><strong>IMPORTANT</strong></span>: All patterns are case-**in**sensitive, including regex.

                                  - Using Phrase matching, the suggestion must match the whole pattern exactly.

                                  - Using FullWord matching, any word of the suggestion must exactly match the pattern.

                                  - Using PartialWord matching, any word of the suggestion must partially match the pattern.

                                  - Using RegularExpression matching, the pattern is treated as a regular expression and must match the suggestion.
                                enum:
                                  - Phrase
                                  - FullWord
                                  - PartialWord
                                  - RegularExpression
                                example: Phrase
                        updatedAt:
                          type: string
                          format: date-time
                          description: Last update time in YYYY-MM-DDThh:mm:ssZ format (ISO 8601, UTC)
                        createdAt:
                          type: string
                          format: date-time
                          description: Creation time in YYYY-MM-DDThh:mm:ssZ format (ISO 8601, UTC)
                  meta:
                    type: object
                    description: 'Optional pagination metadata (sent if `"includeMeta": true`)'
                    properties:
                      totalPages:
                        type: number
                        description: The total number of pages
                      totalCount:
                        type: number
                        description: The total number of campaigns
                      page:
                        type: number
                        description: The current page
                      limit:
                        type: number
                        description: The maximal number of items on a page
                      sortedBy:
                        type: string
                        description: The column (attribute) that the campaigns were sorted by
                      ordering:
                        type: string
                        description: Sorting order
                      code:
                        type: number
                        description: HTTP response code
                      link:
                        type: array
                        description: Links to neighboring pages, first page, and last page in pagination
                        items:
                          type: object
                          properties:
                            url:
                              description: Page URL
                              type: string
                            rel:
                              type: string
                              description: Position of the linked page
                              enum:
                                - first
                                - next
                                - prev
                                - last
        "500":
          description: An error occurred
          content:
            application/json:
              schema:
                type: object
                properties:
                  timestamp:
                    type: string
                    format: date-time
                    description: Time when the error occurred
                  status:
                    type: integer
                    description: Status code
                  error:
                    type: string
                    description: Summary of the error
                  message:
                    type: string
                    description: Description of the problem
                  path:
                    type: string
                    description: URL of the requested resource
                required:
                  - timestamp
                  - status
                  - message
      x-snr-doc-urls:
        - /api-reference/ai-search#tag/Suggestions-Configuration/operation/GetSuggestionsIndices
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request GET \
              --url 'https://api.synerise.com/search/v2/suggestion-indices?page=4&limit=100&sortBy=createdAt%3Adesc&ordering=SOME_STRING_VALUE&includeMeta=SOME_BOOLEAN_VALUE&name=SOME_STRING_VALUE&query=SOME_STRING_VALUE&search=SOME_STRING_VALUE' \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'
        - lang: Python
          label: Python
          source: |-
            import http.client

            conn = http.client.HTTPSConnection("api.synerise.com")

            headers = { 'Authorization': "Bearer REPLACE_BEARER_TOKEN" }

            conn.request("GET", "/search/v2/suggestion-indices?page=4&limit=100&sortBy=createdAt%3Adesc&ordering=SOME_STRING_VALUE&includeMeta=SOME_BOOLEAN_VALUE&name=SOME_STRING_VALUE&query=SOME_STRING_VALUE&search=SOME_STRING_VALUE", headers=headers)

            res = conn.getresponse()
            data = res.read()

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = null;

            const xhr = new XMLHttpRequest();
            xhr.withCredentials = true;

            xhr.addEventListener("readystatechange", function () {
              if (this.readyState === this.DONE) {
                console.log(this.responseText);
              }
            });

            xhr.open("GET", "https://api.synerise.com/search/v2/suggestion-indices?page=4&limit=100&sortBy=createdAt%3Adesc&ordering=SOME_STRING_VALUE&includeMeta=SOME_BOOLEAN_VALUE&name=SOME_STRING_VALUE&query=SOME_STRING_VALUE&search=SOME_STRING_VALUE");
            xhr.setRequestHeader("Authorization", "Bearer REPLACE_BEARER_TOKEN");

            xhr.send(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const http = require("https");

            const options = {
              "method": "GET",
              "hostname": "api.synerise.com",
              "port": null,
              "path": "/search/v2/suggestion-indices?page=4&limit=100&sortBy=createdAt%3Adesc&ordering=SOME_STRING_VALUE&includeMeta=SOME_BOOLEAN_VALUE&name=SOME_STRING_VALUE&query=SOME_STRING_VALUE&search=SOME_STRING_VALUE",
              "headers": {
                "Authorization": "Bearer REPLACE_BEARER_TOKEN"
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on("data", function (chunk) {
                chunks.push(chunk);
              });

              res.on("end", function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $request = new HttpRequest();
            $request->setUrl('https://api.synerise.com/search/v2/suggestion-indices');
            $request->setMethod(HTTP_METH_GET);

            $request->setQueryData([
              'page' => '4',
              'limit' => '100',
              'sortBy' => 'createdAt:desc',
              'ordering' => 'SOME_STRING_VALUE',
              'includeMeta' => 'SOME_BOOLEAN_VALUE',
              'name' => 'SOME_STRING_VALUE',
              'query' => 'SOME_STRING_VALUE',
              'search' => 'SOME_STRING_VALUE'
            ]);

            $request->setHeaders([
              'Authorization' => 'Bearer REPLACE_BEARER_TOKEN'
            ]);

            try {
              $response = $request->send();

              echo $response->getBody();
            } catch (HttpException $ex) {
              echo $ex;
            }
        - lang: Java
          label: Java
          source: |-
            HttpResponse<String> response = Unirest.get("https://api.synerise.com/search/v2/suggestion-indices?page=4&limit=100&sortBy=createdAt%3Adesc&ordering=SOME_STRING_VALUE&includeMeta=SOME_BOOLEAN_VALUE&name=SOME_STRING_VALUE&query=SOME_STRING_VALUE&search=SOME_STRING_VALUE")
              .header("Authorization", "Bearer REPLACE_BEARER_TOKEN")
              .asString();
servers:
  - description: Microsoft Azure EU
    url: https://api.synerise.com
  - description: Microsoft Azure USA
    url: https://api.azu.synerise.com
  - description: Google Cloud Platform
    url: https://api.geb.synerise.com
tags:
  - name: Suggestions Configuration
components:
  securitySchemes:
    JWT:
      type: http
      scheme: bearer
      description: |-
        JWT Bearer token. The header looks like this: `Bearer {JWT}`

        Remember to include the space between 'Bearer' and the token.

        Generate a token via the **Authorization** endpoints.
```
