> ## 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 a replica index

> Learn how to delete replica indices in the dashboard and with the API.

In the Algolia dashboard, you can delete replica indices like regular indices.
For more information, see [Delete indices in the Algolia dashboard](/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/how-to/delete-indices#delete-indices-in-the-algolia-dashboard).

To run the code examples on this page, [install the latest API client](/doc/libraries/sdk/install).

Using the API, delete a replica index in two steps:

<Steps>
  <Step title="Unlink the replica index from its primary">
    <Warning>
      If want to keep other replicas, don't remove them from the `replicas` setting.
      If you set `replicas` to an empty string or list, **all** replicas will be unlinked.
    </Warning>

    To unlink a replica index from its primary index,
    remove it from the [`replicas`](/doc/api-reference/api-parameters/replicas) setting of the primary index,
    using the [`setSettings`](/doc/libraries/sdk/v1/methods/set-settings) method:

    <CodeGroup>
      ```cs C# theme={"system"}
      var response = await client.SetSettingsAsync(
        "INDEX_NAME",
        new IndexSettings { Replicas = new List<string> { "" } }
      );
      ```

      ```dart Dart theme={"system"}
      final response = await client.setSettings(
        indexName: "INDEX_NAME",
        indexSettings: IndexSettings(
          replicas: [
            "",
          ],
        ),
      );
      ```

      ```go Go theme={"system"}
      response, err := client.SetSettings(client.NewApiSetSettingsRequest(
        "INDEX_NAME",
        search.NewEmptyIndexSettings().SetReplicas(
          []string{""})))
      if err != nil {
        // handle the eventual error
        panic(err)
      }
      ```

      ```java Java theme={"system"}
      UpdatedAtResponse response = client.setSettings("INDEX_NAME", new IndexSettings().setReplicas(Arrays.asList("")));
      ```

      ```js JavaScript theme={"system"}
      const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { replicas: [''] } });
      ```

      ```kotlin Kotlin theme={"system"}
      var response =
        client.setSettings(
          indexName = "INDEX_NAME",
          indexSettings = IndexSettings(replicas = listOf("")),
        )
      ```

      ```php PHP theme={"system"}
      $response = $client->setSettings(
          'INDEX_NAME',
          ['replicas' => [
              '',
          ],
          ],
      );
      ```

      ```python Python theme={"system"}
      response = client.set_settings(
          index_name="INDEX_NAME",
          index_settings={
              "replicas": [
                  "",
              ],
          },
      )
      ```

      ```ruby Ruby theme={"system"}
      response = client.set_settings("INDEX_NAME", Algolia::Search::IndexSettings.new(replicas: [""]))
      ```

      ```scala Scala theme={"system"}
      val response = Await.result(
        client.setSettings(
          indexName = "INDEX_NAME",
          indexSettings = IndexSettings(
            replicas = Some(Seq(""))
          )
        ),
        Duration(100, "sec")
      )
      ```

      ```swift Swift theme={"system"}
      let response = try await client.setSettings(
          indexName: "INDEX_NAME",
          indexSettings: IndexSettings(replicas: [""])
      )
      ```
    </CodeGroup>
  </Step>

  <Step title="Delete the (former) replica index">
    See [Delete indices with the API](/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/how-to/delete-indices#delete-indices-with-the-api).
  </Step>
</Steps>
