# Get synonyms

- Operation ID: `GetSynonymsV2`
- HTTP method: `GET`
- Path: `/search/v2/indices/{indexId}/synonyms`
- [Human-readable API reference](https://hub.synerise.com/api-reference/ai-search#tag/Synonyms/operation/GetSynonymsV2)

## 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/indices/{indexId}/synonyms:
    get:
      summary: Get synonyms
      description: |
        Retrieve a list of synonyms.

        ---

        **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:** `SYNONYMS_SEARCH_READ`

        **User role permission required:** `assets_search: read`
      operationId: GetSynonymsV2
      tags:
        - Synonyms
      security:
        - JWT: []
      parameters:
        - in: path
          name: indexId
          required: true
          description: Index identifier
          schema:
            type: string
            format: uuid
        - 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 and ordered by. Supported values: `indexId`, `updatedAt`, `createdAt`, `confidence`, `type`. Defaults to `updatedAt`."
          schema:
            type: string
            example:
              - confidence:asc
        - name: ordering
          in: query
          required: false
          deprecated: true
          description: "Sorting order. Deprecated: append the direction to `sortBy` instead, e.g. `sortBy=createdAt:desc`."
          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: directoryId
          in: query
          required: false
          description: Return only synonyms attached to this directory. Pass the Default directory id (00000000-0000-0000-0000-000000000000) to get the synonyms attached to no directory.
          schema:
            type: string
            format: uuid
        - name: source
          in: query
          required: false
          description: Filter synonyms by source
          schema:
            type: string
            description: Origin of the synonym
            enum:
              - User
              - Agent
              - Import
            default: User
        - name: state
          in: query
          required: false
          description: Filter synonyms by state
          schema:
            type: string
            description: Current state of the synonym
            enum:
              - New
              - Accepted
              - Pending
              - Rejected
            default: Accepted
        - name: type
          in: query
          required: false
          description: Filter synonyms by type
          schema:
            type: string
            description: |
              Type of the synonym.

                - `oneway`: when the word is searched, the results show the results as if the synonyms were searched. Searching for the synonyms does NOT return results for the word or the other synonyms.
                - `synonyms`: the `word` column is empty, all phrases in `synonym` return results for every other phrase in the list.
            enum:
              - oneway
              - synonyms
            default: oneway
        - name: search
          in: query
          required: false
          description: Search synonyms by word or synonym phrase (case-insensitive partial match)
          schema:
            type: string
        - name: confidence
          in: query
          required: false
          description: Filter synonyms with confidence greater than or equal to this value
          schema:
            type: number
            format: float
            minimum: 0
            maximum: 1
      responses:
        "200":
          description: List of synonyms returned
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    description: A list of synonyms
                    items:
                      type: object
                      description: Details of a single synonym
                      properties:
                        id:
                          type: integer
                          description: Identifier of the synonym
                        type:
                          type: string
                          description: |
                            Type of the synonym.

                              - `oneway`: when the word is searched, the results show the results as if the synonyms were searched. Searching for the synonyms does NOT return results for the word or the other synonyms.
                              - `synonyms`: the `word` column is empty, all phrases in `synonym` return results for every other phrase in the list.
                          enum:
                            - oneway
                            - synonyms
                          default: oneway
                        word:
                          type: string
                          description: "The phrase that the synonym relates to. If `type: synonyms`, do not send this value."
                        synonyms:
                          type: array
                          description: A list of synonyms
                          items:
                            type: string
                        createdAt:
                          type: string
                          description: Creation timestamp
                        updatedAt:
                          type: string
                          description: Last update timestamp
                        confidence:
                          type: number
                          format: float
                          minimum: 0
                          maximum: 1
                          nullable: true
                          description: Confidence score of the synonym (0.0 to 1.0)
                        reason:
                          type: string
                          nullable: true
                          maxLength: 1024
                          description: Reason or explanation for the synonym suggestion
                        source:
                          type: string
                          description: Origin of the synonym
                          enum:
                            - User
                            - Agent
                            - Import
                          default: User
                        state:
                          type: string
                          description: Current state of the synonym
                          enum:
                            - New
                            - Accepted
                            - Pending
                            - Rejected
                          default: Accepted
                        directoryId:
                          type: string
                          format: uuid
                          description: "Directory the synonym is attached to, absent when it belongs to the virtual Default directory. Read-only: set it with PATCH /search/v2/indices/{indexId}/synonyms/directories/{directoryId}/attach."
                  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: Some 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/Synonyms/operation/GetSynonymsV2
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request GET \
              --url 'https://api.synerise.com/search/v2/indices/%7BindexId%7D/synonyms?page=4&limit=100&sortBy=confidence%3Aasc&ordering=SOME_STRING_VALUE&includeMeta=SOME_BOOLEAN_VALUE&directoryId=SOME_STRING_VALUE&source=SOME_STRING_VALUE&state=SOME_STRING_VALUE&type=SOME_STRING_VALUE&search=SOME_STRING_VALUE&confidence=SOME_NUMBER_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/indices/%7BindexId%7D/synonyms?page=4&limit=100&sortBy=confidence%3Aasc&ordering=SOME_STRING_VALUE&includeMeta=SOME_BOOLEAN_VALUE&directoryId=SOME_STRING_VALUE&source=SOME_STRING_VALUE&state=SOME_STRING_VALUE&type=SOME_STRING_VALUE&search=SOME_STRING_VALUE&confidence=SOME_NUMBER_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/indices/%7BindexId%7D/synonyms?page=4&limit=100&sortBy=confidence%3Aasc&ordering=SOME_STRING_VALUE&includeMeta=SOME_BOOLEAN_VALUE&directoryId=SOME_STRING_VALUE&source=SOME_STRING_VALUE&state=SOME_STRING_VALUE&type=SOME_STRING_VALUE&search=SOME_STRING_VALUE&confidence=SOME_NUMBER_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/indices/%7BindexId%7D/synonyms?page=4&limit=100&sortBy=confidence%3Aasc&ordering=SOME_STRING_VALUE&includeMeta=SOME_BOOLEAN_VALUE&directoryId=SOME_STRING_VALUE&source=SOME_STRING_VALUE&state=SOME_STRING_VALUE&type=SOME_STRING_VALUE&search=SOME_STRING_VALUE&confidence=SOME_NUMBER_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/indices/%7BindexId%7D/synonyms');
            $request->setMethod(HTTP_METH_GET);

            $request->setQueryData([
              'page' => '4',
              'limit' => '100',
              'sortBy' => 'confidence:asc',
              'ordering' => 'SOME_STRING_VALUE',
              'includeMeta' => 'SOME_BOOLEAN_VALUE',
              'directoryId' => 'SOME_STRING_VALUE',
              'source' => 'SOME_STRING_VALUE',
              'state' => 'SOME_STRING_VALUE',
              'type' => 'SOME_STRING_VALUE',
              'search' => 'SOME_STRING_VALUE',
              'confidence' => 'SOME_NUMBER_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/indices/%7BindexId%7D/synonyms?page=4&limit=100&sortBy=confidence%3Aasc&ordering=SOME_STRING_VALUE&includeMeta=SOME_BOOLEAN_VALUE&directoryId=SOME_STRING_VALUE&source=SOME_STRING_VALUE&state=SOME_STRING_VALUE&type=SOME_STRING_VALUE&search=SOME_STRING_VALUE&confidence=SOME_NUMBER_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: Synonyms
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.
```
