Skip to main content
Required ACL: addObject Adds records to an index or replaces them. If a record doesn’t contain an objectID, Algolia automatically adds it. If you specify an existing objectID, it completely replaces all the attributes except for objectID. To update only some attributes of an existing record, use partialUpdateObjects instead. To add a single record, use the saveObject method. C#, Go, Java, JavaScript, PHP, Python only: To ensure good performance, saveObjects automatically sends batches of 1,000 records. If you’re indexing many records and have a stable, high-speed internet connection, increase the batch size to send more records per request and shorten your indexing time.
When updating large numbers of records, be aware of the rate limitations on these processes and the impact on your analytics data.

Examples

Replace all attributes in existing records

Replace all attributes in a single record

Replace all attributes in existing records and send extra HTTP headers

Increase the default batch size

Parameters

object[]
required
A list of records to save.
boolean
default:false
saveObjects requires an objectID unless you set autoGenerateObjectIDIfNotExist to true.
  • If the objectID exists, Algolia replaces the record
  • If the objectID is present but doesn’t exist, Algolia creates the record
  • If the objectID isn’t specified and autoGenerateObjectID is false (the default), the engine returns an error.
  • If the objectID isn’t specified and autoGenerateObjectID is true, the engine generates an objectID and returns it in the response.
Ruby only: the parameter name is: auto_generate_object_id_if_not_exist.
string
PHP only: The objectID is set from the value of the specified key.
object
A mapping of request options.

Response

string
The objectID of the saved record. This property is only returned when using save object.
list
List of objectIDs of the saved records in order. This property is only returned when using save objects.
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.

Save records

JSON

Save record

JSON
Last modified on May 7, 2026