> ## 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 records

> Delete multiple records by their ID.

**Required ACL:** `deleteObject`

This helper method deletes multiple records from an index by their `objectID`.
It constructs a [Batch](/doc/rest-api/search/batch) request with the `deleteObject` action
and automatically sends requests in batches of 1,000.

## Usage

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

  ```go Go theme={"system"}
  response, err := client.DeleteObjects(
    "INDEX_NAME",
    []string{"1", "2"})
  if err != nil {
    // handle the eventual error
    panic(err)
  }
  ```

  ```java Java theme={"system"}
  List response = client.deleteObjects("INDEX_NAME", Arrays.asList("1", "2"));
  ```

  ```js JavaScript theme={"system"}
  const response = await client.deleteObjects({ indexName: 'INDEX_NAME', objectIDs: ['1', '2'] });
  ```

  ```kotlin Kotlin theme={"system"}
  var response =
    client.deleteObjects(indexName = "INDEX_NAME", objectIDs = listOf("1", "2"))
  ```

  ```php PHP theme={"system"}
  $response = $client->deleteObjects(
      'INDEX_NAME',
      [
          '1',

          '2',
      ],
  );
  ```

  ```python Python theme={"system"}
  response = client.delete_objects(
      index_name="INDEX_NAME",
      object_ids=[
          "1",
          "2",
      ],
  )
  ```

  ```ruby Ruby theme={"system"}
  response = client.delete_objects("INDEX_NAME", ["1", "2"])
  ```

  ```scala Scala theme={"system"}
  val response = Await.result(
    client.deleteObjects(
      indexName = "INDEX_NAME",
      objectIDs = Seq("1", "2")
    ),
    Duration(100, "sec")
  )
  ```

  ```swift Swift theme={"system"}
  let response = try await client.deleteObjects(indexName: "INDEX_NAME", objectIDs: ["1", "2"])
  ```
</CodeGroup>

## Parameter

<Tabs>
  <Tab title="C#">
    <ParamField body="indexName" type="string" required>
      Index name from which to delete records.
    </ParamField>

    <ParamField body="objectIDs" type="IEnumerable" required>
      Object IDs for records to delete.
    </ParamField>

    <ParamField body="waitForTasks" type="bool" default={false}>
      Whether to wait until all batch requests are done.
    </ParamField>

    <ParamField body="cancellationToken" type="cancellationToken" default="default">
      Parameter that can be used as a signal to cancel the request.
    </ParamField>

    <ParamField body="requestOptions" type="RequestOptions">
      Additional [request options](/doc/libraries/sdk/request-options).
    </ParamField>
  </Tab>

  <Tab title="Go">
    <ParamField body="indexName" type="string" required>
      Index name from which to delete records.
    </ParamField>

    <ParamField body="objectIDs" type="[]string" required>
      Object IDs for records to delete.
    </ParamField>

    <ParamField body="opts..." type="ChunkedBatchOption">
      Functional options to provide extra arguments.

      <Expandable title="available functions">
        <ParamField body="search.WithBatchSize" type="function">
          **Signature:** `func(batchSize int) chunkedBatchOption`

          Sets the number of object IDs to process in one batch.
          The default batch size is 1,000.
        </ParamField>

        <ParamField body="search.WithWaitForTasks" type="function">
          **Signature:** `func(withWaitForTasks bool) chunkedBatchOption`

          Whether to wait until all batch requests are done.
        </ParamField>

        <ParamField body="search.WithHeaderParam" type="function">
          **Signature:** `func(key string, value string) requestOption`

          Sets extra header parameters for this request.
          To learn more, see [request options](/doc/libraries/sdk/request-options).
        </ParamField>

        <ParamField body="search.WithQueryParam" type="function">
          **Signature:** `func(key string, value string) requestOption`

          Sets extra query parameters for this request.
          To learn more, see [request options](/doc/libraries/sdk/request-options).
        </ParamField>
      </Expandable>
    </ParamField>
  </Tab>

  <Tab title="Java">
    <ParamField body="indexName" type="String" required>
      Index name from which to delete records.
    </ParamField>

    <ParamField body="objectIDs" type="List<String>" required>
      Object IDs for records to delete.
    </ParamField>

    <ParamField body="waitForTasks" type="boolean" default={false}>
      Whether to wait until all batch requests are done.
    </ParamField>

    <ParamField body="requestOptions" type="RequestOptions">
      Additional [request options](/doc/libraries/sdk/request-options).
    </ParamField>
  </Tab>

  <Tab title="JavaScript">
    <ParamField body="indexName" type="string" required>
      Index name from which to delete records.
    </ParamField>

    <ParamField body="objectIDs" type="string[]" required>
      Object IDs for records to delete.
    </ParamField>

    <ParamField body="waitForTasks" type="boolean" default={false}>
      Whether to wait until all batch requests are done.
    </ParamField>

    <ParamField body="requestOptions" type="RequestOptions">
      Additional [request options](/doc/libraries/sdk/request-options).
    </ParamField>
  </Tab>

  <Tab title="Kotlin">
    <ParamField body="indexName" type="String" required>
      Index name from which to delete records.
    </ParamField>

    <ParamField body="objectIDs" type="List<String>" required>
      Object IDs for records to delete.
    </ParamField>

    <ParamField body="waitForTasks" type="Boolean" default={false}>
      Whether to wait until all batch requests are done.
    </ParamField>

    <ParamField body="requestOptions" type="RequestOptions">
      Additional [request options](/doc/libraries/sdk/request-options).
    </ParamField>
  </Tab>

  <Tab title="PHP">
    <ParamField body="indexName" type="string" required>
      Index name from which to delete records.
    </ParamField>

    <ParamField body="objectIDs" type="string[]" required>
      Object IDs for records to delete.
    </ParamField>

    <ParamField body="requestOptions" type="array">
      Additional [request options](/doc/libraries/sdk/request-options).
    </ParamField>
  </Tab>

  <Tab title="Python">
    <ParamField body="index_name" type="str" required>
      Index name from which to delete records.
    </ParamField>

    <ParamField body="object_ids" type="list[str]" required>
      Object IDs for records to delete.
    </ParamField>

    <ParamField body="wait_for_tasks" type="bool" default="False">
      Whether to wait until all batch requests are done.
    </ParamField>

    <ParamField body="requestOptions" type="dict | RequestOptions">
      Additional [request options](/doc/libraries/sdk/request-options).
    </ParamField>
  </Tab>

  <Tab title="Ruby">
    <ParamField body="index_name" type="String" required>
      Index name from which to delete records.
    </ParamField>

    <ParamField body="object_ids" type="Array[String]" required>
      Object IDs for records to delete.
    </ParamField>

    <ParamField body="wait_for_tasks" type="bool" default={false}>
      Whether to wait until all batch requests are done.
    </ParamField>

    <ParamField body="requestOptions" type="Hash">
      Additional [request options](/doc/libraries/sdk/request-options).
    </ParamField>
  </Tab>

  <Tab title="Scala">
    <ParamField body="indexName" type="String" required>
      Index name from which to delete records.
    </ParamField>

    <ParamField body="objectIds" type="Seq[String]" required>
      Object IDs for records to delete.
    </ParamField>

    <ParamField body="waitForTasks" type="Boolean" default={false}>
      Whether to wait until all batch requests are done.
    </ParamField>

    <ParamField body="requestOptions" type="Option[RequestOptions]">
      Additional [request options](/doc/libraries/sdk/request-options).
    </ParamField>
  </Tab>

  <Tab title="Swift">
    <ParamField body="indexName" type="String" required>
      Index name from which to delete records.
    </ParamField>

    <ParamField body="objectIds" type="[String]" required>
      Object IDs for records to delete.
    </ParamField>

    <ParamField body="waitForTasks" type="Bool" default={false}>
      Whether to wait until all batch requests are done.
    </ParamField>

    <ParamField body="requestOptions" type="RequestOptions">
      Additional [request options](/doc/libraries/sdk/request-options).
    </ParamField>
  </Tab>
</Tabs>
