Skip to content

Indexing API

Perform multiple indexing operations in a single request. This is the most efficient way to index data.

POST /1/indexes/{indexName}/batch
{
"requests": [
{
"action": "addObject",
"body": {
"objectID": "1",
"title": "The Matrix",
"year": 1999
}
},
{
"action": "addObject",
"body": {
"objectID": "2",
"title": "Inception",
"year": 2010
}
}
]
}
ActionDescription
addObjectAdd a record (or replace if objectID exists)
updateObjectFully replace an existing record
partialUpdateObjectUpdate specific attributes of an existing record
deleteObjectDelete a record by objectID
clearRemove all records from the index
{
"taskID": 12345,
"objectIDs": ["1", "2"]
}
Terminal window
curl -X POST 'http://localhost:7700/1/indexes/movies/batch' \
-H 'X-Algolia-Application-Id: flapjack' \
-H 'X-Algolia-API-Key: YOUR_ADMIN_KEY' \
-H 'Content-Type: application/json' \
-d '{
"requests": [
{"action": "addObject", "body": {"objectID": "1", "title": "The Matrix", "year": 1999}},
{"action": "addObject", "body": {"objectID": "2", "title": "Inception", "year": 2010}}
]
}'

Add a single record to an index. If you don’t provide an objectID, one is generated automatically.

POST /1/indexes/{indexName}
{
"title": "The Matrix",
"year": 1999,
"genre": "sci-fi"
}
{
"taskID": 12345,
"objectID": "auto-generated-id"
}

Fully replace an existing record.

PUT /1/indexes/{indexName}/{objectID}
{
"title": "The Matrix Reloaded",
"year": 2003,
"genre": "sci-fi"
}
{
"taskID": 12345,
"objectID": "1",
"updatedAt": "2026-01-15T10:00:00Z"
}

Retrieve a single record by its objectID.

GET /1/indexes/{indexName}/{objectID}
{
"objectID": "1",
"title": "The Matrix",
"year": 1999,
"genre": "sci-fi"
}
Terminal window
curl 'http://localhost:7700/1/indexes/movies/1' \
-H 'X-Algolia-Application-Id: flapjack' \
-H 'X-Algolia-API-Key: YOUR_ADMIN_KEY'

Delete a single record by its objectID.

DELETE /1/indexes/{indexName}/{objectID}
{
"taskID": 12345,
"deletedAt": "2026-01-15T10:00:00Z"
}
Terminal window
curl -X DELETE 'http://localhost:7700/1/indexes/movies/1' \
-H 'X-Algolia-Application-Id: flapjack' \
-H 'X-Algolia-API-Key: YOUR_ADMIN_KEY'