> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get synonym

> Retrieve a single synonym object using its object ID.

export const Legacy = ({title, href}) => {
  return <Note>

    This page documents an earlier version of the API client.
    For the latest version, see <a href={href}>{title}</a>.

    </Note>;
};

<Legacy title="Retrieve a synonym" href="/doc/libraries/sdk/methods/search/get-synonym" />

**Required ACL:** `settings`

## Examples

<CodeGroup>
  ```cs C# theme={"system"}
  Synonym synonym = index.GetSynonym("synonymID");

  // Asynchronous
  Synonym synonym = index.GetSynonymAsync("synonymID");
  ```

  ```go Go theme={"system"}
  synonym, err := index.GetSynonym("synonymID")
  ```

  ```java Java theme={"system"}
  Synonym synonym = index.getSynonym("synonymID");

  // Async version
  CompletableFuture<Synonym> synonym = index.getSynonym("synonymID");
  ```

  ```js JavaScript theme={"system"}
  index.getSynonym('synonymID').then(synonym => {
    console.log(synonym);
  });
  ```

  ```kotlin Kotlin theme={"system"}
  index.getSynonym(ObjectID("synonymID"))
  ```

  ```php PHP theme={"system"}
  $synonym = $index->getSynonym("synonymID");
  ```

  ```python Python theme={"system"}
  synonym = index.get_synonym('synonymID')
  ```

  ```ruby Ruby theme={"system"}
  synonym = index.get_synonym('synonymID')
  ```

  ```scala Scala theme={"system"}
  var synonym: Future[Synonym] = client.execute {
      get synonym "synonymID" from "index_name"
  }
  ```

  ```swift Swift theme={"system"}
  index.getSynonym(withID: "synonymID") { result in
    if case .success(let response) = result {
      print("Response: \(response)")
    }
  }
  ```
</CodeGroup>

## Parameters

<ParamField body="objectID" type="string" required>
  Unique identifier of the synonym you want to retrieve.
</ParamField>

## Response

<ResponseField name="corrections" type="string[]">
  List of corrections.
  (For synonym types `altCorrection1` or `altCorrection2`).
</ResponseField>

<ResponseField name="input" type="string">
  A word used as the basis for synonyms.
  (For synonym type `oneWaySynonym`).
</ResponseField>

<ResponseField name="objectID" type="string">
  The object ID of the retrieved synonym.
</ResponseField>

<ResponseField name="placeholder" type="string">
  A word used as the basis for replacements.
  (For synonym type `placeholder`).
</ResponseField>

<ResponseField name="replacements" type="string[]">
  List of replacements for the placeholder.
  (For synonym type `placeholder`).
</ResponseField>

<ResponseField name="synonyms" type="string[]">
  List of synonyms.
  (For synonym types `synonym` or `oneWaySynonym`).
</ResponseField>

<ResponseField name="type" type="string">
  Synonym type. One of:

  * `altCorrection1`
  * `altCorrection2`
  * `oneWaySynonym`
  * `placeholder`
  * `synonym`
</ResponseField>

<ResponseField name="word" type="string">
  A word used as the basis for corrections.
  (For synonym types `altCorrection1` or `altCorrection2`).
</ResponseField>

### Response as JSON

This section shows the JSON response returned by the API.
Each API client wraps this response in language-specific objects, so the structure may vary.
To view the response, use the `getLogs` method.
Don't rely on the order of properties—JSON objects don't preserve key order.

```jsonc JSON icon=braces theme={"system"}
{
  "objectID": "a-unique-identifier",
  "type": "synonym",
  "synonyms": [
    "car",
    "vehicle"
  ]
}
```
