# Get synonym

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

## 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/{synonymId}:
    get:
      summary: Get synonym
      description: |
        Retrieves a synonym.

        ---

        **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: GetSynonymV2
      tags:
        - Synonyms
      security:
        - JWT: []
      parameters:
        - in: path
          name: synonymId
          required: true
          description: Synonym identifier
          schema:
            type: integer
        - in: path
          name: indexId
          required: true
          description: Index identifier
          schema:
            type: string
            format: uuid
      responses:
        "200":
          description: Synonym returned.
          content:
            application/json:
              schema:
                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."
        "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/GetSynonymV2
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request GET \
              --url https://api.synerise.com/search/v2/indices/%7BindexId%7D/synonyms/%7BsynonymId%7D \
              --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/%7BsynonymId%7D", 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/%7BsynonymId%7D");
            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/%7BsynonymId%7D",
              "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/%7BsynonymId%7D');
            $request->setMethod(HTTP_METH_GET);

            $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/%7BsynonymId%7D")
              .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.
```
