API client / Methods
List of methods

We released a new version of the JavaScript API client in public beta. Read the beta documentation for more information.

We released a new version of the PHP API client in public beta. Read the beta documentation for more information.

We released a new version of the Java API client in public beta. Read the beta documentation for more information.


You don’t need to create an index explicitly. Algolia creates an index automatically the first time you add records to it. To configure your index, see the settings section. Records are schemaless, so you don’t need to define any schema to start indexing.

The initIndex method doesn’t create a new index on Algolia’s servers. It creates an index object you can interact with—for example, to add records.

Don’t use sensitive or personally identifiable information (PII) as your index name, including user’s names, IDs, or email addresses. Since index names appear in network requests, consider them as being publicly available.


The documentation uses the terms “object” and “record”. Although different in the field of computer science, within Algolia’s domain, they’re often the same. The preference, though, is for this terminology:

  • Records are the items in an Algolia index
  • “Objects” are things like JSON structures or instances of classes in programming languages.


The records in your index are schemaless: they can hold any number of fields with any definition and content.

The engine has no expectations of your data other than formatting aspects and the objectID.

The objectID

Every record in an index requires a unique ID (the objectID). You can create it yourself and send it when indexing. If you don’t send an objectID, Algolia generates it for you.

You can use this identifier later with any method that needs to reference a specific record, such as saveObjects or partialUpdateObjects.

Add, update, and partially update records

Singular and plural methods

All methods can be singular or plural.

  • If singular (for example, saveObject), the method accepts one record as a parameter
  • If plural (for example, saveObjects), the method accepts one or multiple records.

See the individual methods for more information about syntax and usage.

Asynchronous methods

Indexing methods are asynchronous. When you call one of these methods, Algolia adds a new task to a queue: the task, not the method call, performs the desired action. Algolia usually completes the task within seconds or milliseconds. It depends on the queue: the new task must wait its turn if the queue has multiple pending tasks.

To help manage this asynchronous indexing, each method returns a unique taskID which you can use with the waitTask method. waitTask guarantees a job is finished before proceeding with new requests.

To ensure that multiple jobs run in the correct order, add them to a queue by:

  1. Calling an indexing method
  2. Calling waitTask
  3. Calling another indexing method
  4. Calling waitTask
  5. And so on.

waitTask ensures that the first indexing methods added to the queue will run before any subsequently added methods are processed.

You can use this behavior to manage dependencies. For example, deleting an index before creating a new index with the same name or clearing an index before adding new records.

Did you find this page helpful?