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

# Delete synonym

> Remove a single synonym from an index 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="Delete a synonym" href="/doc/libraries/sdk/methods/search/delete-synonym" />

**Required ACL:** `editSettings`

## Examples

<CodeGroup>
  ```cs C# theme={"system"}
  index.DeleteSynonym("a-unique-identifier", forwardToReplicas: true);

  // Asynchronous
  await index.DeleteSynonymAsync("a-unique-identifier", forwardToReplicas: true);
  ```

  ```go Go theme={"system"}
  forwardToReplicas := opt.ForwardToReplicas(true)
  res, err := index.DeleteSynonym("a-unique-identifier", forwardToReplicas)
  ```

  ```java Java theme={"system"}
  boolean forwardToReplicas = true;

  index.deleteSynonym("a-unique-identifier", forwardToReplicas);

  // Asynchronous
  index.deleteSynonymAsync("a-unique-identifier", forwardToReplicas);
  ```

  ```js JavaScript theme={"system"}
  index
    .deleteSynonym("a-unique-identifier", {
      forwardToReplicas: true,
    })
    .then(() => {
      // done
    });
  ```

  ```kotlin Kotlin theme={"system"}
  index.deleteSynonym(ObjectID("a-unique-identifier"), forwardToReplicas = true)
  ```

  ```php PHP theme={"system"}
  $index->deleteSynonym("a-unique-identifier", [
    'forwardToReplicas' => true
  ]);
  ```

  ```python Python theme={"system"}
  index.delete_synonym("a-unique-identifier", forward_to_replicas=True)
  ```

  ```ruby Ruby theme={"system"}
  index.delete_synonym(
    "a-unique-identifier",
    {
      :"forwardToReplicas" => true
    }
  )
  ```

  ```scala Scala theme={"system"}
  client.execute {
    delete synonym "a-unique-identifier" from "index_name" and forwardToReplicas
  }
  ```

  ```swift Swift theme={"system"}
    index.deleteSynonym(withID: "a-unique-identifier", forwardToReplicas: true) { result in
      if case .success(let response) = result {
        print("Response: \(response)")
      }
    }
  ```
</CodeGroup>

## Parameters

<ParamField body="objectID" type="string" required>
  Object ID of the synonym to delete.
</ParamField>

<ParamField body="forwardToReplicas" type="boolean" default={false}>
  Whether to delete the synonym also from all replicas of the index.
</ParamField>

<ParamField body="requestOptions" type="object">
  A mapping of request options to send along with the request.
</ParamField>

## Response

<ResponseField name="deletedAt" type="string">
  Date at which the indexing job has been created.
</ResponseField>

<ResponseField name="taskID" type="integer">
  The task ID used with the [`waitTask`](/doc/libraries/sdk/v1/methods/wait-task) method.
</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"}
{
  "deletedAt":"2013-01-18T15:33:13.556Z",
  "taskID": 678
}
```
