Skip to main content
This page documents an earlier version of the API client. For the latest version, see Delete records.
Required ACL: deleteObject You can use two methods to delete records:
  • deleteObject (this method), which uses objectID to identify records
  • deleteBy, which uses filters to identify records.
Each record included in the batch counts as one operation. If you pass an objectID that doesn’t exist, it still counts as an operation because Algolia doesn’t know if the record exists when attempting the operation. Deleting all records in an index doesn’t delete the index. To delete an index completely, including records, settings, synonyms, and rules, use the deleteIndex method. To delete a single record, use the deleteObject method.
When deleting large numbers of records be aware of the rate limitations on these processes and the impact on your analytics data.

Examples

Delete multiple records

List<string> ids = new List<string> { "myID1", "myID2" };

index.DeleteObjects(ids);

// Asynchronous
await index.DeleteObjectsAsync(ids);

Delete a single record

index.DeleteObject("myID");

// Asynchronous
await index.DeleteObjectAsync("myID");

Parameters

objectID
string
required
The objectID of the record to delete. (Required for the deleteObject method).
objectIDs
string[]
required
List of objectIDs to delete. (Required for the deleteObjects method).
requestOptions
object
A mapping of request options to send along with the query.

Response

objectIDs
string[]
List of the objectIDs of the deleted records.
taskID
integer
The task ID used with the waitTask method.

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.
JSON
{
  "objectIDs": [
    "myObjectID1",
    "myObjectID2"
  ],
  "taskID": 678,
}
I